Exemplo n.º 1
0
 /**
  * @return HtmlElement
  */
 protected function _buildElement()
 {
     $p = new HtmlElement('p', ['class' => 'supportTicket notify']);
     $i = new HtmlElement('i', ['class' => Icon32::ENVELOPE]);
     $span = new HtmlElement('span', ['class' => 'count'], $this->_count);
     $p->nest($i);
     $p->nest($span);
     return $p;
 }
Exemplo n.º 2
0
 public function buildMenu()
 {
     $menu = new HtmlElement('span', ['class' => $this->_generateCssClass()]);
     $ul = new HtmlElement('ul');
     $heading = new HtmlElement('li', ['class' => 'heading'], $this->_titleText);
     $ul->nest($heading);
     foreach ($this->_content as $item) {
         $li = new HtmlElement('li');
         $a = new HtmlElement('a', ['href' => $item['href']]);
         $img = new HtmlElement('span', ['class' => 'image ' . $item['icon']]);
         $title = new HtmlElement('span', ['class' => 'title'], $item['title']);
         /**/
         $text = $item['text'];
         if ($this->_menuType == self::TYPE_ARTICLES) {
             $length = 40;
             if (strlen($text) > $length) {
                 $string = substr($text, 0, $length - 3);
                 $text = substr($text, 0, strrpos($string, ' ')) . '...';
             } else {
                 $text .= '...';
             }
         }
         $text = new HtmlElement('span', ['class' => 'text visible-desktop'], $text);
         $a->nest($img);
         $a->nest($title);
         $a->nest($text);
         $li->nest($a);
         $ul->nest($li);
     }
     $menu->nest($ul);
     return $menu;
 }