diff options
Diffstat (limited to 'app/class/controllerhome.php')
-rw-r--r-- | app/class/controllerhome.php | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/app/class/controllerhome.php b/app/class/controllerhome.php index 043ac3e..c053270 100644 --- a/app/class/controllerhome.php +++ b/app/class/controllerhome.php @@ -5,6 +5,8 @@ class Controllerhome extends Controller /** @var Modelhome */ protected $modelhome; protected $opt; + /** @var Optlist */ + protected $optlist; public function __construct($render) { parent::__construct($render); @@ -20,6 +22,8 @@ class Controllerhome extends Controller $this->routedirect('artread/', ['art' => Config::homeredirect()]); } else { + + $table = $this->modelhome->getlister(); $this->opt = $this->modelhome->optinit($table); @@ -27,8 +31,19 @@ class Controllerhome extends Controller $table2 = $this->modelhome->table2($table, $this->opt); $columns = $this->modelhome->setcolumns($this->user->columns()); + + $vars = ['user' => $this->user, 'table2' => $table2, 'opt' => $this->opt, 'columns' => $columns]; + + if(isset($_POST['query']) && $this->user->iseditor()) { + $datas = array_merge($_POST, $_SESSION['opt']); + $this->optlist = new Optlist(Art2::classvarlist()); + $this->optlist->settaglist($table); + $this->optlist->setauthorlist($table); + $this->optlist->hydrate($datas); + $vars['optlist'] = $this->optlist; + } - $this->showtemplate('home', ['user' => $this->user, 'table2' => $table2, 'opt' =>$this->opt, 'columns' => $columns]); + $this->showtemplate('home', $vars); } @@ -37,7 +52,7 @@ class Controllerhome extends Controller public function columns() { if(isset($_POST['columns']) && $this->user->iseditor()) { - $user =$this->usermanager->get($this->user->id()); + $user = $this->usermanager->get($this->user->id()); $user->hydrate($_POST); $this->usermanager->add($user); $this->usermanager->writesession($user); |