/** 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']); }
/** Start over by unchecking all list items */ public function StartoverAction() { if (!($id = waRequest::post('id', 0, 'int'))) { throw new waException('No id given.'); } if (!$this->getRights('list.' . $id)) { throw new waRightsException('Access denied.'); } $lim = new checklistsListItemsModel(); $lim->updateByField('list_id', $id, array('done' => null)); $lm = new checklistsListModel(); $lm->updateCount($id); $this->response = checklistsItem::prepareItems(array_values($lim->getByList($id))); $this->log('list_startover', 1); }