private function printTree($array, $level = 0, $parent = 0) { if ($this->groupOptions instanceof \Closure) { $func = $this->groupOptions; $groupOptions = $func($array, $level, $parent, $this->id); } else { $groupOptions = $this->groupOptions; } $groupOptions = array_merge(['id' => $this->id . '-navi-' . $parent], $groupOptions); $result = \yii\helpers\Html::beginTag($this->groupTag, $groupOptions); foreach ($array as $key => $val) { if ($this->elementOptions instanceof \Closure) { $func = $this->elementOptions; $elementOptions = $func($val, $level, $parent, $this->id); } else { $elementOptions = $this->elementOptions; } $result .= \yii\helpers\Html::beginTag($this->elementTag, $elementOptions); if ($this->value instanceof \Closure) { $value = $this->value; $result .= $value($val, $level); } else { $result .= $val['title']; } $result .= \yii\helpers\Html::endTag($this->elementTag); $result .= $val[$this->childAttribute] ? self::printTree($val[$this->childAttribute], $level + 1, $val['id']) : ''; } $result .= \yii\helpers\Html::endTag($this->groupTag); return $result; }
public function run() { SelectAsset::register($this->view); FilterAsset::register($this->view); $values = []; foreach ($this->data as $value) { $value = strval($value); $values[$value] = $value; } if (!$this->default) { $this->default = $this->multiple ? array_keys($values) : key($values); } $selected = $this->selected($this->default); // Setup options $options = ['id' => $this->name, 'name' => $this->name . '[]', 'style' => 'width: 300px;', 'class' => 'selectpicker']; $extra = ['title' => 'Not selected']; if ($this->multiple) { $extra['multiple'] = 'multiple'; } if ($this->placeholder) { $extra['title'] = strval($this->placeholder); } $options = array_merge($options, $extra); if (!$this->method) { $this->method = 'get'; } // Render echo Html::beginForm(Url::canonical(), $this->method, ['data-pjax' => '1', 'id' => $this->name]); echo Html::beginTag('select', $options, ['data-pjax' => '1']); echo Html::renderSelectOptions($selected, $values); echo Html::endTag("select"); echo Html::endForm(); parent::run(); }
/** * Renders the widget. */ public function run() { echo Html::beginTag('div', $this->options) . "\n"; echo $this->renderBar($this->label) . "\n"; echo Html::endTag('div') . "\n"; $this->registerPlugin('progress'); }
/** * @inheritdoc */ public function run() { if ($this->box) { self::boxBegin($this->box); } echo Html::beginTag('ul', ['class' => 'timeline', 'id' => $this->options['id']]); foreach ($this->data as $datum) { echo Html::beginTag('li', ['class' => 'time-label']); echo Html::tag('span', $datum['date']); echo Html::endTag('li'); foreach ($datum['items'] as $item) { echo Html::beginTag('li'); echo Html::tag('i', null, ['class' => 'fa fa-envelope']); echo Html::beginTag('div', ['class' => 'timeline-item']); echo Html::beginTag('span', ['class' => 'time']); echo Html::tag('i', null, ['class' => 'fa fa-clock-o']); echo ' ' . $item['time']; echo Html::endTag('span'); echo Html::tag('h3', $item['header'], ['class' => 'timeline-header']); echo Html::tag('div', $item['body'], ['class' => 'timeline-body']); echo Html::tag('div', $item['footer'], ['class' => 'timeline-footer']); echo Html::endTag('div'); echo Html::endTag('li'); } } echo Html::endTag('ul'); if ($this->box) { self::boxEnd(); } }
public function init() { $view = $this->getView(); FormAsset::register($view); $this->options['is'] = $this->tagName; echo Html::beginTag('form', $this->options); }
/** * Renders the widget. */ public function run() { echo Html::beginTag('div', $this->options) . "\n"; echo $this->renderProgress() . "\n"; echo Html::endTag('div') . "\n"; UIkitAsset::register($this->getView()); }
/** * */ public function run() { echo Html::beginTag('section', ['class' => 'top-bar-section']); echo $this->renderItems(); echo Html::endTag('section'); FoundationAsset::register($this->getView()); }
public function generateButton() { echo Html::beginTag('div', ['class' => 'input-group-btn']); echo Html::a('<i class="fa fa-minus"></i>', '#', ['id' => $this->getId() . '_del', 'class' => 'btn btn-danger']); echo Html::a('<i class="fa fa-plus"></i>', '#', ['id' => $this->getId() . '_add', 'class' => 'btn btn-success']); echo Html::endTag('div'); }
public function run() { echo Html::beginTag('img', $this->options); $this->options['src'] = ArrayHelper::remove($this->options, 'data-src'); Html::removeCssClass($this->options, 'lazy'); echo '<noscript>' . Html::beginTag('img', $this->options) . '</noscript>'; }
/** * @inheritdoc */ public function init() { if (!isset($this->options['id'])) { $this->options['id'] = $this->getId(); } echo Html::beginTag('div', $this->options); }
public function run() { $component = \Yii::$app->get('moderatorPanel'); /** @var Component $component */ $items = []; foreach ($component->getWidgets() as $widget) { $content = call_user_func([$widget['class'], 'widget'], $widget['options']); if (!empty($content)) { $items[] = $content; } } if (!empty($items)) { echo Html::tag('div', 'MP', ['id' => 'moderator-panel-open-button', 'onclick' => 'mihaildev.moderatorPanel.buttonClick()']); echo Html::beginTag('div', ['id' => 'moderator-panel-frame']); echo Html::beginTag('div', ['id' => 'moderator-panel-frame-header']); echo Html::tag('div', '×', ['id' => 'moderator-panel-frame-close', 'onclick' => 'mihaildev.moderatorPanel.closeFrame()']); echo Html::tag('div', 'Title', ['id' => 'moderator-panel-frame-title']); echo Html::endTag('div'); echo Html::beginTag('div', ['id' => 'moderator-panel-frame-body']); echo Html::endTag('div'); echo Html::endTag('div'); echo Html::beginTag('div', ['id' => 'moderator-panel']); echo Html::beginTag('div', ['id' => 'moderator-panel-header']); echo Html::tag('div', '×', ['id' => 'moderator-panel-close', 'onclick' => 'mihaildev.moderatorPanel.buttonClick()']); echo Html::tag('div', 'MP', ['id' => 'moderator-panel-title']); echo Html::endTag('div'); echo Html::beginTag('ul', ['id' => 'moderator-panel-menu']); echo '<li>' . implode('</li><li>', $items) . "</li>"; echo Html::endTag('ul'); echo Html::endTag('div'); echo '<style>' . $this->getView()->renderPhpFile(__DIR__ . '/assets/css.css') . '</style>'; echo '<script>' . $this->getView()->renderPhpFile(__DIR__ . '/assets/js.js') . '</script>'; } }
public function init() { parent::init(); Html::addCssClass($this->options, 'ui message'); if ($this->icon) { Html::addCssClass($this->options, self::TYPE_ICON); } if ($this->hidden) { Html::addCssClass($this->options, self::TYPE_HIDDEN); } if ($this->visible) { Html::addCssClass($this->options, self::TYPE_VISIBLE); } if ($this->floating) { Html::addCssClass($this->options, self::TYPE_FLOATING); } if ($this->compact) { Html::addCssClass($this->options, self::TYPE_COMPACT); } if ($this->attached) { Html::addCssClass($this->options, self::TYPE_ATTACHED); } if ($this->size) { Html::addCssClass($this->options, $this->size); } if ($this->color) { Html::addCssClass($this->options, $this->color); } if ($this->type) { Html::addCssClass($this->options, $this->type); } echo Html::beginTag('div', $this->options); }
public function run() { Assets::register($this->getView()); echo Html::beginTag('div', $this->containerOptions); if ($this->hasModel()) { echo Html::activeTextarea($this->model, $this->attribute, $this->options); } else { echo Html::textarea($this->name, $this->value, $this->options); } echo Html::endTag('div'); $js = ['bajadev.ckEditor.registerOnChange(' . Json::encode($this->options['id']) . ');']; if (isset($this->editorOptions['filebrowserUploadUrl'])) { $js[] = "bajadev.ckEditor.registerCsrf();"; } if (!isset($this->editorOptions['on']['instanceReady'])) { $this->editorOptions['on']['instanceReady'] = new JsExpression("function( ev ){" . implode(' ', $js) . "}"); } if ($this->_inline) { $JavaScript = "CKEDITOR.inline("; $JavaScript .= Json::encode($this->options['id']); $JavaScript .= empty($this->editorOptions) ? '' : ', ' . Json::encode($this->editorOptions); $JavaScript .= ");"; $this->getView()->registerJs($JavaScript, View::POS_END); $this->getView()->registerCss('#' . $this->containerOptions['id'] . ', #' . $this->containerOptions['id'] . ' .cke_textarea_inline{height: ' . $this->editorOptions['height'] . 'px;}'); } else { $JavaScript = "CKEDITOR.replace("; $JavaScript .= Json::encode($this->options['id']); $JavaScript .= empty($this->editorOptions) ? '' : ', ' . Json::encode($this->editorOptions); $JavaScript .= ");"; $this->getView()->registerJs($JavaScript, View::POS_END); } }
/** * Renders the widget. * @return string */ public function run() { echo Html::a('', false, ['name' => 'footer']); echo Html::beginTag('footer', ['class' => 'c-layout-footer c-layout-footer-4 c-bg-footer-8']); echo Html::beginTag('div', ['class' => 'c-footer']); echo Html::beginTag('div', ['class' => 'container']); echo Html::beginTag('div', ['class' => 'row']); echo Html::beginTag('div', ['class' => 'col-md-6 c-footer-4-p-right']); echo Html::beginTag('div', ['class' => 'c-content-title-1']); echo Html::tag('h3', $this->title, ['class' => 'c-font-uppercase c-font-bold c-font-white c-border']); echo Html::endTag('div'); echo Html::tag('p', $this->about, ['class' => 'c-about']); echo Html::tag('ul', $this->social, ['class' => 'c-socials']); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'col-md-6 c-footer-4-p-right']); echo Html::beginTag('div', ['class' => 'c-feedback']); echo Html::tag('h3', 'CONTACT', ['class' => 'c-font-thin']); echo Html::tag('p', $this->contact, ['class' => 'c-contact c-font-white']); echo Html::endTag('div'); echo Html::endTag('div'); echo Html::endTag('div'); echo Html::endTag('div'); echo Html::endTag('div'); echo Html::endTag('footer'); }
/** * Initializes the widget. */ public function init() { parent::init(); echo Html::beginTag('div', ['class' => 'modal fade', 'id' => $this->modalId, 'role' => "dialog"]); echo Html::beginTag('div', ['class' => 'modal-dialog ' . $this->modalSize]); echo Html::beginTag('div', ['class' => 'modal-content']); echo Html::beginTag('div', ['class' => 'modal-header']); echo Html::beginTag('button', ['type' => "button", 'class' => "close", 'data-dismiss' => "modal"]); echo Html::beginTag('span', ['aria-hidden' => "true"]); echo "×"; echo Html::endTag('span'); echo Html::beginTag('span', ['class' => "sr-only"]); echo "Close"; echo Html::endTag('span'); echo Html::endTag('button'); echo Html::beginTag('h4', ['class' => "modal-title"]); echo Html::endTag('h4'); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'modal-body']); echo Html::beginTag('div', ['class' => 'content', 'style' => 'overflow:auto;']); echo Html::endTag('div'); echo Html::endTag('div'); /* modal-footer tak hapus. Kayaknya ga pernah kepake. Biar tampilan modalnya bagus, ga ada garis bawah pengganggu echo Html::beginTag('div', ['class'=>'modal-footer']); echo Html::endTag('div');*/ echo Html::endTag('div'); echo Html::endTag('div'); echo Html::endTag('div'); if ($this->registerAsset) { ModalAsset::register($this->getView()); } }
public function beginFooter($options = []) { $actionsOptions = ArrayHelper::getValue($options, 'actionsOptions', []); ArrayHelper::remove($options, 'actionsOptions'); parent::beginFooter($options); echo Html::beginTag('div', array_merge($this->actionsOptions, $actionsOptions)); }
/** * Initializes the widget. */ public function init() { parent::init(); $this->initOptions(); echo Html::beginTag('div', $this->options) . "\n"; echo $this->renderBodyBegin() . "\n"; }
/** * @return string */ protected function renderItems() { return Html::ul($this->items, ['encode' => false, 'itemOptions' => ['data-transition' => 'fade', 'data-slotamount' => '1', 'data-masterspeed' => '1000'], 'item' => function ($item, $index) { $html = ''; $html .= Html::beginTag('li', ['data-transition' => 'fade', 'data-slotamount' => '1', 'data-masterspeed' => '1000']); $html .= Html::img($item['imageUrl'], ['data-bgposition' => 'center center', 'data-bgfit' => 'cover', 'data-bgrepeat' => 'no-repeat']); // MAIN TITLE $html .= Html::beginTag('div', ['class' => 'caption customin customout', 'data-x' => 'center', 'data-y' => 'center', 'data-hoffset' => '0', 'data-voffset' => '-70', 'data-speed' => '500', 'data-start' => '1000', 'data-customin' => 'x:0;y:0;z:0;rotationX:0.5;rotationY:0;rotationZ:0;scaleX:0.75;scaleY:0.75;skewX:0;skewY:0;opacity:0;transformPerspective:600;transformOrigin:50% 50%;', 'data-customout' => 'x:0;y:0;z:0;rotationX:0;rotationY:0;rotationZ:0;scaleX:0.75;scaleY:0.75;skewX:0;skewY:0;opacity:0;transformPerspective:600;transformOrigin:50% 50%;', 'data-easing' => 'Back.easeOut', 'data-splitin' => 'none', 'data-splitout' => 'none', 'data-elementdelay' => '0.1', 'data-endelementdelay' => '0.1', 'data-endspeed' => '600']); $html .= Html::tag('h3', $item['title'], ['class' => 'c-main-title c-font-40 c-font-bold c-font-uppercase c-font-white c-center']); $html .= Html::endTag('div'); // SUB TITLE if (isset($item['subTitle'])) { $html .= Html::beginTag('div', ['class' => 'caption customin customout', 'data-x' => 'center', 'data-y' => 'center', 'data-hoffset' => '0', 'data-voffset' => '10', 'data-speed' => '500', 'data-start' => '1500', 'data-customin' => 'x:0;y:0;z:0;rotationX:0.5;rotationY:0;rotationZ:0;scaleX:0.75;scaleY:0.75;skewX:0;skewY:0;opacity:0;transformPerspective:600;transformOrigin:50% 50%;', 'data-customout' => 'x:0;y:0;z:0;rotationX:0;rotationY:0;rotationZ:0;scaleX:0.75;scaleY:0.75;skewX:0;skewY:0;opacity:0;transformPerspective:600;transformOrigin:50% 50%;', 'data-easing' => 'Back.easeOut', 'data-splitin' => 'none', 'data-splitout' => 'none', 'data-elementdelay' => '0.1', 'data-endelementdelay' => '0.1', 'data-endspeed' => '600']); $html .= Html::tag('p', $item['subTitle'], ['class' => 'c-font-20 c-line-height-28 c-font-white c-opacity-07 c-font-thin c-center c-sub-title']); $html .= Html::endTag('div'); } // ACTION BUTTON if (isset($item['actionTitle']) && isset($item['actionUrl'])) { $html .= Html::beginTag('div', ['class' => 'caption randomrotateout', 'data-x' => 'center', 'data-y' => 'center', 'data-hoffset' => '0', 'data-voffset' => '100', 'data-speed' => '500', 'data-start' => '2000', 'data-easing' => 'Back.easeOut']); $html .= Html::a($item['actionTitle'], $item['actionUrl'], ['class' => 'c-action-btn btn btn-lg c-btn-square c-btn-border-2x c-btn-white c-btn-bold c-btn-uppercase']); $html .= Html::endTag('div'); } $html .= Html::endTag('li'); return $html; }]); }
/** * Executes the widget. */ public function run() { echo Html::beginTag('div', ['class' => 'btn-group']); echo $this->renderButton() . "\n" . $this->renderDropdown(); echo Html::endTag('div'); $this->registerPlugin('button'); }
public function init() { parent::init(); $this->registerJs(); Html::addCssClass($this->options, 'ui sticky'); echo Html::beginTag('div', $this->options); }
/** * @inheritdoc */ public function init() { parent::init(); $this->registerWidget('tabs'); echo Html::beginTag('div', $this->options) . "\n"; $this->renderItems(); }
protected static function renderRow($model, $row, $templateName = null) { if (!empty($row['items'])) { $html = null; $items = static::renderItems($model, $row['items'], $templateName); if (count($items)) { $type = !empty($row['type']) && in_array($row['type'], self::types()) ? self::$types[$row['type']] : ['tag' => null, 'class' => null, 'delimiter' => "\n"]; if (!empty($type['tag']) && !empty($type['options']) && count($items) > 1) { $html .= Html::beginTag($type['tag'], $type['options']); } foreach ($items as $elements) { if (!empty($type['itemTag'])) { $html .= Html::beginTag($type['itemTag']); } foreach ($elements as $element) { $html .= $element; } if (!empty($type['itemTag'])) { $html .= Html::endTag($type['itemTag']); } } if (!empty($type['tag']) && !empty($type['options']) && count($items) > 1) { $html .= Html::endTag($type['tag']); } } } return $html; }
/** * Renders the widget. */ public function run() { echo Html::beginTag('div', $this->options) . "\n"; echo $this->renderItems() . "\n"; echo Html::endTag('div') . "\n"; $this->registerPlugin('collapse'); }
/** * @return string */ public function run() { $classes = ['posts-widget']; if ($this->renderCategories) { $classes[] = 'with-categories'; } if ($this->renderPreviews) { $classes[] = 'with-previews'; } $output = Html::beginTag('div', ['class' => implode(' ', $classes)]); if (!count($this->items)) { return $this->renderEmpty(); } foreach ($this->items as $item) { if ($item['category'] && $this->renderCategories) { $output .= Html::beginTag('div', ['class' => 'subcategory col-xs-12 col-sm-4']); $output .= Html::tag('h2', $item['category']->title); } $output .= $this->renderPosts($item['posts']); if ($item['category'] && $this->renderCategories) { $output .= Html::endTag('div'); } } $output .= Html::endTag('div'); return $output; }
/** * Renders the widget. */ public function run() { echo Html::beginTag('div', $this->options) . "\n"; echo $this->renderItems() . "\n"; echo Html::endTag('div') . "\n"; $this->registerWidget(); }
/** * @inheritdoc */ public function run() { echo Html::beginTag('div', $this->options); echo Html::tag('div', $this->content, ['class' => 'ui sticky']); echo Html::endTag('div'); $this->registerPlugin('sticky'); }
public function run() { if ($this->footerWrapper) { echo Html::beginTag('div', ['class' => 'form-group panel-footer']); } $submit_options = []; if ($this->form) { $submit_options['form'] = $this->form; } $extra = ''; if ($this->extraBtns) { $extra = ' ' . implode(' ', (array) $this->extraBtns); } if (isset($this->model->isNewRecord) && $this->model->isNewRecord) { if ($this->saveLink) { $submit_options['class'] = 'btn btn-success'; echo Html::submitButton(__('Create'), $submit_options); } echo $extra; } else { if ($this->saveLink) { $submit_options['class'] = 'btn btn-primary'; echo Html::submitButton(__('Update'), $submit_options); } echo $extra; if ($this->removeLink) { echo ' '; echo Html::a(__('Delete'), ['delete', 'id' => $this->model->id], ['class' => 'btn btn-danger', 'data-confirm' => __('Are you sure you want to delete this item?'), 'data-method' => 'post']); } } if ($this->footerWrapper) { echo Html::endTag('div'); } }
/** * run function. * * @access public * @return void */ public function run() { $classes = $this->generateClass(); echo Html::beginTag('div', ['class' => $classes]) . "\n"; echo $this->renderItems() . "\n"; echo Html::endTag('div') . "\n"; }
/** * Initializes the widget. */ public function init() { parent::init(); echo Html::beginTag('div', ['class' => 'main-sidebar']); echo Html::beginTag('div', ['class' => 'sidebar']); if (isset($this->user) and count($this->user) > 0) { $image = isset($this->user['image']) ? $this->user['image'] : ''; $username = isset($this->user['username']) ? $this->user['username'] : ''; echo Html::beginTag('div', ['class' => 'user-panel']); echo Html::beginTag('div', ['class' => 'pull-left image']); echo '<img src="' . $image . '" class="img-circle" alt="user" />'; echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'pull-left info']); echo Html::tag('p', $username); echo Html::tag('a', '<i class="fa fa-circle text-success"></i> Online'); echo Html::endTag('div'); echo Html::endTag('div'); } if (isset($this->search) and count($this->search) > 0) { $method = isset($this->search['method']) ? $this->search['method'] : 'get'; $action = isset($this->search['action']) ? $this->search['action'] : ''; echo Html::beginTag('form', ['method' => $method, 'action' => $action, 'class' => 'sidebar-form']); echo Html::beginTag('div', ['class' => 'input-group']); echo Html::input('text', 'q', '', ['class' => 'form-control', 'placeholder' => 'Search...']); echo Html::beginTag('span', ['class' => 'input-group-btn']); echo Html::submitButton(Html::tag('i', '', ['class' => 'fa fa-search']), ['id' => 'search-btn', 'class' => "btn btn-flat"]); echo Html::endTag('span'); echo Html::endTag('div'); echo Html::endTag('form'); } }
/** * @return string */ protected function renderItems() { $html = ''; $textAlign = 'c-font-right'; $align = 'right'; foreach ($this->items as $item) { if ('right' == $align) { $html .= Html::beginTag('ul', ['class' => 'c-list']); } $html .= Html::beginTag('li'); $html .= Html::beginTag('div', ['class' => "c-card c-bg-white {$textAlign}", 'data-height' => 'height']); $html .= Html::tag('i', '', ['class' => "{$item['icon']} c-font-white c-font-27 c-theme-bg c-float-{$align}"]); $html .= Html::beginTag('div', ['class' => "c-content c-content-{$align}"]); $html .= Html::tag('h3', $item['title'], ['class' => "c-font-uppercase c-font-bold"]); $html .= Html::tag('p', $item['content']); $html .= Html::endTag('div'); $html .= Html::endTag('div'); $html .= Html::endTag('li'); if ('right' != $align) { $html .= Html::endTag('ul'); } $textAlign = 'c-font-right' == $textAlign ? '' : 'c-font-right'; $align = 'right' == $align ? 'left' : 'right'; } return $html; }