public function up()
 {
     $all = \app\models\Chenneling::query(['description' => null])->all();
     foreach ($all as $item) {
         $i = new \app\models\Chenneling($item);
         $i->update(['description' => \app\services\GsssHtml::getMiniText($i->getField('content'))]);
     }
 }
Esempio n. 2
0
<?php

use yii\helpers\Html;
use yii\bootstrap\ButtonDropdown;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $term string строка запроса */
$this->title = 'Результаты поиска';
$this->params['breadcrumbs'][] = $this->title;
?>

<div class="container">

    <h1 class="page-header">Результаты поиска</h1>
    <?php 
echo \yii\grid\GridView::widget(['dataProvider' => new \yii\data\ActiveDataProvider(['query' => \app\models\Chenneling::query(['like', 'header', $term])->orWhere(['like', 'content', $term])->select('id, img, header, date, id_string')->orderBy(['date_insert' => SORT_DESC]), 'pagination' => ['pageSize' => 20]]), 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['header' => 'Картинка', 'content' => function ($model, $key, $index, $column) {
    return Html::a(Html::img($model['img'], ['width' => 40, 'class' => 'thumbnail', 'style' => 'margin-bottom: 0px;']), ['page/chenneling_item', 'year' => substr($model['date'], 0, 4), 'month' => substr($model['date'], 5, 2), 'day' => substr($model['date'], 8, 2), 'id' => $model['id_string']]);
}], ['header' => 'Название', 'content' => function ($model, $key, $index, $column) {
    return Html::a($model['header'], ['page/chenneling_item', 'year' => substr($model['date'], 0, 4), 'month' => substr($model['date'], 5, 2), 'day' => substr($model['date'], 8, 2), 'id' => $model['id_string']]);
}]]]);
?>
</div>
Esempio n. 3
0
 /**
  * AJAX
  * Функция для обработки AutoComplete
  *
  * REQUEST:
  * - term - string - строка запроса
  */
 public function actionChenneling_search_ajax()
 {
     $term = self::getParam('term');
     if (is_null($term)) {
         return self::jsonError('Нет обязательного параметра term');
     }
     $rows = Chenneling::query(['like', 'header', $term])->select('id, header as value, date, id_string')->limit(10)->all();
     return self::jsonSuccess($rows);
 }
Esempio n. 4
0
    ?>
                    <li><a href="<?php 
    echo Url::to(['admin/chenneling_list_add_from_page', 'page' => $item['name']]);
    ?>
">Добавить
                            с <?php 
    echo $item['title'];
    ?>
</a></li>
                <?php 
}
?>
            </ul>
        </div>
        <?php 
echo \yii\grid\GridView::widget(['dataProvider' => new \yii\data\ActiveDataProvider(['query' => \app\models\Chenneling::query()->orderBy(['date_insert' => SORT_DESC]), 'pagination' => ['pageSize' => 20]]), 'tableOptions' => ['class' => 'table table-striped table-hover'], 'rowOptions' => function ($item) {
    return ['data' => ['id' => $item['id']], 'role' => 'button', 'class' => 'rowTable'];
}, 'columns' => ['id', ['header' => 'Картинка', 'content' => function ($item) {
    $i = ArrayHelper::getValue($item, 'img', '');
    if ($i == '') {
        return '';
    }
    return Html::img($i, ['class' => "thumbnail", 'width' => 80]);
}], 'header:text:Название', ['header' => 'Дата', 'content' => function ($item) {
    return Html::tag('span', GsssHtml::dateString($item['date_insert']), ['style' => 'font-size: 80%; margin-bottom:10px; color: #c0c0c0;']);
}], ['header' => 'Удалить', 'content' => function ($item) {
    return Html::button('Удалить', ['class' => 'btn btn-danger btn-xs buttonDelete', 'data' => ['id' => $item['id']]]);
}], ['header' => 'Рассылка', 'content' => function ($item) {
    if (ArrayHelper::getValue($item, 'is_added_site_update', 0) == 1) {
        return '';
    }