Example #1
0
 /**
  * Default action for database updating.
  *
  * @access   public
  * @return   View
  * @since    2014-08-17
  * @version  1.2.0-dev
  */
 public function actionDefault()
 {
     $this->addToTitle('Database updating module');
     // create update form
     $oForm = new Form('db_update');
     $oForm->setSubmitValue(__('make update'));
     // check if update button has been clicked
     if ($oForm->isSubmittedAndValid()) {
         $sUpdateOutput = static::makeUpdateNoExec();
         Cache::set($sUpdateOutput, 'output', 'dbupdate');
         Session::flash(Router::getCurrentUrl(), __('Database updated successfully.'));
     }
     // return View
     return View::factory('db_update/backend/default')->bind('oForm', $oForm);
 }
Example #2
0
 /**
  * ACTION - Backend delete action.
  *
  * @access     public
  * @return    View
  * @since      1.0.0-alpha
  * @version    1.0.0-alpha
  */
 public function actionDelete()
 {
     try {
         $this->loadModelForActions();
     } catch (Exception $oExc) {
         $this->addToTitle(__('Error'));
         $this->addSystemMessage('XXX', 'error');
         die('TODO');
     }
     // check permissions
     $this->checkPermissions('delete');
     // add title ad breadcrumb
     $this->alterBreadcrumbsTitleDelete();
     // confirm message
     $sMessage = __('Are you sure that want to remove item <b>:name</b> with ' . 'id <b>:id</b> from <b>:section</b> section?', ['name' => $this->getModel()->getEntityTitle(), 'id' => $this->getModel()->getId(), 'section' => __(strtolower(Router::getControllerName()))]);
     $this->addSystemMessage($sMessage, 'danger');
     // delete form
     $oForm = new Form('delete_form');
     $oForm->setSubmitValue(__('delete'));
     // if form submitted
     if ($oForm->isSubmittedAndValid()) {
         $this->alterDeleteUpdateSort();
         $this->alterDelete();
     }
     // return View
     return View::factory($this->sViewForm)->bind('oForm', $oForm)->set('sTitle', $this->getTitle());
 }