/** * [[@doctodo method_description:generateStart]]. * * @return [[@doctodo return_type:generateStart]] [[@doctodo return_description:generateStart]] */ public function generateStart() { $parts = []; foreach ($this->owner->widgetClasses as $class) { Html::addCssClass($this->owner->htmlOptions, $class); } $parts[] = Html::beginTag('div', $this->owner->htmlOptions); return implode("", $parts); }
/** * [[@doctodo method_description:generateHeader]]. * * @return [[@doctodo return_type:generateHeader]] [[@doctodo return_description:generateHeader]] */ public function generateHeader() { $parts = []; $title = $this->owner->generatePanelTitle(); if ($title) { $parts[] = $title; } $parts[] = Html::beginTag('div', ['class' => 'panel-body']); return implode("", $parts); }
/** * @inheritdoc */ public function generateContent() { if (empty(Yii::$app->request->object)) { return false; } if (!($detailFields = Yii::$app->request->object->getDetailFields()) || empty($detailFields)) { return false; } $parts = []; Html::addCssClass($this->contentHtmlOptions, 'dl-horizontal'); $parts[] = Html::beginTag('dl', $this->contentHtmlOptions); foreach ($detailFields as $key => $field) { $parts[] = Html::tag('dt', $field->label, $this->termHtmlOptions); $parts[] = Html::tag('dd', $field->formattedValue, $this->valueHtmlOptions); } $parts[] = Html::endTag('dl'); return implode($parts); }
/** * [[@doctodo method_description:generate]]. * * @return unknown */ public function generate() { if (empty($this->_items)) { return ''; } $result = []; $formOptions = ['options' => ['class' => ''], 'enableClientValidation' => false]; if (Yii::$app->request->isAjax) { Html::addCssClass($formOptions['options'], 'ajax'); } if ($this->hasFile() && !isset($formOptions['options']['enctype'])) { $formOptions['options']['enctype'] = 'multipart/form-data'; } list($this->form, $formStartRow) = ActiveForm::begin($formOptions, false); $result[] = $formStartRow; // $result[] = Html::beginForm('', 'post', array('class' => $this->class)); $result[] = Html::beginTag('div', ['class' => '']); foreach ($this->_items as $item) { $result[] = $item->generate(); } //if (!Yii::$app->request->isAjax) { $result[] = Html::beginTag('div', ['class' => 'row form-group submit-group']); $result[] = Html::beginTag('div', ['class' => 'col-sm-12']); $result[] = Html::submitButton('Save', ['class' => 'btn btn-primary']); $result[] = Html::endTag('div'); $result[] = Html::endTag('div'); //} $result[] = Html::endTag('div'); $result[] = ActiveForm::end(false); return implode("\n", $result); }
if (!isset($htmlOptions)) { $htmlOptions = []; } $roleSet = isset($objectRoles[$requestorObject->primaryKey]) ? $objectRoles[$requestorObject->primaryKey] : []; $role = isset($roleSet['role']) ? $roleSet['role'] : null; $roleObject = isset($role) ? $role->object : null; Html::addCssClass($htmlOptions, 'list-group-item'); $requestorOptions = []; $requestorOptions['id'] = $requestorObject->primaryKey; $requestorOptions['label'] = $requestorObject->descriptor; $requestorOptions['maxRoleLevel'] = isset($maxRoleLevel) ? $maxRoleLevel : false; $requestorOptions['type'] = $requestorObject->objectType->systemId; $requestorOptions['editable'] = true; if (isset($role) && isset($roleSet['inherited']) && $roleSet['inherited'] && !$role->inheritedEditable) { $requestorOptions['editable'] = false; } $htmlOptions['data-requestor'] = json_encode($requestorOptions); if (!$requestorOptions['editable']) { Html::addCssClass($htmlOptions, 'uneditable'); } echo Html::beginTag('li', $htmlOptions); echo $this->renderFile('@cascade/views/object/access_role.php', ['roles' => $roles, 'role' => $roleObject, 'objectAccess' => $objectAccess, 'disableFields' => $disableFields, 'editable' => $requestorOptions['editable']], $this); echo Html::tag('h4', $requestorObject->descriptor, ['class' => 'list-group-item-heading']); if (!isset($helpText)) { $helpText = $requestorObject->objectType->title->upperSingular; } echo Html::tag('p', $helpText, ['class' => 'list-group-item-text help-text']); if (isset($errors[$requestorObject->primaryKey])) { echo Html::tag('p', $errors[$requestorObject->primaryKey], ['class' => 'alert alert-danger']); } echo Html::endTag('li');
<?php /** * @var yii\base\View */ use canis\helpers\ArrayHelper; use canis\helpers\Html; ArrayHelper::multisort($tasks, 'title'); $this->title = 'Assets'; $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 'Assets'; echo Html::endTag('h3'); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'panel-body']); echo Html::endTag('div'); echo Html::endTag('div');
public function generateContent() { if ($this->lazy && !empty($this->dataProvider->totalCount)) { return str_repeat(Html::tag('div', '', ['class' => 'widget-lazy-placeholder']), min($this->dataProvider->totalCount, $this->dataProvider->pagination->pageSize)); } $results = $this->dataProvider; if (!empty($results->totalCount) && !empty($results->count)) { $models = $this->dataProvider->getModels(); $keys = $this->dataProvider->getKeys(); $listOptions = $this->listOptions; $listTag = ArrayHelper::remove($listOptions, 'tag', 'ul'); $rows = []; $rows[] = Html::beginTag($listTag, $listOptions); foreach (array_values($models) as $index => $model) { $rows[] = $this->renderItem($model, $keys[$index], $index); } $rows[] = Html::endTag($listTag); return implode('', $rows); } else { return Html::tag('div', $this->emptyMessage, ['class' => 'empty-messages']); } }
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; $builderId = 'advanced-filter-builder'; echo Html::tag('div', '', ['id' => $builderId]); $js[] = "\$('#{$builderId}').queryBuilder(" . json_encode($queryBuilderOptions) . ");"; echo Html::endTag('div'); echo Html::submitButton('Search', ['class' => 'btn btn-default']); echo Html::endTag('div'); ActiveForm::end(); echo Html::endTag('div'); // filter body echo Html::endTag('div'); // filter section echo Html::beginTag('div', ['class' => 'panel panel-default']); echo Html::tag('div', Html::tag('div', 'Results', ['class' => 'panel-title']), ['class' => 'panel-heading']); echo Html::beginTag('div', ['class' => 'panel-body', 'id' => 'filter-results']); echo Html::endTag('div'); echo Html::endTag('div'); $this->registerJs(implode("\n", $js));
/** * [[@doctodo method_description:generate]]. * * @return unknown */ public function generate() { $this->getFields(); $result = []; if (!empty($this->_settings['title'])) { $result[] = Html::beginTag('fieldset'); $result[] = Html::tag('legend', $this->_settings['title']); } $result[] = $this->grid->generate(); if (!empty($this->_settings['title'])) { $result[] = Html::endTag('fieldset'); } return implode("\n", $result); }
<?php use canis\helpers\Html; echo Html::beginForm('', 'post', ['class' => 'ajax']); echo Html::beginTag('div', ['class' => 'form']); $model->confirm = 1; echo Html::activeHiddenInput($model, 'confirm'); if (count($model->possibleTargets) === 1) { $label = $model->labels[$model->possibleTargets[0]]; echo '<div class="confirm">Are you sure you want with ' . $label['long'] . '?</div>'; } else { $parts = []; $parts[] = 'the ' . $model->object->objectType->title->getSingular(false) . ' <em>' . $model->object->descriptor . '</em>'; if ($model->hasRelationshipTargets()) { $parts[] = 'its relationship with the ' . $model->relationshipWith->objectType->title->getSingular(false) . ' <em>' . $model->relationshipWith->descriptor . '</em>'; } echo '<div class="confirm">What would you like to do to ' . implode($parts, ' and ') . '?</div>'; echo '<div class="btn-group" data-toggle="buttons">'; $itemOptions = ['container' => false]; foreach ($model->possibleTargets as $target) { $label = $model->labels[$target]; $labelOptions = isset($label['options']) ? $label['options'] : []; if (!isset($labelOptions['class'])) { Html::addCssClass($labelOptions, 'btn btn-default'); } else { Html::addCssClass($labelOptions, 'btn'); } if ($model->target === $target) { Html::addCssClass($labelOptions, 'active'); } $labelOptions['title'] = ucfirst(strip_tags($label['long']));
<?php /** * ./app/views/app/create.php. * * @author Jacob Morrison <*****@*****.**> */ use canis\helpers\Html; cascade\components\web\assetBundles\ObjectViewAsset::register($this); $form->output(); if (!empty($primaryModel->modified)) { echo Html::beginTag('div', ['class' => 'canis-info-group']); echo Html::tag('div', 'Modified', ['class' => 'canis-info-label']); echo Html::tag('div', $primaryModel->modified, ['class' => 'canis-info-label']); echo Html::endTag('div'); }
if (!$typeItem->active) { continue; } $types[$typeItem->systemId] = ['label' => $typeItem->object->title->upperSingular, 'possibleRoles' => $typeItem->object->possibleRoles, 'initialRole' => $typeItem->object->initialRole, 'requiredRoles' => $typeItem->object->requiredRoles]; } $dataAccess = ['selector' => ['browse' => ['data' => []], 'search' => []]]; $dataAccess['roles'] = $roles; $dataAccess['types'] = $types; $typeBundle = BrowserResponse::handleInstructions(['handler' => 'types', 'typeFilters' => ['authority']]); $dataAccess['selector']['browse']['data']['modules'] = array_keys(Yii::$app->collectors['types']->authorities); $dataAccess['selector']['browse']['root'] = $typeBundle->package(); $dataAccess['universalMaxRoleLevel'] = $access->getUniversalMaxRoleLevel(); $htmlOptions['data-access'] = json_encode($dataAccess); } $form = ActiveForm::begin(['options' => ['class' => 'ajax']]); echo Html::beginTag('ul', $htmlOptions); if ($publicGroup) { $requestorParams = ['requestorObject' => $publicGroup['object'], 'helpText' => 'Access level for the public', 'maxRoleLevel' => $publicGroup['maxRoleLevel'], 'htmlOptions' => ['class' => 'list-group-item-warning']]; echo $this->renderFile('@cascade/views/object/access_requestor.php', array_merge($baseRequestorParams, $requestorParams), $this); unset($objectRoles[$publicGroup['object']->primaryKey]); } if ($primaryAccount) { $requestorParams = ['requestorObject' => $primaryAccount['object'], 'helpText' => 'Access level for internal staff', 'maxRoleLevel' => $primaryAccount['maxRoleLevel'], 'htmlOptions' => ['class' => 'list-group-item-info']]; echo $this->renderFile('@cascade/views/object/access_requestor.php', array_merge($baseRequestorParams, $requestorParams), $this); unset($objectRoles[$primaryAccount['object']->primaryKey]); } foreach ($objectRoles as $objectId => $objectRole) { echo $this->renderFile('@cascade/views/object/access_requestor.php', array_merge($baseRequestorParams, ['requestorObject' => $objectRole['object']]), $this); } echo Html::endTag('ul'); ActiveForm::end();
/** * [[@doctodo method_description:generateHeader]]. * * @return [[@doctodo return_type:generateHeader]] [[@doctodo return_description:generateHeader]] */ public function generateHeader() { $parts = []; $parts[] = Html::beginTag('div', ['class' => 'panel-body']); return implode("", $parts); }
*/ 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();
/** * @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 use canis\helpers\ArrayHelper; use canis\helpers\Html; use canis\web\grid\Cell; use canis\web\grid\Grid; use yii\helpers\Url; $js = []; $this->title = 'Dashboard'; $refreshable = ['url' => Url::to(['/app/stream']), 'stream' => true, 'data' => ['baseInstructions' => []]]; $this->bodyHtmlOptions['data-refreshable'] = json_encode($refreshable); echo Html::beginTag('div', ['class' => 'ic-dashboard row']); Yii::beginProfile("Build Grid"); $widgets = Yii::$app->collectors['widgets']->getLocation('front'); ArrayHelper::multisort($widgets, ['priority', 'name'], [SORT_ASC, SORT_ASC]); $topGrid = new Grid(); $watchingWidget = Yii::$app->collectors['widgets']->getOne('WatchingContent'); $watchingCell = Yii::$app->collectors['widgets']->build(null, $watchingWidget, [], ['columns' => 6]); $topGrid->currentRow->addCell($watchingCell); $itemsCell = $topGrid->currentRow->addCell(new Cell(['columns' => 6])); $widgetGrid = new Grid(); Html::addCssClass($widgetGrid->htmlOptions, 'ic-front-side'); $js[] = '$("#' . $widgetGrid->id . '").canisAffix();'; $widgetGrid->baseRow = ['trueWidth' => 6]; $cells = []; Yii::beginProfile("Collect Widgets"); foreach ($widgets as $item => $widget) { $cells[] = Yii::$app->collectors['widgets']->build(null, $widget, [], []); } Yii::endProfile("Collect Widgets"); $widgetGrid->cells = $cells;
<?php use canis\helpers\Html; use yii\helpers\Url; $instructions = []; $instructions['ajax'] = ['url' => Url::to(['/app/activity'])]; $instructions['scope'] = 'object'; $instructions['limit'] = 7; $instructions['object'] = $object->primaryKey; echo Html::beginTag('div', ['class' => 'ic-object-activity-viewport']); echo Html::tag('div', '', ['data-activity-feed' => json_encode($instructions)]); echo Html::tag('div', str_repeat(Html::tag('div', '', ['class' => 'widget-lazy-placeholder']), 5), ['class' => 'activity-feed-thinking']); echo Html::endTag('div');
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'); } echo Html::endTag('ul');
} } if (count($sectionsMenu) > 2) { $mainColumnSize -= 2; } $mainCell = []; foreach ($sections as $section) { if ($section->priority === false) { continue; } $mainCell[] = $section->object->cell; } $mainCellGrid = Yii::createObject(['class' => 'canis\\web\\grid\\Grid']); $mainCellGrid->cells = $mainCell; $cells[] = $mainCell = Yii::createObject(['class' => 'canis\\web\\grid\\Cell', 'content' => $mainCellGrid->generate()]); Yii::configure($mainCell, ['mediumDesktopColumns' => 4, 'maxMediumDesktopColumns' => $mainColumnSize, 'largeDesktopSize' => false, 'tabletColumns' => $mainColumnSize + 1]); Html::addCssClass($mainCell->htmlOptions, 'ic-main-cell'); if (count($sectionsMenu) > 2) { $js[] = '$(".ic-sidenav").cascadeAffix();'; $menuContent = Html::beginTag('div', ['class' => 'ic-sidenav']); $menuContent .= Nav::widget(['options' => ['class' => 'navbar-default'], 'encodeLabels' => false, 'items' => $sectionsMenu]); $menuContent .= Html::endTag('div'); $cells[] = $menuCell = Yii::createObject(['class' => 'canis\\web\\grid\\Cell', 'content' => $menuContent]); Yii::configure($menuCell, ['mediumDesktopColumns' => 2, 'maxMediumDesktopColumns' => 2, 'largeDesktopSize' => false, 'tabletSize' => false]); Html::addCssClass($menuCell->htmlOptions, 'hidden-xs hidden-sm'); } $grid->cells = $cells; $grid->output(); echo Html::endTag('div'); // .dashboard $this->registerJs(implode("\n", $js));