コード例 #1
0
 /**
  * Overridden parent method to perform processing before form is build
  *
  * @access public
  */
 public function preProcess()
 {
     $this->ruleConditionId = CRM_Utils_Request::retrieve('rule_condition_id', 'Integer');
     $this->ruleCondition = new CRM_Civirules_BAO_RuleCondition();
     $this->ruleCondition->id = $this->ruleConditionId;
     $ruleConditionData = array();
     CRM_Core_DAO::storeValues($this->ruleCondition, $ruleConditionData);
     $this->condition = new CRM_Civirules_BAO_Condition();
     $this->rule = new CRM_Civirules_BAO_Rule();
     $this->event = new CRM_Civirules_BAO_Event();
     if (!$this->ruleCondition->find(true)) {
         throw new Exception('Civirules could not find ruleCondition');
     }
     $this->condition->id = $this->ruleCondition->condition_id;
     if (!$this->condition->find(true)) {
         throw new Exception('Civirules could not find condition');
     }
     $this->rule->id = $this->ruleCondition->rule_id;
     if (!$this->rule->find(true)) {
         throw new Exception('Civirules could not find rule');
     }
     $this->event->id = $this->rule->event_id;
     if (!$this->event->find(true)) {
         throw new Exception('Civirules could not find event');
     }
     $this->conditionClass = CRM_Civirules_BAO_Condition::getConditionObjectById($this->condition->id, false);
     if ($this->conditionClass) {
         $this->conditionClass->setRuleConditionData($ruleConditionData);
     }
     $this->eventClass = CRM_Civirules_BAO_Event::getEventObjectByEventId($this->event->id, true);
     $this->eventClass->setEventId($this->event->id);
     $this->eventClass->setEventParams($this->rule->event_params);
     parent::preProcess();
     $this->setFormTitle();
     //set user context
     $session = CRM_Core_Session::singleton();
     $editUrl = CRM_Utils_System::url('civicrm/civirule/form/rule', 'action=update&id=' . $this->rule->id, TRUE);
     $session->pushUserContext($editUrl);
 }
コード例 #2
0
 /**
  * Returns the url for redirect
  *
  * @param $event_id
  * @return bool|string url
  */
 protected function getEventRedirect($event_id)
 {
     $event = CRM_Civirules_BAO_Event::getEventObjectByEventId($event_id, true);
     $redirectUrl = $event->getExtraDataInputUrl($this->ruleId);
     if (!empty($redirectUrl)) {
         return $redirectUrl;
     }
     return false;
 }