<!-- Left col --> <div class="col-lg-6"> <!-- Custom tabs (Charts with tabs)--> <div class="box box-info"> <div class="box-header with-border"> <h3 class="box-title">Top URI Request</h3> </div><!-- /.box-header --> <div class="box-body"> <div class="row"> <div class="col-md-11"> <?php Pjax::begin(); ?> <?php echo GridView::widget(['dataProvider' => $dataProviderApi, 'filterModel' => $searchModelApi, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'uri_access', 'value' => function ($model) { return BaseStringHelper::truncate($model->uri_access, 45, ' ... ', null, true); }], 'count']]); ?> <?php Pjax::end(); ?> </div> </div><!-- /.row --> </div><!-- /.box-body --> </div><!-- /.box --> </div><!-- /.Left col --> <div class="col-lg-6"> <!-- Custom tabs (Charts with tabs)--> <div class="box box-info"> <div class="box-header with-border"> <h3 class="box-title">Used IP Address</h3>
public function beforeSave($insert) { if ($this->isNewRecord) { //generate & upload $this->string = substr(uniqid('img'), 0, 12); //imgRandomString $this->image = UploadedFile::getInstance($this, 'img'); $this->filename = 'static/images/' . $this->string . '.' . $this->image->extension; $this->image->saveAs($this->filename); $this->text_preview = BaseStringHelper::truncate($this->text, 250, '...'); //save $this->img = '/' . $this->filename; } else { $this->image = UploadedFile::getInstance($this, 'img'); if ($this->image) { $this->image->saveAs(substr($this->img, 1)); } } return parent::beforeSave($insert); }
<?php foreach ($nodes as $node) { ?> <div class="col-lg-3 col-md-3 col-xs-12 col-sm-3"> <div class="blog_inner"> <div class="blog-img blog-l"> <?php echo \yii\helpers\Html::a(Yii::$app->imageCache->thumb($node->image, '600x400', ['class' => 'img-responsive']), ['review/view', 'slug' => $node->slug]); ?> </div> <h2><?php echo \yii\helpers\Html::a($node->title, ['review/view', 'slug' => $node->slug], ['class' => 'info']); ?> </h2> <div class="post-date"><i class="fa fa-calendar"></i> <?php echo date('d-m-Y', $node->updated_at); ?> </div> <p><?php echo \yii\helpers\BaseStringHelper::truncateWords(strip_tags($node->content), 25); ?> </p> </div> </div> <?php } ?> </div> </div> </section>
* Панель управления книгами. */ use yii\helpers\Html; $this->title = 'CRUD Author'; ?> <h1>Управление авторами</h1> <p> <a class="btn btn-primary" href="<?php echo yii\helpers\Url::to(['back-author/create']); ?> ">Добавить</a> </p> <hr> <?php echo yii\grid\GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $modelAuthor, 'columns' => ['id', 'name', ['attribute' => 'description', 'value' => function ($modelAuthor) { /** @var app\models\Author $modelAuthor */ return \yii\helpers\BaseStringHelper::truncateWords($modelAuthor->description, 10); }], ['attribute' => 'photo', 'format' => 'html', 'value' => function ($modelAuthor) { /** @var app\models\Author $modelAuthor */ return $modelAuthor->photo ? Html::img($modelAuthor->photo) : ''; }], ['format' => 'html', 'label' => 'Опции', 'value' => function ($modelAuthor) { /** @var app\models\Author $modelAuthor */ return Html::a('Просмотреть', ['back-author/view', 'id' => $modelAuthor->id], ['class' => 'btn btn-default']) . ' ' . Html::a('Изменить', ['back-author/update', 'id' => $modelAuthor->id], ['class' => 'btn btn-default']) . ' ' . Html::a('Удалить', ['back-author/delete', 'id' => $modelAuthor->id], ['class' => 'btn btn-danger']); }]]]); ?>
echo $category_title; ?> </h1> <?php foreach ($nodes as $node) { ?> <div class="col-lg-25 partner-item"> <?php echo HTML::a(Yii::$app->imageCache->thumb($node->image, 'post', ['class' => 'img-responsive']), ['post/view', 'slug' => $node->slug]); ?> <h4 class="partner-item-heading"><?php echo HTML::a($node->title, ['post/view', 'slug' => $node->slug]); ?> </h4> <?php echo BaseStringHelper::truncateWords($node->content, 50); ?> </div> <?php } ?> <div class="pagi"> <?php echo \yii\widgets\LinkPager::widget(['pagination' => $pagination, 'options' => ['class' => 'pagination small']]); ?> </div> </div> </div>
<?php use yii\helpers\Html; use yii\helpers\BaseStringHelper; ?> <li><?php echo Html::a(BaseStringHelper::truncate(strip_tags($itemValue['name']), $itemParams['trim'], $itemParams['trimEnding']), $itemParams['controller'] . $itemValue['slug']); ?> </li>
echo \yii\helpers\BaseStringHelper::truncateWords($news->title, $titleLength); ?> </h4> <div class="image-container"> <img class="image" alt="<?php echo $news->title; ?> " src="<?php echo $news->imagePreview; ?> "> </div> </a> <p class="nspText longText"> <?php echo \yii\helpers\BaseStringHelper::truncateWords(strip_tags($news->getTextPreview(0), '<a></a>'), $textLength); ?> <a class="readon inline" href="<?php echo $news->fullLink; ?> ">Подробнее</a> </p> </div> </div> </div> </div> </div> </div> </div> <?php }
<h2> <a href="<?php echo $urlHead . $item->slug; ?> "><?php echo $item->name; ?> </a> </h2> <hr> <?php echo $imageBlock; ?> <p><?php echo BaseStringHelper::truncate(strip_tags($item->text), $textTruncate, "..."); ?> </p> <a class="<?php echo $classMore; ?> " href="<?php echo $urlHead . $item->slug; ?> "><?php echo $captionMore; ?> </a> <hr>
</div> <!-- /.row --> <?php $model = new Content(); // $items = $model->bySection(5, $perPage); $lenghtLimit = 720; $out = ''; if (!empty($models)) { foreach ($models as $item) { $images = ContentHelper::fetchImages($item['text']); $cleanContent = ContentHelper::cleanImages($item['text']); $header = '<h3><a href="/info/' . $item['slug'] . '" > ' . $item['name'] . '</a></h3>'; $buttonMore = ''; if (strlen($cleanContent) >= $lenghtLimit) { $buttonMore = '<a class="btn btn-info" href="/events/' . $item['slug'] . '" style="float:right;" ><i>Докладніше</i></a>'; $cleanContent = BaseStringHelper::truncate(strip_tags($cleanContent), $lenghtLimit, "..."); } $content = '<p>' . $cleanContent . '</p>'; if (!$images['count']) { $item = '<div class="col-md-12">' . $header . $content . $buttonMore . '</div>'; } else { $item = '<div class="col-md-5"><a href="/info/' . $item['slug'] . '"> <img class="img-responsive img-hover" src="' . $images['main']['src'] . '" alt="' . $images['main']['alt'] . '"> </a></div><div class="col-md-7">' . $header . $content . $buttonMore . '</div>'; } $out .= '<div class="row">' . $item . '</div><hr>'; } } ?> <?php
<?php use ut8ia\contentmodule\helpers\ContentHelper; use yii\helpers\BaseStringHelper; $images = ContentHelper::fetchImages($item->text); $alt = isset($images['main']['alt']) ? $images['main']['alt'] : $item->name; $image = '<img class="' . $imageClass . '" src="' . $images['main']['src'] . '" alt="' . $alt . '">'; $btClass = 12 / $numInRow; echo '<div class="col-md-' . $btClass . ' img-portfolio"> <a href="' . $urlHead . $item->slug . '">' . $image . '</a> <h3><a href="' . $urlHead . $item->slug . '">' . $item->name . '</a></h3> <p>' . BaseStringHelper::truncate(strip_tags($item->text), $textTruncate, "...") . '</p> </div>';
Pjax::begin(); ?> <div class="box-body"> <!-- Global Search --> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p><?php echo Html::a("Refresh", ['product/index'], ['class' => 'btn btn-md btn-default']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'tableOptions' => ['class' => 'table table-striped table-bordered'], 'columns' => [['attribute' => 'title', 'contentOptions' => ['style' => 'width: 20%;']], ['attribute' => 'description', 'value' => function ($model) { return BaseStringHelper::truncateWords($model->description, 15); }], ['label' => 'Image', 'format' => 'raw', 'value' => function ($model) { return \common\components\Product::getSmallProductImage($model); }], ['attribute' => 'category_id', 'value' => function ($model) { return empty($model->category_id) ? '-' : $model->category->title; }], 'price', ['header' => 'Actions', 'class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {update} {images} {delete}', 'buttons' => ['images' => function ($url, $model, $key) { return Html::a('<span class="glyphicon glyphicon glyphicon-picture" aria-label="Image"></span>', Url::to(['image/index', 'id' => $model->id])); }], 'contentOptions' => ['style' => 'width: 10%;']]]]); ?> </div> <!-- /.box-body --> <?php Pjax::end(); ?>
<?php /** * @var yii\web\View $this * @var app\models\Book $model * @var int $key * @var int $index * @var \yii\widgets\ListView $widget */ use yii\helpers\Html; $title = $model->title; $link = Html::a($title, ['front/view', 'alias' => $model->alias], ['data-pjax' => 0]); $description = \yii\helpers\BaseStringHelper::truncateWords($model->description, 10); $photo = $model->photo ? Html::img($model->photo) : ''; $authors = array_map(function ($modelAuthor) { /** @var app\models\Author $modelAuthor */ return $modelAuthor->name; }, $model->authors); $authors = join(', ', $authors); $tags = array_map(function ($modelTag) { /** @var app\models\Tag $modelTag */ return $modelTag->title; }, $model->tags); $tags = join(', ', $tags); ?> <div class="row"> <div class="col-md-12"> <h3><?php echo $link; ?>
<input type="text" class="form-control"> <span class="input-group-btn"> <button class="btn btn-default" type="button"><i class="fa fa-search"></i></button> </span> </div> </div> <div class="well"> <h4>Інші події</h4> <div class="row"> <div class="col-lg-12"> <ul class="list-unstyled"> <?php if (!empty($latestPosts)) { $str = ''; foreach ($latestPosts as $post) { $str .= '<li>' . Html::a(BaseStringHelper::truncate(strip_tags($post['name']), 40, "..."), '/info/' . $post['slug']) . '</li>'; } echo '<ul>' . $str . '</ul>'; } ?> </li> </ul> </div> </div> <!-- /.row --> </div> </div> </div> <!-- /.row --> <!-- Related Projects Row -->
/** * Overrides parent method with $skipEmpty default value set to true. * @inheritdoc */ public static function explode($string, $delimiter = ',', $trim = true, $skipEmpty = true) { return parent::explode($string, $delimiter, $trim, $skipEmpty); }