nieuws: list tag options below articles for admins
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 17 Sep 2018 14:06:45 +0000 (16:06 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 17 Sep 2018 15:15:46 +0000 (17:15 +0200)
nieuws/index.php

index 11e305ef04a98fe7323306bf4640adcf9b08e8ba..73973574629bce60a06b8eb8a640cf37a39d43ad 100644 (file)
@@ -12,6 +12,25 @@ if ($page and !is_numeric($page)) {
        if ($article->image) {
                $Place['image'] = "https://lijtweg.nl/".$article->thumb('600x');
        }
+       if (!empty($User['admin'])) {
+               $taglist = [];
+               foreach (glob("$Page/.tags/*") as $tagpath) {
+                       $tagname = pathinfo($tagpath, PATHINFO_BASENAME);
+                       $tagvalue = file_exists("$tagpath/$year-$page.html");
+                       $tagtarget = is_writable($tagpath);
+                       $taglist[] = sprintf(
+                               '<input type="checkbox" name="%s" value="%s" id="%s"%s%s />' .
+                               '<label for="%2$s"> %s</label>',
+                               "tags[$tagname]", $tagname, "tag-$tagname",
+                               $tagvalue ? ' checked' : '',
+                               ' onclick="return false"',
+                               ucfirst($tagname)
+                       );
+               }
+               printf("<p><strong>Tags:</strong> %s</p>\n",
+                       implode("\n\t", $taglist)
+               );
+       }
        if ($replyform) {
                print placeholder_include('nieuws/replies');
        }