コード例 #1
0
ファイル: CampaignModel.php プロジェクト: Yame-/mautic
 /**
  * Get a list of source choices
  *
  * @param $sourceType
  *
  * @return array
  */
 public function getSourceLists($sourceType = null)
 {
     $choices = array();
     switch ($sourceType) {
         case 'lists':
         case null:
             $choices['lists'] = array();
             $lists = empty($options['global_only']) ? $this->leadListModel->getUserLists() : $this->leadListModel->getGlobalLists();
             foreach ($lists as $list) {
                 $choices['lists'][$list['id']] = $list['name'];
             }
         case 'forms':
         case null:
             $choices['forms'] = array();
             $viewOther = $this->security->isGranted('form:forms:viewother');
             $repo = $this->formModel->getRepository();
             $repo->setCurrentUser($this->user);
             $forms = $repo->getFormList('', 0, 0, $viewOther, 'campaign');
             foreach ($forms as $form) {
                 $choices['forms'][$form['id']] = $form['name'];
             }
     }
     foreach ($choices as &$typeChoices) {
         asort($typeChoices);
     }
     return $sourceType == null ? $choices : $choices[$sourceType];
 }
コード例 #2
0
 /**
  * @param CampaignExecutionEvent $event
  */
 public function onCampaignTriggerCondition(CampaignExecutionEvent $event)
 {
     $lead = $event->getLead();
     if (!$lead || !$lead->getId()) {
         return $event->setResult(false);
     }
     $operators = $this->formModel->getFilterExpressionFunctions();
     $form = $this->formModel->getRepository()->findOneById($event->getConfig()['form']);
     if (!$form || !$form->getId()) {
         return $event->setResult(false);
     }
     $result = $this->formSubmissionModel->getRepository()->compareValue($lead->getId(), $form->getId(), $form->getAlias(), $event->getConfig()['field'], $event->getConfig()['value'], $operators[$event->getConfig()['operator']]['expr']);
     $event->setChannel('form', $form->getId());
     return $event->setResult($result);
 }