Пример #1
0
 /**
  * Save an entry
  *
  * @return  void
  */
 public function saveTask()
 {
     // Check for request forgeries
     Request::checkToken();
     // Incoming fields
     $fields = Request::getVar('fields', array(), 'post');
     $fields['standalone'] = 1;
     // Load the profile
     $row = Resource::oneOrNew($fields['id'])->set($fields);
     if ($row->isNew()) {
         $row->set('access', 0);
         $row->set('published', 1);
         $row->set('created', Date::toSql());
         $row->set('created_by', User::get('id'));
     }
     if (!$row->get('alias')) {
         Notify::error(Lang::txt('COM_TOOLS_ERROR_MISSING_ALIAS'));
         return $this->editTask($row);
     }
     $row->set('alias', preg_replace('/[^a-z0-9_\\-]/i', '', strtolower($row->get('alias'))));
     if (!$row->get('title')) {
         Notify::error(Lang::txt('COM_TOOLS_ERROR_MISSING_TITLE'));
         return $this->editTask($row);
     }
     if (!$row->get('path')) {
         Notify::error(Lang::txt('COM_TOOLS_ERROR_MISSING_UUID'));
         return $this->editTask($row);
     }
     if (!$row->save()) {
         Notify::error(Lang::txt('COM_TOOLS_ERROR_MISSING_UUID'));
         return $this->editTask($row);
     }
     Notify::success(Lang::txt('COM_TOOLS_SAVE_SUCCESSFUL'));
     // Redirect
     if ($this->getTask() == 'apply') {
         return $this->editTask($row);
     }
     // Redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false));
 }
Пример #2
0
 /**
  * Check if the review step is completed
  *
  * @param   integer  $id  Resource ID
  * @return  integer  1 = step completed, 0 = not completed
  */
 public function step_review_check($id)
 {
     $resource = Resource::oneOrNew($id);
     if ($resource->get('published') == 1) {
         return 1;
     }
     return 0;
 }