/** * Renders a page button. * You may override this method to customize the generation of page buttons. * * @param string $label the text label for the button * @param integer $page the page number * @param string $class the CSS class for the page button. * @param boolean $disabled whether this page button is disabled * @param boolean $active whether this page button is active * * @return string the rendering result */ protected function renderPageButton($label, $page, $class, $disabled, $active) { if ($active) { $class .= ' ' . $this->activePageCssClass; } if ($disabled) { $class .= ' ' . $this->disabledPageCssClass; } $state = $this->getState(); $state['page'] = $page + 1; $jsonState = json_encode($state); $class .= ' stateful'; $class = trim($class); $options = ['data-state' => $jsonState, 'class' => $class === '' ? null : $class]; return Html::tag('li', Html::a($label, $this->pagination->createUrl($page), ['data-page' => $page]), $options); }
<?php use canis\helpers\Html; echo Html::beginTag('ul', ['class' => 'list-group']); echo Html::beginTag('li', ['class' => 'list-group-item']); echo Html::tag('span', $stats['total'], ['class' => 'badge']); echo 'Total'; echo Html::endTag('li'); if (!empty($stats['top_contributors'])) { echo Html::beginTag('li', ['class' => 'list-group-item']); echo '<h5>Top Contributors</h5>'; echo Html::beginTag('ul', ['class' => 'list-group']); foreach ($stats['top_contributors'] as $id => $contrib) { echo Html::beginTag('li', ['class' => 'list-group-item']); echo Html::tag('span', $contrib['sum'], ['class' => 'badge']); echo Html::a($contrib['label'], ['/object/view', 'id' => $id, 'p' => Yii::$app->request->object->primaryKey]); echo Html::endTag('li'); } echo Html::endTag('ul'); } if (!empty($stats['month_summary'])) { echo Html::beginTag('li', ['class' => 'list-group-item']); echo '<h5>Month Summaries</h5>'; echo Html::beginTag('ul', ['class' => 'list-group']); foreach ($stats['month_summary'] as $month => $sum) { echo Html::beginTag('li', ['class' => 'list-group-item']); echo Html::tag('span', $sum['sum'], ['class' => 'badge']); echo date('F Y', strtotime($month . '-01')); echo Html::endTag('li'); } echo Html::endTag('ul');
/** * Get download link. * * @param [[@doctodo param_type:label]] $label [[@doctodo param_description:label]] [optional] * @param array $htmlAttributes [[@doctodo param_description:htmlAttributes]] [optional] * * @return [[@doctodo return_type:getDownloadLink]] [[@doctodo return_description:getDownloadLink]] */ public function getDownloadLink($label = null, $htmlAttributes = []) { if (is_null($label)) { $label = $this->descriptor; } return Html::a($label, ['/object/view', 'subaction' => 'download', 'id' => $this->id]); }
*/ use canis\helpers\ArrayHelper; use canis\helpers\Html; use canis\daemon\widgets\ExtendedStatus as DaemonStatus; \canis\web\assetBundles\CanisLogViewerAsset::register($this); ArrayHelper::multisort($tasks, 'title'); $this->title = 'Administration'; // $this->params['breadcrumbs'][] = ['label' => 'Administration', 'url' => ['/admin/index']]; $this->params['breadcrumbs'][] = ['label' => $this->title]; echo Html::beginTag('div', ['class' => 'panel panel-default']); echo Html::beginTag('div', ['class' => 'panel-heading']); echo Html::beginTag('h3', ['class' => 'panel-title']); echo Html::beginTag('div', ['class' => 'btn-group btn-group-sm pull-right']); echo Html::endTag('div'); echo 'Administration Tasks'; echo Html::endTag('h3'); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'panel-body']); echo Html::beginTag('div', ['class' => 'list-group']); foreach ($tasks as $taskId => $task) { $dataHandler = ''; if (!isset($task['url'])) { $dataHandler = 'background'; $task['url'] = ['/admin/index', 'task' => $taskId]; } echo Html::a(Html::tag('h4', $task['title'], ['class' => 'list-group-item-heading']) . Html::tag('div', $task['description'], ['class' => 'list-group-item-text']), $task['url'], ['class' => 'list-group-item', 'data-handler' => $dataHandler]); } echo Html::endTag('div'); echo Html::endTag('div'); echo Html::endTag('div'); echo DaemonStatus::widget();
public function getViewLink() { if ($this->can('read')) { return Html::a($this->descriptor, $this->getUrl('view')); } else { return $this->descriptor; } }
/** * @inheritdoc */ public function generateContent() { if (!isset(Yii::$app->request->object)) { return false; } $object = Yii::$app->request->object; $content = []; $content[] = Html::beginTag('div', ['class' => 'well ic-masthead']); if (Yii::$app->request->previousObject) { $content[] = Html::beginTag('div', ['class' => 'ic-object-previous']); $content[] = Html::tag('span', '', ['class' => 'fa fa-reply']) . ' ' . Html::a('Go back to <em>' . Yii::$app->request->previousObject->descriptor . '</em>', Yii::$app->request->previousObject->getUrl('view', [], false)); $content[] = Html::endTag('div'); } if ($object->getBehavior('Photo')) { $photoHtmlOptions = []; $img = $object->getPhotoUrl(200); if ($img) { Html::addCssClass($photoHtmlOptions, 'ic-object-photo ic-object-photo-image'); $photoHtmlOptions['style'] = 'background-image: url("' . $img . '");'; } else { Html::addCssClass($photoHtmlOptions, 'ic-object-photo ic-object-photo-icon ' . $object->objectType->icon); } $photoContent = ''; $content[] = Html::tag('div', $photoContent, $photoHtmlOptions); } $content[] = Html::beginTag('div', ['class' => 'ic-object-header']); $content[] = $object->descriptor; $objectAccess = $object->objectAccess; $objectVisibility = $objectAccess->visibility; $content[] = Html::endTag('div'); if ($object->archived) { $content[] = Html::tag('div', Html::tag('span', 'Archived', ['class' => 'label label-warning']), ['class' => 'center-block center-text']); } $menu = []; $familiarty = $object->getFamiliarity(); $startWatchingItem = ['label' => Html::tag('span', '', ['class' => 'fa fa-eye']) . ' Watch', 'url' => $object->getUrl('watch'), 'options' => ['title' => 'Watch and get notified with changes', 'data-handler' => 'background', 'class' => 'watch-link', 'data-watch-task' => 'start']]; $stopWatchingItem = ['label' => Html::tag('span', '', ['class' => 'fa fa-check']) . ' Watching', 'url' => $object->getUrl('watch', ['stop' => 1]), 'options' => ['title' => 'Stop receiving change notifications', 'data-handler' => 'background', 'data-watch-task' => 'stop', 'class' => 'watch-link']]; $accessManageUrl = $object->getUrl('access'); $startWatchingItem['companion'] = $stopWatchingItem; $stopWatchingItem['companion'] = $startWatchingItem; if (empty($familiarty->watching)) { $menu[] = $startWatchingItem; } else { $menu[] = $stopWatchingItem; } if ($object->can('update')) { $menu[] = ['label' => Html::tag('span', '', ['class' => 'fa fa-wrench']) . ' Update', 'url' => $object->getUrl('update'), 'options' => ['title' => 'Update', 'data-handler' => 'background']]; } if ($object->can('delete') || $object->can('archive')) { $label = 'Delete'; $icon = 'fa-trash-o'; if ($object->can('archive')) { $icon = 'fa-archive'; if ($object->archived) { $label = 'Unarchive'; } else { $label = 'Archive'; } } $menu[] = ['label' => Html::tag('span', '', ['class' => 'fa ' . $icon]) . ' ' . $label, 'url' => $object->getUrl('delete'), 'options' => ['title' => $label, 'data-handler' => 'background']]; } if ($objectVisibility === 'public') { $accessIcon = 'fa fa-globe'; $accessTitle = $object->objectType->title->upperSingular . ' is public'; $accessLabel = 'Public'; } elseif ($objectVisibility === 'shared') { $accessIcon = 'fa fa-rss'; $accessTitle = $object->objectType->title->upperSingular . ' is shared'; $accessLabel = 'Shared'; } elseif ($objectVisibility === 'internal') { $accessIcon = 'fa fa-building-o'; $accessTitle = $object->objectType->title->upperSingular . ' is shared internally'; $accessLabel = 'Internal'; } elseif ($objectVisibility === 'admins') { $accessIcon = 'fa fa-lock'; $accessTitle = $object->objectType->title->upperSingular . ' is shared only with administrators'; $accessLabel = 'Administrators'; } else { $accessIcon = 'fa fa-user'; $accessTitle = $object->objectType->title->upperSingular . ' is private'; $accessLabel = 'Private'; } if ($object->can('manageAccess')) { } $menu[] = ['label' => Html::tag('span', '', ['class' => $accessIcon]) . ' ' . $accessLabel, 'url' => $accessManageUrl, 'options' => ['title' => $accessTitle, 'data-handler' => 'background']]; $menu[] = ['label' => Html::tag('span', '', ['class' => 'fa fa-history']) . ' Activity', 'url' => $object->getUrl('activity'), 'options' => ['title' => 'View Activity', 'data-handler' => 'background']]; if (!empty($menu)) { $content[] = Html::beginTag('div', ['class' => 'ic-object-menu columns-' . count($menu)]); $content[] = Html::beginTag('ul', ['class' => 'clearfix']); $menuCount = 0; foreach ($menu as $item) { $menuCount++; if (!isset($item['options'])) { $item['options'] = []; } $companionContent = ''; if (isset($item['companion'])) { $companion = $item['companion']; if (!isset($companion['options'])) { $companion['options'] = []; } Html::addCssClass($companion['options'], 'hidden'); $companionContent = Html::a($companion['label'], $companion['url'], $companion['options']); } $content[] = Html::tag('li', $companionContent . Html::a($item['label'], $item['url'], $item['options']), ['class' => 'item-' . $menuCount]); } $content[] = Html::endTag('ul'); $content[] = Html::endTag('div'); } $content[] = Html::endTag('div'); return implode($content); }
<?php /** * @var yii\base\View */ use canis\helpers\ArrayHelper; use canis\helpers\Html; ArrayHelper::multisort($tasks, 'title'); $this->title = 'Maintenance Tasks'; $this->params['breadcrumbs'][] = ['label' => 'Administration', 'url' => ['/admin/dashboard/index']]; $this->params['breadcrumbs'][] = ['label' => $this->title]; echo Html::pageHeader($this->title); echo Html::beginTag('div', ['class' => 'list-group']); foreach ($tasks as $taskId => $task) { echo Html::a(Html::tag('h4', $task['title'], ['class' => 'list-group-item-heading']) . Html::tag('div', $task['description'], ['class' => 'list-group-item-text']), ['/admin/dashboard/tasks', 'task' => $taskId], ['class' => 'list-group-item', 'data-handler' => 'background']); } echo Html::endTag('div');
/** * @var yii\base\View */ use canis\helpers\ArrayHelper; use canis\helpers\Html; use yii\grid\GridView; ArrayHelper::multisort($tasks, 'title'); $this->title = 'Sensor Providers'; $this->params['breadcrumbs'][] = ['label' => 'Administration', 'url' => ['/admin']]; $this->params['breadcrumbs'][] = ['label' => $this->title]; echo Html::beginTag('div', ['class' => 'panel panel-default']); echo Html::beginTag('div', ['class' => 'panel-heading']); echo Html::beginTag('h3', ['class' => 'panel-title']); echo Html::beginTag('div', ['class' => 'btn-group btn-group-sm pull-right']); echo Html::a('Add Provider <span class="caret"></span>', '#', ['class' => 'btn btn-primary dropdown-toggle', 'data-toggle' => 'dropdown']); echo Html::beginTag('ul', ['class' => 'dropdown-menu']); echo Html::tag('li', Html::a('Pull Provider', ['/admin/provider/create', 'type' => 'pull'], ['class' => '', 'data-handler' => 'background'])); echo Html::tag('li', Html::a('Pushing Provider', ['/admin/provider/create', 'type' => 'push'], ['class' => '', 'data-handler' => 'background'])); //echo Html::a('Static Provider', ['/admin/provider/create', 'type' => 'static'], ['class' => '', 'data-handler' => 'background']); echo Html::endTag('ul'); echo Html::endTag('div'); echo 'Sensor Providers'; echo Html::endTag('h3'); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'panel-body']); echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}', 'buttonOptions' => ['data-handler' => 'background'], 'buttons' => ['delete' => function ($url, $model, $key) { $options = array_merge(['title' => Yii::t('yii', 'Delete'), 'aria-label' => Yii::t('yii', 'Delete'), 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), 'data-method' => 'post', 'data-pjax' => '0'], []); return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, $options); }]], 'name', 'type', 'active', 'last_refresh:datetime', 'created:datetime']]); echo Html::endTag('div'); echo Html::endTag('div');
<?php /** * @var yii\base\View */ use canis\helpers\Html; $this->title = 'Administration'; $this->params['breadcrumbs'][] = ['label' => $this->title]; echo Html::beginTag('div', ['class' => 'list-group']); echo Html::a(Html::tag('h4', 'Maintenance Tasks', ['class' => 'list-group-item-heading']) . Html::tag('div', 'Run various maintenance tasks', ['class' => 'list-group-item-text']), ['/admin/dashboard/tasks'], ['class' => 'list-group-item']); echo Html::a(Html::tag('h4', 'Interfaces', ['class' => 'list-group-item-heading']) . Html::tag('div', 'Run various maintenance tasks', ['class' => 'list-group-item-text']), ['/admin/interface/index'], ['class' => 'list-group-item']); echo Html::endTag('div');
<?php use canis\helpers\Html; $this->title = "<em>{$dataInterface->name}</em> Interface Logs"; $this->params['breadcrumbs'][] = ['label' => 'Administration', 'url' => ['/admin/dashboard/index']]; $this->params['breadcrumbs'][] = ['label' => 'Interfaces', 'url' => ['admin/interface/index']]; $this->params['breadcrumbs'][] = $this->title; echo Html::pageHeader($this->title); echo Html::beginTag('div', ['class' => 'list-group']); $logs = $dataInterface->getRelatedLogQuery()->orderBy(['created' => SORT_DESC])->all(); foreach ($logs as $log) { $itemHtmlOptions = ['class' => 'list-group-item']; Html::addCssClass($itemHtmlOptions, 'list-group-item-' . $log->bootstrapState); echo Html::a(date("F d, Y h:i:sa", strtotime($log->created)), ['admin/interface/view-log', 'id' => $log->id], $itemHtmlOptions); } echo Html::endTag('div');
/** * Get link. * * @return [[@doctodo return_type:getWebLink]] [[@doctodo return_description:getWebLink]] */ public function getWebLink() { return Html::a($this->descriptor, $this->url, ['target' => '_blank']); }
$this->title = 'Browse ' . $type->title->upperPlural; $js = []; echo Html::beginTag('div', ['class' => 'panel panel-default']); echo Html::tag('div', Html::tag('div', 'Filter', ['class' => 'panel-title']), ['class' => 'panel-heading']); echo Html::beginTag('div', ['class' => 'panel-body', 'id' => 'filter']); $searchModel = new SearchForm(); $searchForm = ActiveForm::begin(['id' => 'filter-form', 'enableClientValidation' => false, 'action' => ['/api/' . $type->systemId]]); echo Html::beginTag('ul', ['class' => 'nav nav-tabs', 'role' => 'tablist']); $simpleOptions = []; Html::addCssClass($simpleOptions, 'active'); echo Html::beginTag('li', $simpleOptions); echo Html::a('Simple', '#simple-filter', ['role' => 'tab', 'data-toggle' => 'tab']); echo Html::endTag('li'); $advancedOptions = []; echo Html::beginTag('li', $advancedOptions); echo Html::a('Advanced', '#advanced-filter', ['role' => 'tab', 'data-toggle' => 'tab']); echo Html::endTag('li'); echo Html::endTag('ul'); echo Html::beginTag('div', ['class' => 'tab-content well']); // simple Html::addCssClass($simpleOptions, 'tab-pane'); $simpleOptions['id'] = 'simple-filter'; echo Html::beginTag('div', $simpleOptions); echo $searchForm->field($searchModel, 'query', ['inputOptions' => ['id' => 'simple-filter-input', 'placeholder' => 'Search', 'class' => 'form-control']]); echo Html::endTag('div'); // advanced Html::addCssClass($advancedOptions, 'tab-pane'); $advancedOptions['id'] = 'advanced-filter'; echo Html::beginTag('div', $advancedOptions); $queryBuilderOptions = []; $queryBuilderOptions['filters'] = $type->dummyModel->filterFields;
<?php use canis\helpers\Html; use yii\helpers\Url; echo Html::beginTag('div', ['class' => 'panel panel-default']); echo Html::beginTag('div', ['class' => 'panel panel-heading']); echo Html::tag('h3', $object->shortDescriptor, ['class' => 'panel-title']); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'panel-body']); echo Html::tag('div', 'Please choose the object you wish to view ' . Html::tag('em', $object->shortDescriptor) . ' through.', ['class' => 'alert alert-info']); echo Html::beginTag('div', ['class' => 'list-group']); foreach ($options as $option) { echo Html::a($option['descriptor'], $option['url'], ['class' => 'list-group-item']); } echo Html::endTag('div'); echo Html::endTag('div'); echo Html::endTag('div');
<?php use canis\helpers\Html; $this->params['breadcrumbs'][] = ['label' => 'Administration', 'url' => ['/admin/dashboard/index']]; $this->params['breadcrumbs'][] = ['label' => $this->title]; $this->title = 'Interfaces'; echo Html::pageHeader($this->title); echo Html::beginTag('div', ['class' => 'list-group']); foreach (Yii::$app->collectors['dataInterfaces']->getAll() as $interfaceItem) { $interface = $interfaceItem->object; $interfaceModel = $interfaceItem->interfaceObject; $lastLog = $interfaceModel->lastDataInterfaceLog; echo Html::beginTag('div', ['class' => 'list-group-item']); $items = []; $items[] = ['label' => 'Logs', 'url' => ['/admin/interface/view-logs', 'id' => $interfaceModel->primaryKey]]; if (empty($lastLog) || !$lastLog->isActive) { $items[] = ['label' => 'Run', 'url' => ['/admin/interface/run', 'id' => $interfaceModel->primaryKey], 'htmlOptions' => ['data-handler' => 'background']]; } else { $items[] = ['label' => 'View Active Log', 'url' => ['/admin/interface/view-log', 'id' => $lastLog->primaryKey]]; } if (!empty($lastLog)) { $lastRanHtmlOptions = ['class' => 'label label-' . $lastLog->bootstrapState]; $lastRan = Html::a(date("F d, Y h:ia", strtotime($lastLog->created)), ['/admin/interface/view-log', 'id' => $lastLog->primaryKey], $lastRanHtmlOptions); } else { $lastRan = Html::tag('span', 'Never Ran', ['class' => 'label label-warning']); } echo Html::tag('h4', $interface->name . ' ' . $lastRan . Html::buttonGroup($items, ['class' => 'pull-right btn-group-sm'])); echo Html::endTag('div'); } echo Html::endTag('div');