/**
  * Trigger point actions for asset download.
  *
  * @param AssetLoadEvent $event
  */
 public function onAssetDownload(AssetLoadEvent $event)
 {
     $asset = $event->getRecord()->getAsset();
     if ($asset !== null) {
         $this->pointModel->triggerAction('asset.download', $asset);
     }
 }
 /**
  * Trigger point actions for email send.
  *
  * @param EmailSendEvent $event
  */
 public function onEmailSend(EmailSendEvent $event)
 {
     if ($leadArray = $event->getLead()) {
         $lead = $this->em->getReference('MauticLeadBundle:Lead', $leadArray['id']);
     } else {
         return;
     }
     $this->pointModel->triggerAction('email.send', $event->getEmail(), null, $lead);
 }
 /**
  * Trigger point actions for page hits.
  *
  * @param Events\PageHitEvent $event
  */
 public function onPageHit(Events\PageHitEvent $event)
 {
     if ($event->getPage()) {
         // Mautic Landing Page was hit
         $this->pointModel->triggerAction('page.hit', $event->getHit());
     } else {
         // Mautic Tracking Pixel was hit
         $this->pointModel->triggerAction('url.hit', $event->getHit());
     }
 }
 /**
  * Set a widget detail when needed.
  *
  * @param WidgetDetailEvent $event
  */
 public function onWidgetDetailGenerate(WidgetDetailEvent $event)
 {
     $this->checkPermissions($event);
     $canViewOthers = $event->hasPermission('point:points:viewother');
     if ($event->getType() == 'points.in.time') {
         $widget = $event->getWidget();
         $params = $widget->getParams();
         if (!$event->isCached()) {
             $event->setTemplateData(['chartType' => 'line', 'chartHeight' => $widget->getHeight() - 80, 'chartData' => $this->pointModel->getPointLineChartData($params['timeUnit'], $params['dateFrom'], $params['dateTo'], $params['dateFormat'], [], $canViewOthers)]);
         }
         $event->setTemplate('MauticCoreBundle:Helper:chart.html.php');
         $event->stopPropagation();
     }
 }
 /**
  * @param MauticEvents\CommandListEvent $event
  */
 public function onBuildCommandList(MauticEvents\CommandListEvent $event)
 {
     $security = $this->security;
     if ($security->isGranted('point:points:view')) {
         $event->addCommands('mautic.point.actions.header.index', $this->pointModel->getCommandList());
     }
 }
 /**
  * Trigger point actions for form submit.
  *
  * @param SubmissionEvent $event
  */
 public function onFormSubmit(SubmissionEvent $event)
 {
     $this->pointModel->triggerAction('form.submit', $event->getSubmission());
 }