Exemple #1
0
 /**
  * get list of statuses for dropdown
  */
 public static function getUserTypeList()
 {
     $droptions = UserType::find()->asArray()->all();
     return Arrayhelper::map($droptions, 'user_type_value', 'user_type_name');
 }
Exemple #2
0
<div class="post-index">
    <p>
        <?php 
echo Html::a('Создать запись', ['create'], ['class' => 'btn btn-success']);
?>
    </p>
    
    <?php 
Pjax::begin();
?>
    <?php 
echo himiklab\sortablegrid\SortableGridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'id' => 'post_tbl', 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['class' => CheckboxColumn::classname()], ['attribute' => 'title', 'format' => 'html', 'value' => function ($model) {
    return Html::a($model['title'], ['update', 'id' => $model['id']]);
}], ['attribute' => 'cat_id', 'content' => function ($data) {
    return $data->getCategoryName();
}, 'filter' => \yii\helpers\Arrayhelper::map(\app\modules\category\models\Category::find()->all(), 'id', 'title')], ['attribute' => 'created_at', 'format' => ['date', 'dd.MM.yyyy'], 'options' => array('width' => '225px'), 'filter' => \yii\jui\DatePicker::widget(['dateFormat' => 'dd.MM.yyyy', 'model' => $searchModel, 'attribute' => 'created_at', 'options' => ['class' => 'form-control'], 'clientOptions' => ['dateFormat' => 'dd.mm.yy']])], ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) {
    $class = $model->status === 1 ? '<i class="icon-ok"></i>' : '<i class="icon-lock">';
    return $class;
}, 'options' => array('width' => '100px'), 'filter' => Html::activeDropDownList($searchModel, 'status', array(1 => 'On', 0 => 'Off'), ['class' => 'form-control', 'prompt' => 'Все'])], ['attribute' => 'main', 'format' => 'html', 'value' => function ($model) {
    $res = $model->main === 1 ? '<i class="icon-ok"></i>' : '<i class="icon-minus">';
    return $res;
}, 'options' => array('width' => '100px'), 'filter' => Html::activeDropDownList($searchModel, 'main', array(1 => 'Да', 0 => 'Нет'), ['class' => 'form-control', 'prompt' => 'Все'])], 'username', ['class' => 'yii\\grid\\ActionColumn', 'header' => 'Действия', 'headerOptions' => ['width' => '100']]]]);
?>

<p> 
  <?php 
echo Html::a('Удалить выбранные', ['massdelete'], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Вы уверены?', 'data-method' => 'post']]);
?>
  
</p>
Exemple #3
0
 public static function getRoleList()
 {
     $droptions = Role::find()->asArray()->all();
     return Arrayhelper::map($droptions, 'id', 'name');
 }
Exemple #4
0
<div class="header">
        <h1><?php 
echo Html::encode($this->title);
?>
</h1>
</div>

<div class="comments-index">

    <div class="well">

        <?php 
Pjax::begin();
?>
        <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'id' => 'comments_tbl', 'columns' => [['class' => CheckboxColumn::classname()], 'id', 'post:ntext', ['attribute' => 'created_at', 'format' => ['date', 'dd.MM.yyyy'], 'options' => array('width' => '225px'), 'filter' => \yii\jui\DatePicker::widget(['dateFormat' => 'dd.MM.yyyy', 'model' => $searchModel, 'attribute' => 'created_at', 'options' => ['class' => 'form-control'], 'clientOptions' => ['dateFormat' => 'dd.mm.yy']])], ['attribute' => 'post_id', 'options' => array('width' => '80')], ['attribute' => 'module', 'options' => array('width' => '80'), 'filter' => Html::activeDropDownList($searchModel, 'module', \yii\helpers\Arrayhelper::map(Comments::find()->groupBy('module')->all(), 'module', 'module'), ['class' => 'form-control', 'prompt' => 'Все'])], ['attribute' => 'username', 'format' => 'raw', 'value' => function ($model) {
    return Html::a($model['username'], ['/user/' . $model['username']], ['target' => '_blank']);
}], ['class' => 'yii\\grid\\ActionColumn', 'header' => 'Действия', 'headerOptions' => ['width' => '80']]]]);
?>
 



<p> 
  <?php 
echo Html::a('Удалить выбранные', ['massdelete'], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Вы уверены?', 'data-method' => 'post']]);
?>
  
</p>

<?php 
Exemple #5
0
 public static function getSourceList()
 {
     $sources = Source::find()->asArray()->all();
     return Arrayhelper::map($sources, 'id', 'name');
 }
 public static function getCategoryList()
 {
     $droptions = Category::find()->asArray()->all();
     return Arrayhelper::map($droptions, 'id', 'name');
 }
Exemple #7
0
        </ul>
    </span>
<?php 
}
?>
    <?php 
$campuses = Model::find()->orderBy('title')->where(['locale' => Yii::$app->language])->asArray()->all();
foreach ($campuses as $key => $value) {
    $id = $value['id'];
    $title = $value['title'];
    $user = User::findIdentity($value['author_id']);
    $user = $user->username;
    $data[] = ['id' => $id, 'title' => $title . "(" . $user . ")"];
}
$columns = ['id', ['attribute' => 'model_id', 'filter' => Arrayhelper::map($data, 'id', 'title')], 'title', 'slug', ['class' => \common\grid\EnumColumn::className(), 'attribute' => 'status', 'enum' => [Yii::t('backend', 'Not Published'), Yii::t('backend', 'Published')]], ['attribute' => 'search_date_published', 'label' => 'Дата публикации', 'value' => 'published_at', 'format' => ['date', 'php:d-m-Y']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {log} {delete}', 'buttons' => ['log' => function ($url, $model) {
    $customurl = Yii::$app->getUrlManager()->createUrl(['timeline-event/index', 'TimelineEventSearch[category]' => 'common\\models\\locale\\Info', 'TimelineEventSearch[row_id]' => $model->id]);
    return Html::a('<span class="glyphicon glyphicon-time"></span>', $customurl, ['title' => Yii::t('yii', 'Log'), 'data-pjax' => '0']);
}]]];
if (\Yii::$app->user->can('administrator')) {
    // adding after url
    array_splice($columns, 4, 0, [['attribute' => 'domain_id', 'content' => function ($model) {
        $domain = Domain::findOne($model->domain_id);
        $domain = $domain ? $domain->title : '';
        return Html::tag('div', $model->domain_id, ['data-toggle' => 'tooltip', 'data-placement' => 'left', 'title' => $domain, 'style' => 'cursor:default;']);
    }]]);
}
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => $columns]);
?>

</div>