public static function getHtmlOptions($tag, $asString = true) { $tag = strtolower($tag); $options = []; switch ($tag) { case 'body': if (strcasecmp(Metronic::getComponent()->headerOption, 'fixed') === 0) { Html::addCssClass($options, 'page-header-fixed'); } switch (Metronic::getComponent()->layoutOption) { case Metronic::LAYOUT_FULL_WIDTH: Html::addCssClass($options, Metronic::LAYOUT_FULL_WIDTH); break; case Metronic::LAYOUT_BOXED: Html::addCssClass($options, Metronic::LAYOUT_BOXED); break; } break; case 'header': Html::addCssClass($options, 'header navbar'); if (strcasecmp(Metronic::getComponent()->headerOption, 'fixed') === 0) { Html::addCssClass($options, 'navbar-fixed-top'); } else { Html::addCssClass($options, 'navbar-static-top'); } break; } return $asString ? Html::renderTagAttributes($options) : $options; }
/** * Renders the content of a menu item. * Note that the container and the sub-menus are not rendered here. * @param array $item the menu item to be rendered. Please refer to [[items]] to see what data might be in the item. * @return string the rendering result */ protected function renderItem($item) { $linkOptions = ArrayHelper::getValue($item, 'linkOptions', []); if (isset($item['url'])) { $template = ArrayHelper::getValue($item, 'template', $this->linkTemplate); return strtr($template, ['{url}' => Html::encode(Url::to($item['url'])), '{label}' => $item['label'], '{attr}' => Html::renderTagAttributes($linkOptions)]); } else { $template = ArrayHelper::getValue($item, 'template', $this->labelTemplate); return strtr($template, ['{label}' => $item['label'], '{attr}' => Html::renderTagAttributes($linkOptions)]); } }
public function run() { $id = $this->getId(); if (isset($this->options['id']) and !empty($this->options['id'])) { $id = $this->options['id']; } // if no container is set, it will create one if ($this->containerId === null) { $this->htmlOptions['id'] = 'div-chart' . $id; $this->containerId = $this->htmlOptions['id']; echo '<div ' . Html::renderTagAttributes($this->htmlOptions) . '></div>'; } $this->registerClientScript($id); }
public function init() { if (!isset($this->options['id'])) { $this->_cid = $this->options['id'] = 'tilec_' . $this->getId(); } $collapseTag = 'collapse'; Html::addCssClass($this->options, 'box'); Html::addCssClass($this->options, 'box-solid'); Html::addCssClass($this->options, 'bg-' . $this->type); if ($this->collapse and $this->collapseDefault and !$this->collapse_remember) { Html::addCssClass($this->options, 'collapsed-box'); } $this->registerJs(); echo '<div ' . Html::renderTagAttributes($this->options) . '>' . (!$this->title && !$this->collapse && !$this->custom_tools && !$this->left_tools ? '' : '<div class="box-header"' . (!$this->tooltip ? '' : 'data-toggle="tooltip" data-original-title="' . $this->tooltip . '" data-placement="' . $this->tooltip_placement . '"') . '>' . (!$this->left_tools ? '' : '<div class="box-tools pull-left">' . $this->left_tools . '</div>') . (!$this->title ? '' : '<h3 class="box-title">' . $this->title . '</h3>') . (!$this->collapse ? '' : (!$this->custom_tools ? '<div class="box-tools pull-right"><button class="btn btn-primary btn-xs" data-widget="' . $collapseTag . '" id="' . $this->_cid . '_btn"><i class="fa fa-minus"></i></button></div>' : '')) . (!$this->custom_tools ? '' : '<div class="box-tools pull-right">' . $this->custom_tools . (!$this->collapse ? '' : '<button class="btn btn-primary btn-xs" data-widget="' . $collapseTag . '" id="' . $this->_cid . '_btn"> <i class="fa fa-minus"></i></button>') . '</div>') . '</div>') . '<div class="box-body">'; }
public function run() { $boxContent = ob_get_clean(); $boxTitle = $this->title ? strtr($this->titleTemplate, ['{title}' => $this->title]) : ''; Html::addCssClass($this->options, 'box'); if ($this->cssClass) { Html::addCssClass($this->options, $this->cssClass); } if ($this->_hasBody == false) { ob_start(); $this->beginBody(); echo $boxContent; $this->endBody(); $boxContent = ob_get_clean(); } echo strtr($this->template, ['{options}' => Html::renderTagAttributes($this->options), '{title}' => $boxTitle, '{content}' => $boxContent]); }
/** * Create tree. * @param array $rows * @param int $parent_id * @return string tree */ private function buildTree($rows, $parent_id = 0) { $containerAttributes = ''; if (!$this->containerOptionsIsSet) { $containerAttributes = Html::renderTagAttributes($this->containerOptions); $this->containerOptionsIsSet = true; } $result = "<ul{$containerAttributes}>"; foreach ($rows as $row) { if ($row['parent_id'] == $parent_id) { $value = call_user_func_array($this->value, ['model' => $row['model']]); $result .= "<li>{$value}"; if ($this->hasChild($rows, $row['id'])) { $result .= $this->buildTree($rows, $row['id']); } $result .= '</li>'; } } $result .= '</ul>'; return $result; }
protected function renderListItem($model, $key, $index, $widget) { $ret_val = ''; $counter = $index + 1; foreach ($this->attributes as $k => $v) { list($title, $value, $priority, $options) = $this->getParts($model, $k, $v, $counter); ob_start(); $tag = ArrayHelper::remove($options, 'tag', 'a'); echo "<{$tag} " . Html::renderTagAttributes($options) . ">"; if (isset($priority) && !is_null($priority)) { echo Html::tag('div', Html::tag('h2', $priority, ['style' => 'height: 30px; display: table-cell; vertical-align: middle;']), ['style' => 'float: left; width: 10%']); } echo Html::tag('div', Html::tag('h4', ucfirst($title), ['class' => 'list-group-item-heading']) . Html::tag('p', $value, ['class' => 'list-group-item-text']), ['style' => isset($priority) ? 'margin-left: 10%; width: 90%' : 'width: 100%']); echo "</{$tag}>"; $item = ob_get_contents(); ob_end_clean(); $ret_val .= $item; } return $ret_val; }
Translation\backend\assets\ListAssetBundle::register($this); /** * @param string $type * @param string $label * @return string */ function sortLink($type, $label) { $label .= ' ' . FA::icon('sort-numeric-desc', ['ng-show' => 'pages.sort.order === "-' . $type . '"']); $label .= ' ' . FA::icon('sort-numeric-asc', ['ng-show' => 'pages.sort.order === "' . $type . '"']); return Html::a($label, null, ['ng-click' => 'pages.sort.setOrder("' . $type . '")']); } ?> <section <?php echo Html::renderTagAttributes(['class' => 'content', 'ng-controller' => 'translation.ListController']); ?> > <div class="row"> <div class="col-xs-3 com-sm-3 col-md-3 col-lg-2"> <div class="box-filter"> <h3><?php echo Yii::t('cookyii', 'Filter'); ?> </h3> <hr> <?php echo Html::tag('a', FA::icon('check') . ' ' . Yii::t('cookyii.translation', 'Translated'), ['class' => 'checker', 'ng-click' => 'filter.toggleTranslated()', 'ng-class' => Json::encode(['checked' => new \yii\web\JsExpression('filter.translated === true')])]); ?>
/** * Renders a single attribute. * @param array $attribute the specification of the attribute to be rendered. * @param integer $index the zero-based index of the attribute in the [[attributes]] array * @return string the rendering result */ protected function renderAttribute($attribute, $index) { if ($attribute['value'] === '') { return ''; } $template = ArrayHelper::getValue($attribute, 'template', $this->template); if (is_string($template)) { if (isset($attribute['label'])) { return strtr($template, ['{label}' => $attribute['label'], '{options}' => Html::renderTagAttributes($attribute['options']), '{rawValue}' => $attribute['value'], '{value}' => $this->formatter->format($attribute['value'], $attribute['format'])]); } else { return strtr($template, ['{value}' => $this->formatter->format($attribute['value'], $attribute['format'])]); } } else { return call_user_func($template, $attribute, $index, $this); } }
/** * @inheritdoc */ protected function renderItem($item) { $item['badgeOptions'] = isset($item['badgeOptions']) ? $item['badgeOptions'] : []; if (!ArrayHelper::getValue($item, 'badgeOptions.class')) { $bg = isset($item['badgeBgClass']) ? $item['badgeBgClass'] : $this->badgeBgClass; $item['badgeOptions']['class'] = $this->badgeClass . ' ' . $bg; } if (isset($item['items']) && !isset($item['right-icon'])) { $item['right-icon'] = $this->parentRightIcon; } if (isset($item['url'])) { $template = ArrayHelper::getValue($item, 'template', $this->linkTemplate); return strtr($template, ['{badge}' => isset($item['badge']) ? Html::tag('small', $item['badge'], $item['badgeOptions']) : '', '{icon}' => isset($item['icon']) ? $item['icon'] : '', '{right-icon}' => isset($item['right-icon']) ? $item['right-icon'] : '', '{url}' => Url::to($item['url']), '{label}' => $item['label'], '{linkOptions}' => isset($item['linkOptions']) ? Html::renderTagAttributes($item['linkOptions']) : '']); } else { $template = ArrayHelper::getValue($item, 'template', $this->labelTemplate); return strtr($template, ['{badge}' => isset($item['badge']) ? Html::tag('small', $item['badge'], $item['badgeOptions']) : '', '{icon}' => isset($item['icon']) ? $item['icon'] : '', '{right-icon}' => isset($item['right-icon']) ? $item['right-icon'] : '', '{label}' => $item['label'], '{linkOptions}' => isset($item['linkOptions']) ? Html::renderTagAttributes($item['linkOptions']) : '']); } }
<?php /** @var \yii\web\View $this */ /** @var \bedezign\yii2\desktop\Shortcut $shortcut */ /** @var int $x */ /** @var int $y */ $icon = $shortcut->icon->render(\bedezign\yii2\desktop\Icon::DISPLAY_DESKTOP); $anchor = \yii\helpers\ArrayHelper::merge(['id' => $shortcut->id, 'style' => "left: {$x}px; top: {$y}px", 'class' => 'application_shortcut'], $shortcut->anchor); ?> <a <?php echo \yii\helpers\Html::renderTagAttributes($anchor); ?> > <?php echo $icon; ?> <?php if ($shortcut->title) { ?> <span class="title"><?php echo $shortcut->title; ?> </span><?php } ?> </a>
$options = ['data-tag' => $tag]; if ($row['status'] < 300) { Html::addCssClass($options, 'success'); } elseif ($row['status'] < 400) { Html::addCssClass($options, 'info'); } elseif ($row['status'] < 500) { Html::addCssClass($options, 'warning'); } else { Html::addCssClass($options, 'danger'); } if ($tag === $activeTag) { Html::addCssClass($options, 'active'); } ?> <li <?php echo Html::renderTagAttributes($options); ?> > <a href="<?php echo Url::to(['request', 'tag' => $tag]); ?> "> <span class="request-name"> <span class="request-method"> <?php echo Html::encode($row['method']); ?> </span> <span class="request-endpoint"> <?php echo Html::encode($row['endpoint']);
/** * Retrieves Html options * @param string $tag given tag * @param boolean $asString if return as string * @return type */ public static function getHtmlOptions($tag, $options = [], $asString = false) { $callback = sprintf('static::_%sOptions', strtolower($tag)); $htmlOptions = call_user_func($callback, $options); return $asString ? Html::renderTagAttributes($htmlOptions) : $htmlOptions; }
/** * {@inheritdoc} */ protected function renderItem($item) { return strtr(ArrayHelper::getValue($item, 'template', isset($item['url']) ? $this->linkTemplate : $this->labelTemplate), ['{url}' => isset($item['url']) ? Url::to($item['url']) : null, '{icon}' => $item['icon'] === false ? '' : sprintf('<i class="%s"></i>', static::iconClass($item['icon'] ?: $this->defaultIcon)), '{label}' => $item['label'], '{arrow}' => !empty($item['items']) ? '<i class="fa pull-right fa-angle-left"></i>' : '', '{linkOptions}' => Html::renderTagAttributes(ArrayHelper::getValue($item, 'linkOptions', []))]); }
/** * Renders a single attribute. * @param array $attribute the specification of the attribute to be rendered. * @param integer $index the zero-based index of the attribute in the [[attributes]] array * @return string the rendering result */ protected function renderAttribute($attribute, $index) { if (is_string($this->template)) { $captionOptions = Html::renderTagAttributes(ArrayHelper::getValue($attribute, 'captionOptions', [])); $contentOptions = Html::renderTagAttributes(ArrayHelper::getValue($attribute, 'contentOptions', [])); return strtr($this->template, ['{label}' => $attribute['label'], '{value}' => $this->formatter->format($attribute['value'], $attribute['format']), '{captionOptions}' => $captionOptions, '{contentOptions}' => $contentOptions]); } else { return call_user_func($this->template, $attribute, $index, $this); } }
if (Yii::$app->user->identity->isAdmin) { ?> <li class="list-group-item"> <?php echo ButtonLink::widget(['label' => $user->account->getIsBlocked() ? '<i class="fa fa-fw fa-unlock"></i> ' . Yii::t('app', 'Unblock') : '<i class="fa fa-fw fa-lock"></i> ' . Yii::t('app', 'Block'), 'encodeLabel' => false, 'type' => $user->account->getIsBlocked() ? 'primary' : 'danger', 'url' => ['/accounts/block', 'id' => $user->account->id], 'options' => ['class' => 'btn-block', 'data-method' => 'post', 'data-confirm' => Yii::t('user', 'Are you sure you want to block this user?')]]); ?> </li> <?php } ?> </ul> </div> </div> <div class="col-md-4"> <div <?php echo Html::renderTagAttributes(['class' => 'panel ' . ($user->Blocked ? 'panel-danger' : 'panel-success')]); ?> > <div class="panel-heading"> <h2 class="panel-title"> <?php if ($user->group->IsService) { ?> <i class="fa fa-fw fa-user-md" aria-hidden="true"></i> <?php } else { ?> <i class="fa fa-fw fa-user" aria-hidden="true"></i> <?php } ?>
$title = $application->title; $icon = $application->icon->render(\bedezign\yii2\desktop\Icon::DISPLAY_TITLEBAR); $attributes = ['id' => 'window_' . $application->applicationId, 'class' => 'application_window absolute']; if ($application->windowState) { Html::addCssStyle($attributes, $application->windowState); } if ($application->windowMaximised) { Html::addCssClass($attributes, 'window_maximized'); } if ($application->sessionData) { $attributes['data-desktop-session'] = \yii\helpers\Json::encode($application->sessionData); } ?> <div <?php echo Html::renderTagAttributes($attributes); ?> > <div class="window_titlebar"> <?php echo $icon; ?> <div class="window_title"><?php echo $title; ?> </div> <div class="window_buttons"> <a href="#" class="window_button minimize"></a> <a href="#" class="window_button maximize"></a> <a href="#<?php echo $application->applicationId;
/** @var \frontend\components\Controller $controller */ $controller = $this->context; /** @var \resources\Account\Model|null $Account */ $Account = User()->identity; $this->registerLinkTag(['rel' => 'canonical', 'href' => \yii\helpers\Url::canonical()], 'canonical'); $this->registerMetaTag(['charset' => Yii::$app->charset], 'charset'); $this->registerMetaTag(['name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'], 'viewport'); if (!User()->isGuest) { $this->registerMetaTag(['name' => 'token', 'content' => $Account->token], 'token'); } rmrevin\yii\favicon\Favicon::widget(['forceGenerate' => true, 'appname' => 'Cookyii CMF', 'color' => '#2B5797', 'fillColor' => '#A4EDFF']); $this->beginPage(); ?> <!DOCTYPE html> <html <?php echo Html::renderTagAttributes(['lang' => Yii::$app->language, 'ng-app' => 'FrontendApp']); ?> > <head> <!--[if IE]> <meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'><![endif]--> <?php echo Html::csrfMetaTags(); echo Html::tag('title', $title); $this->head(); ?> </head> <body> <?php $this->beginBody();
* index.php * @author Revin Roman * @link https://rmrevin.com * * @var yii\web\View $this * @var Feed\backend\forms\SectionEditForm $SectionEditForm */ use cookyii\modules\Feed; use rmrevin\yii\fontawesome\FA; use yii\helpers\Html; $this->title = Yii::t('cookyii.feed', 'Edit section'); Feed\backend\assets\EditSectionAssetBundle::register($this); ?> <section <?php echo Html::renderTagAttributes(['class' => 'content', 'ng-controller' => 'feed.section.DetailController']); ?> > <div class="row" ng-show="updatedWarning"> <div class="col-xs-12 col-lg-6"> <div class="info-box bg-yellow"> <span class="info-box-icon"><?php echo FA::icon('warning'); ?> </span> <div class="info-box-content"> <strong class="info-box-text"><?php echo Yii::t('cookyii', 'Warning'); ?>
* index.php * @author Revin Roman * @link https://rmrevin.com * * @var yii\web\View $this * @var Postman\backend\forms\TemplateEditForm $TemplateEditForm */ use cookyii\modules\Postman; use rmrevin\yii\fontawesome\FA; use yii\helpers\Html; $this->title = Yii::t('cookyii.postman', 'Edit template'); Postman\backend\assets\TemplateEditAssetBundle::register($this); ?> <section <?php echo Html::renderTagAttributes(['class' => 'content', 'ng-controller' => 'postman.template.DetailController']); ?> > <div class="row" ng-show="templateUpdatedWarning"> <div class="col-xs-12 col-lg-6"> <div class="info-box bg-yellow"> <span class="info-box-icon"><?php echo FA::icon('warning'); ?> </span> <div class="info-box-content"> <strong class="info-box-text"><?php echo Yii::t('cookyii', 'Warning'); ?>
<?php /** * Tab Navigation by MenuWidget. * * @package humhub.widgets * @since 0.5 */ use yii\helpers\Html; ?> <ul class="nav nav-pills"> <?php foreach ($this->context->getItems() as $item) { ?> <li <?php echo Html::renderTagAttributes($item['htmlOptions']); ?> > <?php echo Html::a($item['label'], $item['url']); ?> </li> <?php } ?> </ul>
protected static function tag($name, $content = '', $options = []) { return "<{$name}" . Html::renderTagAttributes($options) . '>' . $content . "</{$name}>"; }
public function testRenderAttributes() { $this->assertEquals('', Html::renderTagAttributes([])); $this->assertEquals(' name="test" value="1<>"', Html::renderTagAttributes(['name' => 'test', 'empty' => null, 'value' => '1<>'])); $this->assertEquals(' checked disabled', Html::renderTagAttributes(['checked' => true, 'disabled' => true, 'hidden' => false])); }
public function init() { if (!isset($this->options['id'])) { $this->_cid = $this->options['id'] = 'bc_' . $this->getId(); } $this->registerJs(); Html::addCssClass($this->options, 'box'); Html::addCssClass($this->options, 'box-' . $this->type); if ($this->solid) { Html::addCssClass($this->options, 'box-solid'); } if ($this->collapse and $this->collapseDefault and !$this->collapse_remember) { Html::addCssClass($this->options, 'collapsed-box'); } if (is_array($this->custom_tools)) { if ($this->collapse) { $this->custom_tools[] = '<button class="btn btn-' . $this->type . ' btn-xs" data-widget="collapse" id="' . $this->_cid . '_btn"><i class="fa fa-minus"></i></button>'; } $this->custom_tools = ButtonGroup::widget(['buttons' => $this->custom_tools, 'encodeLabels' => false]); } else { $this->custom_tools = $this->custom_tools . ($this->collapse ? '<button class="btn btn-' . $this->type . ' btn-xs" data-widget="collapse" id="' . $this->_cid . '_btn"><i class="fa fa-minus"></i></button>' : ''); } if (is_array($this->left_tools) && !empty($this->left_tools)) { $this->left_tools = ButtonGroup::widget(['buttons' => $this->left_tools, 'encodeLabels' => false]); } $custTools = Html::tag('div', $this->custom_tools, ['class' => 'box-tools pull-right']); $headerContent = !$this->left_tools ? '' : '<div class="box-tools pull-left">' . $this->left_tools . '</div>'; $headerContent .= !$this->title ? '' : Html::tag($this->header_tag, $this->title, ['class' => 'box-title']); $headerContent .= $this->custom_tools || $this->collapse ? $custTools : ''; $headerOptions = ['class' => 'box-header']; if ($this->withBorder) { Html::addCssClass($headerOptions, 'with-border'); } if ($this->tooltip) { $headerOptions = array_merge($headerOptions, ['data-toggle' => 'tooltip', 'data-original-title' => $this->tooltip, 'data-placement' => $this->tooltip_placement]); } $header = Html::tag('div', $headerContent, $headerOptions); echo '<div ' . Html::renderTagAttributes($this->options) . '>' . (!$this->title && !$this->collapse && !$this->custom_tools && !$this->left_tools ? '' : $header) . '<div class="box-body">'; }
/** * Executes the widget. * This method registers all needed client scripts and renders * the text field. */ public function run() { $uploadDir = \Yii::$app->urlManager->baseUrl . '/uploads'; $id = $this->options['id']; if (isset($this->options['name'])) { $name = $this->options['name']; } if ($this->sizeValidate !== array() and isset($this->sizeValidate['width'], $this->sizeValidate['height'])) { $this->width = $this->sizeValidate['width']; $this->height = $this->sizeValidate['height']; $textSmall = strtr($this->templateSmall, array('{width}' => $this->sizeValidate['width'], '{height}' => $this->sizeValidate['height'])); echo '<small class="text-muted">' . $textSmall . '</small>'; } $img = ''; if (!$this->model->isNewRecord and !empty($this->model->{$this->attribute})) { $img = "<img id=\"jcrop_target{$id}\" class=\"img-responsive img-rounded\" src=\"{$uploadDir}/{$this->model->{$this->attribute}}\" alt=\"\">"; } $arrayFile = explode('.', $this->model->{$this->attribute}); $ext = end($arrayFile); if (isset($this->iconExtensions[$ext])) { $filenamePreview = $this->iconExtensions[$ext]; $img = "<div class=\"text-center\"><a href=\"{$uploadDir}/{$this->model->{$this->attribute}}\" target=\"_blank\"><i class=\"{$filenamePreview}\"></i></a></div>"; } if (isset($this->imgContainerOptions['class'])) { $this->imgContainerOptions['class'] = $this->imgContainerOptions['class'] . " {$this->containerCss} {$id}_img text-center"; } else { $this->imgContainerOptions['class'] = "{$this->containerCss} {$id}_img text-center"; } $this->imgContainerOptions['data-url'] = "{$uploadDir}"; $icon = ""; if ($this->iconButtom !== false) { $icon = "<i class=\"fa {$this->iconButtom} mtl\" style=\"font-size: 10em;color: #f0f0f0\"></i>"; } if (!$this->model->isNewRecord and !empty($this->model->{$this->attribute})) { $icon = ""; } echo "<div class=\"tile qq-upload-extra-drop-area\">\n <div" . Html::renderTagAttributes($this->imgContainerOptions) . ">\n {$img}\n {$icon}\n </div>\n <div id=\"{$id}_link\"></div>\n </div>"; if ($this->hasModel()) { echo Html::activeHiddenInput($this->model, $this->attribute, $this->options); } else { echo Html::hiddenInput($this->name, $this->value, $this->options); } $this->registerClientScript(); }
* index.php * @author Revin Roman * @link https://rmrevin.com * * @var yii\web\View $this * @var Page\backend\forms\PageEditForm $PageEditForm */ use cookyii\modules\Page; use rmrevin\yii\fontawesome\FA; use yii\helpers\Html; $this->title = Yii::t('cookyii.page', 'Edit page'); Page\backend\assets\EditAssetBundle::register($this); ?> <section <?php echo Html::renderTagAttributes(['class' => 'content', 'ng-controller' => 'page.DetailController']); ?> > <div class="row" ng-show="updatedWarning"> <div class="col-xs-12 col-lg-6"> <div class="info-box bg-yellow"> <span class="info-box-icon"><?php echo FA::icon('warning'); ?> </span> <div class="info-box-content"> <strong class="info-box-text"><?php echo Yii::t('cookyii', 'Warning'); ?>
<?php /* @var $this yii\web\View */ use yii\grid\GridView; $this->title = \Yii::$app->name; ?> <div class="site-index"> <div class="body-content"> <div class="row"> <div <?php echo \yii\helpers\Html::renderTagAttributes(['class' => 'notice ' . ($cashBoxCash > 0 ? $cashBoxCash > 10000 ? 'notice-success' : 'notice-info' : 'notice-warning')]); ?> > <strong><?php echo Yii::$app->formatter->asCurrency($cashBoxCash); ?> </strong> / в кассе </div> </div> <div class="row"> <?php if ([] !== $usersPerHour) { ?> <div class="panel panel-success"> <div class="panel-heading"><h2 class="panel-title"><i class="fa fa-bar-chart"></i> Посетители</h2></div> <div class="panel-body no-padding"> <?php echo \dosamigos\chartjs\ChartJs::widget(['type' => 'bar', 'options' => ['height' => 100, 'width' => 800], 'data' => $usersPerHour]); ?> </div> </div>
/** * @inheritdoc */ protected function renderItem($item) { $item['badgeOptions'] = isset($item['badgeOptions']) ? $item['badgeOptions'] : []; if (!ArrayHelper::getValue($item, 'badgeOptions.class')) { $badgeBgClass = isset($item['badgeBgClass']) ? $item['badgeBgClass'] : $this->badgeBgClass; $item['badgeOptions']['class'] = $this->badgeClass . ' ' . $badgeBgClass; } if (isset($item['items']) && !isset($item['right-icon'])) { $item['right-icon'] = $this->parentRightIcon; } if (isset($item['url'])) { $template = ArrayHelper::getValue($item, 'template', $this->linkTemplate); return strtr($template, ['{icon}' => isset($item['icon']) ? '<i class="' . $item['icon'] . '"></i> ' : null, '{url}' => Html::encode(Url::to($item['url'])), '{label}' => $item['label'], '{right-icon}' => isset($item['right-icon']) ? '<i class="' . $item['right-icon'] . '"></i>' : null, '{badge}' => isset($item['badge']) ? Html::tag($this->badgeTag, $item['badge'], $item['badgeOptions']) : null, '{linkOptions}' => isset($item['linkOptions']) ? Html::renderTagAttributes($item['linkOptions']) : null]); } $template = ArrayHelper::getValue($item, 'template', $this->labelTemplate); return strtr($template, ['{icon}' => isset($item['icon']) ? '<i class="' . $item['icon'] . '"></i> ' : null, '{label}' => $item['label'], '{right-icon}' => isset($item['right-icon']) ? '<i class="' . $item['right-icon'] . '"></i>' : null, '{badge}' => isset($item['badge']) ? Html::tag($this->badgeTag, $item['badge'], $item['badgeOptions']) : null, '{linkOptions}' => isset($item['linkOptions']) ? Html::renderTagAttributes($item['linkOptions']) : null]); }