public function execute($params)
 {
     $id = $this->get('id', true);
     $sheet_model = new stickiesSheetModel();
     $data = array();
     if (waRequest::post('name') !== null) {
         $data['name'] = waRequest::post('name');
     }
     if (waRequest::post('background_id') !== null) {
         $data['background_id'] = waRequest::post('background_id');
     }
     if (!$data) {
         throw new waAPIException('invalid_param', 'Nothing to update');
     }
     if ($sheet_model->available($id)) {
         if ($sheet_model->updateById($id, $data)) {
             $method = new stickiesSheetGetInfoMethod();
             $this->response = $method->getResponse(true);
         } else {
             throw new waAPIException('server_error', 500);
         }
     } else {
         throw new waAPIException('access_denied', "Not enough rights to work with current board", 403);
     }
 }
示例#2
0
 protected function saveAction()
 {
     if ($this->sheet_model->available($this->sheet_id)) {
         $sheet_data = array('name' => waRequest::post('name', '', 'string_trim'), 'background_id' => waRequest::post('background_id', '', 'string_trim'));
         $this->sheet_model->updateById($this->sheet_id, $sheet_data);
         $this->response = $sheet_data;
         $this->log('board_edit', 1);
     } else {
         $this->errors = _w("Not enough rights to work with current board");
     }
 }
 public function execute()
 {
     $id = (int) $this->post('id', true);
     $sheet_model = new stickiesSheetModel();
     if ($sheet_model->available($id)) {
         if ($sheet_model->deleteById($id)) {
             $this->response = true;
         } else {
             throw new waAPIException('server_error', 500);
         }
     } else {
         throw new waAPIException('access_denied', "Not enough rights to work with current board", 403);
     }
 }
 protected static function availableSheet($sheet_id)
 {
     if (!stickiesSheetModel::available($sheet_id)) {
         throw new waRightsException(_w("Not enough rights to work with current board"));
     }
 }