/** Show items in TODO list */
 public function ListAction($list = null)
 {
     if (!$list) {
         if (!($id = waRequest::request('id', 0, 'int'))) {
             throw new waException('No id specified.');
         }
         $lm = new checklistsListModel();
         if (!($list = $lm->getById($id))) {
             throw new waException('List does not exist.');
         }
     }
     $access = $this->getRights('list.' . $list['id']);
     if (!$access) {
         throw new waRightsException('Access denied.');
     }
     $this->view->assign('can_edit', $access > 1);
     $this->view->assign('list', $list);
     $lim = new checklistsListItemsModel();
     $items = checklistsItem::prepareItems($lim->getByList($list['id']));
     $this->view->assign('items', array_values($items));
     wa()->getResponse()->setCookie('last_list_id', $list['id']);
     $this->layout->setTitle($list['name']);
 }
 /** Delete list */
 public function DeletelistAction()
 {
     if (!($id = waRequest::post('id', 0, 'int'))) {
         throw new waException('No id given.');
     }
     // check access
     if ($this->getRights('list.' . $id) <= 1) {
         throw new waRightsException('Access denied.');
     }
     $lm = new checklistsListModel();
     $lm->deleteById($id);
     $lim = new checklistsListItemsModel();
     $lim->deleteByField('list_id', $id);
     $this->log('list_delete', 1);
     $this->response = 'done';
 }