private function publishNow(Operation $operation, Form $form)
 {
     if ($form->get('campaignchain_hook_campaignchain_due')->has('execution_choice') && $form->get('campaignchain_hook_campaignchain_due')->get('execution_choice')->getData() == 'now') {
         $this->job->execute($operation->getId());
         $content = $this->contentService->getSlideshowByOperation($operation);
         $this->session->getFlashBag()->add('success', 'The slide show was published. <a href="' . $content->getUrl() . '">View it on SlideShare.net</a>.');
         return true;
     }
     return false;
 }
Exemplo n.º 2
0
 public function getContent(Operation $operation)
 {
     return $this->getNewsItemByOperation($operation->getId());
 }
Exemplo n.º 3
0
 public function getContent(Operation $operation)
 {
     return $this->getStatusByOperation($operation->getId());
 }
 public function getEditModalRenderOptions(Operation $operation)
 {
     // Get Webinar info.
     $webinar = $this->contentService->getWebinarByOperation($operation->getId());
     // TODO: Check if Webinar dates were edited on GoToWebinar.
     return array('template' => 'CampaignChainOperationGoToWebinarBundle::read_modal.html.twig', 'vars' => array('webinar' => $webinar, 'show_date' => true, 'operation' => $operation, 'activity' => $operation->getActivity()));
 }
 private function publishNow(Operation $operation, Form $form, $content)
 {
     if ($form->get('campaignchain_hook_campaignchain_due')->has('execution_choice') && $form->get('campaignchain_hook_campaignchain_due')->get('execution_choice')->getData() == 'now') {
         $this->job->execute($operation->getId());
         $content = $this->contentService->getNewsletterByOperation($operation);
         $this->session->getFlashBag()->add('success', 'The newsletter was published. <a href="' . $content->getArchiveUrl() . '">View it on MailChimp</a>.');
         return true;
     } else {
         // Unschedule the newsletter on MailChimp if it was scheduled there,
         // to let CampaignChain handle the scheduling.
         $remoteNewsletter = $this->getRemoteNewsletter();
         if ($remoteNewsletter['status'] == 'schedule') {
             $client = $this->getRestApiConnectionByOperation($operation);
             $client->campaigns->unschedule($content->getCampaignId());
         }
     }
     return false;
 }
 public function getContent(Operation $operation)
 {
     return $this->getWebinarByOperation($operation->getId());
 }
Exemplo n.º 7
0
 public function getContent(Operation $operation)
 {
     $operationServices = $operation->getModule()->getServices();
     if (isset($operationServices['operation'])) {
         $operationService = $this->container->get($operationServices['operation']);
         return $operationService->getContent($operation);
     } else {
         throw new \Exception('No content available for Operation ' . 'with ID "' . $operation->getId() . '" ' . 'in module "' . $operation->getModule()->getIdentifier() . '" of bundle "' . $operation->getModule()->getBundle()->getName() . '".');
     }
 }
 public function getContent(Operation $operation)
 {
     return $this->getSocialMediaScheduleByOperation($operation->getId());
 }
Exemplo n.º 9
0
 /**
  * Counts the number of shortened URLs available for the same URL.
  *
  * @param $url
  * @param Operation $operation
  * @param Location $location
  * @return mixed
  */
 protected function countShortenedUrls($url, Operation $operation, Location $location = null)
 {
     if ($operation->getActivity()->getCampaign()->getInterval()) {
         $isParentCampaign = false;
         $campaign = $operation->getActivity()->getCampaign();
     } elseif ($operation->getActivity()->getCampaign()->getParent() && $operation->getActivity()->getCampaign()->getParent()->getInterval()) {
         $isParentCampaign = true;
         $campaign = $operation->getActivity()->getCampaign()->getParent();
     }
     $qb = $this->em->getRepository('CampaignChainCoreBundle:CTA')->createQueryBuilder('cta')->from('CampaignChainCoreBundle:Campaign', 'c')->from('CampaignChainCoreBundle:Activity', 'a')->from('CampaignChainCoreBundle:Operation', 'o')->where('cta.originalUrl = :originalUrl')->setParameter('originalUrl', $url)->andWhere('a.location = :location')->setParameter('location', $operation->getActivity()->getLocation())->andWhere('cta.operation = o.id')->andWhere('o.activity = a.id');
     if (!$isParentCampaign) {
         $qb->andWhere('a.campaign = :campaign');
     } else {
         $qb->andWhere('a.campaign = c.id')->andWhere('c.parent = :campaign');
     }
     $qb->setParameter('campaign', $campaign);
     if ($location) {
         $qb->andWhere('cta.location = :location')->setParameter('location', $location);
     } else {
         $qb->andWhere('cta.location IS NULL');
     }
     $results = $qb->getQuery()->getResult();
     return count($results);
 }
 public function getContent(Operation $operation)
 {
     return $this->getSlideshowByOperation($operation->getId());
 }
 private function publishNow(Operation $operation, Form $form)
 {
     if ($form->get('campaignchain_hook_campaignchain_due')->has('execution_choice') && $form->get('campaignchain_hook_campaignchain_due')->get('execution_choice')->getData() == 'now') {
         $this->job->execute($operation->getId());
         $content = $this->contentService->getSocialMediaScheduleByOperation($operation);
         foreach ($content->getLocations() as $location) {
             $flashMsgPart = '<li><a href="' . $location->getUrl() . '">View it on ' . $location->getName() . ' (' . $location->getLocationModule()->getDisplayName() . ')</a></li>';
         }
         $this->session->getFlashBag()->add('success', 'The message was published on these Locations:' . '<ul>' . $flashMsgPart . '</ul>');
         return true;
     }
     return false;
 }
Exemplo n.º 12
0
 public function getContent(Operation $operation)
 {
     return $this->getMessageByOperation($operation->getId());
 }