diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2020-04-08 16:38:38 +0200 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2020-04-08 16:38:38 +0200 |
commit | c3e62c500b38104acaecc987621cfc03058729c0 (patch) | |
tree | 8e71178b383055eb5bc659b04bb2da59dad6b778 /app | |
parent | b49830232096951202688bd775193424880bbd11 (diff) | |
download | wcms-c3e62c500b38104acaecc987621cfc03058729c0.tar.gz wcms-c3e62c500b38104acaecc987621cfc03058729c0.zip |
fix and clean Opt
Diffstat (limited to 'app')
-rw-r--r-- | app/class/Modelhome.php | 1 | ||||
-rw-r--r-- | app/class/Opt.php | 20 | ||||
-rw-r--r-- | app/class/Page.php | 5 | ||||
-rw-r--r-- | app/view/templates/homeopt.php | 2 |
4 files changed, 8 insertions, 20 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>'; } ?> |