aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/class/Opt.php50
-rw-r--r--app/view/templates/home.php6
-rw-r--r--assets/css/home.css18
3 files changed, 37 insertions, 37 deletions
diff --git a/app/class/Opt.php b/app/class/Opt.php
index 4e1eb72..253e4f6 100644
--- a/app/class/Opt.php
+++ b/app/class/Opt.php
@@ -111,66 +111,48 @@ class Opt extends Item
* @param array $taglist List of tag to be
* @return string html code to be printed
*/
- public function tag(array $taglist = []) : string
+ public function taglinks(array $taglist = []) : string
{
$tagstring = "";
foreach ($taglist as $tag ) {
- $tagstring .= '<a class="tag" href="?' . $this->gettagadress($tag) . '" >' . $tag . '</a>' . PHP_EOL;
+ $tagstring .= '<a class="tag tag_' . $tag . '" href="?' . $this->getfilteradress(['tagfilter' => [$tag]]) . '" >' . $tag . '</a>' . PHP_EOL;
}
return $tagstring;
}
/**
- * Generate http query based on a new tagfilter input
- *
- * @param string $tag The tag to be selected
- * @return string Query string without `?`
- */
- public function gettagadress(string $tag = "") : string
- {
- $object = $this->drylist(['sortby', 'order', 'secure', 'tagcompare', 'authorfilter', 'authorcompare', 'invert', 'limit']);
- if(!empty($tag)) {
- $object['tagfilter'][] = $tag;
- }
- $object['submit'] = 'filter';
-
- return urldecode(http_build_query($object));
- }
-
-
- /**
* Get the link list for each authors of an page
*
* @param array $authorlist List of author to be
* @return string html code to be printed
*/
- public function author(array $authorlist = []) : string
+ public function authorlinks(array $authorlist = []) : string
{
$authorstring = "";
foreach ($authorlist as $author ) {
- $authorstring .= '<a class="tag" href="?' . $this->getauthoradress($author) . '" >' . $author . '</a>' . PHP_EOL;
+ $authorstring .= '<a class="tag author_' . $author . '" href="?' . $this->getfilteradress(['authorfilter' => [$author]]) . '" >' . $author . '</a>' . PHP_EOL;
}
return $authorstring;
}
- /**
- * Generate http query based on a new authorfilter input
- *
- * @param string $author The author to be selected
- * @return string Query string without `?`
- */
- public function getauthoradress(string $author = "") : string
+ public function securelink(int $level, string $secure)
{
- $object = $this->drylist(['sortby', 'order', 'secure', 'tagfilter', 'tagcompare', 'authorcompare', 'invert', 'limit']);
- if(!empty($author)) {
- $object['authorfilter'][] = $author;
- }
- $object['submit'] = 'filter';
+ return '<a class="secure ' . $secure . '" href="?' . $this->getfilteradress(['secure' => $level]) . '">' . $secure . '</a>' . PHP_EOL;
+ }
+
+ public function getfilteradress(array $vars = [])
+ {
+ $varlist = ['sortby', 'order', 'secure', 'tagfilter', 'tagcompare', 'authorfilter', 'authorcompare', 'invert', 'limit'];
+ // array_filter($vars, function ())
+ $object = $this->drylist($varlist);
+ $object = array_merge($object, $vars);
+ $object['submit'] = 'filter';
return urldecode(http_build_query($object));
}
+
/**
* Get the query as http string
*
diff --git a/app/view/templates/home.php b/app/view/templates/home.php
index 6b3bca3..60dd836 100644
--- a/app/view/templates/home.php
+++ b/app/view/templates/home.php
@@ -97,7 +97,7 @@
<td class="hidephone"><a href="<?= $this->upage('pagedownload', $item->id()) ?>" download><img src="<?= Wcms\Model::iconpath() ?>download.png" class="icon"></a></td>
<?php }
if ($columns['tag']) { ?>
- <td class="tag"><?= $opt->tag($item->tag('array')) ?></td>
+ <td class="tag"><?= $opt->taglinks($item->tag('array')) ?></td>
<?php }
if ($columns['title']) { ?>
<td class="title" title="<?= $item->title() ?>"><?= $item->title() ?></td>
@@ -121,10 +121,10 @@
<td class="date"><?= $item->date('dmy') ?></td>
<?php }
if ($columns['secure']) { ?>
- <td class="secure"><?= $item->secure('string') ?></td>
+ <td class="secure"><?= $opt->securelink($item->secure('int') , $item->secure('string')) ?></td>
<?php }
if ($columns['authors']) { ?>
- <td class="authors"><?= $opt->author($item->authors('array')) ?></td>
+ <td class="authors"><?= $opt->authorlinks($item->authors('array')) ?></td>
<?php }
if ($columns['visitcount']) { ?>
<td class="visitcount"><?= $item->visitcount() ?></td>
diff --git a/assets/css/home.css b/assets/css/home.css
index bfae718..b14f9a1 100644
--- a/assets/css/home.css
+++ b/assets/css/home.css
@@ -119,6 +119,22 @@ table a.tag {
padding: 1px 4px;
}
+table a.secure{
+ padding: 1px 3px;
+}
+
+table a.secure.private {
+ background-color: #b9b67b;
+}
+
+table a.secure.not_published {
+ background-color: #b97b7b;
+}
+
+table a.secure.public {
+ background-color: #80b97b;
+}
+
body {
margin: 0;
@@ -541,3 +557,5 @@ footer {
}
+
+