protected function viewAction() { $items = $this->sticky_model->getFieldsByField(array('id' => $this->sticky_id)); $sticky = array_shift($items); $this->sticky_model->available($sticky['id']); $sheet = $this->sheet_model->getById($sticky['sheet_id']); $this->response = array('sticky' => $sticky, 'sheet' => $sheet); }
protected function addAction() { if ($sheet_id = $this->sheet_model->create(_w('Board'))) { $this->response = $this->sheet_model->getById($sheet_id); $this->log('board_add', 1); } else { $this->errors = _w("Not enough rights to add new board"); } }
public function execute() { $id = $this->get('id', true); $sheet_model = new stickiesSheetModel(); $this->checkRights($id); $sheet = $sheet_model->getById($id); if (!$sheet) { throw new waAPIException('invalid_param', 'Sheet not found', 404); } $this->response = $sheet; }
protected function checkRights($sheet_id) { $sheet_model = new stickiesSheetModel(); $sheet = $sheet_model->getById($sheet_id); if (!$sheet) { throw new waAPIException('invalid_param', 'Sheet not found', 404); } if (!$this->getRights('sheet.' . $sheet_id)) { throw new waAPIException('access_denied', "Not enough rights to work with current board", 403); } return true; }