public function run() { $dataProvider = new \yii\data\ArrayDataProvider(["allModels" => is_array($this->items) && !empty($this->items) ? $this->items : $this->model->getModels(), 'pagination' => false]); switch (\Yii::$app->user->identity->isAdmin()) { case true: break; } $revisions = GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['attribute' => 'author_id', 'label' => 'Author', 'format' => 'html', 'value' => function ($model, $index, $widget) { return $model->author()->url(); }], 'created_at', ['attribute' => 'parent_type', 'label' => 'Type'], ['class' => 'yii\\grid\\ActionColumn', 'buttons' => $this->getActions(), 'template' => "{view} {restore} {delete}", 'urlCreator' => function ($action, $model, $key, $index) { return \Yii::$app->controller->id . '/' . $action . '/' . $model->getId(); }, 'options' => ['rowspan' => 3]]], 'rowOptions' => function ($model, $key, $index, $grid) { return ["class" => \nitm\helpers\Statuses::getIndicator($model->getStatus())]; }, "tableOptions" => ['class' => 'table']]); $this->options['id'] .= $this->parentId; echo Html::tag('div', $revisions, $this->options); }
* @var yii\web\View $this * @var app\models\Issues $model */ //$this->title = $model->title; $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Issues'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; $uniqid = !isset($uniqid) ? uniqid() : $uniqid . $model->getId(); ?> <div id="message<?php echo $model->getId(); ?> " class="message <?php echo $model->hidden ? 'message-hidden' : ''; ?> <?php echo \nitm\helpers\Statuses::getIndicator($model->getStatus()); ?> "> <?php switch (isset($isNew) && $isNew === true || $model->isNew()) { case true: echo \nitm\widgets\activityIndicator\ActivityIndicator::widget(); break; } ?> <div id="message-avatar<?php echo $model->getId(); ?> " class="message-avatar"> <img id='messageAvatar<?php echo $model->getId();
}, 'options' => ['rowspan' => 3]], ['sortLinkOptions' => ['data-pjax' => 1], 'format' => 'raw', 'attribute' => 'type_id', 'label' => 'Type', 'value' => function ($model) { return $model->url('type_id', [$model->typeOf(), 'name']); }], ['sortLinkOptions' => ['data-pjax' => 1], 'format' => 'raw', 'attribute' => 'request_for_id', 'label' => 'Request For', 'value' => function ($model) { return $model->url('request_for_id', [$model->requestFor(), 'name']); }], ['sortLinkOptions' => ['data-pjax' => 1], 'format' => 'raw', 'attribute' => 'status', 'label' => 'Urgency', 'value' => function ($model, $index, $widget) { return $model->url('status', $model->getUrgency()); }, 'contentOptions' => ['class' => 'visible-lg visible-md'], 'headerOptions' => ['class' => 'visible-lg visible-md']], ['sortLinkOptions' => ['data-pjax' => 1], 'attribute' => 'author_id', 'label' => 'Author', 'format' => 'raw', 'value' => function ($model, $index, $widget) { return $model->author()->url(\Yii::$app->getModule('nitm')->useFullnames, \Yii::$app->request->url, [$model->formname() . '[author]' => $model->author_id]); }], ['sortLinkOptions' => ['data-pjax' => 1], 'attribute' => 'created_at', 'format' => 'datetime', 'contentOptions' => ['class' => 'visible-lg visible-md'], 'headerOptions' => ['class' => 'visible-lg visible-md']], ['class' => 'yii\\grid\\ActionColumn', 'buttons' => ['form/update' => function ($url, $model) { return \nitm\widgets\modal\Modal::widget(['size' => 'x-large', 'toggleButton' => ['tag' => 'a', 'label' => Icon::forAction('update'), 'href' => \Yii::$app->urlManager->createUrl([$url, '__format' => 'modal']), 'title' => Yii::t('yii', 'Edit '), 'class' => 'fa-2x', 'role' => 'dynamicAction updateAction disabledOnClose'], 'contentOptions' => ["class" => "modal-full"], 'dialogOptions' => ["class" => "modal-full"]]); }, 'close' => function ($url, $model) { return Html::a(Icon::forAction('close', 'closed', $model), \Yii::$app->urlManager->createUrl([$url]), ['title' => Yii::t('yii', ($model->closed ? 'Open' : 'Close') . ' ' . $model->title), 'role' => 'metaAction closeAction', 'class' => 'fa-2x', 'data-parent' => 'tr', 'data-pjax' => '0']); }, 'complete' => function ($url, $model) { return Html::a(Icon::forAction('complete', 'completed', $model), \Yii::$app->urlManager->createUrl([$url]), ['title' => Yii::t('yii', ($model->completed ? 'Incomplete' : 'Complete') . ' ' . $model->title), 'role' => 'metaAction resolveAction disabledOnClose', 'class' => 'fa-2x', 'data-parent' => 'tr', 'data-pjax' => '0']); }], 'template' => "{form/update} {complete} {close}", 'urlCreator' => function ($action, $model, $key, $index) { return '/' . $model->isWhat() . '/' . $action . '/' . $model->getId(); }, 'options' => ['rowspan' => 3]]], 'tableOptions' => ['class' => 'table'], 'rowOptions' => function ($model, $key, $index, $grid) { return ["class" => 'item ' . \nitm\helpers\Statuses::getIndicator($model->getStatus()), "style" => "border-top:solid medium #CCC", 'id' => 'request' . $model->getId(), 'role' => 'statusIndicator' . $model->getId()]; }, 'afterRow' => function ($model, $key, $index, $grid) { $replies = $this->context->replyCountWidget(["model" => $model->replyModel(), 'fullDetails' => false]); $revisions = $this->context->revisionsCountWidget(['model' => $model->revisionModel(), "parentId" => $model->getId(), "parentType" => $model->isWhat(), 'fullDetails' => false]); $issues = $this->context->issueCountWidget(['model' => $model->issueModel(), 'enableComments' => true, "parentId" => $model->getId(), "parentType" => $model->isWhat(), 'fullDetails' => false]); $follow = \nitm\widgets\alerts\Follow::widget(['model' => $model->followModel(), 'buttonOptions' => ['size' => 'normal']]); $title = Html::tag('h4', $model->title); $activityInfo = Html::tag('div', Html::tag('div', $replies, ['class' => 'col-md-3 col-lg-3 center-block']) . Html::tag('div', $revisions, ['class' => 'col-md-3 col-lg-3 center-block']) . Html::tag('div', $issues, ['class' => 'col-md-3 col-lg-3 center-block']) . Html::tag('div', $follow, ['class' => 'col-md-3 col-lg-3 center-block']), ['class' => 'row']); $links = Html::tag('div', \nitm\widgets\metadata\ShortLink::widget(['label' => 'View', 'url' => \Yii::$app->urlManager->createAbsoluteUrl([$model->isWhat() . '/view/' . $model->getId()]), 'header' => $model->title, 'type' => 'modal', 'size' => 'large'])); $links .= Html::tag('div', \nitm\widgets\metadata\ShortLink::widget(['label' => 'Update', 'url' => \Yii::$app->urlManager->createAbsoluteUrl([$model->isWhat() . '/form/update/' . $model->getId()]), 'header' => $model->title, 'type' => 'modal', 'size' => 'x-large', 'modalOptions' => ['dialogOptions' => ['class' => 'modal-full']]])); $statusInfo = \nitm\widgets\metadata\StatusInfo::widget(['items' => [['blamable' => $model->editor(), 'date' => $model->updated_at, 'value' => $model->edits, 'label' => ['true' => "Updated ", 'false' => "No updates"]], ['blamable' => $model->completedBy(), 'date' => $model->completed_at, 'value' => $model->completed, 'label' => ['true' => "Completed ", 'false' => "Not completed"]], ['blamable' => $model->closedBy(), 'date' => $model->closed_at, 'value' => $model->closed, 'label' => ['true' => "Closed ", 'false' => "Not closed"]]]]); $metaInfo = Html::tag('div', Html::tag('div', implode('<br>', [$title, $statusInfo, $activityInfo, $links])), ['class' => 'wrapper']); return Html::tag('tr', Html::tag('td', $metaInfo, ['colspan' => 9, 'rowspan' => 1]), ["class" => 'item ' . \nitm\helpers\Statuses::getIndicator($model->getStatus()), 'role' => 'statusIndicator' . $model->getId()]); }, 'pager' => ['class' => \nitm\widgets\ias\ScrollPager::className(), 'overflowContainer' => '#' . $isWhat . '-ias-container', 'container' => '#' . $isWhat, 'item' => ".item", 'negativeMargin' => 150, 'delay' => 500]]);
</h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::tag("You are editing: " . $this->title); ?> </p> <p> <?php echo Html::a('Create Token', ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo $this->context->legendWidget(); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['id', ['label' => 'User', 'attribute' => 'user_id', 'value' => function ($model) { return $model->user()->fullName(true); }], 'token:ntext', 'added', 'active:boolean', 'level', 'revoked:boolean', 'revoked_on', ['class' => 'yii\\grid\\ActionColumn']], 'rowOptions' => function ($model, $key, $index, $grid) { return ["class" => \nitm\helpers\Statuses::getIndicator($model->getStatus())]; }, "tableOptions" => ['class' => 'table table-bordered']]); ?> </div>
<?php use yii\helpers\Html; use yii\grid\GridView; use yii\data\ArrayDataProvider; use nitm\helpers\Icon; use yii\bootstrap\Tabs; ?> <?php $uniqid = uniqid(); echo Tabs::widget(['encodeLabels' => false, 'items' => [['label' => 'General Info', 'content' => Html::tag('div', $this->render('../general_info', ["model" => $model]), ['class' => \nitm\helpers\Statuses::getIndicator($model->getStatus()), 'role' => 'statusIndicator' . $uniqid, 'id' => 'request-general-info' . $uniqid])], ['label' => 'Issues ' . Html::tag('span', (int) $model->issueModel()->count(), ['class' => 'badge']), 'content' => Html::tag('div', '', ['class' => \nitm\helpers\Statuses::getIndicator($model->getStatus()), 'role' => 'statusIndicator' . $uniqid, 'id' => 'request-issues' . $uniqid, 'style' => 'display:none']), 'linkOptions' => ['role' => 'visibility', 'data-run-once' => 1, 'data-type' => 'html', 'data-id' => 'request-issues' . $uniqid, 'data-url' => \Yii::$app->urlManager->createUrl(['/issue/index/' . $model->isWhat() . '/' . $model->getId(), '__format' => 'html', \nitm\widgets\models\Issues::COMMENT_PARAM => true])]], ['label' => 'Comments ' . Html::tag('span', (int) $model->replyModel()->count(), ['class' => 'badge']), 'content' => Html::tag('div', '', ['class' => "col-lg-12 col-md-12 " . \nitm\helpers\Statuses::getIndicator($model->getStatus()), 'role' => 'statusIndicator' . $uniqid, 'id' => 'request-comments' . $uniqid, 'style' => 'display:none']), 'linkOptions' => ['role' => 'visibility', 'data-run-once' => 1, 'data-type' => 'html', 'data-id' => 'request-comments' . $uniqid, 'data-url' => \Yii::$app->urlManager->createUrl(['/reply/index/' . $model->isWhat() . '/' . $model->getId(), '__format' => 'html'])]], ['label' => 'Revisions ' . Html::tag('span', (int) $model->revisionModel()->count(), ['class' => 'badge']), 'content' => Html::tag('div', '', ['class' => "col-lg-12 col-md-12 " . \nitm\helpers\Statuses::getIndicator($model->getStatus()), 'role' => 'statusIndicator' . $uniqid, 'id' => 'request-revisions' . $uniqid, 'style' => 'display:none']), 'linkOptions' => ['role' => 'visibility', 'data-run-once' => 1, 'data-type' => 'html', 'data-id' => 'request-revisions' . $uniqid, 'data-url' => \Yii::$app->urlManager->createUrl(['/revisions/index/' . $model->isWhat() . '/' . $model->getId(), '__format' => 'html'])]]]]); ?> <script type='text/javascript'> $nitm.onModuleLoad('entity:request', function (module) { module.initMetaActions('#<?php echo $model->isWhat(); ?> _form_container'); <?php if (\Yii::$app->request->isAjax) { ?> $nitm.module('tools').initVisibility('#<?php echo $model->isWhat(); ?> _form_container'); <?php } ?> }); </script>