protected function getImages() { $images = []; $imagesCount = count($this->_gallery->images); $limit = ($imagesCount >= 4 ? 4 : $imagesCount) - 1; for ($i = 0; $i <= $limit; ++$i) { $imageModel = $this->_gallery->images[$i]; $images[] = DisplayImage::widget(['width' => \Yii::$app->params['galleryLinkImageSize'], 'height' => \Yii::$app->params['galleryLinkImageSize'], 'options' => ['class' => 'responsive-img', 'title' => $imageModel->title], 'category' => 'all', 'image' => $imageModel->filename]); } return $images; }
?> </div> <div id="image-thumbnail"<?php echo $model->imageFilename ? '' : 'style="display: none;"'; ?> > <strong><?php echo Yii::t('back', 'Image for perex'); ?> </strong> <p> <?php echo Html::a('<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>', '#', ['class' => 'showBrowser']); ?> <?php echo DisplayImage::widget(['width' => 100, 'height' => 100, 'image' => $model->imageFilename, 'category' => 'all']); ?> </p> <?php if ($model->imageFilename) { echo $form->field($model, 'imageFilename')->hiddenInput()->label(false); } ?> </div> <?php echo $form->field($model, 'perex')->widget(CKEditor::className(), ['options' => ['rows' => 4], 'preset' => 'custom', 'clientOptions' => ['height' => 200, 'toolbarGroups' => [['name' => 'clipboard', 'groups' => ['mode', 'undo', 'selection', 'clipboard', 'doctools']], ['name' => 'editing', 'groups' => ['tools']], ['name' => 'basicstyles', 'groups' => ['basicstyles', 'cleanup']], '/', ['name' => 'paragraph', 'groups' => ['list', 'indent', 'align']], ['name' => 'links'], ['name' => 'insert']], 'removeButtons' => 'Templates,Smiley,Iframe,ShowBlocks,Image,Flash,PageBreak,Anchor,Gallery,Sound,Youtube,Poll,Article']]); ?> <?php echo $form->field($model, 'description')->widget(CKEditor::className(), ['options' => ['rows' => 6], 'preset' => 'custom', 'clientOptions' => ['height' => 400, 'toolbarGroups' => [['name' => 'clipboard', 'groups' => ['mode', 'undo', 'selection', 'clipboard', 'doctools']], ['name' => 'styles'], ['name' => 'editing', 'groups' => ['tools']], ['name' => 'basicstyles', 'groups' => ['basicstyles', 'cleanup']], '/', ['name' => 'paragraph', 'groups' => ['list', 'indent', 'align', 'blocks']], ['name' => 'links'], ['name' => 'insert'], ['name' => 'others']], 'removeButtons' => 'Templates,CreateDiv,Styles,Font,FontSize,Smiley,Iframe,Flash,PageBreak,Article']]);
<?php /* @var $this yii\web\View */ /* @var $menuContent \frontend\models\MenuContent */ /* @var $page \common\models\Page */ use frontend\components\CategoryArticlesList; use frontend\components\InvitationsList; use frontend\utilities\FrontEndHelper; use pavlinter\display\DisplayImage; $this->title = $menuContent->title; $this->params['menuContent'] = $menuContent; $page = $menuContent->content; /** @noinspection PhpUndefinedFieldInspection */ $this->context->layout = 'page-content'; if ($page->image) { echo DisplayImage::widget(['options' => ['class' => 'responsive-img', 'title' => $menuContent->title], 'category' => 'all', 'image' => $page->image->filename]); } if ($page->perex) { echo '<div class="perex">' . $page->perex . '</div>'; } if ($page->description) { echo '<div class="description" style="margin-bottom: 2rem">'; echo FrontEndHelper::parseContent($page->description); echo '</div>'; } echo InvitationsList::widget(['categoryId' => Yii::$app->params[Yii::$app->language]['hallInvitationsCategoryId'], 'viewName' => 'invitations', 'wordsCount' => 30, 'withImage' => true, 'maxImageWidth' => 200, 'columnsCount' => 1, 'imageEdgeRatio' => 0.5, 'noMessage' => true]); echo CategoryArticlesList::widget(['categoryId' => Yii::$app->params[Yii::$app->language]['hallActualitiesCategoryId'], 'viewName' => 'actualities', 'wordsCount' => 50, 'withImage' => true, 'maxImageWidth' => 200, 'imageEdgeRatio' => 0.5, 'noMessage' => true]);
foreach ($items as $item) { $articleUrlParts = ['page/article', 'ida' => $item->id, 'article' => Inflector::slug(strip_tags($item->title)), 'web' => \Yii::$app->request->get('web'), 'language' => \Yii::$app->request->get('language')]; if (!$menuUrlParts) { $menuUrlParts = ArticleContent::getMenuUrlParts($item->id); } $url = ArrayHelper::merge($articleUrlParts, $menuUrlParts); $test = $i % $columnsCount; if ($test == 0) { echo '<div class="row">'; } echo '<div class="col s12' . ($columnsCount == 2 ? ' l6' : ($columnsCount == 3 ? ' l4' : '')) . '">'; echo '<div class="row">'; if ($withImage) { echo '<div class="col s12 l1">'; if (isset($item->image)) { $image = DisplayImage::widget(['width' => $maxImageSize['width'], 'height' => $maxImageSize['height'], 'options' => ['class' => 'responsive-img hoverable', 'title' => $item->title], 'category' => 'all', 'image' => $item->image->filename]); echo Html::a($image, $url); } echo '</div>'; echo '<div class="col s12 l11">'; } else { echo '<div class="col s12">'; } $dateTimeString = '<span class="subheader">( * ' . Yii::$app->formatter->asDate($item->content_date, 'dd.MM.y'); if ($item->content_end_date) { $dateTimeString .= ' , † ' . Yii::$app->formatter->asDate($item->content_end_date, 'dd.MM.y'); } $dateTimeString .= ' )</span>'; echo '<h4>' . $dateTimeString . Html::a($item->title, $url) . '</h4>'; $text = strip_tags($item->perex, 'a, strong, b, em, i'); echo '<p>';
use dosamigos\google\maps\LatLng; use dosamigos\google\maps\overlays\Marker; use frontend\utilities\FrontEndHelper; use frontend\widgets\GoogleMap; use yii\helpers\Html; $page = $content->content; $data = [['lat' => 49.083191, 'lng' => 15.422774], ['lat' => 49.082224, 'lng' => 15.433216], ['lat' => 49.084096, 'lng' => 15.434793], ['lat' => 49.081995, 'lng' => 15.433613], ['lat' => 49.083391, 'lng' => 15.426961], ['lat' => 49.082153, 'lng' => 15.434847], ['lat' => 49.082818, 'lng' => 15.423321], ['lat' => 49.080432, 'lng' => 15.419617], ['lat' => 49.079634, 'lng' => 15.441433], ['lat' => 49.074403, 'lng' => 15.442875], ['lat' => 49.077979, 'lng' => 15.430677], ['lat' => 49.084297, 'lng' => 15.478046], ['lat' => 49.074553, 'lng' => 15.460972], ['lat' => 49.093647, 'lng' => 15.395012], ['lat' => 49.081998, 'lng' => 15.383993], ['lat' => 49.059376, 'lng' => 15.43991], ['lat' => 49.051084, 'lng' => 15.462888], ['lat' => 49.086869, 'lng' => 15.357986], ['lat' => 49.107628, 'lng' => 15.458102], ['lat' => 49.123202, 'lng' => 15.41228], ['lat' => 49.119018, 'lng' => 15.450244]]; $center = new LatLng(['lat' => 49.082224, 'lng' => 15.433216]); $map = new GoogleMap(['width' => 640, 'height' => 800, 'center' => $center, 'zoom' => 13]); foreach ($data as $item) { $coord = new LatLng(['lat' => $item['lat'], 'lng' => $item['lng']]); $marker = new Marker(['position' => $coord]); $map->addOverlay($marker); } echo '<body>'; echo '<h1>' . $content->title . '</h1>'; echo '<div class="row"><div class="col s12">'; echo Html::img($map->getStaticMapUrl()); echo '</div></div>'; if ($page->image) { echo \pavlinter\display\DisplayImage::widget(['category' => 'all', 'image' => $page->image->filename]); } if ($page->perex) { echo '<div class="perex">' . $page->perex . '</div>'; } if ($page->description) { echo '<div class="description">'; echo FrontEndHelper::parsePdfContent($page->description); echo '</div>'; } echo '</body>';
<?php /* @var $this yii\web\View */ /* @var $menuContent \frontend\models\MenuContent */ /* @var $articleContent \frontend\models\ArticleContent */ use frontend\utilities\FrontEndHelper; $this->title = $menuContent->title . ' - ' . $articleContent->title; $this->params['menuContent'] = $menuContent; $this->params['articleContent'] = $articleContent; /** @noinspection PhpUndefinedFieldInspection */ $this->context->layout = 'article-content'; if ($articleContent->image) { echo \pavlinter\display\DisplayImage::widget(['width' => 200, 'height' => 200, 'options' => ['class' => 'image', 'title' => $articleContent->image->title], 'category' => 'all', 'image' => $articleContent->image->filename]); } if ($articleContent->perex) { echo '<div class="perex">' . $articleContent->perex . '</div>'; } if ($articleContent->description) { echo '<div class="description">'; echo FrontEndHelper::parseContent($articleContent->description); echo '</div>'; }
use dosamigos\google\maps\overlays\Marker; use frontend\utilities\FrontEndHelper; use frontend\widgets\GoogleMap; use pavlinter\display\DisplayImage; use yii\helpers\Html; $page = $content->content; $data = [['lat' => 49.083191, 'lng' => 15.422774]]; $center = new LatLng(['lat' => 49.083191, 'lng' => 15.422774]); $map = new GoogleMap(['width' => 640, 'height' => 400, 'center' => $center, 'zoom' => 16]); foreach ($data as $item) { $coord = new LatLng(['lat' => $item['lat'], 'lng' => $item['lng']]); $marker = new Marker(['position' => $coord]); $map->addOverlay($marker); } echo '<body>'; echo '<h1>' . $content->title . '</h1>'; echo '<div class="row"><div class="col s12">'; echo Html::img($map->getStaticMapUrl()); echo '</div></div>'; if ($page->image) { echo DisplayImage::widget(['category' => 'all', 'image' => $page->image->filename]); } if ($page->perex) { echo '<div class="perex">' . $page->perex . '</div>'; } if ($page->description) { echo '<div class="description">'; echo FrontEndHelper::parsePdfContent($page->description); echo '</div>'; } echo '</body>';
<?php /* @var $this yii\web\View */ /* @var $content \frontend\models\MenuContent */ /* @var $page \common\models\Page */ use frontend\components\Forecast; use frontend\utilities\FrontEndHelper; use pavlinter\display\DisplayImage; $page = $content->content; echo '<body>'; echo '<h1>' . $content->title . '</h1>'; if ($page->image) { echo DisplayImage::widget(['width' => 200, 'height' => 200, 'category' => 'all', 'image' => $page->image->filename]); } if ($page->perex) { echo '<div class="perex">' . $page->perex . '</div>'; } if ($page->description) { echo '<div class="description">'; echo FrontEndHelper::parsePdfContent($page->description); echo '</div>'; } echo Forecast::widget(['viewName' => 'full2ColumnsForecast']); echo '</body>';
<?php /* @var $this yii\web\View */ /* @var $gallery Gallery */ use common\models\Gallery; use frontend\utilities\FrontEndHelper; use pavlinter\display\DisplayImage; use yii\helpers\Html; $this->title = Yii::$app->name . ': ' . $gallery->title; $this->params['title'] = $gallery->title; $this->params['description'] = $gallery->description; echo '<div class="row">'; echo '<div id="links" class="col s12">'; foreach ($gallery->imageGalleries as $imageGallery) { /** @var \common\models\Image $image */ $image = $imageGallery->image; $title = $image->getFileTitle(FrontEndHelper::getLanguageIdFromAcronym()); $thumbnail = DisplayImage::widget(['width' => \Yii::$app->params['galleryThumbnailSize'], 'height' => \Yii::$app->params['galleryThumbnailSize'], 'options' => ['class' => 'img-responsive hoverable', 'title' => $title], 'category' => 'all', 'image' => $image->filename]); echo Html::a($thumbnail, '@web/admin/' . Yii::$app->params['imageUploadDir'] . $image->filename, ['title' => $title, 'data-description' => $image->getFileDescription(FrontEndHelper::getLanguageIdFromAcronym()), 'data-gallery' => true]); } echo '</div>'; echo '</div>';
/** * Renders photo with remove btn * @param $photo * @return string */ private function renderPhotoWithControl($photo) { $html = Html::a('<span class="glyphicon glyphicon-remove" title="' . Yii::t('back', 'remove photo from gallery') . '"></span>', ['remove-photo', 'gid' => $this->item_id, 'pid' => $photo->id]); $html .= DisplayImage::widget(['width' => 100, 'height' => 100, 'image' => $photo->filename, 'category' => 'all']); return $html; }
<?php /* @var $article \common\models\Article */ /* @var $type string */ use pavlinter\display\DisplayImage; use yii\helpers\Html; use yii\helpers\Url; $url = str_replace('admin/', '', Url::to(['site/content', 'id' => $article->id], true)); $image = ''; if ($article->image) { $image = DisplayImage::widget(['width' => Yii::$app->params['newsletterArticleImage']['width'], 'height' => Yii::$app->params['newsletterArticleImage']['height'], 'category' => 'all', 'image' => $article->image->filename, 'absolutePath' => true]); } ?> <tr> <td> <table style="width: 100%; background-color: <?php echo $type == 'main' ? '#C1E6F6;' : 'whitesmoke;'; ?> padding: 15px 15px 15px 15px; margin: 15px 0 15px 0;"> <tr> <?php if ($image) { ?> <td style="width: 30%; vertical-align: top; padding-right: 15px;"><?php echo Html::a($image, $url); ?> </td> <?php } ?> <td style="vertical-align: top;">
/** * @param $id_row * @param $category * @param array $widget * @param array $options * @return array */ public static function getImages($id_row, $category, $widget = [], $options = []) { $options['isDisplayImagePath'] = true; $images = static::getOriginalImages($id_row, $category, $options); $displayImages = []; if (!isset($widget['returnSrc'])) { $widget['returnSrc'] = true; } $widget['category'] = $category; if ($id_row) { $widget['id_row'] = $id_row; } foreach ($images as $k => $image) { if (is_array($image)) { $widget['image'] = $image['image']; $image['display'] = DisplayImage::widget($widget); if ($image['image'] === null) { $image['image'] = $image['display']; } if ($image['originImage'] === null) { $image['originImage'] = $image['display']; } $displayImages[$k] = $image; } else { $widget['image'] = $image; $displayImages[$k] = DisplayImage::widget($widget); } } return $displayImages; }