public function api_get($id_slug) { if (($menu = $this->findText($id_slug)) === null) { return $this->notFound($id_slug); } return LIVE_EDIT ? API::liveEdit($menu['label'], Url::to(['/admin/menu/a/edit/', 'id' => $menu['menu_id']])) : $menu['label']; }
public function api_get($id_slug) { if (($text = $this->findText($id_slug)) === null) { return $this->notFound($id_slug); } return LIVE_EDIT ? API::liveEdit($text['text'], Url::to(['/admin/text/a/edit/', 'id' => $text['text_id']])) : $text['text']; }
public function api_widget($width, $height, $clientOptions = []) { if (!count($this->_items)) { return LIVE_EDIT ? Html::a(Yii::t('easyii/carousel/api', 'Create carousel'), ['/admin/carousel/a/create'], ['target' => '_blank']) : ''; } if (count($clientOptions)) { $this->clientOptions = array_merge($this->clientOptions, $clientOptions); } $items = []; foreach ($this->_items as $item) { $temp = ['content' => Html::img($item->thumb($width, $height)), 'caption' => '']; if ($item->link) { $temp['content'] = Html::a($temp['content'], $item->link); } if ($item->title) { $temp['caption'] .= '<h3>' . $item->title . '</h3>'; } if ($item->text) { $temp['caption'] .= '<p>' . $item->text . '</p>'; } $items[] = $temp; } $widget = \yii\bootstrap\Carousel::widget(['options' => ['class' => 'slide'], 'clientOptions' => $this->clientOptions, 'items' => $items]); return LIVE_EDIT ? API::liveEdit($widget, Url::to(['/admin/carousel']), 'div') : $widget; }
public function getText() { if ($this->model->isNewRecord) { return $this->createLink; } else { return LIVE_EDIT ? API::liveEdit($this->model->text, $this->editLink, 'div') : $this->model->text; } }
public function getUrl() { if ($this->model->isNewRecord) { return $this->createLink; } else { return LIVE_EDIT ? API::liveEdit($this->model->url, $this->editLink) : $this->model->url; } }
public function init() { parent::init(); $texts = Data::cache(TextModel::CACHE_KEY, 3600, function () { return TextModel::find()->asArray()->all(); }); foreach ($texts as $text) { $this->_texts[$text['text_id']] = $this->parseText($text); } }
public function init() { parent::init(); $data = Data::cache(CarouselModel::CACHE_KEY, 3600, function () { return CarouselModel::find()->status(CarouselModel::STATUS_ON)->sort()->asArray()->all(); }); foreach ($data as $item) { $temp = ['content' => '<img src="' . $item['image'] . '"/>', 'caption' => '']; if ($item['title']) { $temp['caption'] .= '<h3>' . $item['title'] . '</h3>'; } if ($item['text']) { $temp['caption'] .= '<p>' . $item['text'] . '</p>'; } $this->_items[] = $temp; } }
public function getText() { return LIVE_EDIT ? API::liveEdit($this->model->text, $this->editLink, 'div') : $this->model->text; }
public function box($width, $height) { $img = Html::img($this->thumb($width, $height)); $a = Html::a($img, $this->image, ['class' => 'easyii-box', 'rel' => 'album-' . ($this->rel ? $this->rel : $this->model->item_id), 'title' => $this->description]); return LIVE_EDIT ? API::liveEdit($a, $this->editLink) : $a; }
public function getAnswer() { return LIVE_EDIT ? API::liveEdit($this->model->answer, $this->editLink, 'div') : $this->model->answer; }
public function getTitle() { return LIVE_EDIT ? API::liveEdit($this->model->title, $this->editLink) : $this->model->title; }
public function getDescription() { return LIVE_EDIT ? API::liveEdit($this->model->description, $this->editLink, 'div') : $this->model->description; }
public function box($width, $height, array $options = []) { $img = Html::img($this->thumb($width, $height)); $a = Html::a($img, $this->image, ['class' => 'easyii-box', 'rel' => 'catalog-' . $this->model->item_id, 'title' => $this->description]); return LIVE_EDIT ? API::liveEdit($a, $this->editLink) : $a; }
public function box($width, $height) { $img = Html::img($this->thumb($width, $height), ['style' => 'margin-bottom:5px;']); $a = Html::a($img, $this->image, ['class' => 'easyii-box', 'rel' => 'article-' . $this->model->item_id, 'title' => $this->description]); return LIVE_EDIT ? API::liveEdit($a, $this->editLink) : $a; }