Exemplo n.º 1
0
 public function procede()
 {
     try {
         if ($this->oRequest->existParam('url')) {
             if (!$this->oRequest->existParam('tracker')) {
                 throw new Error('FRAMEWORK_ERROR_RSS_TRACKER', 3);
             }
             if (!$this->oRequest->existParam('mask')) {
                 throw new Error('FRAMEWORK_ERROR_RSS_MASK', 3);
             }
             if (!$this->oRequest->existParam('encoding')) {
                 throw new Error('FRAMEWORK_ERROR_RSS_ENCODE', 3);
             }
             if ($this->oRequest->existParam('edit')) {
                 $oRss = new Rss($this->oRequest->getParam('tracker', 'int'), $this->oRequest->getParam('url', 'string'), $this->oRequest->getParam('mask', 'string'), $this->oRequest->getParam('forcedate', 'boolean'), 0, $this->oRequest->getParam('encoding', 'string'), $this->oRequest->getParam('edit', 'int'));
                 //Delete
                 if ($this->oRequest->existParam('delete') && $this->oRequest->getParam('delete', 'boolean')) {
                     $oRss->delete();
                     Logger::log('admin', Language::translate('RSS_ADMIN_RSS_DELLOG') . $oRss->getUrl() . ' [' . $this->oCurrentUser->getLogin() . ']');
                     $this->oView->addAlert(Language::translate('RSS_ADMIN_RSS_DEL'), 'success');
                 } else {
                     //Edit
                     $oRss->update();
                     Logger::log('admin', Language::translate('RSS_ADMIN_RSS_UPDATELOG') . $oRss->getUrl() . ' a été modifié par ' . $this->oCurrentUser->getLogin());
                     $this->oView->addAlert(Language::translate('RSS_ADMIN_RSS_UPDATE'), 'success');
                 }
             } else {
                 $oRss = new Rss($this->oRequest->getParam('tracker', 'int'), $this->oRequest->getParam('url', 'string'), $this->oRequest->getParam('mask', 'string'), $this->oRequest->getParam('forcedate', 'boolean'), 0, $this->oRequest->getParam('encoding', 'string'));
                 $oRss->store();
                 Logger::log('admin', Language::translate('RSS_ADMIN_RSS_ADDLOG') . $oRss->getUrl() . ' a été ajouté par ' . $this->oCurrentUser->getLogin());
                 $this->oView->addAlert(Language::translate('RSS_ADMIN_RSS_ADD'), 'success');
             }
         }
     } catch (Exception $ex) {
         $this->oView->addAlert($ex, 'danger');
     } finally {
         $this->createView();
     }
 }