Пример #1
0
 public function run()
 {
     $shortLinkLabel = $this->useLabel ? Html::tag('span', $this->label, ['class' => 'input-group-addon']) : '';
     $shortLinkInput = Html::input('text', $this->label, empty($this->inputOptions['text']) ? $this->url : $this->inputOptions['text'], array_merge(['class' => 'form-control'], $this->inputOptions));
     $shortLinkButton = Html::a("View " . Icon::show('eye'), $this->url, array_merge(['class' => 'input-group-addon'], $this->viewOptions));
     switch ($this->type) {
         case 'modal':
             $this->modalOptions = array_merge(['size' => $this->size, 'header' => $this->header, 'toggleButton' => ['label' => Icon::show('eye') . " Modal", 'data-remote' => $this->getUrl('modal'), 'class' => 'btn btn-default', 'wrapper' => ['tag' => 'span', 'class' => 'input-group-btn']], 'options' => ['id' => 'short-link' . uniqid()]], $this->modalOptions);
             $shortLinkButton = \nitm\widgets\modal\Modal::widget($this->modalOptions);
             break;
         default:
             $shortLinkButton = Html::a(Icon::show('eye') . (!isset($this->viewOptions['label']) ? " In Page" : $this->viewOptions['label']), $this->getUrl('page'), array_merge(['class' => 'input-group-addon'], $this->viewOptions));
             $this->viewOptions = [];
             break;
     }
     $newWindowLinkButton = Html::a(Icon::show('eye') . " Window", 'javascript:void(0)', array_merge(['class' => 'input-group-addon', 'onclick' => "javascript:window.open('" . $this->getUrl('popup') . "', '" . uniqid() . "', 'width=800, height=900, location=0, scrollbars=1')"], $this->viewOptions));
     $shortLink = Html::tag('div', $shortLinkLabel . $shortLinkInput . $shortLinkButton . $newWindowLinkButton, ['class' => 'input-group', 'style' => 'width:100%']);
     echo $shortLink;
 }
Пример #2
0
 public function modalWidget(array $options)
 {
     return \nitm\widgets\modal\Modal::widget($options);
 }
Пример #3
0
    echo " with id <b>" . $model->remote_id . "</b>";
}
?>
	</div>
	<div class="col-md-3 col-lg-3">
		that has a priority of <b><?php 
echo !empty($model->priority) ? $model->setting('priorities.' . $model->priority) : 'Normal';
?>
</b>
	</div>
	<div class="col-md-2 col-lg-2">
		alert me using <b><?php 
echo $model->methods;
?>
</b>
	</div>
	<div class="col-md-2 col-lg-2">
		<?php 
echo \nitm\widgets\modal\Modal::widget(['size' => 'large', 'toggleButton' => ['tag' => 'a', 'class' => 'btn btn-info', 'label' => Icon::forAction('update'), 'href' => \Yii::$app->urlManager->createUrl(['/alerts/form/update/' . $model->getId(), '__format' => 'modal']), 'title' => Yii::t('yii', 'Update '), 'role' => 'updateAlert']]);
?>
		<?php 
echo Html::a(Icon::forAction('delete'), '#', ['class' => 'btn btn-danger', 'role' => 'removeAlert', 'data-action' => '/alerts/delete/' . $model->getId(), 'data-parent' => "#alert" . $model->getId()]);
?>
	</div>
</div>
<?php 
if (!isset($notAsListItem)) {
    ?>
</li>
<?php 
}
Пример #4
0
    </p>
    <p>
        <?php 
echo $filterButton;
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['id', ['format' => 'raw', 'attribute' => 'parent_ids', 'value' => function ($model) {
    return $model->url('parent_ids', [$model->parent(), 'name']);
    $select2 = \nitm\widgets\metadata\ParentListInput::widget(['model' => $model, 'name' => 'parent_id_autocomplete', 'data' => [['id' => $model->parent()->getId(), 'text' => $model->parent()->name]], 'options' => ['multiple' => false, 'class' => 'form-control', 'id' => 'categories_parent' . $model->getId(), 'role' => 'autocompleteSelect', 'data-real-input' => "#categories-parent_ids" . $model->getId()], 'url' => '/api/autocomplete/category/true']);
    $input = Html::hiddenInput('parent_ids', $model->parent()->getId(), ['title' => $model->parent()->name, 'id' => 'categories-parent_ids' . $model->getId()]);
    return $select2;
}], 'name', 'slug', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {form/update} {disable}', 'buttons' => ['form/update' => function ($url, $model) {
    return \nitm\widgets\modal\Modal::widget(['toggleButton' => ['tag' => 'a', 'label' => Icon::forAction('update'), 'href' => \Yii::$app->urlManager->createUrl([$url, '__format' => 'modal']), 'title' => Yii::t('yii', 'Edit '), 'role' => 'disabledOnClose', 'data-pjax' => 0, 'class' => $model->disabled ? 'hidden' : '']]);
}, 'view' => function ($url, $model) {
    return \nitm\widgets\modal\Modal::widget(['size' => 'large', 'toggleButton' => ['tag' => 'a', 'label' => Icon::forAction('view'), 'href' => \Yii::$app->urlManager->createUrl([$url, '__format' => 'modal']), 'title' => Yii::t('yii', 'View ' . $model->name), 'role' => 'disabledOnClose', 'data-pjax' => 0, 'class' => $model->disabled ? 'hidden' : '']]);
}, 'disable' => function ($url, $model) {
    return Html::a(Icon::forAction('disable', 'disabled', $model), $url, ['title' => Yii::t('yii', 'Disable category: ' . $model->name), 'role' => 'metaAction disableAction', 'data-parent' => '#' . $model->isWhat() . $model->getId(), 'data-pjax' => 0, 'data-method' => 'post']);
}], "urlCreator" => function ($action, $model) {
    $csrfVar = \Yii::$app->request->csrfParam;
    $csrfToken = \Yii::$app->request->getCsrfToken();
    $params = ["/" . $model->isWhat() . '/' . $action . "/" . $model->id];
    return \yii\helpers\Url::toRoute($params);
}]], 'options' => ['id' => 'categories'], 'rowOptions' => function ($model, $key, $index, $grid) {
    return ["class" => 'item'];
}, 'pager' => ['class' => \nitm\widgets\ias\ScrollPager::className(), 'overflowContainer' => '.content', 'container' => '#categories', 'item' => ".item", 'negativeMargin' => 150, 'delay' => 500]]);
?>

</div>
Пример #5
0
 protected function getAsGrid()
 {
     return GridView::widget(['dataProvider' => new \yii\data\ArrayDataProvider(['allModels' => $this->items]), 'options' => ['role' => 'metadata', 'id' => 'metadata' . $this->uniqid, 'role' => 'statusIndicator' . $this->uniqid], 'showHeader' => false, 'showFooter' => false, 'summary' => false, 'layout' => "{items}", 'columns' => array_merge($this->attributes, [['class' => 'yii\\grid\\ActionColumn', 'buttons' => ['form/update-metadata' => function ($url, $model) {
         return \nitm\widgets\modal\Modal::widget(['toggleButton' => ['tag' => 'a', 'label' => Icon::forAction('pencil'), 'href' => \Yii::$app->urlManager->createUrl([$url, '__format' => 'modal']), 'title' => \Yii::t('yii', 'Edit '), 'role' => 'dynamicAction updateAction disabledOnClose']]);
     }, 'delete-metadata' => function ($url, $model) {
         return Html::a(Icon::forAction('delete'), \Yii::$app->urlManager->createUrl([$url]), ['title' => \Yii::t('yii', 'Delete Metadata'), 'role' => 'metaAction deleteAction', 'data-depth' => 0, 'data-parent' => 'tr', 'data-pjax' => '0', 'data-force' => 1]);
     }], 'template' => "{form/update-metadata} {delete-metadata}", 'urlCreator' => function ($action, $model, $key, $index) {
         return (!MetadataInfo::$controllerRoute ? $model->isWhat() : MetadataInfo::$controllerRoute) . '/' . $action . '/' . $model->getId();
     }, 'options' => ['rowspan' => 2, 'class' => 'col-md-1 col-lg-1']]])]);
 }
Пример #6
0
    $ret_val .= Html::tag('h1', $model->getId());
    return $ret_val;
}, 'contentOptions' => function ($model) {
    return ['rowspan' => 2, 'role' => 'voteIndicator' . $model->getId(), 'style' => "vertical-align: middle; background-color:rgba(255,51,0," . $model->voteModel()->rating()['ratio'] . ")"];
}], ['sortLinkOptions' => ['data-pjax' => 1], 'attribute' => 'rating', 'label' => '%', 'format' => 'raw', 'value' => function ($model, $index, $widget) {
    return $this->context->voteWidget(['size' => 'large', 'model' => $model->voteModel(), 'parentType' => $model->isWhat(), 'parentId' => $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']);
Пример #7
0
 public function run()
 {
     $this->header = !isset($this->header) ? $this->getDefaultHeader() : $this->header;
     $this->content = !$this->content ? $this->getDefaultContent() : $this->content;
     return parent::run() . Html::script("\$nitm.onModuleLoad('search-modal', function () {\n\t\t\t\$nitm.module('search-modal').initSearch('#" . $this->options['id'] . "');\n\t\t});");
 }
Пример #8
0
 protected function getInfoLink($type = null)
 {
     $typeHr = ucfirst($type == null ? $this->model->isWhat() : $type);
     if ($this->useModal) {
         $this->options['href'] .= '__format=modal';
         $info = \nitm\widgets\modal\Modal::widget(['options' => ['id' => $this->options['id'] . '-modal'], 'size' => 'large', 'header' => $type, 'toggleButton' => $this->options, 'dialogOptions' => ['class' => 'modal-full']]);
     } else {
         $this->widgetOptions['class'] = 'list-group';
         $header = $this->model->count() . ' ' . $typeHr;
         $last = '';
         if ($this->model->count() >= 1 && is_a($this->model->last, $this->model->className()) && $this->fullDetails) {
             $last = Html::tag('span', 'Last By ' . $this->model->last->author()->url());
             $last .= Html::tag('span', " on " . $this->model->last->created_at, []);
         }
         $info = Html::tag('ul', Html::tag('li', Html::tag('strong', $header, ['class' => 'list-group-item-heading']) . Html::tag('span', $last, ['class' => 'list-group-item-text', 'style' => 'margin-left: 15px']) . Html::tag('div', Html::a('View ' . $typeHr . ' ' . Icon::show('eye'), $this->options['href'], ['role' => 'visibility', 'data-id' => '#' . $type . '-for-' . $this->parentType . '-' . $this->parentId, 'data-remote-once' => 1]), ['class' => 'pull-right']), ['class' => 'list-group-item ' . ($this->model->count() ? 'list-group-item-success' : ''), 'style' => !$this->model->count() ? 'background-color: transparent' : '']), $this->widgetOptions) . Html::tag('div', '', ['id' => $type . '-for-' . $this->parentType . '-' . $this->parentId, 'class' => 'hidden center-block', 'style' => 'padding-bottom: 10px']);
     }
     return $info;
 }
Пример #9
0
 public function run()
 {
     echo \nitm\widgets\modal\Modal::widget(['options' => $this->options, 'dialogOptions' => $this->dialogOptions, 'size' => $this->size]);
 }