Пример #1
0
 /**
  * Saves an entry and redirects to listing
  *
  * @return  void
  */
 public function saveTask()
 {
     // Check for request forgeries
     Request::checkToken();
     // Incoming
     $fields = Request::getVar('fields', array(), 'post');
     $fields = array_map('trim', $fields);
     // Initiate extended database class
     $row = new Service($this->database);
     if (!$row->bind($fields)) {
         $this->setMessage($row->getError(), 'error');
         $this->editTask($row);
         return;
     }
     // Store content
     if (!$row->check()) {
         $this->setMessage($row->getError(), 'error');
         $this->editTask($row);
         return;
     }
     // Store content
     if (!$row->store()) {
         $this->setMessage($row->getError(), 'error');
         $this->editTask($row);
         return;
     }
     $this->setMessage(Lang::txt('COM_SERVICES_SAVED'), 'message');
     if ($this->_task == 'apply') {
         return $this->editTask($row);
     }
     // Redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false));
 }
Пример #2
0
 /**
  * Initial setup of default services
  *
  * @return     boolean False if errors, true otherwise
  */
 protected function _setupServices()
 {
     $objS = new Service($this->database);
     $now = Date::toSql();
     $default1 = array('id' => 0, 'title' => Lang::txt('Employer Service, Basic'), 'category' => strtolower(Lang::txt('jobs')), 'alias' => Lang::txt('employer_basic'), 'status' => 1, 'description' => Lang::txt('Allows to search member resumes and post one job ad'), 'unitprice' => '0.00', 'pointprice' => 0, 'currency' => '$', 'maxunits' => 6, 'minunits' => 1, 'unitsize' => 1, 'unitmeasure' => strtolower(Lang::txt('month')), 'changed' => $now, 'params' => "promo=First 3 months FREE\npromomaxunits=3\nmaxads=1");
     $default2 = array('id' => 0, 'title' => Lang::txt('Employer Service, Premium'), 'category' => strtolower(Lang::txt('jobs')), 'alias' => Lang::txt('employer_premium'), 'status' => 0, 'description' => Lang::txt('Allows to search member resumes and post up to 3 job ads'), 'unitprice' => '500.00', 'pointprice' => 0, 'currency' => '$', 'maxunits' => 6, 'minunits' => 1, 'unitsize' => 1, 'unitmeasure' => strtolower(Lang::txt('month')), 'changed' => $now, 'params' => "promo=\npromomaxunits=\nmaxads=3");
     if (!$objS->bind($default1)) {
         App::redirect(Route::url('index.php?option=com_jobs'), $objS->getError(), 'error');
     }
     if (!$objS->store()) {
         App::redirect(Route::url('index.php?option=com_jobs'), $objS->getError(), 'error');
     }
     if (!$objS->bind($default2)) {
         App::redirect(Route::url('index.php?option=com_jobs'), $objS->getError(), 'error');
     }
     if (!$objS->store()) {
         App::redirect(Route::url('index.php?option=com_jobs'), $objS->getError(), 'error');
     }
     return true;
 }