Beispiel #1
0
 public function _initTriggerActionTypes()
 {
     $plugins = array();
     $plugins[] = new Ot_Trigger_ActionType_EmailQueue('Ot_Trigger_ActionType_EmailQueue', 'Send email via Queue', 'Sends email using the built-in queue manager');
     $plugins[] = new Ot_Trigger_ActionType_Email('Ot_Trigger_ActionType_Email', 'Send email immediately', 'Send email immediately without queuing');
     $tpr = new Ot_Trigger_ActionTypeRegister();
     $tpr->registerTriggerActionTypes($plugins);
 }
 /**
  * delete an existing trigger action
  *
  */
 public function deleteAction()
 {
     $triggerActionId = $this->_getParam('triggerActionId', null);
     if (is_null($triggerActionId)) {
         throw new Ot_Exception_Input('msg-error-triggerActionIdNotFound');
     }
     $action = new Ot_Model_DbTable_TriggerAction();
     $thisTriggerAction = $action->find($triggerActionId);
     if (is_null($thisTriggerAction)) {
         throw new Ot_Exception_Data('msg-error-noTriggerActionId');
     }
     $actionTypeRegister = new Ot_Trigger_ActionTypeRegister();
     $thisActionType = $actionTypeRegister->getTriggerActionType($thisTriggerAction->actionKey);
     if (is_null($thisActionType)) {
         throw new Ot_Exception_Data('msg-error-noTrigger');
     }
     if ($this->_request->isPost()) {
         $dba = $action->getAdapter();
         $dba->beginTransaction();
         $where = $action->getAdapter()->quoteInto('triggerActionId = ?', $triggerActionId);
         try {
             $action->delete($where);
             $thisActionType->getDbTable()->delete($where);
         } catch (Exception $e) {
             $dba->rollback();
             throw $e;
         }
         $dba->commit();
         $logOptions = array('attributeName' => 'triggerActionId', 'attributeId' => $triggerActionId);
         $this->_helper->log(Zend_Log::INFO, 'Trigger Action deleted', $logOptions);
         $this->_helper->messenger->addWarning('msg-info-triggerDeleted');
         $this->_helper->redirector->gotoRoute(array('controller' => 'trigger', 'action' => 'details', 'eventKey' => $thisTriggerAction->eventKey), 'ot', true);
     } else {
         throw new Ot_Exception_Access('You are not allowed to access this method directly');
     }
 }