Example #1
0
 /**
  * compile the button toolbar
  */
 protected function compile()
 {
     $buttons = new Helper\Buttons();
     $buttons->loadFromFieldset($this->buttons);
     $buttons->buttonStyle = $this->buttonStyle;
     $this->Template->buttons = $buttons;
 }
Example #2
0
 /**
  * compile
  */
 protected function compile()
 {
     if ($this->cssID[0] == '') {
         $cssID = $this->cssID;
         $cssID[0] = 'modal-' . $this->id;
         $cssID[1] .= $this->modalDynamicContent ? ' modal-reloadable' : '';
         $this->cssID = $cssID;
     }
     // check if ajax is used
     if ($this->modalAjax) {
         $this->Template->hideFrame = (bool) $this->isAjax;
         $this->Template->hideContent = !$this->Template->hideFrame;
     }
     if ($this->Template->hideContent) {
         $url = sprintf($GLOBALS['BOOTSTRAP']['modal']['remoteUrl'], $GLOBALS['objPage']->id, $this->id);
         $this->Template->dataRemote = ' data-remote="' . $url . '"';
         return;
     } elseif ($this->isAjax && $this->modalDynamicContent) {
         $dynamic = \Input::get('dynamic');
         if ($dynamic != '' && in_array($dynamic, array('article', 'module', 'form'))) {
             $this->{$dynamic} = \Input::get('id');
             $this->modalContentType = $dynamic;
         }
     }
     switch ($this->modalContentType) {
         case 'article':
             $this->Template->content = $this->getArticle($this->article, false, true);
             break;
         case 'form':
             $GLOBALS['bootstrapModalForm'] = '';
             $this->Template->content = $this->getForm($this->form);
             if ($GLOBALS['BOOTSTRAP']['modal']['adjustForm']) {
                 $this->Template->footer = $GLOBALS['bootstrapModalForm'];
                 unset($GLOBALS['bootstrapModalForm']);
             }
             // render style select if it is used
             if ($this->isAjax && $GLOBALS['BOOTSTRAP']['form']['styleSelect']['enabled']) {
                 $this->Template->content .= sprintf('<script>$(\'.%s\').selectpicker(\'render\');</script>', $GLOBALS['BOOTSTRAP']['form']['styleSelect']['class']);
             }
             break;
         case 'module':
             $this->Template->content = $this->getFrontendModule($this->module);
             break;
         case 'html':
             $this->Template->content = TL_MODE == 'FE' ? $this->html : htmlspecialchars($this->html);
             break;
         case 'template':
             ob_start();
             include $this->getTemplate($this->modalTemplate);
             $buffer = ob_get_contents();
             ob_end_clean();
             $this->Template->content = $buffer;
             break;
         case 'text':
             $this->Template->content = \String::toHtml5($this->text);
             break;
     }
     if ($this->addModalFooter) {
         $buttons = new Helper\Buttons();
         $buttons->loadFromFieldset($this->buttons, true);
         $buttons->buttonStyle = $this->buttonStyle ? $this->buttonStyle : 'btn-default';
         $buttons->addContainer = false;
         $this->Template->footerButtons = $buttons;
     }
     $this->Template->headerClose = $GLOBALS['BOOTSTRAP']['modal']['dismiss'];
 }