public function run() { echo Html::beginTag('div', ['class' => 'input-group']); if (!isset($this->options['class'])) { $this->options['class'] = 'form-control'; } $iconId = 'icon-' . $this->options['id']; if (!isset($this->options['aria-describedby'])) { $this->options['aria-describedby'] = $iconId; } if ($this->hasModel()) { $replace['{input}'] = Html::activeTextInput($this->model, $this->attribute, $this->options); } else { $replace['{input}'] = Html::textInput($this->name, $this->value, $this->options); } if ($this->icon != '') { $replace['{icon}'] = Html::tag('span', Icon::show($this->icon, [], Icon::FA), ['class' => 'input-group-addon', 'id' => $iconId]); } echo strtr($this->template, $replace); echo Html::endTag('div'); $view = $this->getView(); Assets::register($view); $idMaster = $this->hasModel() ? Html::getInputId($this->model, $this->fromField) : $this->fromField; $idSlave = $this->options['id']; $view->registerJs("\n \$('#{$idMaster}').syncTranslit({\n destination: '{$idSlave}',\n type: 'url',\n caseStyle: 'lower',\n urlSeparator: '-'\n });"); }
public function renderItem($message, $options) { echo Html::beginTag('div', $options) . "\n"; echo Html::beginTag('p'); echo $message; echo Html::endTag('p'); echo "\n" . Html::endTag('div'); }
/** * @inheritdoc */ public function run() { Html::addCssClass($this->containerOptions, ['widget' => 'dropdown actions']); $options = $this->containerOptions; $tag = ArrayHelper::remove($options, 'tag', 'div'); $this->registerPlugin('button'); return implode("\n", [Html::beginTag($tag, $options), $this->renderButton(), $this->renderItems(), Html::endTag($tag)]); }
/** * Renders the widget. */ public function run() { // @todo use [[options]] instead of [[containerOptions]] and introduce [[buttonOptions]] before 2.1 release Html::addCssClass($this->containerOptions, ['widget' => 'btn-group']); $options = $this->containerOptions; $tag = ArrayHelper::remove($options, 'tag', 'div'); $this->registerPlugin('button'); return implode("\n", [Html::beginTag($tag, $options), $this->renderButton(), $this->renderDropdown(), Html::endTag($tag)]); }
/** * Renders the widget. */ public function run() { echo "\n" . $this->renderBodyEnd(); echo "\n" . $this->renderFooter(); echo "\n" . Html::endTag('div'); // modal-content echo "\n" . Html::endTag('div'); // modal-dialog $this->registerPlugin('modal'); }
/** * @inheritdoc */ public function run() { parent::run(); // TODO: Change the autogenerated stub if (!empty($this->country)) { $class = 'flag-icon flag-icon-' . $this->country; Html::addCssClass($this->options, $class); if ($this->squared) { Html::addCssClass($this->options, 'flag-icon-squared'); } $this->register(); echo Html::beginTag('span', $this->options); echo Html::endTag('span'); } }
public function torMenu($parent = null, $level = 1) { $links = Links::find()->where(['categories_id' => $this->categories_id, 'parent' => $parent])->orderBy(['seq' => SORT_ASC])->all(); $items = Html::beginTag('ul', ['class' => 'tor-nav-' . $level . ' ' . ($level > 2 ? 'list-unstyled' : 'list-inline')]); /** @var $link Links */ foreach ($links as $link) { $items .= '<li>' . Html::a($link->anchor, $link->url); if ($link->child_exist == 1) { if ($link->level == 1) { $items .= '<span class="caret"></span>' . Html::tag('div', $this->torMenu($link->id, $link->level + 1), ['class' => 'tor-sub-nav']); } else { $items .= $this->torMenu($link->id, $link->level + 1); } } $items .= '</li>'; } $items .= Html::endTag('ul'); return $items; }
/** * @return string render input */ protected function renderInput() { $input = Html::dropDownList($this->name, $this->selected, $this->items, $this->options); // If use form model then $input use active input if ($this->hasModel()) { $input = Html::activeDropDownList($this->model, $this->attribute . '[status]', $this->items, $this->options); } $input .= Html::beginTag('div', ['id' => 'status_payment', 'style' => 'margin-top: 20px;']); foreach ($this->columns as $status => $item) { $input .= Html::beginTag('div', ['class' => 'status_payment', 'id' => 'status_payment_' . $status, 'style' => 'display: none']); foreach ($item as $name => $info) { $placeholder = isset($info['placeholder']) ? $info['placeholder'] : null; $value = isset($info['value']) ? $info['value'] : null; $input .= Html::activeInput('text', $this->model, $this->attribute . '[infomation][' . $name . ']', ['placeholder' => $placeholder, 'class' => $this->options['columnClass'], 'readonly' => '', 'value' => $value, 'style' => 'margin-top: 20px;']); } $input .= Html::endTag('div'); } $input .= Html::endTag('div'); return $input; }
public function run() { $formId = $this->formOptions['id']; $this->getView()->registerCss("#{$formId} button {-webkit-box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.2);box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.2);}"); $form = ActiveForm::begin(array_merge($this->defaultFormOptions, $this->formOptions)); print Html::beginTag('div', ['class' => 'row']); print Html::beginTag('div', ['class' => 'col-xs-12']); print Html::beginTag('div', ['class' => 'input-group']); if ($this->inputWidget) { print $form->field($this->model, $this->attribute, ['template' => '{input}'])->widget($this->inputWidget, $this->inputOptions); } else { print $form->field($this->model, $this->attribute, ['template' => '{input}'])->input($this->inputType, array_merge(['placeholder' => $this->model->getAttributeLabel($this->attribute), 'class' => 'form-control'], $this->inputOptions)); } print Html::beginTag('span', ['class' => 'input-group-btn']); print Html::submitButton(Yii::t('hipanel', 'Search'), ['class' => 'btn btn-flat ' . $this->buttonColor]); print Html::endTag('span'); print Html::endTag('div'); print Html::endTag('div'); print Html::endTag('div'); ActiveForm::end(); }
/** * @param $item * @return string */ public static function settingField($key, $item, $traslateCategory) { $return = ''; switch ($item['type']) { case 'checkbox': $return = parent::beginTag('div', ['class' => 'form-group']) . parent::beginTag('label', ['class' => 'col-md-3 control-label']) . \Yii::t($traslateCategory, $key) . parent::endTag('label') . parent::beginTag('div', ['class' => 'col-md-9']) . parent::hiddenInput('Settings[' . $key . ']', 0) . \oakcms\bootstrapswitch\Switcher::widget(['id' => 'wid' . uniqid(), 'name' => 'Settings[' . $key . ']', 'checked' => $item['value']]) . parent::endTag('div') . parent::endTag('div'); break; case 'textInput': $return = parent::beginTag('div', ['class' => 'form-group']) . parent::beginTag('label', ['class' => 'col-md-3 control-label']) . \Yii::t($traslateCategory, $key) . parent::endTag('label') . parent::beginTag('div', ['class' => 'col-md-9']) . parent::textInput('Settings[' . $key . ']', $item['value'], ['class' => 'form-control']) . parent::endTag('div') . parent::endTag('div'); break; case 'textarea': $return = parent::beginTag('div', ['class' => 'form-group']) . parent::beginTag('label', ['class' => 'col-md-3 control-label']) . \Yii::t($traslateCategory, $key) . parent::endTag('label') . parent::beginTag('div', ['class' => 'col-md-9']) . parent::textarea('Settings[' . $key . ']', $item['value'], ['class' => 'form-control']) . parent::endTag('div') . parent::endTag('div'); break; case 'mediaInput': $return = parent::beginTag('div', ['class' => 'form-group']) . parent::beginTag('label', ['class' => 'col-md-3 control-label']) . \Yii::t($traslateCategory, $key) . parent::endTag('label') . parent::beginTag('div', ['class' => 'col-md-9']) . InputFile::widget(['id' => 'wid' . uniqid(), 'language' => \Yii::$app->language, 'filter' => 'image', 'name' => 'Settings[' . $key . ']', 'value' => $item['value']]) . parent::endTag('div') . parent::endTag('div'); break; default: $return = ''; break; } return $return; }
/** * @inheritdoc */ public function run() { if (!$this->requiresDjax()) { echo Html::endTag('div'); $this->registerClientScript(); return; } $view = $this->getView(); $view->endBody(); // Do not re-send css files as it may override the css files that were loaded after them. // This is a temporary fix for https://github.com/yiisoft/yii2/issues/2310 // It should be removed once djax supports loading only missing css files $view->cssFiles = null; $view->endPage(true); $content = ob_get_clean(); // only need the content enclosed within this widget $response = Yii::$app->getResponse(); $response->clearOutputBuffers(); $response->setStatusCode(200); $response->format = Response::FORMAT_HTML; $response->content = $content; $response->send(); Yii::$app->end(); }
<?php /** * @var $content * @var $options * @var $branding * @var $brandingOptions * */ use yii\bootstrap\Html; ?> <?php echo Html::beginTag('header', $options); ?> <?php echo Html::tag('div', $branding, $brandingOptions); ?> <?php echo $content; ?> <?php echo Html::endTag('header'); ?>
/** * Ham generate template widget khi move vao postion. * @param string $containerId id cua container * @param string $positionId id cua position * @param string $widgetId id cua widget trong mang data cua diy * @param string $id id cua widget * @param array $settings Mang gia tri cua cac option * @return string */ public static function generateTemplateSetting($containerId, $positionId, $widgetId, $id, $settings) { // Get widget info by id $model = self::find()->where(['_id' => $id])->one(); $templateSetting = null; if ($model) { // Template widget $templateSetting .= Html::beginTag('div', ['class' => 'let_widget row', 'data-id' => $id, 'id' => $widgetId]); $templateSetting .= Html::beginTag('div', ['class' => 'btn btn-info']); $templateSetting .= $model->title; $templateSetting .= Html::endTag('div'); // Begin button widget $templateSetting .= Html::beginTag('div', ['class' => 'pull-right']); $templateSetting .= Html::beginTag('div', ['class' => 'btn-group buttonDeleteWidget']); $templateSetting .= Html::button('<i class="glyphicon glyphicon-trash"></i>', ['type' => 'button', 'class' => 'btn btn-danger btn-xs', 'onclick' => 'deleteItems(this, "w", ".let_widget");']); $templateSetting .= Html::button('<i class="glyphicon glyphicon-plus"></i>', ['type' => 'button', 'class' => 'btn btn-success btn-xs', 'onclick' => 'accordionWidget("' . $widgetId . '");']); $templateSetting .= Html::endTag('div'); $templateSetting .= Html::endTag('div'); // End button widget $templateSetting .= Html::beginTag('div', ['class' => 'row setting_widget', 'id' => 'setting_widget_' . $widgetId, 'style' => 'margin-top: 20px; display: none;', 'data-show' => 0, 'data-container' => $containerId, 'data-position' => $positionId, 'data-id' => $widgetId]); // Begin template setting. $templateSetting .= Html::beginForm(NULL, 'POST', ['role' => 'form', 'id' => 'settingForm']); if (!empty($model->setting)) { foreach ($model->setting as $keySetting => $config) { // Kieu hien thi cua setting $type = ArrayHelper::getValue($config, 'type'); // Gia tri cua setting $value = ArrayHelper::getValue($settings, $keySetting); // Danh sach cac gia tri cua setting neu la dropdown, checkbox, radio $items = ArrayHelper::getValue($config, 'items'); $templateSetting .= Html::beginTag('div', ['class' => 'form-group field-setting-key']); $templateSetting .= Html::beginTag('label', ['class' => 'control-label col-sm-2', 'for' => 'DiyWidget-' . $keySetting . '']); $templateSetting .= $keySetting; $templateSetting .= Html::endTag('label'); $templateSetting .= Html::beginTag('div', ['class' => 'col-sm-10']); $templateSetting .= self::getInputByType($type, $templateSetting, $keySetting, $value, $items); $templateSetting .= Html::beginTag('div', ['class' => 'help-block help-block-error help-block m-b-none']) . Html::endTag('div'); $templateSetting .= Html::endTag('div'); // End .col-sm-10 $templateSetting .= Html::endTag('div'); // End .field-setting-key } } // Begin button save $templateSetting .= Html::beginTag('div', ['class' => 'col-sm-12']); $templateSetting .= Html::beginTag('div', ['class' => 'pull-right']); $templateSetting .= Html::button(Yii::t('diy', 'Save'), ['type' => 'button', 'class' => 'btn btn-success', 'onclick' => 'saveSettingsWidget(this);']); $templateSetting .= Html::endTag('div'); $templateSetting .= Html::endTag('div'); // End button save $templateSetting .= Html::endForm(); // End template setting $templateSetting .= Html::endTag('div'); // End .row $templateSetting .= Html::endTag('div'); // End .let_widget } return $templateSetting; }
echo Html::beginTag('div', ['class' => 'col-sm-10']); if ($model->type === 'text') { echo Html::textInput('setting[' . (string) $model->_id . ']', $model->value, ['class' => 'form-control']); } else { if ($model->type === 'dropdown') { echo Html::dropDownList('setting[' . (string) $model->_id . ']', $model->value, $model->items, ['class' => 'form-control']); } else { if ($model->type === 'checkbox') { echo Html::checkboxList('setting[' . (string) $model->_id . ']', $model->value, $model->items, ['class' => 'i-checks', 'separator' => '<br />']); } else { if ($model->type === 'radio') { echo Html::radioList('setting[' . (string) $model->_id . ']', $model->value, $model->items, ['class' => 'i-checks', 'separator' => '<br />']); } } } } echo Html::endTag('div'); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'hr-line-dashed']); echo Html::endTag('div'); } ActiveForm::end(); ?> </div> </div> </div> </div> <?php } ?> </div>
<?php use yii\bootstrap\Html; if ($link == true) { echo Html::beginTag('a', $linkOptions); } echo Html::beginTag('div', $acronymHtmlOptions); echo $acronym; echo Html::endTag('div'); echo Html::img($space->getProfileImage()->getUrl(), $imageHtmlOptions); if ($link == true) { echo Html::endTag('a'); }
<?php /** * 邢帅教育 * 本源代码由邢帅教育及其作者共同所有,未经版权持有者的事先书面授权, * 不得使用、复制、修改、合并、发布、分发和/或销售本源代码的副本。 * @copyright Copyright (c) 2013 xsteach.com all rights reserved. */ use yii\bootstrap\Html; use yii\widgets\ListView; echo ListView::widget(['dataProvider' => $dataProvider, 'layout' => '{items}', 'options' => ['class' => 'row'], 'itemOptions' => ['class' => 'col-sm-6 col-md-4'], 'itemView' => function ($model) { return Html::beginTag('div', ['class' => 'thumbnail brand-primary']) . Html::beginTag('div', ['class' => 'caption']) . Html::tag('h3', $model->name, ['class' => 'text-center']) . Html::tag('p', ' ') . Html::tag('p', Html::a('上线任务', ['tasks/index', 'id' => $model->id], ['class' => 'btn btn-info', 'role' => 'button']) . ' ' . Html::a('部署任务', ['deploy/index', 'id' => $model->id], ['class' => 'btn btn-success', 'role' => 'button'])) . Html::endTag('div') . Html::endTag('div'); }]);
/** * Renders the main content, which includes all external services links. */ protected function renderMainContent() { $clients = $this->getClients(); $clientCount = count($clients); if ($clientCount == 0) { return; } $this->view->registerCssFile('@web/resources/user/authChoice.css'); $this->view->registerJsFile('@web/resources/user/authChoice.js'); echo Html::beginTag('div', ['class' => 'authChoice']); $i = 0; $extraCssClass = 'btn-sxm'; foreach ($clients as $client) { $i++; if ($i == $this->maxShowClients + 1) { // Add more button echo Html::a('<i class="fa fa-angle-double-down" aria-hidden="true"></i>', '#', ['class' => 'btn btn-default pull-right btn-sxm', 'id' => 'btnAuthChoiceMore']); // Div contains more auth clients echo Html::beginTag('div', ['class' => 'authChoiceMore']); $extraCssClass = 'btn-sm'; // further buttons small } $this->clientLink($client, null, ['class' => $extraCssClass]); echo " "; } if ($i > $this->maxShowClients) { echo Html::endTag('div'); } echo Html::endTag('div'); echo Html::tag('div', Html::tag('hr') . Html::tag('div', Yii::t('UserModule.base', 'or')), ['class' => 'or-container']); }
<div class="has-feedback"> <input type="text" class="form-control input-sm" placeholder="Поиск..."> <span class="glyphicon glyphicon-search form-control-feedback"></span> </div> </div> </div><!-- /.box-header --> <div class="box-body"> <?php if ($properties) { echo Html::beginTag('table', ['class' => 'table']); /** @var $realty_property \common\models\realty\RealtyProperties */ foreach ($properties as $realty_property) { echo '<tr>' . '<td><strong>' . $realty_property->name . '</strong><br><small clas="text-muted">' . $realty_property->realtyPropertyType->name . ' — ' . $realty_property->realtyPropertyType->comment . '</small></td>' . '<td>' . Html::a('<i class="fa fa-pencil-square-o"></i>', ['index', 'action' => 'ch', 'id' => $realty_property->id], ['class' => 'btn btn-default btn-xs btn-falt']) . '</td>' . '</tr>'; } echo Html::endTag('table'); } ?> </div><!-- /.box-body --> </div><!-- /.box --> </div> <?php if (Yii::$app->request->get('action')) { ?> <div class="col-sm-7"> <?php echo $this->render('propertyForm', ['property' => $property, 'property_value' => $property_value]); ?> </div>
private static function labelInput($fieldName, $fld, $input) { $html = ''; $html .= Html::beginTag('div', ['class' => 'form-group']); $html .= Html::label(Inflector::camel2words($fieldName), $fld, ['class' => 'col-lg-2 control-label']); $html .= Html::beginTag('div', ['class' => 'col-lg-10']); $html .= $input; $html .= Html::endTag('div'); $html .= Html::endTag('div'); return $html; }
/** * Ham get ra template cua position * @param int $numberColumn so cot cua position * @param string $diyId id cua diy * @param string $containerId id cua container * @param string $itemId id cua position * @param array $widgetItems mang cac widget cua position * @return string */ public static function generateTemplatePosition($numberColumn = 12, $diyId = null, $containerId, $itemId = null, $widgetItems = []) { $tempalatePosition = Html::beginTag('div', ['class' => 'let_position col-md-' . $numberColumn . ' col-sm-' . $numberColumn . ' col-xs-12', 'id' => $itemId, 'data-diyId' => $diyId, 'data-id' => $itemId]); // Begin button delete position $tempalatePosition .= Html::beginTag('div', ['class' => 'row positionButton', 'style' => 'margin: 10px 0 10px 0;']); $tempalatePosition .= Html::beginTag('div', ['class' => 'pull-right']); $tempalatePosition .= Html::beginTag('div', ['class' => 'btn-group buttonDelete']); $tempalatePosition .= Html::button('<i class="glyphicon glyphicon-trash"></i>', ['class' => 'btn btn-danger btn-xs', 'onclick' => 'deleteItems(this, "p", ".let_position");']); $tempalatePosition .= Html::endTag('div'); $tempalatePosition .= Html::endTag('div'); $tempalatePosition .= Html::endTag('div'); // End button delete position $tempalatePosition .= Html::beginTag('div', ['class' => 'let_widget_position']); if (!empty($widgetItems)) { foreach ($widgetItems as $widgetId => $widget) { $id = ArrayHelper::getValue($widget, 'id'); $settings = ArrayHelper::getValue($widget, 'settings', []); $tempalatePosition .= DiyWidget::generateTemplateSetting($containerId, $itemId, $widgetId, $id, $settings); } } $tempalatePosition .= Html::endTag('div'); $tempalatePosition .= Html::endTag('div'); return $tempalatePosition; }
/** * Ham lay ra hinh anh trong website theo duong dan * @param string $path duong dan chua anh * @param string $template hinh anh duoc lay ra tu thu muc upload * @return string */ private function getGalleryByPath($path, $template = '') { // Duong dan chua anh $rootPath = Yii::getAlias(Yii::$app->getModule('gallery')->syaDirPath); // Thu muc upload $dirPath = Yii::$app->getModule('gallery')->syaDirUpload; if (!file_exists($path)) { return null; } $entrys = scandir($path); foreach ($entrys as $entry) { if (in_array($entry, ['.', '..', 'cache'])) { continue; } $entryPath = $path . DIRECTORY_SEPARATOR . $entry; if (is_dir($entryPath)) { $template .= self::getGalleryByPath($entryPath, $template); } else { if (in_array(end(explode('.', $entry)), self::$fileType)) { $imgPath = str_replace($rootPath . $dirPath . DIRECTORY_SEPARATOR, '', $entryPath); $template .= Html::beginTag('div', ['class' => 'col-md-3 text-center']); // input chua cac image duoc chon $template .= Html::hiddenInput('let_galleries', '', ['id' => 'let_galleries', 'class' => 'col-md-3 text-center input_image', 'data-type' => 'path']); // View image $template .= Html::beginTag('div', ['class' => 'letImgPreview', 'id' => $imgPath, 'onclick' => 'insertImagePath(this);']); $template .= Html::img('@web/' . $dirPath . DIRECTORY_SEPARATOR . $imgPath, ['style' => 'max-width: 100%; height: 200px;']); $template .= Html::endTag('div'); $template .= Html::endTag('div'); } } } return $template; }
/** * @param $xmlRow * @param $settings * @param bool $place * @return string */ private function generateHtml($xmlRow, $settings, $place = false) { $html = ""; $button_option = $xmlRow['field']; //Проверка "отображать" или нет элемент if (isset($button_option[6]['@attributes']['value']) && $button_option[6]['@attributes']['value'] == "0") { return $html; } $html .= \yii\bootstrap\Html::beginTag("div", ['class' => 'row form-group']); $html .= \yii\bootstrap\Html::beginTag("div", ['class' => 'col-xs-6']); $html .= isset($place[1]) ? str_replace("#place#", $place[1], $button_option[4]['@attributes']['value']) : $button_option[4]['@attributes']['value']; $html .= \yii\bootstrap\Html::endTag("div"); $html .= \yii\bootstrap\Html::beginTag("div", ['class' => 'col-xs-6']); $fieldName = isset($place[0]) ? $place[0] . $button_option[0]['@attributes']['value'] : $button_option[0]['@attributes']['value']; $elProperty = array(); //Проверка "разрешить" редактирование или нет if ($button_option[5]['@attributes']['value'] == "0") { $elProperty["disabled"] = "disabled"; } //Проверка "отображать" или нет элемент if (isset($button_option[6]['@attributes']['value']) && $button_option[6]['@attributes']['value'] == "0") { $elProperty["style"] = "display:none"; } //Дополнительные атрибуты if ($button_option[1]['@attributes']['value'] == "text") { $elProperty["size"] = 50; } switch ($button_option[1]['@attributes']['value']) { case 'text': $match = array(); preg_match("/#(.*)#/i", $button_option[2]['@attributes']['value'], $match); $value = isset($match[1]) && !empty($match[1]) ? eval($match[1]) : $button_option[2]['@attributes']['value']; $html .= \yii\bootstrap\Html::textInput($fieldName, isset($settings[$fieldName]) ? $settings[$fieldName] : $value, $elProperty); break; case 'select': $select = json_decode($button_option[3]['@attributes']['value'], true); $html .= \yii\bootstrap\Html::dropDownList($fieldName, isset($settings[$fieldName]) ? $settings[$fieldName] : $button_option[2]['@attributes']['value'], $select, $elProperty); break; } $html .= \yii\bootstrap\Html::endTag("div"); $html .= \yii\bootstrap\Html::endTag("div"); return $html; }
?> </head> <?php echo Html::beginTag('body', ['class' => implode(' ', array_filter(['hold-transition', Yii::$app->keyStorage->get('backend.theme-skin', 'skin-blue'), Yii::$app->keyStorage->get('backend.layout-fixed') ? 'fixed' : null, Yii::$app->keyStorage->get('backend.layout-boxed') ? 'layout-boxed' : null, Yii::$app->keyStorage->get('backend.layout-collapsed-sidebar') ? 'sidebar-collapse' : null, Yii::$app->keyStorage->get('backend.layout-mini-sidebar') ? 'sidebar-mini' : null]))]); ?> <?php $this->beginBody(); ?> <div class="wrapper"> <?php echo $this->render('_header.php'); ?> <?php echo $this->render('_left.php'); ?> <?php echo $this->render('_content.php', ['content' => $content]); ?> </div> <?php $this->endBody(); ?> <?php echo Html::endTag('body'); ?> </html> <?php $this->endPage(); }
<?php /** @var \backend\modules\rss\models\NewsFeedForm $model */ use yii\bootstrap\Html; use yii\widgets\Pjax; echo \Yii::$app->request->isAjax ? '' : Html::beginTag('div', ['class' => 'modal', 'id' => 'editFeedModal']); ?> <div class="modal-dialog"> <div class="modal-content"> <?php Pjax::begin(['id' => 'add_modal', 'enablePushState' => false, 'enableReplaceState' => false, 'timeout' => 10000, 'clientOptions' => []]); ?> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span></button> <h4 class="modal-title"><?php echo $model->isNew ? 'Добавление' : 'Редактирование'; ?> RSS ленты</h4> </div> <?php echo $this->render('editForm', ['model' => $model]); Pjax::end(); ?> </div> </div> <?php echo \Yii::$app->request->isAjax ? '' : Html::endTag('div');
<?php echo Html::endTag('h5'); } ?> <?php if ($isFinished && !empty($winnersForecast->allModels)) { ?> <p><?php echo $winnersForecastDetails; ?> </p> <p><b>Общее количество дополнительных очков: <?php echo $totalAdditionalPoints; ?> </b></p> <?php } ?> <hr> <?php echo Html::beginTag('h4', ['class' => 'text-center']); ?> Очки по турам <?php echo Html::endTag('h4'); ?> <?php echo extendedGridView::widget(['dataProvider' => $forecast, 'showPageSummary' => true, 'summary' => false, 'condensed' => true, 'columns' => [['attribute' => 'tour', 'header' => 'Тур', 'headerOptions' => ['class' => 'text-center'], 'options' => ['class' => 'col-xs-6'], 'hAlign' => 'center', 'vAlign' => 'middle', 'pageSummary' => 'Всего'], ['attribute' => 'points', 'header' => 'Очки', 'headerOptions' => ['class' => 'text-center'], 'options' => ['class' => 'col-xs-6'], 'hAlign' => 'center', 'vAlign' => 'middle', 'pageSummary' => true, 'pageSummaryOptions' => ['align' => 'center']]]]);
echo Html::a('Отмена', Url::current(['realty_property_values_id' => null]), ['class' => 'btn btn-default btn-flat btn-sm']); } ?> <?php echo Html::submitButton(Yii::$app->request->get('realty_property_values_id') ? 'Изменить' : 'Добавить', ['class' => 'btn btn-primary btn-flat btn-sm']); ?> <?php if (Yii::$app->request->get('realty_property_values_id')) { Modal::begin(['header' => $property_value->name, 'toggleButton' => ['label' => 'Удалить', 'class' => 'btn btn-danger btn-flat btn-sm'], 'footer' => Html::a('Отмена', '#', ['data-dismiss' => 'modal', 'class' => 'btn btn-default btn-flat btn-sm']) . Html::a('Удалить', ['delete-property-value', 'id' => Yii::$app->request->get('id'), 'realty_property_values_id' => $property_value->id], ['class' => 'btn btn-danger btn-flat btn-sm'])]); echo '<p>Действительно удалить значение свойства?</p>'; Modal::end(); } ?> </div> </div> <?php ActiveForm::end(); ?> <?php $property_values = RealtyPropertyValues::find()->all(); if ($property_values) { echo Html::beginTag('ul', ['class' => 'list-inline']); foreach (RealtyPropertyValues::find()->all() as $value) { echo '<li>' . Html::a($value->name, Url::current(['realty_property_values_id' => $value->id])) . '</li>'; } echo Html::endTag('ul'); }
/** * @param null $options * @param null $pluginOptions * * @return string * @throws \Exception */ public function getItem($options = null, $pluginOptions = null) { switch ($this->type) { case self::TYPE_TEXT: return Html::input('text', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']); case self::TYPE_EMAIL: return Html::input('email', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']); case self::TYPE_NUMBER: return Html::input('number', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']); case self::TYPE_TEXTAREA: return Html::textarea('Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']); case self::TYPE_COLOR: return ColorInput::widget(['value' => $this->value, 'name' => 'Setting[' . $this->code . ']', 'options' => $options != null ? $options : ['class' => 'form-control']]); case self::TYPE_DATE: return DatePicker::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['format' => 'yyyy-mm-dd', 'todayHighlight' => true]]); case self::TYPE_TIME: return TimePicker::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['minuteStep' => 1, 'showSeconds' => true, 'showMeridian' => false]]); case self::TYPE_DATETIME: return DateTimePicker::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => ['format' => 'yyyy-mm-dd H:i:s', 'todayHighlight' => true]]); case self::TYPE_PASSWORD: return PasswordInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['showMeter' => true, 'toggleMask' => false]]); case self::TYPE_ROXYMCE: return RoxyMceWidget::widget(['id' => 'Setting_' . $this->code, 'name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'action' => Url::to(['roxymce/default']), 'options' => $options != null ? $options : ['title' => $this->getName()], 'clientOptions' => $pluginOptions != null ? $pluginOptions : []]); case self::TYPE_SELECT: return Select2::widget(['value' => $this->value, 'name' => 'Setting[' . $this->code . ']', 'data' => $this->getStoreRange(), 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => ['allowClear' => true]]); case self::TYPE_MULTI_SELECT: $options['multiple'] = true; if (!isset($options['class'])) { $options['class'] = 'form-control'; } return Select2::widget(['name' => 'Setting[' . $this->code . ']', 'value' => explode(",", $this->value), 'data' => $this->getStoreRange(), 'options' => $options, 'pluginOptions' => ['allowClear' => true]]); case self::TYPE_FILE_PATH: $value = Yii::getAlias($this->store_dir) . DIRECTORY_SEPARATOR . $this->value; return FileInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $value, 'options' => $options != null ? $options : ['class' => 'form-control', 'multiple' => false], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['previewFileType' => 'any', 'showRemove' => false, 'showUpload' => false, 'initialPreview' => !$this->isNewRecord ? [$this->value] : []]]); case self::TYPE_FILE_URL: $value = $this->store_url . '/' . $this->value; return FileInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['previewFileType' => 'any', 'showRemove' => false, 'showUpload' => false, 'initialPreviewAsData' => true, 'initialPreviewFileType' => self::fileType(pathinfo($this->value, PATHINFO_EXTENSION)), 'initialPreview' => !$this->isNewRecord ? $value : [], 'initialCaption' => $this->value]]); case self::TYPE_PERCENT: return RangeInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'html5Options' => ['min' => 0, 'max' => 100, 'step' => 1], 'options' => $options != null ? $options : ['class' => 'form-control'], 'addon' => ['append' => ['content' => '%']]]); case self::TYPE_SWITCH: $selector = explode(',', $this->store_range); if (count($selector) != 2) { throw new ErrorException(Yii::t('setting', 'Switch Field should have store with 2 value, and negative is first. Example: no,yes'), 500); } return Html::hiddenInput('Setting[' . $this->code . ']', $selector[0]) . SwitchInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $selector[1], 'containerOptions' => ['class' => 'nv-switch-container'], 'options' => $options != null ? $options : [], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['state' => $this->value == $selector[1], 'size' => 'small', 'offText' => ucfirst($selector[0]), 'onText' => ucfirst($selector[1])]]); case self::TYPE_CHECKBOX: $random = rand(1000, 9999); return Html::checkboxList('Setting[' . $this->code . ']', explode(",", $this->value), $this->getStoreRange(), $options != null ? $options : ['class' => 'nv-checkbox-list checkbox', 'item' => function ($index, $label, $name, $checked, $value) use($random) { $html = Html::beginTag('div'); $html .= Html::checkbox($name, $checked, ['id' => 'Setting_checkbox_' . $label . '_' . $index . '_' . $random, 'value' => $value]); $html .= Html::label($label, 'Setting_checkbox_' . $label . '_' . $index . '_' . $random); $html .= Html::endTag('div'); return $html; }]); case self::TYPE_RADIO: $random = rand(1000, 9999); return Html::radioList('Setting[' . $this->code . ']', $this->value, $this->getStoreRange(), $options != null ? $options : ['class' => 'nv-checkbox-list radio', 'item' => function ($index, $label, $name, $checked, $value) use($random) { $html = Html::beginTag('div'); $html .= Html::radio($name, $checked, ['id' => 'Setting_radio_' . $label . '_' . $index . '_' . $random, 'value' => $value]); $html .= Html::label($label, 'Setting_radio_' . $label . '_' . $index . '_' . $random); $html .= Html::endTag('div'); return $html; }]); case self::TYPE_SEPARATOR: return '<hr>'; default: return Html::input('text', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']); } }
/** * Function generate log order * @return string */ public function generateLogOrder() { $template = null; if (is_array($this->log) and !empty($this->log)) { foreach ($this->log as $log) { // Declare infomation log $created_at = ArrayHelper::getValue($log, 'created_at'); $action = ArrayHelper::getValue($log, 'action'); $note = ArrayHelper::getValue($log, 'note'); $creator = ArrayHelper::getValue($log, 'creator'); $logCreator = ArrayHelper::getValue($log, 'creator_name'); // Get namespace of model $ecommerce = Ecommerce::module(); // User field $linkUser = ArrayHelper::getValue($ecommerce->userTable, 'linkInfo'); $idUser = ArrayHelper::getValue($ecommerce->userTable, 'idField'); $template .= Html::beginTag('div', ['class' => 'timeline-item']); $template .= Html::beginTag('div', ['class' => 'row']); $template .= Html::beginTag('div', ['class' => 'col-xs-3 date']); $template .= Html::tag('i', '', ['class' => 'fa ' . ArrayHelper::getValue(\sya\ecommerce\Module::$logStatus, $action)]); $template .= date('H:i a', $created_at->sec); $template .= Html::tag('br'); $template .= Html::tag('small', Yii::$app->formatter->asRelativeTime($created_at->sec), ['class' => 'text-navy']); $template .= Html::endTag('div'); $template .= Html::beginTag('div', ['class' => 'col-xs-7 content no-top-border']); $template .= Html::tag('p', Html::tag('strong', ucfirst($action)), ['class' => 'm-b-xs']); $template .= Html::tag('p', Html::a($logCreator, Url::to([$linkUser, $idUser => $creator])) . ' ' . $note); $template .= Html::endTag('div'); $template .= Html::endTag('div'); $template .= Html::endTag('div'); } } return $template; }
.menuItems{ margin: 20px 0; } CSS; $js = <<<'JS' $('#menuItems').addInputArea(); $("#menuItems").sortable({ forcePlaceholderSize: true, items: '.movable', placeholder: '<div style="display: block;" role="option" class="form-group sortablePlaceholder"></div>' }).on('sortupdate', function(e){ $.each($(".menuItems .movable"), function(key, item){ key++; $(item).find(".field-menuitemform-order input").val(key); }); }); JS; $this->registerCss($css); $this->registerJsFile('/js/addInputArea.js', ['depends' => 'yii\\web\\JqueryAsset']); $this->registerJs($js); /** @var \backend\modules\ads\models\BannerForm $model */ $form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'id' => 'edit-menu-form', 'options' => ['data-pjax' => true]]); echo $form->field($model, 'name'), $form->field($model, 'alias', ['inputOptions' => [$model->isNew ? 'enabled' : 'disabled' => 'disabled']]), Html::beginTag('div', ['class' => 'menuItems', 'id' => 'menuItems']); foreach ($model->items as $itemModel) { echo Html::tag('div', $form->field($itemModel, 'name', ['options' => ['class' => 'col-xs-5'], 'inputOptions' => ['name_format' => 'MenuItemForm[%d][name]', 'labelSpan' => 4]]) . $form->field($itemModel, 'link', ['options' => ['class' => 'col-xs-7'], 'inputOptions' => ['name_format' => 'MenuItemForm[%d][link]'], 'addon' => ['append' => ['content' => Html::button(FA::icon('times'), ['class' => 'menuItems_del btn btn-danger btn-sm', 'style' => 'height: 34px; width: 34px;']), 'asButton' => true]]]) . $form->field($itemModel, 'id', ['options' => ['style' => 'display: none'], 'inputOptions' => ['name_format' => 'MenuItemForm[%d][id]']])->hiddenInput()->label(false) . $form->field($itemModel, 'order', ['options' => ['style' => 'display: none'], 'inputOptions' => ['name_format' => 'MenuItemForm[%d][order]']])->hiddenInput()->label(false), ['class' => 'form-group movable menuItems_var']); } echo Html::endTag('div'), Html::button(FA::icon('plus') . ' Добавить', ['class' => 'menuItems_add btn btn-success btn-sm', 'style' => 'margin: 0px auto; display: block;']), Html::tag('br'), Html::tag('div', Html::button('Сохранить', ['class' => 'btn btn-success', 'type' => 'submit']), ['class' => 'text-center']); $form->end();
/** * Function generate preview infomation image * @param $image Infomation image * @return string */ public static function generatePreviewImage($image) { $image = Json::decode($image); $url = ArrayHelper::getValue($image, 'url'); $title = ArrayHelper::getValue($image, 'title'); $caption = ArrayHelper::getValue($image, 'caption'); $alt_text = ArrayHelper::getValue($image, 'alt_text'); $imageUrl = Yii::getAlias('@web') . DIRECTORY_SEPARATOR . Yii::$app->getModule('gallery')->syaDirUpload . DIRECTORY_SEPARATOR . $url; $imagePath = Yii::getAlias(Yii::$app->getModule('gallery')->syaDirPath) . Yii::$app->getModule('gallery')->syaDirUpload . DIRECTORY_SEPARATOR . $url; $info = FileHelper::getInfomation($imagePath); $basename = ArrayHelper::getValue($info, 'basename'); $filesize = ArrayHelper::getValue($info, 'filesize'); $fileatime = ArrayHelper::getValue($info, 'fileatime'); $width = ArrayHelper::getValue($info, 'width'); $height = ArrayHelper::getValue($info, 'height'); $template = Html::tag('h3', Yii::t('gallery', 'ATTACHMENT DETAILS'), []); // Info img $template .= Html::beginTag('div', ['class' => 'sya_info_galllery row']); $template .= Html::beginTag('div', ['class' => 'col-md-6', 'style' => 'padding: 0;']); $template .= Html::img($imageUrl, []); $template .= Html::endTag('div'); $template .= Html::beginTag('div', ['class' => 'col-md-6', 'style' => 'padding: 0; word-break: break-word;']); // File Name $template .= Html::beginTag('div', ['style' => 'font-weight: bold;']); $template .= $basename; $template .= Html::endTag('div'); $template .= Html::beginTag('div', []); $template .= date('d/m/Y', $fileatime); $template .= Html::endTag('div'); // File size $template .= Html::beginTag('div', []); $template .= $filesize; $template .= Html::endTag('div'); $template .= Html::beginTag('div', []); $template .= $width . ' x ' . $height; $template .= Html::endTag('div'); $template .= Html::endTag('div'); $template .= Html::endTag('div'); // Attribute img $template .= Html::beginTag('div', ['class' => 'col-md-12 form-horizontal', 'style' => 'margin-top: 20px;']); $template .= Html::beginForm(' ', ' ', ['id' => 'sya_gallery_form_preview']); // Url $template .= Html::beginTag('div', ['class' => 'form-group field-gallery-url']); $template .= Html::tag('label', 'Url', ['class' => 'control-label col-sm-3']); $template .= Html::beginTag('div', ['class' => 'col-sm-9']); $template .= Html::input('text', 'sya_url', $url, ['class' => 'col-sm-10 form-control', 'readonly' => true]); $template .= Html::endTag('div'); $template .= Html::endTag('div'); // Title $template .= Html::beginTag('div', ['class' => 'form-group field-gallery-title']); $template .= Html::tag('label', 'Title', ['class' => 'control-label col-sm-3']); $template .= Html::beginTag('div', ['class' => 'col-sm-9']); $template .= Html::input('text', 'sya_title', $title, ['class' => 'col-sm-10 form-control', 'id' => 'sya_preview_title']); $template .= Html::endTag('div'); $template .= Html::endTag('div'); // Caption $template .= Html::beginTag('div', ['class' => 'form-group field-gallery-caption']); $template .= Html::tag('label', 'Caption', ['class' => 'control-label col-sm-3']); $template .= Html::beginTag('div', ['class' => 'col-sm-9']); $template .= Html::textarea('sya_caption', $caption, ['class' => 'col-sm-10 form-control', 'id' => 'sya_preview_caption']); $template .= Html::endTag('div'); $template .= Html::endTag('div'); // Alt text $template .= Html::beginTag('div', ['class' => 'form-group field-gallery-alt-text']); $template .= Html::tag('label', 'Alt text', ['class' => 'control-label col-sm-3']); $template .= Html::beginTag('div', ['class' => 'col-sm-9']); $template .= Html::input('text', 'sya_alt_text', $alt_text, ['class' => 'col-sm-10 form-control', 'id' => 'sya_preview_alt_text']); $template .= Html::endTag('div'); $template .= Html::endTag('div'); $template .= Html::endForm(); $template .= Html::endTag('div'); return $template; }