コード例 #1
0
 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
 public function execute()
 {
     $name = $this->post('name', true);
     $sheet_model = new stickiesSheetModel();
     $sheet_id = $sheet_model->create($name, waRequest::post('background_id'));
     if ($sheet_id) {
         $_GET['id'] = $sheet_id;
         $method = new stickiesSheetGetInfoMethod();
         $this->response = $method->getResponse(true);
     } else {
         throw new waAPIException('server_error', 500);
     }
 }
コード例 #3
0
 public function execute()
 {
     $sheet_id = $this->get('sheet_id', true);
     $this->checkRights($sheet_id);
     $data = array('position_top' => max(0, waRequest::post('position_top', 2000 + rand(0, 1000), 'int')), 'position_left' => max(0, waRequest::post('position_left', 2000 + rand(0, 1000), 'int')), 'color' => waRequest::post('color', 'default'), 'size_height' => max(150, waRequest::post('size_height', 150)), 'size_width' => max(150, waRequest::post('size_width', 150)), 'content' => $this->post('content', true), 'font_size' => waRequest::post('font_size', 16));
     $sticky_model = new stickiesStickyModel();
     $sticky_id = $sticky_model->create($sheet_id, $data);
     if ($sticky_id) {
         $_GET['id'] = $sticky_id;
         $method = new stickiesSheetGetInfoMethod();
         $this->response = $method->getResponse(true);
     } else {
         throw new waAPIException('server_error', 500);
     }
 }
コード例 #4
0
 public function execute()
 {
     $id = $this->get('id', true);
     $this->getSticky($id);
     $data = waRequest::post();
     if (isset($data['id'])) {
         unset($data['id']);
     }
     if (isset($data['sheet_id'])) {
         $this->checkRights($data['sheet_id']);
     }
     $sticky_model = new stickiesStickyModel();
     if ($sticky_model->modify($id, $data)) {
         $method = new stickiesSheetGetInfoMethod();
         $this->response = $method->getResponse(true);
     } else {
         throw new waAPIException('server_error', 500);
     }
 }