Beispiel #1
0
 /**
  * Save a record
  *
  * @return  mixed
  */
 public function _save()
 {
     $note_id = Request::getInt('note', 0);
     $model = \Plugins\Courses\Notes\Models\Note::oneOrNew($note_id);
     if ($scope = Request::getWord('scope', 'lecture')) {
         $model->set('scope', $scope);
     }
     if ($scope_id = Request::getInt('scope_id', 0)) {
         $model->set('scope_id', $scope_id);
     }
     if ($pos_x = Request::getInt('x', 0)) {
         $model->set('pos_x', $pos_x);
     }
     if ($pos_y = Request::getInt('y', 0)) {
         $model->set('pos_y', $pos_y);
     }
     if ($width = Request::getInt('w', 0)) {
         $model->set('width', $width);
     }
     if ($height = Request::getInt('h', 0)) {
         $model->set('height', $height);
     }
     if ($state = Request::getInt('state', 0)) {
         $model->set('state', $state);
     }
     if ($timestamp = Request::getVar('time', '')) {
         $model->set('timestamp', $timestamp);
     }
     if ($content = Request::getVar('txt', '')) {
         $model->set('content', $content);
     }
     $model->set('access', Request::getInt('access', 0));
     $model->set('section_id', $this->view->offering->section()->get('id'));
     if (!$model->save()) {
         $this->setError($model->getError());
         if (!$this->view->no_html) {
             return $this->_edit($model);
         }
     }
     if (!$this->view->no_html) {
         return $this->_list();
     }
     return $model->get('id');
 }