/** * @return string */ public function render() { $timerEvent = new TimerEvent('router.htmlPage', ['elements' => sizeof($this->elements)]); $out = '<!DOCTYPE html lang="' . self::locale() . '">' . "\n"; // default seo if (!$this->headTitle && ($title = self::trans('seo.default/title'))) { $this->setHeadTitle($title); } if (!$this->headDescription && ($description = self::trans('seo.default/description'))) { $this->setHeadDescription($description); } // add mandatory headers $language = new HtmlElement('<meta />'); $language->addAttributes(['http-equiv' => 'Content-Language', 'content' => self::locale()]); $this->head->addFirst($language); $charset = new HtmlElement('<meta />'); $charset->addAttribute('charset', 'utf-8'); $this->head->addFirst($charset); $content = $this->body->getContent(); if ($content) { $this->body->setContent($content . $this->footer->render()); } $parent = parent::render(); $out .= $parent; $timerEvent->addData(['size' => $this->getContent() ? strlen($this->getContent()) : strlen($parent)]); self::emit($timerEvent); return $out; }
public function render() { if ($this->badge) { if ($this->content) { $this->content = '<span class="badge">' . $this->badge . '</span> ' . $this->content; } else { $this->addFirst((new HtmlElement('<span>', $this->badge))->addClass('badge')); } } return parent::render(); }
/** * {@inheritdoc} */ public function render() { $this->ul->clear(); $this->ul->add($this->getLi(max(1, $this->current - 1), '«')->addClass('prev')); $min = 1; $max = $this->page; if ($this->page > $this->maxItem) { $min = max(1, $this->current - $this->maxItem / 2); $max = min($this->page, $this->current + $this->maxItem / 2); } if ($min - 1 >= 1) { $this->ul->add($this->getLi($min + 1, '...')); } for ($i = $min; $i <= $max; $i++) { $this->ul->add($this->getLi($i)); } if ($max + 1 < $this->page) { $this->ul->add($this->getLi($max + 1, '...')); } $this->ul->add($this->getLi(min($this->page, $this->current + 1), '»')->addClass('next')); $this->setContent($this->ul->render()); return parent::render(); }
/** * {@inheritdoc} */ public function render() { if ($this->title || $this->title) { $header = (new HtmlContainer('<div>'))->addClass('panel-heading'); if ($this->buttonGroup) { $header->add($this->buttonGroup); } if ($this->title) { $header->add((new HtmlElement('<h3>', $this->title))->addClass('panel-title')); } parent::add($header); } if ($this->content) { parent::add((new HtmlElement('<div>', $this->content))->addClass('panel-body')); } else { $container = new Container(); foreach ($this->container->getElements() as $element) { if ($element instanceof Table || $element instanceof Grid || $element instanceof ListGroup) { if (sizeof($container->getElements()) > 0) { parent::add((new HtmlContainer('<div>'))->addClass('panel-body')->add($container)); $container = new Container(); } parent::add($element); } else { $container->add($element); } } if (sizeof($container->getElements()) > 0) { parent::add((new HtmlContainer('<div>'))->addClass('panel-body')->add($container)); } } if ($this->footer) { parent::add((new HtmlElement('<div>', $this->footer))->addClass('panel-footer')); } return parent::render(); }
/** * {@inheritdoc} */ public function render() { $this->content = $this->layout()->render(); return parent::render(); }
/** * {@inheritdoc} */ public function render() { $container = new Container(); $container->add(new Element(parent::render())); $container->add($this->widgetOptions); return $container->render(); }
/** * @return string */ private function renderClone() { return parent::render(); }
/** * @return string */ private function renderClone() : string { // add columns viksiblity dropdown $this->options->add($this->getColumnDropdown()); if ($this->filtersForm) { $this->filtersForm->add(new Submit(self::trans('bootstrap.grid/filter'))); } // add pagination if ($this->rowCount) { $this->options->add($this->getRowsPerPageDropdown()); $pagination = new Pagination((int) ceil($this->rowCount / $this->getPageSize()), $this->argsCallback); $this->navbar->add($pagination, false); } return parent::render(); }
/** * {@inheritdoc} */ public function render() { if ($this->visible) { return parent::render(); } else { return ''; } }
/** * @return string */ public function render() { if (sizeof($this->data)) { // append row actions foreach ($this->rowActions as $i => $rowAction) { $this->add((new Column('row_action_' . $i, ''))->addRenderer(new RowActionRenderer($rowAction))->addClass('row-action')->setHideable(false)); } foreach ($this->data as $row) { $tr = new HtmlContainer('<tr>'); if (sizeof($this->thead->elements)) { /** @var Column $column */ foreach ($this->thead->elements as $column) { if ($column->isVisible() && $column->isRenderable()) { $td = new HtmlElement('<td>'); $td->addClass($column->getClasses()); $content = $row[$column->getId()] ?? ''; if ($column->getRenderer()) { foreach ($column->getRenderer() as $renderer) { $content = $renderer($content, $column, $this->getPrimaryValues($row), $row); } } $td->setContent((string) $content); $tr->add($td); } } } else { foreach ($row as $col) { $tr->add(new HtmlElement('<td>', $col)); } } if ($this->rowRenderers) { foreach ($this->rowRenderers as $callback) { $tr = call_user_func($callback, $tr, $row, $this); } } $this->tbody->add($tr); } } else { $this->tbody->add((new HtmlContainer('<tr>'))->add((new HtmlElement('<td>'))->addAttribute('colspan', (string) sizeof($this->getVisibleColumns()))->setContent(self::trans('html.table/noResult'))->addClass('text-center'))); } $return = parent::render(); return $return; }
/** * {@inheritdoc} */ public function render() { $this->alterBeforeRender(); return parent::render(); }