Пример #1
0
 public function procede()
 {
     try {
         if ($this->oRequest->existParam('name')) {
             if ($this->oRequest->existParam('edit')) {
                 $oRank = new Rank($this->oRequest->getParam('name', 'string'), $this->oRequest->getParam('default', 'boolean'), $this->oRequest->getParam('edit', 'int'));
                 //Delete
                 if ($this->oRequest->existParam('delete') && $this->oRequest->getParam('delete', 'boolean')) {
                     $oRank->delete();
                     Logger::log('admin', Language::translate('RANKS_ADMIN_RANK_DELLOG') . $this->oRequest->getParam('name', 'string') . ' [' . $this->oCurrentUser->getLogin() . ']');
                     $this->oView->addAlert(Language::translate('RANKS_ADMIN_RANK_DEL'), 'success');
                 } else {
                     //Edit
                     $oRank->update();
                     Logger::log('admin', Language::translate('RANKS_ADMIN_RANK_UPDATELOG') . $this->oRequest->getParam('name', 'string') . ' [' . $this->oCurrentUser->getLogin() . ']');
                     $this->oView->addAlert(Language::translate('RANKS_ADMIN_RANK_UPDATE'), 'success');
                 }
             } else {
                 $oRank = new Rank($this->oRequest->getParam('name', 'string'), $this->oRequest->getParam('default', 'boolean'));
                 $oRank->store();
                 Logger::log('admin', Language::translate('RANKS_ADMIN_RANK_ADDLOG') . $this->oRequest->getParam('name', 'string') . ' [' . $this->oCurrentUser->getLogin() . ']');
                 $this->oView->addAlert(Language::translate('RANKS_ADMIN_RANK_ADD'), 'success');
             }
         }
     } catch (Exception $ex) {
         $this->oView->addAlert($ex, 'danger');
     } finally {
         $this->createView();
     }
 }