Beispiel #1
0
 public function insert($fieldsCols = null)
 {
     $row = parent::insert(['beforeInsert' => function ($fields) {
         $fields['date_insert'] = gmdate('YmdHis');
         $fields['id_string'] = Str::rus2translit($fields['header']);
         $fields['date'] = gmdate('Y-m-d');
         return $fields;
     }]);
     $item = new \app\models\Article($row);
     $fields = [];
     if ($this->is_add_image) {
         $fields = ['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')];
     }
     if ($item->getField('description', '') == '') {
         $fields['description'] = GsssHtml::getMiniText($item->getField('content', ''));
     }
     $item->update($fields);
     return $item;
 }
Beispiel #2
0
?>
</div>

<!-- Begin Blog Grid -->
<div class="blog-wrap">
    <!-- Begin Blog -->
    <div class="blog-grid">

        <?php 
foreach ($list as $item) {
    ?>
            <?php 
    $article = new \app\models\Article($item);
    ?>
            <?php 
    if ($article->getField('video')) {
        ?>
                <div class="post format-video box">
                    <div class="video frame">
                        <iframe width="100%" height="281" src="<?php 
        echo $article->getField('video');
        ?>
"
                                frameborder="0" allowfullscreen></iframe>
                    </div>
                    <h2 class="title"><a href="<?php 
        echo $article->getLink();
        ?>
"><?php 
        echo $item['header'];
        ?>