Ejemplo n.º 1
0
 /**
  * @return Mesour\Components\Utils\Html
  */
 public function getClosePrototype()
 {
     if (!$this->disableButtonPrototype) {
         $this->disableButtonPrototype = Mesour\Components\Utils\Html::el($this->getOption(self::CLOSE, 'el'), $this->getOption(self::CLOSE, 'attributes'));
         $this->disableButtonPrototype->add($this->getOption(self::CLOSE, 'content'));
     }
     return $this->disableButtonPrototype;
 }
Ejemplo n.º 2
0
 protected function addLink(Mesour\Components\Utils\Html $ul, $iteratorCount, $isEnabled = true, $activeClass = 'active', $activeValue = null)
 {
     $activeValue = is_null($activeValue) ? $iteratorCount : $activeValue;
     $itemArgs = [];
     if ($isEnabled) {
         $itemArgs = ['href' => $this->getApplication()->createLink($this, 'setPage', ['page' => $iteratorCount]), 'data-mesour' => 'ajax'];
     }
     $li = $this->createItemPrototype(['class' => !$isEnabled ? $activeClass : ''])->add($this->createItemAnchorPrototype($itemArgs)->setHtml($activeValue));
     $ul->add($li);
 }
Ejemplo n.º 3
0
 protected function createCustomFilterItem(Mesour\Components\Utils\Html &$subUl, $filter)
 {
     if (!isset($filter['type'])) {
         if (!isset($filter['name'])) {
             throw new Mesour\InvalidArgumentException('Key name is required in filter items.');
         }
         $subLi = $this->getListLiPrototype();
         $filterItem = $this->getFiltersItemPrototype(isset($filter['attributes']) ? $filter['attributes'] : []);
         $filterItem->setText($this->getTranslator()->translate($filter['name']));
         $subLi->add($filterItem);
     } elseif (is_array($filter['type'])) {
         if (!isset($filter['name'])) {
             throw new Mesour\InvalidArgumentException('Key name is required in filter items.');
         }
         $currentUl = $this->getListUlPrototype();
         foreach ($filter['type'] as $currentFilter) {
             $this->createCustomFilterItem($currentUl, $currentFilter);
         }
         $subLi = $this->getListLiPrototype(['class' => 'dropdown-submenu']);
         $subLi->add('<span tabindex="-1">' . $this->getTranslator()->translate($filter['name']) . '</span>');
         $subLi->add($currentUl);
     } elseif ($filter['type'] === 'divider') {
         $subLi = $this->getListLiPrototype(['class' => 'divider']);
     } else {
         throw new Mesour\InvalidArgumentException('Unknown type ' . $filter['type'] . ' possible are only array, "divider" or NULL.');
     }
     $subUl->add($subLi);
 }