Esempio n. 1
0
 /**
  * Return the link picker wizard.
  *
  * @param DC_General $dataContainer The DC_General currently in use.
  *
  * @return string
  */
 public function pagePicker(DC_General $dataContainer)
 {
     $environment = $dataContainer->getEnvironment();
     if (version_compare(VERSION, '3.0', '<')) {
         $event = new GenerateHtmlEvent('pickpage.gif', $environment->getTranslator()->translate('MSC.pagepicker'), 'style="vertical-align:top;cursor:pointer" onclick="Backend.pickPage(\'ctrl_' . $dataContainer->inputName . '\')"');
         $environment->getEventDispatcher()->dispatch(ContaoEvents::IMAGE_GET_HTML, $event);
         return ' ' . $event->getHtml();
     }
     $url = sprintf('%scontao/page.php?do=metamodels&table=tl_metamodel_rendersettings&field=ctrl_%s', \Environment::get('base'), $dataContainer->inputName);
     $options = sprintf("{'width':765,'title':'%s','url':'%s','id':'%s','tag':'ctrl_%s','self':this}", $environment->getTranslator()->translate('MOD.page.0'), $url, $dataContainer->inputName, $dataContainer->inputName);
     $event = new GenerateHtmlEvent('pickpage.gif', $environment->getTranslator()->translate('MSC.pagepicker'), 'style="vertical-align:top;cursor:pointer"');
     $environment->getEventDispatcher()->dispatch(ContaoEvents::IMAGE_GET_HTML, $event);
     return sprintf(' <a href="%s"%s>%s</a>', $url, ' onclick="Backend.openModalSelector(' . $options . '); return false;"', $event->getHtml());
 }
Esempio n. 2
0
 /**
  * Update the value via ajax and redraw the widget.
  *
  * @param string     $ajaxAction Not used in here.
  *
  * @param DC_General $dc         The data container to use.
  *
  * @return string
  */
 public function updateAjax($ajaxAction, $dc)
 {
     if ($ajaxAction !== 'reloadGeneralTreePicker') {
         return '';
     }
     $this->setUp($dc);
     $value = $this->dataContainer->getEnvironment()->getInputProvider()->getValue('value');
     // ToDo: THIS IS TOTALLY CRAP.
     if ($this->fieldType == 'checkbox' && stripos($value, '	') !== false) {
         $delimiter = '	';
     } else {
         $delimiter = ',';
     }
     $this->value = explode($delimiter, $value);
     echo '<h3><label>' . $this->label . '</label></h3><div>' . $this->generate() . '</div>';
     exit;
 }
Esempio n. 3
0
    /**
     * The hook for nested menu post defined content.
     *
     * @param string $do The do parameter.
     *
     * @return string
     *
     * @SuppressWarnings(PHPMD.ShortVariable)
     */
    public function hookNestedMenuPostContent($do)
    {
        if ($do == 'avisota_config') {
            $general = new DC_General('orm_avisota_transport');
            $environment = $general->getEnvironment();
            $eventDispatcher = $environment->getEventDispatcher();
            $translator = $environment->getTranslator();
            $eventDispatcher->dispatch(ContaoEvents::SYSTEM_LOAD_LANGUAGE_FILE, new LoadLanguageFileEvent('avisota_promotion'));
            $context = array('opensource' => $translator->translate('opensource', 'avisota_promotion'), 'partners' => $translator->translate('partners', 'avisota_promotion'), 'copyright' => 'Avisota newsletter and mailing system &copy; 2013-2016 way.vision and all ' . '<a href="https://github.com/avisota/contao/graphs/contributors" ' . 'target="_blank">contributors</a>', 'disclaimer' => <<<HTML
Avisota use icons from the <a href="http://www.famfamfam.com/" target="_blank">famfamfam silk icons</a> and
<a href="http://www.picol.org/" target="_blank">Picol Vector icons</a>,
licensed under the <a href="http://creativecommons.org/licenses/by/3.0/">CC-BY-3.0.</a>
HTML
);
            $template = new \TwigTemplate('avisota/backend/config_footer', 'html5');
            return $template->parse($context);
        }
    }
 /**
  * @param array               $options
  * @param DC_General|DcCompat $general
  *
  * @return array
  */
 public function getRecipientFieldOptions(DC_General $general, $options = array())
 {
     global $container;
     //TODO check general parameter
     /** @var EventDispatcher $eventDispatcher */
     $eventDispatcher = $container['event-dispatcher'];
     $eventDispatcher->dispatch(ContaoEvents::SYSTEM_LOAD_LANGUAGE_FILE, new LoadLanguageFileEvent('orm_avisota_recipient'));
     $eventDispatcher->dispatch(ContaoEvents::CONTROLLER_LOAD_DATA_CONTAINER, new LoadDataContainerEvent('orm_avisota_recipient'));
     $factory = DcGeneralFactory::deriveFromEnvironment($general->getEnvironment());
     $factory->setContainerName('orm_avisota_recipient');
     $containerFactory = $factory->createContainer();
     if ($containerFactory->hasPropertiesDefinition()) {
         $properties = $containerFactory->getPropertiesDefinition()->getProperties();
         foreach ($properties as $property) {
             if ($property->getWidgetType()) {
                 $options[$property->getName()] = $property->getLabel();
             }
         }
     }
     return $options;
 }
Esempio n. 5
0
 /**
  * Return all gallery templates as array
  *
  * @param object
  *
  * @return array
  */
 public function getGalleryTemplateOptions(DC_General $dc, $options = array())
 {
     if (!is_array($options) && !$options instanceof \ArrayAccess) {
         $options = array();
     }
     // Get the page ID
     $article = \Database::getInstance()->prepare("SELECT pid FROM tl_article WHERE id=?")->limit(1)->execute($dc->getEnvironment()->getCurrentModel()->getProperty('pid'));
     // Inherit the page settings
     $page = $this->getPageDetails($article->pid);
     // Get the theme ID
     $layout = \Database::getInstance()->prepare("SELECT pid FROM tl_layout WHERE id=?")->limit(1)->execute($page->layout);
     // Return all gallery templates
     $templateGroup = $this->getTemplateGroup('nl_gallery_', $layout->pid);
     foreach ($templateGroup as $key => $value) {
         $options[$key] = $value;
     }
     return $options;
 }
Esempio n. 6
0
 /**
  * Update the value via ajax and redraw the widget.
  *
  * @param string     $ajaxAction    Not used in here.
  *
  * @param DC_General $dataContainer The data container to use.
  *
  * @return string
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  * @SuppressWarnings(PHPMD.CamelCaseVariableName)
  * @SuppressWarnings(PHPMD.ExitExpression)
  */
 public function updateAjax($ajaxAction, $dataContainer)
 {
     if ($ajaxAction !== 'reloadGeneralTreePicker') {
         return '';
     }
     $this->setUp($dataContainer);
     $environment = $this->dataContainer->getEnvironment();
     $this->value = $environment->getInputProvider()->getValue('value');
     $result = '<input type="hidden" value="' . $this->strName . '" name="FORM_INPUTS[]">' . '<h3><label>' . $this->label . '</label></h3>' . $this->generate();
     $label = $environment->getDataDefinition()->getPropertiesDefinition()->getProperty($this->strName)->getDescription();
     if ($GLOBALS['TL_CONFIG']['showHelp'] && strlen($label)) {
         $result .= '<p class="tl_help tl_tip">' . $label . '</p>';
     }
     echo $result;
     exit;
 }