aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2020-01-29 03:33:22 +0100
committervincent-peugnet <v.peugnet@free.fr>2020-01-29 03:33:22 +0100
commit5aa781242e42c95c6f2e04a30510d853a89fa944 (patch)
treee1096011f9473a380240c40a01b610e37097e88f
parentcc73b11de5d9185825e058d1914d65bb8703077d (diff)
downloadwcms-5aa781242e42c95c6f2e04a30510d853a89fa944.tar.gz
wcms-5aa781242e42c95c6f2e04a30510d853a89fa944.zip
new feature : authors column
-rw-r--r--app/class/Model.php2
-rw-r--r--app/class/Modelhome.php2
-rw-r--r--app/class/Opt.php4
-rw-r--r--app/class/Page.php2
-rw-r--r--app/view/templates/home.php7
5 files changed, 12 insertions, 5 deletions
diff --git a/app/class/Model.php b/app/class/Model.php
index f48b555..655de9f 100644
--- a/app/class/Model.php
+++ b/app/class/Model.php
@@ -58,7 +58,7 @@ abstract class Model
'' => 'other'
];
- const COLUMNS = ['id', 'title', 'description', 'tag', 'date', 'datemodif', 'datecreation', 'secure', 'linkfrom', 'linkto', 'visitcount', 'affcount', 'editcount'];
+ const COLUMNS = ['id', 'title', 'description', 'tag', 'date', 'datemodif', 'datecreation', 'secure', 'authors', 'linkfrom', 'linkto', 'visitcount', 'affcount', 'editcount'];
const TEXT_ELEMENTS = ['header', 'nav', 'main', 'aside', 'footer'];
diff --git a/app/class/Modelhome.php b/app/class/Modelhome.php
index f12f7d3..701eb73 100644
--- a/app/class/Modelhome.php
+++ b/app/class/Modelhome.php
@@ -13,7 +13,7 @@ class Modelhome extends Modelpage
{
$opt = new Opt(Page::classvarlist());
- $opt->setcol(['id', 'tag', 'linkfrom', 'linkto', 'description', 'title', 'datemodif', 'datecreation', 'date', 'secure', 'visitcount', 'editcount', 'affcount']);
+ $opt->setcol(['id', 'tag', 'linkfrom', 'linkto', 'description', 'title', 'datemodif', 'datecreation', 'date', 'secure', 'authors', 'visitcount', 'editcount', 'affcount']);
$opt->settaglist($table);
$opt->setauthorlist($table);
$opt->submit();
diff --git a/app/class/Opt.php b/app/class/Opt.php
index 426328f..6697c63 100644
--- a/app/class/Opt.php
+++ b/app/class/Opt.php
@@ -244,7 +244,7 @@ class Opt extends Item
public function setsortby($sortby)
{
- if (is_string($sortby) && in_array($sortby, $this->pagevarlist)) {
+ if (is_string($sortby) && in_array($sortby, $this->pagevarlist) && in_array($sortby, Model::COLUMNS)) {
$this->sortby = strtolower(strip_tags($sortby));
}
}
@@ -337,7 +337,7 @@ class Opt extends Item
public function setcol($col)
{
if (is_array($col)) {
- $this->col = array_intersect($this->pagevarlist(), $col);
+ $this->col = array_intersect($this->pagevarlist, $col);
}
}
diff --git a/app/class/Page.php b/app/class/Page.php
index 82e61c1..7475b6b 100644
--- a/app/class/Page.php
+++ b/app/class/Page.php
@@ -399,6 +399,8 @@ class Page extends Dbitem
return implode(', ', $this->authors);
} elseif ($type == 'array') {
return $this->authors;
+ } elseif ($type == 'sort') {
+ return count($this->authors);
}
}
diff --git a/app/view/templates/home.php b/app/view/templates/home.php
index 73a00eb..ceaa98c 100644
--- a/app/view/templates/home.php
+++ b/app/view/templates/home.php
@@ -71,7 +71,9 @@
if ($columns['secure']) { ?>
<th class="secure"><a href="<?= $opt->sortbyorder('secure') ?>">privacy</a></th>
<?php }
-
+ if ($columns['authors']) { ?>
+ <th class="authors"><a href="<?= $opt->sortbyorder('authors') ?>">authors</a></th>
+ <?php }
if ($columns['visitcount']) { ?>
<th class="visitcount"><a href="<?= $opt->sortbyorder('visitcount') ?>">visit</a></th>
<?php }
@@ -121,6 +123,9 @@
if ($columns['secure']) { ?>
<td class="secure"><?= $item->secure('string') ?></td>
<?php }
+ if ($columns['authors']) { ?>
+ <td class="authors"><?= $item->authors('string') ?></td>
+ <?php }
if ($columns['visitcount']) { ?>
<td class="visitcount"><?= $item->visitcount() ?></td>
<?php }