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'))]);
     }
 }
Exemple #2
0
 public function update($fieldsCols = null)
 {
     return parent::update(['beforeUpdate' => function ($fields) {
         if ($fields['description'] == '') {
             $fields['description'] = GsssHtml::getMiniText($fields['content']);
         }
         return $fields;
     }]);
 }
Exemple #3
0
 /**
  * @param bool $isUseContent true - будет использовано поле `content` в случае отсутствия
  *
  * @return string
  */
 public function getDescription($isUseContent = false)
 {
     if ($isUseContent) {
         if ($this->getValue('description') == '') {
             return GsssHtml::getMiniText($this->getContent());
         }
     }
     return $this->getField('description');
 }
Exemple #4
0
 public function update($fieldsCols = null)
 {
     return parent::update(['beforeUpdate' => function ($fields, \app\models\Form\Blog $model) {
         if ($fields['description'] == '') {
             $fields['description'] = GsssHtml::getMiniText($fields['content']);
         }
         if ($model->is_add_image) {
             $fields['content'] = Html::tag('p', Html::img(\cs\Widget\FileUpload2\FileUpload::getOriginal($model->image), ['class' => 'thumbnail', 'style' => 'width:100%;', 'alt' => $fields['header']])) . $fields['content'];
         }
         return $fields;
     }]);
 }
Exemple #5
0
 public function update($fieldsCols = null)
 {
     $fields = parent::update(['beforeUpdate' => function ($fields, \app\models\Form\Article $model) {
         if ($fields['description'] == '') {
             $fields['description'] = GsssHtml::getMiniText($fields['content']);
         }
     }]);
     $item = \app\models\Article::find($this->id);
     if ($this->is_add_image) {
         $content = Html::tag('p', Html::img(\cs\Widget\FileUpload2\FileUpload::getOriginal($item->getImage()), ['class' => 'thumbnail', 'style' => 'width:100%;', 'alt' => $item->getField('header')])) . $item->getField('content');
         $item->update(['content' => $content]);
     }
 }
Exemple #6
0
 public function update($fieldsCols = null)
 {
     parent::update();
     $item = \app\models\Picture::find($this->id);
     $fields = [];
     if ($item->getField('description') == '') {
         $fields['description'] = GsssHtml::getMiniText($item->getField('content'));
     }
     if (count($fields) > 0) {
         $item->update($fields);
     }
     return true;
 }
Exemple #7
0
<?php

/**
 * @var $item \app\models\Article
 * @var $user \app\models\user
 */
use yii\helpers\Html;
use app\services\GsssHtml;
$content = $item->getField('description', '');
if ($content == '') {
    $content = GsssHtml::getMiniText($item->getField('content'));
}
?>

На инструмент Вознесения было добавлена следующая статья:
<?php 
echo $item->getName();
?>

Краткое содержание:
<?php 
echo $content;
?>

Читать далее по ссылке:
<?php 
echo $item->getLink(true);
Exemple #8
0
 /**
  * @return string
  */
 public function getDescription()
 {
     return GsssHtml::getMiniText($this->getContent());
 }
Exemple #9
0
<?php

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\captcha\Captcha;
use app\models\UnionCategory;
use yii\db\Query;
/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model cs\base\BaseForm */
$this->title = \app\services\GsssHtml::getMiniText($model->target, 30);
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="container">
    <div class="page-header">
        <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    </div>

    <?php 
if (Yii::$app->session->hasFlash('contactFormSubmitted')) {
    ?>

        <div class="alert alert-success">
            Успешно обновлено.
        </div>

    <?php 
} else {
Exemple #10
0
                            <img src="<?php 
        echo $item['image'];
        ?>
" class="thumbnail" width="80">
                        <?php 
    }
    ?>
                    </div>

                    <div class="col-lg-9">
                        <?php 
    echo Html::tag('span', GsssHtml::dateString($item['date']), ['style' => 'font-size: 80%; margin-bottom:10px; color: #c0c0c0;']);
    ?>
                        <br>
                        <?php 
    echo GsssHtml::getMiniText($item['content']);
    ?>
                        <br>
                        <br>
                        <button class="btn btn-danger btn-xs buttonDelete" data-id="<?php 
    echo $item['id'];
    ?>
">Удалить</button>
                        <?php 
    if (\yii\helpers\ArrayHelper::getValue($item, 'is_added_site_update', 0) == 0) {
        ?>
                            <button class="btn btn-success btn-xs buttonAddSiteUpdate" data-id="<?php 
        echo $item['id'];
        ?>
">Сделать рассылку</button>
                        <?php 
Exemple #11
0
?>

<div class="container">
    <div class="page-header">
        <h1>Смета</h1>
    </div>

    <?php 
echo \yii\grid\GridView::widget(['dataProvider' => new \yii\data\ActiveDataProvider(['query' => \app\models\Smeta::query()->orderBy(['date_insert' => SORT_DESC]), 'pagination' => ['pageSize' => 20]]), 'columns' => ['id', ['header' => 'Назначение', 'content' => function ($item) {
    return Html::a(GsssHtml::getMiniText($item['target'], 70), ['admin_smeta/edit', 'id' => $item['id']]);
}], ['header' => 'Подарок', 'content' => function ($item) {
    return Html::a(GsssHtml::getMiniText($item['present'], 70), ['admin_smeta/edit', 'id' => $item['id']]);
}], ['header' => 'Цена', 'content' => function ($item) {
    return Yii::$app->formatter->asDecimal($item['price']);
}], ['header' => 'Счет', 'content' => function ($item) {
    return GsssHtml::getMiniText($item['bill'], 70);
}], ['header' => 'Удалить', 'content' => function ($item) {
    return Html::button('Удалить', ['class' => 'btn btn-danger btn-xs buttonDelete', 'data-id' => $item['id']]);
}]]]);
?>



    <div class="col-lg-6">
        <div class="row">
            <!-- Split button -->
            <div class="btn-group">
                <a href="<?php 
echo Url::to(['admin_smeta/add']);
?>
" class="btn btn-default">Добавить</a>
Exemple #12
0
    echo $item['img'];
    ?>
"
                        style="width: 100%; display: block;"
                        > </a>

                <div class="caption">
                    <h3>
                        <?php 
    echo $item['header'];
    ?>
                    </h3>

                    <p>
                        <?php 
    echo \app\services\GsssHtml::getMiniText($item['content']);
    ?>
                    </p>

                    <!--                                <p>-->
                    <!--                                    <a href="#"-->
                    <!--                                       class="btn btn-default"-->
                    <!--                                       role="button"-->
                    <!--                                        style="width: 100%"-->
                    <!--                                        >Button</a>-->
                    <!--                                </p>-->
                </div>
            </div>

        <?php 
}
Exemple #13
0
        <?php 
echo $item->getField('content');
?>

    </div>
    <!-- End Post -->


</div>

<div class="sidebar box">
    <div class="sidebox widget">

        <a href="/"><img src="/images/home1.png" width="20"/><br><br></a>
        <h3 class="widget-title"> Поиск</h3>
        <form class="searchform" method="get" action="/search">
            <input type="text" name="term" value="Введите слово ..." onFocus="this.value=''"
                   onBlur="this.value='Введите слово ...'"/>
        </form>
    </div>
</div>

<div class="clear"></div>

<div class="intro">
</div>

<?php 
echo $this->render('../blocks/share', ['url' => \yii\helpers\Url::current([], true), 'image' => \cs\Widget\FileUpload2\FileUpload::getOriginal($item->getImage()), 'title' => $this->title, 'description' => \app\services\GsssHtml::getMiniText($item->getField('content'))]);