Ejemplo n.º 1
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>
Ejemplo n.º 2
0
<div id='notification-index' class="absolute full full-width full-height" role="notificationListForm">
	<div class="col-md-6 col-lg-6">
		<h1>
			<?php 
    echo Html::encode($this->title);
    ?>
		</h1>
	</div>
	<div class="col-md-6 col-lg-6">
		<h1>
			<?php 
    echo Html::a(Icon::show('refresh'), \Yii::$app->urlManager->createUrl(['/alerts/notifications', '__format' => 'html', '__contentOnly' => true]), ['role' => 'dynamicValue', 'data-id' => 'notification-list-container', 'data-type' => 'html', 'class' => 'pull-right']);
    ?>
		</h1>
	</div>
	<div class="col-md-12 col-lg-12">
	<?php 
}
?>
		<?php 
echo ListView::widget(['dataProvider' => $dataProvider, 'itemView' => function ($model, $key, $index, $widget) {
    return $this->render('view-notification', ['model' => $model]);
}, "layout" => "{summary}\n{items}{pager}", 'itemOptions' => ['class' => 'item'], 'options' => ['id' => 'notification-list-container', 'tag' => 'div', 'class' => 'list-group', 'role' => 'notificationList'], 'pager' => ['class' => \nitm\widgets\ias\ScrollPager::className(), 'overflowContainer' => '#notification-index', 'container' => '#notification-list-container', 'item' => ".item", 'negativeMargin' => 75, 'noneLeftText' => 'No more notifications', 'triggerText' => 'More notifications']]);
?>
	<?php 
if (isset($contentOnly) && $contentOnly === false) {
    ?>
	</div>
</div>
<?php 
}
Ejemplo n.º 3
0
    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]]);
Ejemplo n.º 4
0
$title = Yii::t('app', 'Chat');
switch (\Yii::$app->request->isAjax) {
    case true:
        $this->title = $title;
        break;
}
$this->params['breadcrumbs'][] = $title;
$widget->withForm = isset($widget->withForm) ? $widget->withForm : \Yii::$app->request->get(Replies::FORM_PARAM);
$_GET[Replies::FORM_PARAM] = 0;
$widget->listOptions['class'] = isset($widget->listOptions['class']) ? $widget->listOptions['class'] : 'chat-messages';
$dataProvider->pagination->route = '/reply/index/chat/0/1';
$params = array_intersect_key($_GET, [Replies::FORM_PARAM => null, 'page' => null]);
$dataProvider->pagination->params = $params;
$messages = ListView::widget(['layout' => "{items}\n{pager}", 'options' => $widget->listOptions, 'dataProvider' => $dataProvider, 'itemOptions' => ['class' => 'item'], 'itemView' => function ($model, $key, $index, $_widget) use($widget) {
    return $widget->render('@nitm/widgets/views/chat/view', ['model' => $model, 'primaryModel' => $widget->model]);
}, 'pager' => ['class' => \nitm\widgets\ias\ScrollPager::className(), 'overflowContainer' => '#chat-messages-container', 'container' => '#' . $widget->listOptions['id'], 'item' => ".item", 'negativeMargin' => 200, 'noneLeftText' => 'No More messages']]);
$form = $widget->withForm == true ? \nitm\widgets\replies\ChatForm::widget(['model' => $widget->model]) : '';
switch (isset($widget->noContainer) && $widget->noContainer == true) {
    case false:
        $messages = Html::tag('div', $messages, ['id' => 'chat-messages-container', 'class' => 'chat-messages-container']);
        $messages = Html::tag('div', $messages . $form, $widget->options);
        break;
}
echo $messages;
?>
<script type="text/javascript">
$nitm.onModuleLoad('replies', function () {
	<?php 
if (\Yii::$app->request->isAjax) {
    ?>
	$nitm.module('nitm-ias').initIas("<?php