public function execute() { $lm = new checklistsListModel(); $lists = $lm->getAllowed(); foreach ($lists as $id => &$list) { if (strtolower(substr($list['icon'], 0, 7)) == 'http://') { $list['icon'] = '<i class="icon16" style="background-image:url(' . htmlspecialchars($list['icon']) . ')"></i>'; } else { $list['icon'] = '<i class="icon16 ' . $list['icon'] . '"></i>'; } } $id = waRequest::request('id'); if (($id = waRequest::request('id')) && isset($lists[$id])) { $lists[$id]['current'] = true; } $this->view->assign('lists', $lists); $this->view->assign('can_add_lists', $this->getRights('add_list')); }
/** Default action when no other action is specified. */ public function defaultAction() { $lm = new checklistsListModel(); $lists = $lm->getAllowed(); if (!$lists) { if ($this->getRights('add_list')) { $this->execute('editor'); return; } // No available lists and cannot create new one: show default template return; } // is there a cookie with last list user opened? $id = waRequest::cookie('last_list_id', 0, 'int'); if ($id && isset($lists[$id])) { $this->execute('list', $lists[$id]); return; } // simply show the first list $lists = array_values($lists); $this->execute('list', $lists[0]); }