public function buildIconPicker() { $icons = new Partial('<li class="%s"></li>'); foreach ($this->_getIcons() as $icon) { $icons->addElement($icon); } $iconList = new HtmlElement('ul', ['class' => 'iconlist'], $icons); return new HtmlElement('div', ['class' => 'iconpicker-popup'], $iconList); }
public function render() { $menus = ['Categories' => 'admin/category', 'Articles' => 'admin/article', 'Videos' => 'admin/video', 'Platforms' => 'admin/platform', 'Users' => 'admin/user']; $navItems = new Partial('<li class="%s"><a href="%s" title="%s">%s</a></li>', null, false); $currPath = $this->request()->path(); foreach ($menus as $item => $path) { $state = starts_with($currPath, "/{$path}", false) ? 'active' : ''; $navItems->addElement($state, '/' . $path, $item, $item); } return new RenderGroup('<a id="support-logo" class="brand" href="/admin">', 'Support Center</a>', '<ul class="nav">', $navItems, '</ul>', '<div class="nav-collapse collapse">' . '<ul class="nav pull-right">' . '<li><a href="/admin/profile">' . Auth::getRawUsername() . '</a></li>' . '<li><a href="/admin/access/logout">Logout</a></li>' . '</ul>' . '</div>'); }
public function getPager() { $this->paginate(); $edges = new Partial('<li class="%s">%s</li>', null, false); $pages = new Partial('<li class="%s"><a href="%s">%s</a></li>'); $pager = new RenderGroup(); $pager->add(<<<HTML <div class="pagination pagination-centered"> <ul> HTML ); if (1 === $this->getPage()) { $edges->addElement("disabled", '<span>' . $this->_prevLabel . '</span>'); } else { $url = $this->_getUrl($this->getPage() - 1); $edges->addElement("", '<a href="' . $url . '">' . $this->_prevLabel . '</a>'); } $pager->add($edges->render()); $edges->clearElements(); for ($page = 1; $page <= $this->_pages; $page++) { if ($page < $this->getPage() - $this->_numPagesBefore) { if ($page == 1) { $pages->addElement("", $this->_getUrl(1), "First"); } continue; } else { if ($page > $this->getPage() + $this->_numPagesAfter) { $pages->addElement("", $this->_getUrl($this->_pages), "Last"); break; } else { $class = $page == $this->getPage() ? "active" : ""; $pages->addElement($class, $this->_getUrl($page), $page); } } } $pager->add($pages); if ($this->_pages == $this->getPage() || $this->_pages <= 1) { $edges->addElement("disabled", '<span>' . $this->_nextLabel . '</span>'); } else { $url = $this->_getUrl($this->getPage() + 1); $edges->addElement("", '<a href="' . $url . '">' . $this->_nextLabel . '</a>'); } $pager->add($edges->render()); $edges->clearElements(); $pager->add(<<<HTML </ul> </div> HTML ); if ($this->_pages > 1) { return $pager; } return ''; }
public function render() { $menus = ['Home' => '/', 'Video' => '/video/1-example-video', 'Category' => '/category/1-example-category', 'Article' => '/article/1-example-article', 'Walkthrough' => '/walkthrough/1-example-walkthrough/1-step', 'Search Results' => '/search/example', 'Contact' => '/contact']; $navItems = new Partial('<li class="%s"> <a href="%s" title="%s">%s</a></li>', null, false); foreach ($menus as $text => $url) { $state = ''; $navItems->addElement($state, $url, $text, $text); } $searchForm = new FormSearch(); $searchForm->setAttribute('method', 'post'); $searchForm->setAttribute('action', '/search'); $searchForm->setFormType(FormSearch::FORM_TYPE_NAVBAR); $searchForm->setAlignment(FormSearch::ALIGN_RIGHT); $searchForm->setText('Search'); $searchForm->setName('term'); return new RenderGroup('<a id="support-logo" class="brand" href="/">', 'Support Center</a>', '<ul class="nav">', $navItems, '</ul>', $searchForm->render()); }