/**
  * Function to delete all rule conditions with rule id
  *
  * @param int $ruleId
  * @access public
  * @static
  */
 public static function deleteWithRuleId($ruleId)
 {
     $ruleCondition = new CRM_Civirules_BAO_RuleCondition();
     $ruleCondition->rule_id = $ruleId;
     $ruleCondition->find(FALSE);
     while ($ruleCondition->fetch()) {
         $ruleCondition->delete();
     }
 }
 /**
  * Overridden parent method to set default values
  *
  * @return array $defaultValues
  * @access public
  */
 public function setDefaultValues()
 {
     $data = array();
     $defaultValues = array();
     $defaultValues['rule_condition_id'] = $this->ruleConditionId;
     $ruleCondition = new CRM_Civirules_BAO_RuleCondition();
     $ruleCondition->id = $this->ruleConditionId;
     if ($ruleCondition->find(true)) {
         $data = unserialize($ruleCondition->condition_params);
     }
     if (!empty($data['operator'])) {
         $defaultValues['operator'] = $data['operator'];
     }
     if (!empty($data['value'])) {
         $defaultValues['value'] = $data['value'];
     }
     if (!empty($data['multi_value'])) {
         $defaultValues['multi_value'] = implode("\r\n", $data['multi_value']);
     }
     if (!empty($data['original_operator'])) {
         $defaultValues['original_operator'] = $data['original_operator'];
     }
     if (!empty($data['original_value'])) {
         $defaultValues['original_value'] = $data['original_value'];
     }
     if (!empty($data['original_multi_value'])) {
         $defaultValues['original_multi_value'] = implode("\r\n", $data['original_multi_value']);
     }
     return $defaultValues;
 }
 /**
  * Method to set the form title
  *
  * @access protected
  */
 protected function setFormTitle()
 {
     $conditionLabel = '';
     $ruleCondition = new CRM_Civirules_BAO_RuleCondition();
     $ruleCondition->id = $this->ruleConditionId;
     if ($ruleCondition->find(true)) {
         $condition = new CRM_Civirules_BAO_Condition();
         $condition->id = $ruleCondition->condition_id;
         if ($condition->find(true)) {
             $conditionLabel = $condition->label;
         }
     }
     $title = 'CiviRules Edit Condition parameters';
     $this->assign('ruleConditionHeader', 'Edit Condition ' . $conditionLabel . ' of CiviRule ' . CRM_Civirules_BAO_Rule::getRuleLabelWithId($ruleCondition->rule_id));
     CRM_Utils_System::setTitle($title);
 }