Ejemplo n.º 1
0
 /**
  * Function to process the form
  *
  * @access public
  * @return None
  */
 public function postProcess()
 {
     require_once 'CRM/Core/BAO/MessageTemplates.php';
     if ($this->_action & CRM_Core_Action::DELETE) {
         CRM_Core_BAO_MessageTemplates::del($this->_id);
     } elseif ($this->_action & CRM_Core_Action::VIEW) {
         // currently, the above action is used solely for previewing default workflow templates
         CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/messageTemplates', 'selectedChild=workflow&reset=1'));
     } else {
         $params = array();
         // store the submitted values in an array
         $params = $this->exportValues();
         if ($this->_action & CRM_Core_Action::UPDATE) {
             $params['id'] = $this->_id;
         }
         if ($this->_workflow_id) {
             $params['workflow_id'] = $this->_workflow_id;
             $params['is_active'] = true;
         }
         $messageTemplate = CRM_Core_BAO_MessageTemplates::add($params);
         CRM_Core_Session::setStatus(ts('The Message Template \'%1\' has been saved.', array(1 => $messageTemplate->msg_title)));
         if ($this->_workflow_id) {
             CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/messageTemplates', 'selectedChild=workflow&reset=1'));
         }
     }
 }