/**
  * @inheritdoc
  */
 public function toHtml()
 {
     $modulo = $this->getSchrittweite();
     $ul = Html::create('ul')->css('pagination')->css('pagination-sm')->addCssClasses($this->cssClasses);
     $prev = Html::create('li')->addTo($ul)->text(Html::create('a')->attr('href', '#' . ($this->currentPage - 1))->attr('data-page', $this->currentPage - 1)->text('«'));
     // Links für die Seitenzahlen
     for ($i = 1; $i <= $this->pages; $i++) {
         // Die Seite wird angezeigt, wenn
         // - Es die aktuelle Seite ist
         // - Es die erste Seite ist
         // - Es die letzte Seite ist
         // - Die Seite im Bereich +-5 um die aktuelle liegt
         // - Die Seite zum Modulo passt
         $showPage = $i === $this->currentPage || $i === 1 || $i === $this->pages || $i >= $this->currentPage - 5 && $i <= $this->currentPage + 5 || $i % $modulo === 0;
         if ($showPage) {
             $li = Html::create('li')->addTo($ul);
             $current = Html::create('a')->attr('data-page', $i)->attr('href', '#' . $i)->text($i);
             $li->text($current);
             if ($i === $this->currentPage) {
                 $li->css('active');
             }
         }
     }
     $next = Html::create('li')->addTo($ul)->text(Html::create('a')->attr('href', '#' . ($this->currentPage + 1))->attr('data-page', $this->currentPage + 1)->text('&raquo;'));
     // Markierungen für aktiv / inaktiv setzen
     if ($this->currentPage === 1) {
         $prev->css('disabled');
     }
     if ($this->currentPage === $this->pages) {
         $next->css('disabled');
     }
     return $ul->render();
 }
 /**
  * @inheritdoc
  */
 public function toHtml()
 {
     if (count(Routing::getBreadcrumbs()) === 0) {
         return '';
     }
     $ul = Html::create($this->tagToUse)->addCssClasses($this->cssClasses)->css('breadcrumb');
     $lastLi = null;
     foreach (Routing::getBreadcrumbs() as $curBreadcrumb) {
         $li = Html::create('li')->addTo($ul);
         $fulllink = $curBreadcrumb['link'];
         if (strpos($fulllink, 'http') === false) {
             $fulllink = Configuration::get('site.scriptUrl') . $fulllink;
         }
         $text = $curBreadcrumb['text'];
         if (mb_strlen($curBreadcrumb['text']) > 20) {
             $text = mb_substr($curBreadcrumb['text'], 0, 20) . '...';
         }
         if ($curBreadcrumb['link'] !== '') {
             Html::create('a')->addTo($li)->attr('href', $fulllink)->attr('title', $curBreadcrumb['text'])->text($text);
         } else {
             Html::create('span')->addTo($li)->attr('title', $curBreadcrumb['text'])->text($text);
         }
         $lastLi = $li;
     }
     $lastLi->css('active');
     return $ul->render();
 }
 /**
  * In der aktuellen Implementierung werden für die Ausgabe
  * Bootstrap-Alerts verwendet. Diese werden hier aufgebaut und
  * das resultierende HTML zurückgegeben
  *
  * @return string
  */
 public function toHtml()
 {
     $div = Html::create('div')->css('alert')->css('alert-dismissable')->css('alert-' . $this->level);
     Html::create('button')->attr('type', 'button')->css('close')->attr('data-dismiss', 'alert')->attr('aria-hidden', 'true')->text('&times;')->addTo($div);
     $div->text($this->message);
     return $div->render();
 }
 public function toHtml()
 {
     // TODO: Close-Button wird nicht angezeigt
     $div = Html::create('div')->css('alert')->css('alert-dismissable')->css($this->alertClass);
     $button = Html::create('button')->data('dismiss', 'alert')->css('close')->attr('type', 'button')->render();
     $div->text($button . ' ' . $this->text);
     return $div->render();
 }
 /**
  * Gibt einen formatierten String zurück. Wird von den Controls genutzt
  * und setzt beispielsweise einen Boolean-Wert in "ja" / "nein" um
  */
 public function toString()
 {
     $parts = explode(':', $this->value);
     if (count($parts) > 1) {
         return Html::create('span')->css('label')->css('label-' . $parts[0])->text($parts[1])->render();
     }
     return '';
 }
 /**
  * @inheritdoc
  */
 public function toDesignModeHtml()
 {
     $row = Html::create('div')->css('row')->css('design-mode');
     $column1 = Html::create('div')->css('col-md-12')->addTo($row)->text('<h4 class="page-header">Spalte 1</h4>')->text($this->columns['column1']->toDesignModeHtml());
     $btn1 = AddRegionControl::create(null)->setRegion($this->region)->setCollectionName('column1');
     $column1->text($btn1->toHtml());
     return $row;
 }
 private function createTotal($label, $value)
 {
     $row = Html::create('div')->css('row');
     $label = Html::create('div')->css('col-md-2')->text($label)->addTo($row);
     $col = Html::create('div')->css('col-md-10')->addTo($row);
     $progress = Html::create('div')->css('progress')->addTo($col);
     Html::create('div')->addTo($progress)->css('progress-bar')->css('progress-bar-primary')->attr('style', 'width: 100%')->text($value . ' ms');
     return $row;
 }
 /**
  * Generiert den HTML Code für das Control und gibt diesen zurück. Das
  * Control muss selbst entscheiden, wie die HTML-Ausgabe entsteht. Es stehen
  * die Hilfsmethoden @see renderBySkin() und @see renderChildren() bereit.
  *
  * @return string|HtmlOutputInterface
  */
 public function toHtml()
 {
     $this->options->requirePlugins();
     if (trim($this->name) === '') {
         $this->name = $this->id;
     }
     $html = Html::create('textarea')->attr('name', $this->name)->attr('id', $this->id)->attr('style', 'height: 280px')->text($this->value);
     return $html->render();
 }
 /**
  * @inheritdoc
  */
 public function toHtml()
 {
     if ($this->value === '') {
         $this->value = ' ';
     }
     if ($this->name === '') {
         $this->name = $this->id;
     }
     $html = Html::create('textarea')->attr('name', $this->id)->attr('id', $this->id)->attr('style', 'height: 280px')->text($this->value);
     return $html->render();
 }
 /**
  * @inheritdoc
  */
 public function toHtml()
 {
     $outer = Html::create('div');
     foreach ($this->boxen as $box) {
         $div = Html::create('div')->css('checkbox')->addTo($outer);
         $label = Html::create('label')->addTo($div);
         $input = Html::create('input')->attr('type', 'checkbox')->attr('id', $box['id'])->attr('name', $box['id'])->attr('value', $box['value'])->addTo($label);
         // Muss nach dem Input eingefügt werden
         $label->text($box['text']);
         if ($box['checked']) {
             $input->attr('checked', 'checked');
         }
     }
     return $outer->render();
 }
 /**
  * @inheritdoc
  */
 public function toHtml()
 {
     $this->templates = new InnerTemplateList($this->outerTemplate->name);
     $div = Html::create('div')->css('chooseTemplateDiv')->css('row');
     Html::create('input')->attr('type', 'hidden')->attr('name', $this->id)->attr('id', $this->id)->attr('value', $this->chosenTemplate)->addTo($div);
     foreach ($this->templates->getTemplates() as $template) {
         $innerDiv = Html::create('div')->css('col-md-1')->addTo($div);
         $a = Html::create('a')->css('chooseTemplate')->attr('href', '#')->attr('title', $template->getName())->addTo($innerDiv);
         if ($this->chosenTemplate === $template->getName()) {
             $a->css('chosen');
         }
         Html::create('img')->attr('src', $template->getThumbnailUrl())->addTo($a);
     }
     return $div->render();
 }
 /**
  * @inheritdoc
  */
 public function toHtml()
 {
     $div = Html::create('div')->css('checkbox')->css($this->cssClasses);
     $label = Html::create('label')->addTo($div);
     $html = Html::create('input')->addTo($label)->attr('type', 'checkbox')->attr('id', $this->id)->attr('name', $this->id . '_box')->attr('value', $this->value)->css('checkbox')->css($this->cssClasses);
     if ($this->readOnly) {
         $html->attr('disabled', 'disabled');
     }
     $valueStr = 0;
     if ($this->checked) {
         $html->attr('checked', 'checked');
         $valueStr = 1;
     }
     $hidden = Html::create('input')->attr('type', 'hidden')->attr('name', $this->id)->attr('id', $this->id . '_hidden')->attr('value', $valueStr);
     return $div->render() . $hidden->render();
 }
 public function getData($row)
 {
     $this->checkbox = Html::create('input')->css('select-column')->attr('type', 'checkbox')->attr('name', 'selected[' . $this->entity->id . ']')->attr('value', 1);
     // Hack, damit die IDE hier nicht meckert, obwohl alles richtig ist
     if ($this->callable != 'none') {
         $callable = $this->callable;
         $this->checked = $callable($this->entity);
     }
     if ($this->checked) {
         $this->checkbox->attr('checked', 'checked');
     }
     if ($this->checked && $this->disabledWhenChecked) {
         $this->checkbox->attr('disabled', 'disabled');
     }
     return $this->checkbox->render();
 }
 public function toHtml()
 {
     if ($this->name == '') {
         $this->name = $this->id;
     }
     $group = Html::create('div')->css('input-group');
     $html = Html::create('input')->addTo($group)->attr('type', 'text')->attr('id', $this->id)->attr('name', $this->name)->attr('value', $this->value)->css('form-control')->css('url')->css($this->cssClasses);
     if ($this->maxlength) {
         $html->attr('maxlength', $this->maxlength);
     }
     if ($this->readOnly) {
         $html->attr('disabled', 'disabled');
     }
     if ($this->placeholder != '') {
         $html->attr('placeholder', $this->placeholder);
     }
     $span = Html::create('span')->addTo($group)->css('input-group-btn');
     $button = Html::create('a')->addTo($span)->css('btn btn-default')->text('Aufrufen')->attr('href', $this->value)->attr('target', '_blank');
     return $group->render();
 }
 public function toHtml()
 {
     $group = Html::create('fieldset');
     if ($this->caption != null) {
         $legend = Html::create('legend')->addInnerHtml($this->caption)->addTo($group);
     }
     foreach ($this->boxen as $box) {
         $input = Html::create('input')->attr('type', 'radio')->attr('id', $this->id . '_' . $box['id'])->attr('name', $this->id)->attr('value', $box['value']);
         $label = Html::create('label')->text($input)->text($box['text'])->addTo($group);
         if ($box['checked']) {
             $input->addAttribute('checked', 'checked');
         }
     }
     if (count($this->boxen) > 5) {
         $outer = Html::createElement('div')->addAttribute('style', 'height: 300px; overflow: auto; margin-bottom: 10px;')->addInnerHtml($group);
         return $outer->render();
     } else {
         return $group->render();
     }
 }
 /**
  * @inheritdoc
  */
 public function toHtml()
 {
     if ($this->readOnly) {
         $inner = new InputTextboxControl(null, $this->id);
         $inner->setValue($this->value);
         $inner->setReadOnly(true);
         return $inner->toHtml();
     }
     $div = Html::create('div')->css('input-group')->css('date')->attr('id', $this->id . '-div');
     $input = Html::create('input')->addTo($div)->attr('type', 'text')->css('form-control')->css($this->cssClasses)->attr('value', $this->value)->attr('name', $this->id)->attr('id', $this->id);
     if ($this->mode === self::MODE_DATE) {
         $input->css('date');
     }
     if (!$this->readOnly) {
         $span = Html::create('span')->addTo($div)->css('input-group-addon');
         $icon = Html::create('span')->addTo($span)->css('glyphicon');
         if ($this->mode === self::MODE_TIME) {
             $icon->css('glyphicon-time');
         } else {
             $icon->css('glyphicon-calendar');
         }
     }
     return $div->render();
 }
 public function toHtml()
 {
     if ($this->inline) {
         $this->addCssClass('form-inline');
     }
     if (!$this->readOnly) {
         $control = Html::create('div')->css('submitDataControl')->css($this->getCssString())->attr('id', $this->id);
         foreach ($this->hiddenValues as $key => $value) {
             $hidden = Html::create('input')->attr('type', 'hidden')->attr('name', $key)->attr('value', $value);
             $control->text($hidden);
         }
         $control->text($this->renderChildren());
         $submit = new ButtonControl(null, 'btn' . $this->id);
         $submit->setCaption($this->buttonCaption)->setIcon($this->buttonIcon)->setButtonClass($this->buttonClass);
         $control->text($submit);
         return $control->render();
     }
     return '';
 }
 public function toHtml()
 {
     $path = Configuration::get('site.url');
     $iconPath = Template::getInstance()->imgDirectory;
     $script = Configuration::get('site.scriptUrl');
     $this->unterordner = new Kollektion();
     $this->unterordner = $this->unterordner->filter(['parent' => $this->ordner]);
     $this->dateien = new Medien();
     $this->dateien = $this->dateien->filter(['kollektion' => $this->ordner]);
     $div = Html::create('div')->addAttribute('id', $this->id);
     $table = Html::create('table')->css('table')->css('table-striped')->css('table-hover')->addTo($div);
     // HEADER
     $thead = Html::create('thead')->addTo($table);
     $tr = Html::create('tr')->addTo($thead);
     $th = Html::create('th')->addTo($tr)->addInnerHtml('Titel');
     $th = Html::create('th')->addTo($tr)->addInnerHtml('Dateiname');
     $th = Html::create('th')->addTo($tr)->addInnerHtml('Größe');
     $th = Html::create('th')->addTo($tr)->addCssClass('icon')->addInnerHtml('&nbsp;');
     // BODY
     $tbody = Html::create('tbody')->addTo($table);
     // Ebene nach oben
     if ($this->ordnerObj != null && $this->ordnerObj->ko_parent > 0 && $this->showUp) {
         $tr = Html::create('tr')->addTo($tbody);
         $td = Html::create('td')->addTo($tr)->addInnerHtml('<a class="nfs-ajax" data-target="' . $this->ajaxTarget . '" href="' . $script . '/medien/showKollektion/id/' . $this->ordnerObj->ko_parent . '"><img src="' . $iconPath . '/icons/folder_up.png" /> zurück...</a>');
         $td = Html::create('td')->addTo($tr)->addInnerHtml('');
         $td = Html::create('td')->addTo($tr)->addInnerHtml('');
         $td = Html::create('td')->addTo($tr)->addInnerHtml('');
     } elseif ($this->ordnerObj != null && $this->showUp) {
         $tr = Html::create('tr')->addTo($tbody);
         $td = Html::create('td')->addTo($tr)->addInnerHtml('<a class="nfs-ajax" data-target="' . $this->ajaxTarget . '" href="' . $script . '/medien/showKollektion"><img src="' . $iconPath . '/icons/folder_up.png" /> zurück...</a>');
         $td = Html::create('td')->addTo($tr)->addInnerHtml('');
         $td = Html::create('td')->addTo($tr)->addInnerHtml('');
         $td = Html::create('td')->addTo($tr)->addInnerHtml('');
     }
     foreach ($this->unterordner as $akt) {
         $tr = Html::create('tr')->addTo($tbody);
         $td = Html::create('td')->addTo($tr)->addInnerHtml('<a class="nfs-ajax" data-target="' . $this->ajaxTarget . '" href="' . $script . '/medien/showKollektion/id/' . $akt->id . '"><img src="' . $iconPath . '/files/folder.png" /> ' . $akt->ko_bezeichnung . "</a> <a href=\"" . $script . "/medien/editKollektion/id/" . $akt->id . "\">[Edit]</a>");
         $td = Html::create('td')->addTo($tr)->addInnerHtml('');
         $td = Html::create('td')->addTo($tr)->addInnerHtml('');
         $td = Html::create('td')->addTo($tr)->addCssClass('icons')->addInnerHtml('<a class="nfs-ajax" data-target="' . $this->ajaxTarget . '" href="' . $script . '/medien/deleteKollektion/id/' . $akt->id . '"><img src="' . $iconPath . '/icons/delete.png" /></a>');
     }
     foreach ($this->dateien as $akt) {
         $tr = Html::create('tr')->addTo($tbody);
         // TODO: Bilder und andere Dokumente unterscheiden
         $td = Html::create('td')->addTo($tr)->addInnerHtml('<a class="magnigic-popup" href="' . $path . '/medien/' . $akt->me_kollektion . '/' . $akt->me_dateiname . '"><img src="' . $iconPath . '/files/' . $akt->me_erweiterung . '.png" /> ' . $akt->me_titel . "</a>&nbsp;&nbsp;&nbsp; <a href=\"" . $script . "/medien/editMedien/id/" . $akt->id . "\">[Edit]</a>");
         $td = Html::create('td')->addTo($tr)->addInnerHtml($akt->me_dateiname);
         $td = Html::create('td')->addTo($tr)->addInnerHtml(intval($akt->me_groesse / 1024) . ' KB');
         $td = Html::create('td')->addTo($tr)->addCssClass('icons')->addInnerHtml('<a href="' . $script . '/medien/deleteMedien/id/' . $akt->id . '"><img src="' . $iconPath . '/icons/delete.png" /></a> ');
     }
     $script = Html::create('script')->addInnerHtml("\n            \$('.magnific-popup').magnificPopup({\n                type: 'image'\n            });\n          ");
     return $table->render() . $script->render();
 }
 public function getAvatarTag()
 {
     return Html::create('img')->attr('src', Configuration::get('site.internalUrl') . '/medien/-1/thumbs/' . $this->val('us_profilbild'));
 }
 /**
  * Gibt den HTML String für die unterliegenden Menüpunkte aus
  *
  * @return string
  */
 public function getSubHtml()
 {
     if (!$this->renderChildren or !$this->page->hasChildren()) {
         return '';
     }
     $ul = Html::create('ul')->css('dropdown-menu')->attr('role', 'menu');
     foreach ($this->children as $child) {
         $ul->text($child->toHtml());
     }
     return $ul->render();
 }
 /**
  * Gibt den Sort-Indicator als HTML zurück
  */
 private function getSortIndicator($col)
 {
     if ($col == $this->sorting['column']) {
         if ($this->sorting['direction'] == 1) {
             $icon = "glyphicon-sort-by-attributes";
         } else {
             $icon = "glyphicon-sort-by-attributes-alt";
         }
         $indicator = Html::create('span')->css('glyphicon')->css($icon)->css('indicator');
         return $indicator;
     } else {
         return null;
     }
 }
 /**
  * @inheritdoc
  */
 public function toHtml()
 {
     $div = Html::create('div')->css('row');
     Html::create('div')->css('col-sm-5')->addTo($div)->text($this->datumvon);
     Html::create('div')->css('col-sm-2')->addTo($div)->text('<p class="form-control-static">bis zum</p>');
     Html::create('div')->css('col-sm-5')->addTo($div)->text($this->datumbis);
     return $div->render();
 }
 public function toHtml()
 {
     $caption = $this->caption;
     $link = '';
     if ($this->icon !== '' && $this->iconPosition === self::ICON_LEFT) {
         $caption = '<span class="glyphicon glyphicon-' . $this->icon . '"></span> ' . $caption;
     }
     if ($this->icon !== '' && $this->iconPosition === self::ICON_RIGHT) {
         $caption = $caption . ' <span class="glyphicon glyphicon-' . $this->icon . '"></span>';
     }
     if (!$this->isSubmit && !isset($this->onClick)) {
         $link = Routing::appLink($this->module, $this->action, $this->parameter);
     }
     // Link
     if ($this->useAnchor) {
         $html = Html::create('a')->attr('role', 'button')->attr('href', $link)->text($caption);
         if ($this->target != null) {
             $html->addAttribute('target', $this->target);
         }
         if ($this->disabled) {
             $html->addCssclass('disabled');
         }
         // Submit
     } elseif ($this->isSubmit) {
         $html = Html::createElement('button');
         $html->addAttribute('type', 'submit')->addInnerHtml($caption);
         if ($this->disabled) {
             $html->addAttribute('disabled', 'disabled');
         }
         // Button als Link
     } elseif (!isset($this->onClick)) {
         $html = Html::createElement('button');
         $html->addAttribute('type', 'button')->addAttribute('onClick', "location.href='{$link}'")->addInnerHtml($caption);
         if ($this->disabled) {
             $html->addAttribute('disabled', 'disabled');
         }
     } else {
         $html = Html::createElement('button');
         $html->addAttribute('type', 'button')->addAttribute('onClick', $this->onClick)->addInnerHtml($caption);
         if ($this->disabled) {
             $html->addAttribute('disabled', 'disabled');
         }
     }
     if (isset($this->dataTarget)) {
         $html->data('target', $this->dataTarget);
     }
     $html->attr('id', $this->id)->attr('title', $this->title)->css($this->cssClasses)->css('btn')->css('btn-' . $this->buttonClass);
     if ($this->size !== self::SIZE_DEFAULT) {
         $html->css('btn-' . $this->size);
     }
     return $html->render() . ' ';
 }
 /**
  * @inheritdoc
  */
 protected function init()
 {
     $this->innerHtml = Html::create();
 }
 /**
  * Erzeugt das Markup für ein horizontales Bootstrap Form
  * @return string
  */
 public function toHorizontalBootstrapHtml()
 {
     $div = Html::create('div')->css('editControl')->css('form-horizontal');
     $i = 0;
     $colwidth = 1;
     $labelwidth = $this->labelWidth;
     $controlwidth = $this->controlWidth;
     if ($this->columns > 1) {
         $div->css('row');
         $colwidth = round(12 / $this->columns);
         Logging::debug('Zeige ' . $this->columns . ' Spalten mit Breite ' . $colwidth);
         $labelwidth = 3;
         $controlwidth = 9;
     }
     foreach ($this->rows as $row) {
         $container = $div;
         if ($this->columns > 1 && $i % $this->columns == 0) {
             $container = Html::create('div')->css('col-sm-' . $colwidth);
             $container->addTo($div);
         }
         $firstChar = substr($row['field'], 0, 1);
         switch ($firstChar) {
             case "-":
                 Html::create('p')->addInnerHtml('&nbsp;')->css('form-empty')->addTo($container);
                 break;
             case "*":
                 Html::create('h4')->addInnerHtml(substr($row['field'], 1))->addTo($container);
                 break;
             default:
                 $formGroup = Html::create('div')->css('form-group')->addTo($container);
                 if (!$row['control'] instanceof Control) {
                     continue;
                 }
                 Html::create('label')->addTo($formGroup)->css('control-label')->css('col-sm-' . $labelwidth)->attr('for', $row['control']->getId())->text($row['header']);
                 $inner = Html::create('div')->css('col-sm-' . $controlwidth)->addTo($formGroup);
                 $control = $row['control'];
                 $inner->addInnerHtml($control);
                 break;
         }
     }
     return $div->render();
 }
 public function toHtml()
 {
     $html = Html::create('input')->addAttribute('type', 'hidden')->addAttribute('id', $this->id)->addAttribute('name', $this->id)->addAttribute('value', $this->value);
     return $html->render();
 }
 public function toHtml()
 {
     $html = Html::create('p');
     $html->css('static-form-control')->addCssClasses($this->cssClasses)->text($this->html);
     return $html->render();
 }
 /**
  * @inheritdoc
  */
 public function toHtml()
 {
     $select = Html::create('select')->css('lookup')->css('form-control')->addCssClasses($this->cssClasses)->attr('name', $this->name)->attr('id', $this->id);
     if ($this->groupfield !== null) {
         $select->css('grouped');
     }
     if ($this->multiple) {
         $select->attr('multiple', 'multiple');
         $select->attr('name', $this->name . '[]');
     }
     if ($this->readOnly) {
         $select->attr('disabled', 'disabled');
     }
     // Falls null-Wert angezeigt werden soll
     if ($this->showNullValue) {
         Html::create('option')->attr('value', $this->nullValue)->text($this->nullText)->addTo($select);
     }
     $groupValue = null;
     $optGroup = null;
     // Objekte laden, damit die Formatierungen angewendet werden
     $items = $this->lookupentity->filter($this->filter, 3000);
     if (!$this->parent instanceof SubmitDataControl && count($items) > 50) {
         $this->setUseChosen(true);
     }
     foreach ($items as $curItem) {
         // Gruppenkopf
         if ($this->groupfield != null && $groupValue !== $this->getEntityText($curItem, $this->groupfield)) {
             $optGroup = new Html('optgroup');
             $optGroup->attr('label', $this->getEntityText($curItem, $this->groupfield))->addTo($select);
             $groupValue = $this->getEntityText($curItem, $this->groupfield);
         }
         $text = $this->getEntityText($curItem, $this->textfield);
         if ($this->textfield2 !== null) {
             $text .= ', ' . $this->getEntityText($curItem, $this->textfield2);
         }
         $option = new Html('option');
         $option->attr('value', $curItem->val($this->valuefield))->text($text);
         if ($curItem->val($this->valuefield) == $this->selectedValue) {
             $option->attr('selected', 'selected');
         }
         if ($optGroup !== null) {
             $optGroup->text($option);
         } else {
             $select->text($option);
         }
     }
     return $select->render();
 }
 /**
  * @inheritdoc
  */
 public function toHtml()
 {
     if ($this->action !== '') {
         $this->addHiddenValue('action', $this->action);
         $this->addHiddenValue('module', $this->module);
         $url = Configuration::get('site.scriptUrl');
         if (strpos($url, '.php') === false) {
             $url = Configuration::get('site.internalUrl') . '/index.php';
         }
     } else {
         $url = $this->url;
     }
     $form = Html::create('form');
     $form->attr('id', $this->id)->attr('enctype', $this->encoding)->attr('action', $url)->attr('method', $this->method)->attr('role', 'form')->text($this->renderChildren());
     return $form->render();
 }
 public function toHtml()
 {
     $div = Html::create('div')->css('chart_wrapper')->id($this->id . 'wrapper');
     $canvas = Html::create('canvas')->id($this->id)->css('chart')->addTo($div);
     return $div->render();
 }