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 getRestApiConnectionByOperation(Operation $operation) { if (!$this->restApiConnection) { $this->restApiConnection = $this->restClient->connectByActivity($operation->getActivity()); } return $this->restApiConnection; }
/** * 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); }