aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2020-04-08 16:38:38 +0200
committervincent-peugnet <v.peugnet@free.fr>2020-04-08 16:38:38 +0200
commitc3e62c500b38104acaecc987621cfc03058729c0 (patch)
tree8e71178b383055eb5bc659b04bb2da59dad6b778
parentb49830232096951202688bd775193424880bbd11 (diff)
downloadwcms-c3e62c500b38104acaecc987621cfc03058729c0.tar.gz
wcms-c3e62c500b38104acaecc987621cfc03058729c0.zip
fix and clean Opt
-rw-r--r--app/class/Modelhome.php1
-rw-r--r--app/class/Opt.php20
-rw-r--r--app/class/Page.php5
-rw-r--r--app/view/templates/homeopt.php2
-rw-r--r--assets/css/home.css3
5 files changed, 9 insertions, 22 deletions
diff --git a/app/class/Modelhome.php b/app/class/Modelhome.php
index b7b063e..e8bdbf8 100644
--- a/app/class/Modelhome.php
+++ b/app/class/Modelhome.php
@@ -13,7 +13,6 @@ class Modelhome extends Modelpage
{
$opt = new Opt();
- $opt->setcol(['id', 'tag', 'linkto', 'description', 'title', 'datemodif', 'datecreation', 'date', 'secure', 'authors', 'visitcount', 'editcount', 'affcount']);
$opt->settaglist($table);
$opt->setauthorlist($table);
$opt->setpageidlist($table);
diff --git a/app/class/Opt.php b/app/class/Opt.php
index 59a3302..ecfbbc1 100644
--- a/app/class/Opt.php
+++ b/app/class/Opt.php
@@ -12,7 +12,6 @@ class Opt extends Item
protected $authorcompare = 'AND';
protected $secure = 4;
protected $linkto = '';
- protected $col = ['id'];
protected $taglist = [];
protected $authorlist = [];
protected $invert = 0;
@@ -25,7 +24,8 @@ class Opt extends Item
public function __construct(array $data = [])
{
$this->hydrate($data);
- $this->pagevarlist = get_object_vars(new Page());
+ $page = new Page();
+ $this->pagevarlist = ($page->getobjectvars());
}
@@ -246,15 +246,6 @@ class Opt extends Item
return $this->linkto;
}
- public function col($type = 'array')
- {
- if ($type == 'string') {
- return implode(', ', $this->col);
- } else {
- return ($this->col);
- }
- }
-
public function taglist()
{
return $this->taglist;
@@ -355,13 +346,6 @@ class Opt extends Item
}
}
- public function setcol($col)
- {
- if (is_array($col)) {
- $this->col = array_intersect($this->pagevarlist, $col);
- }
- }
-
public function settaglist(array $pagelist)
{
$taglist = [];
diff --git a/app/class/Page.php b/app/class/Page.php
index eefbca7..da19f61 100644
--- a/app/class/Page.php
+++ b/app/class/Page.php
@@ -64,6 +64,11 @@ class Page extends Dbitem
$this->hydrate($datas);
}
+ public function getobjectvars() : array
+ {
+ return get_object_vars($this);
+ }
+
public function reset()
{
$now = new DateTimeImmutable(null, timezone_open("Europe/Paris"));
diff --git a/app/view/templates/homeopt.php b/app/view/templates/homeopt.php
index ed7315d..b720aea 100644
--- a/app/view/templates/homeopt.php
+++ b/app/view/templates/homeopt.php
@@ -16,7 +16,7 @@
<legend>Sort</legend>
<select name="sortby" id="sortby">
<?php
- foreach ($opt->col('array') as $key => $col) {
+ foreach (Wcms\Model::COLUMNS as $col) {
echo '<option value="' . $col . '" ' . ($opt->sortby() == $col ? "selected" : "") . '>' . $col . '</option>';
}
?>
diff --git a/assets/css/home.css b/assets/css/home.css
index ef59a53..a728a4a 100644
--- a/assets/css/home.css
+++ b/assets/css/home.css
@@ -143,8 +143,7 @@ main.home table .id {
#home2table a.linkto {
font-family: monospace;
font-size: medium;
- text-decoration: underline;
- text-decoration-color: white;
+ background-color: #7b97b9;
}
nav span.counter {