Example #1
0
 /**
  * Get the bread crumb elements.
  *
  * @param GetBreadcrumbEvent $event This event.
  *
  * @return void
  *
  * @SuppressWarnings(PHPMD.LongVariable)
  */
 public function getBreadCrumb(GetBreadcrumbEvent $event)
 {
     $environment = $event->getEnvironment();
     $dataDefinition = $environment->getDataDefinition();
     $inputProvider = $environment->getInputProvider();
     $translator = $environment->getTranslator();
     $modelParameter = $inputProvider->hasParameter('act') ? 'id' : 'pid';
     if ($dataDefinition->getName() !== 'orm_avisota_salutation' || !$inputProvider->hasParameter($modelParameter)) {
         return;
     }
     $salutationModelId = ModelId::fromSerialized($inputProvider->getParameter($modelParameter));
     if (!in_array($salutationModelId->getDataProviderName(), array('orm_avisota_salutation', 'orm_avisota_salutation_group'))) {
         return;
     }
     $elements = $event->getElements();
     $urlSalutationBuilder = new UrlBuilder();
     $urlSalutationBuilder->setPath('contao/main.php')->setQueryParameter('do', $inputProvider->getParameter('do'))->setQueryParameter('ref', TL_REFERER_ID);
     $elements[] = array('icon' => 'assets/avisota/salutation/images/salutation.png', 'text' => $translator->translate('avisota_salutation.0', 'MOD'), 'url' => $urlSalutationBuilder->getUrl());
     if ($modelParameter === 'pid') {
         $event->setElements($elements);
         return;
     }
     $urlSalutationGroupBuilder = new UrlBuilder();
     $urlSalutationGroupBuilder->setPath('contao/main.php')->setQueryParameter('do', $inputProvider->getParameter('do'))->setQueryParameter('table', $inputProvider->getParameter('table'))->setQueryParameter('pid', $inputProvider->getParameter('pid'))->setQueryParameter('ref', TL_REFERER_ID);
     $salutationGroupModelId = ModelId::fromSerialized($inputProvider->getParameter('pid'));
     $dataProvider = $environment->getDataProvider($salutationGroupModelId->getDataProviderName());
     $model = $dataProvider->fetch($dataProvider->getEmptyConfig()->setId($salutationGroupModelId->getId()));
     $entity = $model->getEntity();
     $elements[] = array('icon' => 'assets/avisota/subscription-recipient/images/recipients.png', 'text' => $entity->getTitle(), 'url' => $urlSalutationGroupBuilder->getUrl());
     $event->setElements($elements);
 }
Example #2
0
 /**
  * Get the bread crumb elements.
  *
  * @param GetBreadcrumbEvent $event This event.
  *
  * @return void
  */
 public function getBreadCrumb(GetBreadcrumbEvent $event)
 {
     $environment = $event->getEnvironment();
     $inputProvider = $environment->getInputProvider();
     if (!in_array($inputProvider->getParameter('do'), array('avisota_transport', 'avisota_queue', 'avisota_salutation', 'avisota_recipient_source', 'avisota_mailing_list', 'avisota_theme'), null)) {
         return;
     }
     $baseUrl = new UrlBuilder();
     $baseUrl->setPath('contao/main.php')->setQueryParameter('do', 'avisota_config')->setQueryParameter('ref', TL_REFERER_ID);
     $translator = $environment->getTranslator();
     $event->setElements(array(array('icon' => 'assets/avisota/core/images/avisota-breadcrumb.png', 'text' => $translator->translate('avisota_config.0', 'MOD'), 'url' => $baseUrl->getUrl())));
 }
Example #3
0
 /**
  * Get the bread crumb elements.
  *
  * @param GetBreadcrumbEvent $event This event.
  *
  * @return void
  */
 public function getBreadCrumb(GetBreadcrumbEvent $event)
 {
     $environment = $event->getEnvironment();
     $dataDefinition = $environment->getDataDefinition();
     $inputProvider = $environment->getInputProvider();
     if ($dataDefinition->getName() !== 'orm_avisota_transport' || !$inputProvider->hasParameter('id')) {
         return;
     }
     $modelId = ModelId::fromSerialized($inputProvider->getParameter('id'));
     if ($modelId->getDataProviderName() !== 'orm_avisota_transport') {
         return;
     }
     $elements = $event->getElements();
     $urlBuilder = new UrlBuilder();
     $urlBuilder->setPath('contao/main.php')->setQueryParameter('do', 'avisota_transport')->setQueryParameter('ref', TL_REFERER_ID);
     $translator = $environment->getTranslator();
     $elements[] = array('icon' => 'assets/avisota/core/images/transport.png', 'text' => $translator->translate('avisota_transport.0', 'MOD'), 'url' => $urlBuilder->getUrl());
     $event->setElements($elements);
 }
 /**
  * Get the bread crumb elements.
  *
  * @param GetBreadcrumbEvent $event This event.
  *
  * @return void
  */
 public function getBreadCrumb(GetBreadcrumbEvent $event)
 {
     $environment = $event->getEnvironment();
     $dataDefinition = $environment->getDataDefinition();
     $inputProvider = $environment->getInputProvider();
     $modelParameter = $inputProvider->hasParameter('act') ? 'id' : 'pid';
     if ($dataDefinition->getName() !== 'orm_avisota_recipient_source' || !$inputProvider->hasParameter($modelParameter)) {
         return;
     }
     $modelId = ModelId::fromSerialized($inputProvider->getParameter($modelParameter));
     if ($modelId->getDataProviderName() !== 'orm_avisota_recipient_source') {
         return;
     }
     $elements = $event->getElements();
     $urlBuilder = new UrlBuilder();
     $urlBuilder->setPath('contao/main.php')->setQueryParameter('do', $inputProvider->getParameter('do'))->setQueryParameter('ref', TL_REFERER_ID);
     $elements[] = array('icon' => 'assets/avisota/core/images/recipient_source.png', 'text' => $GLOBALS['TL_LANG']['MOD']['avisota_recipient_source'][0], 'url' => $urlBuilder->getUrl());
     $event->setElements($elements);
 }
 /**
  * Retrieve the arguments for the callback.
  *
  * @param GetBreadcrumbEvent $event The event being emitted.
  *
  * @return array
  */
 public function getArgs($event)
 {
     return array(new DcCompat($event->getEnvironment()));
 }
Example #6
0
 /**
  * Get the bread crumb elements.
  *
  * @param GetBreadcrumbEvent $event This event.
  *
  * @return void
  */
 public function getBreadCrumb(GetBreadcrumbEvent $event)
 {
     $environment = $event->getEnvironment();
     $dataDefinition = $environment->getDataDefinition();
     $inputProvider = $environment->getInputProvider();
     $translator = $environment->getTranslator();
     $newsletterParameter = $inputProvider->hasParameter('act') ? 'id' : 'pid';
     if ($dataDefinition->getName() !== 'orm_avisota_message' || !$inputProvider->hasParameter($newsletterParameter)) {
         return;
     }
     $newsletterModelId = ModelId::fromSerialized($inputProvider->getParameter($newsletterParameter));
     if ($newsletterModelId->getDataProviderName() !== 'orm_avisota_message') {
         return;
     }
     $elements = $event->getElements();
     $urlNewsletterBuilder = new UrlBuilder();
     $urlNewsletterBuilder->setPath('contao/main.php')->setQueryParameter('do', $inputProvider->getParameter('do'))->setQueryParameter('ref', TL_REFERER_ID);
     $elements[] = array('icon' => 'assets/avisota/message/images/newsletter.png', 'text' => $translator->translate('avisota_newsletter.0', 'MOD'), 'url' => $urlNewsletterBuilder->getUrl());
     $dataProvider = $environment->getDataProvider($newsletterModelId->getDataProviderName());
     $model = $dataProvider->fetch($dataProvider->getEmptyConfig()->setId($newsletterModelId->getId()));
     $newsletter = $model->getEntity();
     $newsletterCategory = $newsletter->getCategory();
     $urlNewsletterBuilder = new UrlBuilder();
     $urlNewsletterBuilder->setPath('contao/main.php')->setQueryParameter('do', $inputProvider->getParameter('do'))->setQueryParameter('table', $newsletterModelId->getDataProviderName())->setQueryParameter('pid', ModelId::fromValues('orm_avisota_message_category', $newsletterCategory->getId())->getSerialized())->setQueryParameter('ref', TL_REFERER_ID);
     $elements[] = array('text' => $newsletterCategory->getTitle(), 'url' => $urlNewsletterBuilder->getUrl());
     $event->setElements($elements);
 }
Example #7
0
 /**
  * Event handler.
  *
  * @param GetBreadcrumbEvent $event The event.
  *
  * @return void
  */
 public function getBreadcrumb(GetBreadcrumbEvent $event)
 {
     $environment = $event->getEnvironment();
     $event->setElements($this->getBreadcrumbElements($environment, array()));
     $event->stopPropagation();
 }
 /**
  * Get the bread crumb elements.
  *
  * @param GetBreadcrumbEvent $event This event.
  *
  * @return void
  *
  * @SuppressWarnings(PHPMD.LongVariable)
  */
 public function getBreadCrumb(GetBreadcrumbEvent $event)
 {
     $environment = $event->getEnvironment();
     $dataDefinition = $environment->getDataDefinition();
     $inputProvider = $environment->getInputProvider();
     $translator = $environment->getTranslator();
     if ($dataDefinition->getName() !== 'orm_avisota_message_content' || (!$inputProvider->hasParameter('act') || $inputProvider->getParameter('act') === 'create') || !$inputProvider->hasParameter('id')) {
         return;
     }
     $messageContentModelId = ModelId::fromSerialized($inputProvider->getParameter('id'));
     if ($messageContentModelId->getDataProviderName() !== 'orm_avisota_message_content') {
         return;
     }
     $elements = $event->getElements();
     $dataProvider = $environment->getDataProvider($messageContentModelId->getDataProviderName());
     $model = $dataProvider->fetch($dataProvider->getEmptyConfig()->setId($messageContentModelId->getId()));
     $messageContent = $model->getEntity();
     $message = $messageContent->getMessage();
     $messageCategory = $message->getCategory();
     $urlNewsletterBuilder = new UrlBuilder();
     $urlNewsletterBuilder->setPath('contao/main.php')->setQueryParameter('do', $inputProvider->getParameter('do'))->setQueryParameter('ref', TL_REFERER_ID);
     $elements[] = array('icon' => 'assets/avisota/message/images/newsletter.png', 'text' => $translator->translate('avisota_newsletter.0', 'MOD'), 'url' => $urlNewsletterBuilder->getUrl());
     global $container;
     $entityManager = $container['doctrine.orm.entityManager'];
     $messageMeta = $entityManager->getClassMetadata(get_class($message));
     $messageCategoryMeta = $entityManager->getClassMetadata(get_class($messageCategory));
     $messageContentMeta = $entityManager->getClassMetadata(get_class($messageContent));
     $urlMessageCategoryBuilder = new UrlBuilder();
     $urlMessageCategoryBuilder->setPath('contao/main.php')->setQueryParameter('do', $inputProvider->getParameter('do'))->setQueryParameter('table', $messageMeta->getTableName())->setQueryParameter('pid', ModelId::fromValues($messageCategoryMeta->getTableName(), $messageCategory->getId())->getSerialized())->setQueryParameter('ref', TL_REFERER_ID);
     $elements[] = array('text' => $messageCategory->getTitle(), 'url' => $urlMessageCategoryBuilder->getUrl());
     $urlMessageBuilder = new UrlBuilder();
     $urlMessageBuilder->setPath('contao/main.php')->setQueryParameter('do', $inputProvider->getParameter('do'))->setQueryParameter('table', $messageContentMeta->getTableName())->setQueryParameter('pid', ModelId::fromValues($messageMeta->getTableName(), $message->getId())->getSerialized())->setQueryParameter('ref', TL_REFERER_ID);
     $elements[] = array('text' => $message->getSubject(), 'url' => $urlMessageBuilder->getUrl());
     $event->setElements($elements);
 }