Esempio n. 1
0
    public function render()
    {
        global $core;
        $panel = new Element('div', array('class' => 'install-panel'));
        $component = $this->component;
        $rendered_component = (string) $component;
        $content = '';
        $name = $component['name'];
        $title = $component[self::TITLE];
        $description = $component[self::DESCRIPTION];
        if ($rendered_component) {
            $content = '<div class="install-panel-content">' . $rendered_component . '</div>';
        } else {
            $panel->add_class('no-content');
        }
        if ($name) {
            $panel['id'] = "panel-{$name}";
            $panel->add_class("install-panel--{$name}");
        }
        if (!empty($core->session->install['done'][$name])) {
            $panel->add_class('done');
        }
        $panel[Element::INNER_HTML] = <<<EOT
<div class="install-panel-inner">
\t<h3 class="install-panel-title">{$title}</h3>
\t<div class="install-panel-description">{$description}</div>
\t{$content}
</div>
EOT;
        return (string) $panel;
    }
Esempio n. 2
0
 protected function render_inner_html()
 {
     global $core;
     $page = $core->request->context->page;
     $translations_by_language = $this->collect();
     new LanguagesElement\CollectEvent($this, array('languages' => &$translations_by_language));
     if (count($translations_by_language) == 1) {
         throw new ElementIsEmpty();
     }
     /*
     if ($template)
     {
     	return $patron($template, $translations_by_language);
     }
     */
     $page_language = $page->language;
     $links = array();
     foreach ($translations_by_language as $language => $record) {
         $link = new Element('a', array(Element::INNER_HTML => $language, 'class' => 'btn language--' . \Brickrouge\normalize($language), 'href' => $record->url));
         if ($language == $page_language) {
             $link->add_class('active');
         }
         $links[$language] = $link;
     }
     new LanguagesElement\AlterEvent($this, array('links' => &$links, 'languages' => &$translations_by_language, 'page' => $page));
     return implode('', $links);
 }