Пример #1
0
 private function editRelease()
 {
     if (!$this->oRequest->existParam('name')) {
         throw new Error('Vous devez renseigner un nom.', 1163);
     }
     if (!$this->oRequest->existParam('pre')) {
         throw new Error('Vous devez renseigner un PRE Time.', 1163);
     }
     //Suppression
     if ($this->oRequest->existParam('delete') && $this->oRequest->getParam('delete', 'boolean')) {
         $this->oRelease->delete();
         Logger::log('admin', 'La release' . $this->oRelease->getName() . ' a été supprimée par ' . $this->oCurrentUser->getLogin());
         $this->oView->addAlert('La release a été supprimée.', 'success');
     } else {
         $this->oRelease->setName($this->oRequest->getParam('name', 'string'));
         $this->oRelease->setPre($this->oRequest->getParam('pre', 'string'));
         $this->oRelease->update();
         Logger::log('admin', 'La release' . $this->oRelease->getName() . ' a été modifiée par ' . $this->oCurrentUser->getLogin());
         $this->oView->addAlert('La release a été modifiée.', 'success');
     }
 }
Пример #2
0
 /**
  * method Delete()
  * Delete a record
  */
 function Delete($param)
 {
     try {
         // get the parameter $key
         $key = $param['key'];
         // open a transaction with database 'changeman'
         TTransaction::open('changeman');
         // instantiates object Release
         $object = new Release($key);
         // deletes the object from the database
         $object->delete();
         // close the transaction
         TTransaction::close();
         // reload the listing
         $this->onReload();
         // shows the success message
         new TMessage('info', TAdiantiCoreTranslator::translate('Record deleted'));
     } catch (Exception $e) {
         // shows the exception error message
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // undo all pending operations
         TTransaction::rollback();
     }
 }