Beispiel #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;
 }
Beispiel #2
0
 public function create()
 {
     $table = Mesour\Components\Utils\Html::el('table', $this->attributes);
     $table->add($this->header->create());
     $table->add($this->body->create());
     return $table;
 }
Beispiel #3
0
 public function create()
 {
     $tr = Mesour\Components\Utils\Html::el('tr', $this->attributes);
     foreach ($this->cells as $cell) {
         $tr->add($cell->create());
     }
     return $tr;
 }
Beispiel #4
0
 public function create()
 {
     $tableBody = Mesour\Components\Utils\Html::el('tbody', $this->attributes);
     foreach ($this->rows as $row) {
         $tableBody->add($row->create());
     }
     return $tableBody;
 }
Beispiel #5
0
 public function create()
 {
     $tableHead = Mesour\Components\Utils\Html::el('thead', $this->headerAttributes);
     $tr = Mesour\Components\Utils\Html::el('tr', $this->attributes);
     foreach ($this->cells as $cell) {
         $tr->add($cell->create());
     }
     $tableHead->add($tr);
     return $tableHead;
 }
Beispiel #6
0
 public function __construct($name = null, Mesour\Components\ComponentModel\IContainer $parent = null)
 {
     if (is_null($name)) {
         throw new Mesour\InvalidStateException('Component name is required.');
     }
     parent::__construct($name, $parent);
     $this->setHtmlElement(Mesour\Components\Utils\Html::el($this->getOption(self::WRAPPER, 'el'), $this->getOption(self::WRAPPER, 'attributes')));
     $this->addComponent(new Mesour\Modal\ModalHeader('modalHeader'));
     $this->addComponent(new Mesour\Modal\ModalBody('modalBody'));
     $this->addComponent(new Mesour\Modal\ModalFooter('modalFooter'));
 }
 public function getBodyContent($data, $rawData)
 {
     $input = Mesour\Components\Utils\Html::el('input');
     $input->type('number');
     $input->id('getPartsInput-' . $data['socketId']);
     $input->class('getPartsInput form-control');
     $input->onChange('getPartsInputChange($(this))');
     $input->onLoad('getPartsInputInitialize($(this))');
     $input->min(0);
     $input->max($data['available']);
     $input->size(10);
     return $input;
 }
Beispiel #8
0
 public function create()
 {
     $dialogContent = Mesour\Components\Utils\Html::el('div', $this->attributes);
     if ($this->header) {
         $dialogContent->add($this->header->create());
     }
     if ($this->body) {
         $dialogContent->add($this->body->create());
     }
     if ($this->footer) {
         $dialogContent->add($this->footer->create());
     }
     return $dialogContent;
 }
Beispiel #9
0
 public function create()
 {
     if ($this->column instanceof Mesour\Object && isset($this->column->onRender)) {
         $this->column->onRender($this->rawData, $this->column);
     }
     $attributes = $this->column->getBodyAttributes($this->data, true, $this->rawData);
     if ($attributes === false) {
         return '';
     }
     $td = Mesour\Components\Utils\Html::el('td', $attributes);
     $content = $this->column->getBodyContent($this->data, $this->rawData);
     if (!is_null($content)) {
         $td->setHtml($content);
     }
     return $td;
 }
Beispiel #10
0
 /**
  * @param bool|FALSE $navOnly
  * @return Mesour\Components\Utils\Html|string
  * @throws Mesour\InvalidStateException
  * @throws Mesour\InvalidArgumentException
  * @internal
  */
 public function getForCreate($navOnly = false)
 {
     if ($this->paginator->getPageCount() <= $this->maxForNormal) {
         $nav = parent::getForCreate(true);
     } else {
         $nav = $this->createNav();
     }
     $container = $this->createContainerPrototype(1, 1);
     $container->add('&nbsp;');
     $this->snippet->add($container)->class('row');
     $container = $this->createContainerPrototype(9, 8);
     $container->add($nav);
     $this->snippet->add($container)->class('row');
     $rightGroup = $this->createRightGroupPrototype();
     $rightGroup->add(sprintf('<input type="text" class="form-control" value="%s" data-page-input="1">', $this->paginator->getPage()));
     $rightGroup->add(sprintf('<span class="input-group-addon">/ %s</span></span>', $this->paginator->getPageCount()));
     $groupButton = Mesour\Components\Utils\Html::el('span', ['class' => 'input-group-btn']);
     $groupButton->add($this->getSwitcherButton());
     $rightGroup->add($groupButton);
     $container = $this->createContainerPrototype(2, 3);
     $container->add($rightGroup);
     $this->snippet->add($container)->class('row');
     return $this->snippet;
 }
Beispiel #11
0
 /**
  * @return Mesour\Components\Utils\Html
  */
 protected function getMenuItemPrototype()
 {
     return Mesour\Components\Utils\Html::el($this->getOption(self::MENU_ITEM, 'el'), $this->getOption(self::MENU_ITEM, 'attributes'));
 }
Beispiel #12
0
 public function create()
 {
     parent::create();
     $wrapper = $this->getWrapperPrototype();
     if ($this->referenceSettings) {
         $wrapper->addAttributes(['data-reference-settings' => $this->referenceSettings]);
     }
     $button = $this->getButtonPrototype();
     $this->onRender($this);
     /** @var Mesour\UI\Icon $icon */
     $iconClass = $this->getIconClass();
     $icon = new $iconClass();
     $icon->setType($this->iconOk);
     $icon->setAttribute('style', 'display: none');
     $icon->setAttribute('data-filter-icon', 'check');
     $button->add($icon->render());
     $button->add('&nbsp;' . $this->getText() . '&nbsp;');
     $button->add('<span class="caret"></span>');
     $icon->setAttribute('style', false);
     if (count($this->valueTranslates)) {
         $wrapper->add(Mesour\Components\Utils\Html::el('input', ['value' => json_encode($this->valueTranslates), 'type' => 'hidden', 'data-translates' => 1]));
     }
     $wrapper->add($button);
     $ul = $this->getListUlPrototype();
     if ($this->hasMainFilter && count($this->filters) > 0) {
         $subMenu = $this->getListLiPrototype(['class' => 'dropdown-submenu']);
         $icons = '<span><button type="button" class="btn btn-success btn-xs reset-filter" title="';
         $icons .= $this->getTranslator()->translate('Reset filter') . '" style="display: none;">';
         $icon->setAttribute('data-filter-icon', 'has-custom');
         $icons .= $icon->render();
         $icon->setAttribute('style', 'display: none');
         $icon->setType($this->iconClose);
         $icon->setAttribute('data-filter-icon', 'reset');
         $icons .= $icon->render();
         $icon->setAttribute('style', false);
         $icons .= '</button><button type="button" class="btn btn-primary btn-xs mesour-open-modal edit-filter" title="';
         $icons .= $this->getTranslator()->translate('Edit filter') . '" style="display: none;">';
         $icon->setAttribute('data-filter-icon', 'edit');
         $icon->setType($this->iconEdit);
         $icons .= $icon->render();
         $icons .= sprintf('</button>%s</span>', $this->getTranslator()->translate($this->filtersName));
         $subMenu->add($icons);
         $subUl = Mesour\Components\Utils\Html::el('ul', ['class' => 'dropdown-menu']);
         foreach ($this->filters as $filter) {
             $this->createCustomFilterItem($subUl, $filter);
         }
         $subMenu->add($subUl);
         $ul->add($subMenu);
     }
     if ($this->hasCheckers || $this->referenceSettings !== false) {
         if ($this->hasMainFilter) {
             $ul->add($this->getListLiPrototype(['class' => 'divider']));
         }
         $checkersLi = $this->getListLiPrototype();
         $inlineBox = Mesour\Components\Utils\Html::el('div', ['class' => 'inline-box']);
         $search = Mesour\Components\Utils\Html::el('div', ['class' => 'search']);
         $search->add('<input type="text" class="form-control search-input" placeholder="' . $this->getTranslator()->translate('Search...') . '">');
         $checkersLi->add($inlineBox);
         $inlineBox->add($search);
         $boxInner = Mesour\Components\Utils\Html::el('div', ['class' => 'box-inner']);
         $checkersLi->add($boxInner);
         $innerUl = Mesour\Components\Utils\Html::el('ul');
         $boxInner->add($innerUl);
         $linkName = $this->createLinkName();
         $innerUl->add('<li class="all-select-li">
                             <input type="checkbox" class="select-all" id="select-all-' . $linkName . '">
                             <label for="select-all-' . $linkName . '">' . $this->getTranslator()->translate('Select all') . '</label>
                         </li>
                         <li class="all-select-searched-li">
                             <input type="checkbox" class="select-all-searched" id="selected-' . $linkName . '">
                             <label for="selected-' . $linkName . '">' . $this->getTranslator()->translate('Select all searched') . '</label>
                         </li>');
         $ul->add($checkersLi);
     }
     $wrapper->add($ul);
     return $wrapper;
 }
Beispiel #13
0
 public function createSnippet()
 {
     $name = self::SNIPPET_PREFIX . $this->createLinkName();
     //$this->getApplication()->setSnippet($name, $this);
     return Mesour\Components\Utils\Html::el('div', ['id' => $name]);
 }
Beispiel #14
0
$dataStructure->addManyToOne('group', 'groups', 'group_id', '{name}');
$groupsStructure = $dataStructure->getOrCreateTableStructure('types', 'id');
$groupsStructure->addNumber('id');
$groupsStructure->addText('name');
$groupsStructure->addBool('verified');
$groupsStructure = $dataStructure->getOrCreateTableStructure('parameters', 'id');
$groupsStructure->addNumber('id');
$groupsStructure->addNumber('method_id');
$groupsStructure->addText('name');
$userCompaniesStructure = $dataStructure->getOrCreateTableStructure('method_types', 'method_id');
$userCompaniesStructure->addNumber('method_id');
$userCompaniesStructure->addNumber('type_id');
$dataStructure->addManyToMany('types', 'types', 'type_id', 'method_types', 'method_id', '{name} - {verified}');
$dataStructure->addOneToMany('parameters', 'parameters', 'method_id', '{name}');
$table->onRenderRow[] = function (\Mesour\Table\Render\Table\Row $row) {
    $row->setAttribute('class', 'test-class', true);
};
$table->setAttribute('class', 'table table-striped table-hover');
$table->addColumn('method', 'Method')->setCallback(function ($rawData, \Mesour\Table\Column $column) {
    return \Mesour\Components\Utils\Html::el('b')->setText($rawData['method']);
});
$table->addColumn('returns', 'Returns');
$table->addColumn('group', 'Group');
$table->addColumn('types', 'Types');
$table->addColumn('parameters', 'Parameters');
$table->addColumn('description', 'Description');
echo $table->render();
?>
</div>

<hr>
Beispiel #15
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);
 }
Beispiel #16
0
 public function create()
 {
     $dialog = Mesour\Components\Utils\Html::el('div', $this->attributes);
     $dialog->add($this->content->create());
     return $dialog;
 }
Beispiel #17
0
 public function __construct($name = null, Mesour\Components\ComponentModel\IContainer $parent = null)
 {
     parent::__construct($name, $parent);
     $this->setHtmlElement(Mesour\Components\Utils\Html::el($this->getOption(self::WRAPPER, 'el'), $this->getOption(self::WRAPPER, 'attributes')));
 }
Beispiel #18
0
 protected function createLiPrototype()
 {
     return Mesour\Components\Utils\Html::el('li', $this->liAttributes);
 }
Beispiel #19
0
 /**
  * @return Mesour\Components\Utils\Html
  */
 public function getControlPrototype()
 {
     return !$this->wrapper ? $this->wrapper = Mesour\Components\Utils\Html::el('span') : $this->wrapper;
 }
Beispiel #20
0
 public function getResetButtonPrototype()
 {
     $attributes = $this->getOption(self::RESET_BUTTON, 'attributes');
     $attributes = array_merge($attributes, ['data-filter-name' => $this->createLinkName()]);
     return $this->resetButton ? $this->resetButton : ($this->resetButton = Mesour\Components\Utils\Html::el($this->getOption(self::RESET_BUTTON, 'el'), $attributes)->setHtml($this->getOption(self::RESET_BUTTON, 'content')));
 }
Beispiel #21
0
 /**
  * @return string|Mesour\Components\Utils\IString
  */
 public function getHeaderContent()
 {
     $header = !$this->header ? $this->getName() : $this->header;
     return Mesour\Components\Utils\Html::el('span', $this->getTranslator()->translate($header));
 }
Beispiel #22
0
 public function create()
 {
     parent::create();
     if ($this->getDataStructure() instanceof Mesour\Editable\Structures\DataStructure && !$this->getDataStructure()->getSource(false)) {
         throw new Mesour\InvalidStateException(sprintf('Source is required if use %s.', Mesour\Editable\Structures\DataStructure::class));
     }
     $wrapper = $this->getControlPrototype();
     $oldWrapper = clone $wrapper;
     foreach ($oldWrapper->attrs as $key => $attr) {
         if (is_object($attr)) {
             $oldWrapper->attrs[$key] = clone $attr;
         }
     }
     $script = Mesour\Components\Utils\Html::el('script');
     $script->setHtml($this->createCoreScript());
     $wrapper->add($script);
     $modal = $this->getModal();
     $modal->getModalFooter()->addButton('saveButton')->setType('primary')->setAttribute('data-editable-form-save', 'true')->setText('Save');
     $modal->setAttribute('data-editable-modal', $this->createLinkName());
     $wrapper->add($this->getModal()->create());
     $this->onRender($this);
     $this->setHtmlElement($oldWrapper);
     return $wrapper;
 }
Beispiel #23
0
 public function getMainCheckboxPrototype()
 {
     $attributes = $this->getOption(self::MAIN, 'attributes');
     $attributes = array_merge($attributes, ['data-name' => $this->createLinkName(), 'data-icon-prefix' => $this->createNewIcon('cog')->getPrefix()]);
     return $this->mainCheckbox ? $this->mainCheckbox : ($this->mainCheckbox = Mesour\Components\Utils\Html::el($this->getOption(self::MAIN, 'el'), $attributes)->setHtml($this->getOption(self::MAIN, 'content')));
 }