public function run() { BootstrapPluginAsset::register($this->getView()); $this->registerClientEvents(); $buttonDropdown = $this->renderDropdown(); $items = $this->renderItems($this->items, $this->options); $content = $buttonDropdown . $items; return Html::tag('div', $content, $this->dropdownContainerOptions); }
/** * Registers a specific Bootstrap plugin and the related events * @param string $name the name of the Bootstrap plugin */ protected function registerPlugin($name) { $view = $this->getView(); BootstrapPluginAsset::register($view); $id = $this->options['id']; if ($this->clientOptions !== false) { $options = empty($this->clientOptions) ? '' : Json::htmlEncode($this->clientOptions); $js = "jQuery('#{$id}').{$name}({$options});"; $view->registerJs($js); } $this->registerClientEvents(); }
public function init() { parent::init(); if (!in_array($this->toggle, [static::TOGGLE_DROPDOWN, static::TOGGLE_COLLAPSE])) { $this->toggle = static::TOGGLE_DROPDOWN; } foreach ($this->items as $key => $item) { $item = static::prepareItem($item); if ($item !== null) { $this->items[$key] = $item; } else { unset($this->items[$key]); } } BootstrapPluginAsset::register($this->getView()); }
/** * Registers a specific Bootstrap plugin and the related events * @param string $name the name of the Bootstrap plugin */ protected function registerPlugin($name) { $view = $this->getView(); BootstrapPluginAsset::register($view); $id = $this->options['id']; if ($this->clientOptions !== false) { $options = empty($this->clientOptions) ? '' : Json::encode($this->clientOptions); $js = "jQuery('#{$id}').{$name}({$options});"; $view->registerJs($js); } if (!empty($this->clientEvents)) { $js = []; foreach ($this->clientEvents as $event => $handler) { $js[] = "jQuery('#{$id}').on('{$event}', {$handler});"; } $view->registerJs(implode("\n", $js)); } }
public function render($type) { // Obviously we need the bootstrap assets for this \yii\bootstrap\BootstrapPluginAsset::register($this->desktop->view); $glyph = $this->image; if (!$glyph) { $glyph = 'folder-open'; } $attributes = ['class' => "glyphicon glyphicon-{$glyph}"]; $styles = []; switch ($type) { case self::DISPLAY_DOCK: $styles = ['position' => 'relative', 'top' => '3px', 'font-size' => '16px', 'padding-right' => '5px']; break; case self::DISPLAY_TITLEBAR: $styles = ['float' => 'left', 'margin' => '4px 8px 0 0', 'font-size' => '20px']; break; case self::DISPLAY_DESKTOP: $styles = ['font-size' => '32px']; break; } Html::addCssStyle($attributes, $styles); return Html::tag('span', '', $attributes); }
public function init() { if ($this->useNativeBootstrap == true) { \Yii::info('Registering a bootstrap assets', __METHOD__); $this->view->registerAssetBundle(BootstrapAsset::className(), View::POS_HEAD); $this->view->registerAssetBundle(BootstrapPluginAsset::className(), View::POS_HEAD); } $this->view->registerAssetBundle(AssetBundle::className(), View::POS_BEGIN); $this->options['id'] = $this->id; if (!empty($this->value) && !isset($this->sliderOptions['value'])) { $this->sliderOptions['value'] = $this->value; } if (strtolower($this->mode) === 'js') { $this->view->registerJs(sprintf('var slider%1$s = window.slider%1$s = new Slider(\'#%2$s\',%3$s);', Inflector::id2camel($this->id), $this->id, Json::encode($this->sliderOptions)), View::POS_END); } elseif (strtolower($this->mode) === 'data') { $data = ['provide' => 'slider']; foreach ($this->sliderOptions as $k => $v) { $data[sprintf('slider-%s', $k)] = $v; } $this->options['data'] = $data; } else { throw new InvalidParamException('A \'mode\' must be set to \'data\' or \'js\'!'); } }
echo $this->theme->baseUrl; ?> /assets/vendors/html5/html5shiv-printshiv.min.js"></script> <script type="text/javascript" src="<?php echo $this->theme->baseUrl; ?> /assets/vendors/html5/respond.min.js"></script> <![endif]--> <?php $this->registerCssFile(Yii::getAlias('@web') . '/vendor/components/font-awesome/css/font-awesome.css', ['depends' => \yii\bootstrap\BootstrapPluginAsset::className()]); $this->registerCssFile($this->theme->baseUrl . '/assets/vendors/pushy/css/pushy.css', ['depends' => \yii\bootstrap\BootstrapPluginAsset::className()]); $this->registerCssFile($this->theme->baseUrl . '/assets/vendors/font-elegant/style.css', ['depends' => \yii\bootstrap\BootstrapPluginAsset::className()]); $this->registerCssFile($this->theme->baseUrl . '/assets/css/styles.css', ['depends' => \yii\bootstrap\BootstrapPluginAsset::className()]); //custom css $this->registerCssFile($this->theme->baseUrl . '/assets/css/custom.css', ['depends' => \yii\bootstrap\BootstrapPluginAsset::className()]); $this->registerJsFile($this->theme->baseUrl . '/assets/vendors/jquery/jquery-migrate-1.2.1.min.js', ['depends' => \yii\web\JqueryAsset::className()]); $this->registerJsFile($this->theme->baseUrl . '/assets/vendors/jquery/jquery.easing.1.3.js', ['depends' => \yii\web\JqueryAsset::className()]); $this->registerJsFile($this->theme->baseUrl . '/assets/js/sticky-nav.js', ['depends' => \yii\web\JqueryAsset::className()]); $this->registerJsFile($this->theme->baseUrl . '/assets/js/scroll-top.js', ['depends' => \yii\web\JqueryAsset::className()]); $this->registerJsFile($this->theme->baseUrl . '/assets/vendors/pushy/js/pushy.min.js', ['depends' => \yii\web\JqueryAsset::className()]); $this->registerJsFile($this->theme->baseUrl . '/assets/js/testimonial-carousel.js', ['depends' => \yii\web\JqueryAsset::className()]); $this->registerJsFile($this->theme->baseUrl . '/assets/js/bootbox.min.js', ['depends' => \yii\web\JqueryAsset::className()]); $this->registerJsFile($this->theme->baseUrl . '/assets/js/theme.js', ['depends' => \yii\web\JqueryAsset::className()]); ?> <?php $this->head(); ?> </head> <body class="logged_in home-page">
/** * Registers the client assets for the widget */ public function registerAssets() { $view = $this->getView(); TreeViewAsset::register($view); if ($this->_hasBootstrap && $this->autoLoadBsPlugin) { BootstrapPluginAsset::register($view); } $this->pluginOptions += ['treeId' => $this->treeOptions['id'], 'detailId' => $this->detailOptions['id'], 'toolbarId' => $this->toolbarOptions['id'], 'wrapperId' => $this->treeWrapperOptions['id'], 'actions' => $this->nodeActions, 'modelClass' => $this->query->modelClass, 'formAction' => $this->nodeActions[Module::NODE_SAVE], 'formOptions' => $this->nodeFormOptions, 'currUrl' => Yii::$app->request->url, 'messages' => $this->clientMessages, 'alertFadeDuration' => $this->alertFadeDuration, 'enableCache' => ArrayHelper::getValue($this->cacheSettings, 'enableCache', true), 'cacheTimeout' => ArrayHelper::getValue($this->cacheSettings, 'cacheTimeout', 300000), 'showTooltips' => $this->showTooltips, 'isAdmin' => $this->isAdmin, 'showInactive' => $this->showInactive, 'softDelete' => $this->softDelete, 'iconsList' => $this->_iconsList, 'showFormButtons' => $this->showFormButtons, 'showIDAttribute' => $this->showIDAttribute, 'nodeView' => $this->nodeView, 'nodeAddlViews' => $this->nodeAddlViews, 'nodeSelected' => $this->_nodeSelected, 'breadcrumbs' => $this->breadcrumbs, 'multiple' => $this->multiple, 'allowNewRoots' => $this->allowNewRoots]; $this->registerPlugin('treeview'); }
<?php require_once '../../common/components/MainView.php'; use common\components\MainView; use frontend\models\User; $params = array_merge(require __DIR__ . '/../../common/config/params.php', require __DIR__ . '/../../common/config/params-local.php', require __DIR__ . '/params.php', require __DIR__ . '/params-local.php'); return ['id' => 'app-frontend', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'controllerNamespace' => 'frontend\\controllers', 'aliases' => ['@file_view_dir' => '@frontend/files'], 'components' => ['user' => ['identityClass' => User::className(), 'enableAutoLogin' => true], 'assetManager' => ['bundles' => [\yii\web\JqueryAsset::className() => ['js' => ["http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"], 'jsOptions' => ['position' => MainView::POS_HEAD]], \yii\bootstrap\BootstrapAsset::className() => ['baseUrl' => '@web', 'basePath' => '@webroot', 'css' => ['https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css']], \yii\bootstrap\BootstrapPluginAsset::className() => ['js' => ['https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js']]]], 'log' => ['traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [['class' => 'yii\\log\\FileTarget', 'levels' => ['error', 'warning']]]], 'errorHandler' => ['errorAction' => 'site/error']], 'params' => $params];
/** * Register client side */ public function registerAssets($view) { BootstrapPluginAsset::register($view); $queue = ArrayHelper::remove($this->clientOptions, 'queue'); $strollToPopover = ArrayHelper::remove($this->clientOptions, 'strollToPopover'); $strollToFirstPopover = ArrayHelper::remove($this->clientOptions, 'strollToFirstPopover'); $showBg = ArrayHelper::remove($this->clientOptions, 'showBg'); $scrollOptions = ArrayHelper::remove($this->clientOptions, 'scrollOptions', []); $scrollOptions = ArrayHelper::merge(['duration' => 500], $scrollOptions); $id = $this->options['id']; $script = '$("#' . $id . '").popover(' . Json::encode($this->clientOptions) . ') .on("hidden.bs.popover", function () { if(disposableHintQueue.length && ' . ($queue ? 1 : 0) . '){ var $next = $(disposableHintQueue.shift()).popover("show"); ' . ($strollToPopover ? 'disposableHintScrollTo($next);' : '') . ' }else{ $(".bg-disposable-hint").removeClass("show").hide(); } });'; foreach ($this->clientEvents as $event => $handler) { $script .= '$("#' . $id . '").on("' . $event . '" ,' . new JsExpression($handler) . ');'; } if ($queue) { $script .= ' disposableHintQueue.push("#' . $id . '"); '; } else { $script .= ' $("#' . $id . '").popover("show"); '; } $view->registerJs($script); if (self::$showBg === false && $showBg) { $view->on($view::EVENT_END_BODY, function ($event) { echo Html::tag('div', '', ['class' => 'bg-disposable-hint modal-backdrop fade in show']); }); self::$showBg = true; } if (self::$loaded === false) { $script = ''; if ($strollToFirstPopover) { $script .= ' if(disposableHintQueue.length){ disposableHintScrollTo($(disposableHintQueue.shift()).popover("show")); } '; } else { $script .= ' if(disposableHintQueue.length){ $(disposableHintQueue.shift()).popover("show"); } '; } $script .= ' $(document).on("click",".disposable-hint-btn",function(){ var $cont = $($(this).attr("data-trigger")); var id = parseInt($cont.attr("data-id")); if(!id){ return false; } $.ajax({ url: "' . Url::to(['/' . $this->moduleId]) . '", type: "POST", dataType: "json", data: {id:id}, beforeSend: function(){ $cont.popover("hide"); $("#' . $id . '").trigger("dhint.ajaxBeforeSend",[$cont,id]); }, success: function(d){ $("#' . $id . '").trigger("dhint.ajaxSuccess",[$cont,id,d]); }, complete:function(jqXHR,textStatus){ $("#' . $id . '").trigger("dhint.ajaxComplete",[$cont,id,jqXHR,textStatus]); }, error:function(jqXHR,textStatus,message){ $("#' . $id . '").trigger("dhint.ajaxError",[$cont,id,jqXHR,textStatus,message]); }, }); return false; }); '; $view->registerJs($script); $view->registerJs(' var disposableHintQueue = []; var disposableHintScrollTo = function($next){ var settings = $next.data("bs.popover"); var $tip = settings.$tip; var top = $tip.offset().top - ($(window).height() - $tip.outerHeight(true))/2; $("html").animate({scrollTop : top},' . Json::encode($scrollOptions) . '); } ', $view::POS_HEAD); self::$loaded = true; } }
public function init() { $model = $this->model; $this->id = strtolower(self::FORM_ID_PREF . str_replace("\\", "-", $model::className())); BootstrapPluginAsset::register($this->view); }
public function run() { BootstrapPluginAsset::register($this->getView()); BsRemoteModalAssets::register($this->getView()); $this->_beginModal(); $this->_beginContent(); $this->_header(); $this->_body(); $this->_footer(); $this->_endContent(); $this->_endModal(); $this->_scripts(); }
protected function label() { $label = isset($this->label) ? $this->label : Html::encode($this->model->getAttributeLabel($this->attribute)); if ($this->translation) { $label = Yii::t($this->translation, $label); } if ($this->hint) { $hintId = Html::getInputId($this->model, $this->attribute) . '-hint'; Yii::$app->getView()->registerAssetBundle(BootstrapPluginAsset::className()); Yii::$app->getView()->registerJs('jQuery("#' . $hintId . '").tooltip()'); $label .= Html::tag('span', ' <i class="glyphicon glyphicon-question-sign"></i>', ['id' => $hintId, 'title' => $this->hint, 'data-toggle' => 'tooltip']); } return $label; }
/** * Renders the widget. */ public function run() { echo Html::endTag('div'); if ($this->padded) { echo Html::endTag('div'); } echo Html::endTag('div'); BootstrapPluginAsset::register($this->getView()); }
/** * Renders the widget. */ public function run() { BootstrapPluginAsset::register($this->getView()); }
<?php require_once '../components/MainView.php'; require_once '../models/Languages.php'; use app\components\MainView; use app\models\Languages; $params = array_merge(require __DIR__ . '/params.php', require __DIR__ . '/params-local.php'); $config = ['id' => 'basic', 'language' => 'en-US', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'defaultRoute' => 'site/login', 'aliases' => ['@file_save_dir' => '@app/web/files/', '@file_view_url' => '/files/', '@beacon_save_dir' => '@app/web/beacon_images/', '@beacon_view_url' => '/beacon_images', '@backend_beacon_view_dir' => '@app/web/beacon_images', '@frontend_beacon_view_dir' => '@app/web/beacon_images'], 'components' => ['cache' => ['class' => 'yii\\caching\\FileCache'], 'view' => ['class' => 'app\\components\\MainView'], 'user' => ['identityClass' => 'app\\models\\Users', 'enableAutoLogin' => true], 'assetManager' => ['bundles' => [\yii\web\JqueryAsset::className() => ['js' => ["http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js", "http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"], 'jsOptions' => ['position' => MainView::POS_HEAD]], \yii\bootstrap\BootstrapAsset::className() => ['baseUrl' => '@web', 'basePath' => '@webroot', 'css' => ['css/bootstrap.min.css']], \yii\bootstrap\BootstrapPluginAsset::className() => ['js' => ['https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js']]], 'appendTimestamp' => true], 'errorHandler' => ['errorAction' => 'site/error'], 'urlManager' => ['enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => ['<controller:\\w+>/<id:\\d+>' => '<controller>/view', '<controller:\\w+>/<action:\\w+>/<id:\\d+>' => '<controller>/<action>', '<controller:\\w+>/<action:\\w+>' => '<controller>/<action>']], 'authManager' => ['class' => yii\rbac\DbManager::className(), 'cache' => 'cache', 'defaultRoles' => ['super_admin', 'admin', 'user', 'promo_user']], 'apcCache' => ['class' => yii\caching\MemCache::className()], 'mailer' => ['class' => '\\zyx\\phpmailer\\Mailer', 'viewPath' => '@app/mail', 'useFileTransport' => false, 'messageConfig' => ['from' => ['*****@*****.**' => 'Beacon CMS']]], 'log' => ['traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [['class' => 'yii\\log\\FileTarget', 'levels' => ['error', 'warning']]]], 'session' => ['class' => 'yii\\web\\DbSession'], 'i18n' => ['translations' => ['*' => ['class' => 'yii\\i18n\\DbMessageSource', 'sourceLanguage' => 'en-US', 'forceTranslation' => true]]], 'languagepicker' => ['class' => '\\lajax\\languagepicker\\widgets\\LanguagePicker', 'languages' => function () { return Languages::getLanguageNames(true); }]], 'params' => $params]; return $config;
/** * Runs the widget. */ public function run() { $attribute = $this->attribute; $buttons = []; foreach ($this->buttons as $button) { if (is_array($button)) { $name = $this->name ?: $this->model->{$this->attribute}; $value = isset($button['value']) ? $button['value'] : $this->value; $checked = $value == $this->value; $options = isset($button['options']) ? $button['options'] : []; if (!isset($options['class'])) { Html::addCssClass($options, 'btn btn-primary'); } if ($checked) { Html::addCssClass($options, 'active'); } $buttons[] = Html::radio($name, $checked, ['label' => $button['label'], 'value' => $value, 'uncheck' => null, 'labelOptions' => $options]); } else { $buttons[] = $button; } } $view = $this->getView(); BootstrapPluginAsset::register($view); $view->registerJs(' $(".button-group-wrapper .btn").button(); '); return Html::tag('div', ButtonGroup::widget(['options' => ['class' => 'btn-group btn-toggle', ' data-toggle' => 'buttons'], 'buttons' => $buttons]), ['class' => 'button-group-wrapper']); }
/** * Renders the widget. */ public function run() { Html::addCssClass($footerOptions, 'box-footer'); echo Html::endTag('div'); if (!empty($this->footer)) { echo Html::beginTag('div', $footerOptions); echo $this->footer; echo Html::endTag('div'); } echo Html::endTag('div'); BootstrapPluginAsset::register($this->getView()); }
/** * Renders the widget. */ public function run() { echo Html::endTag('div'); if ($this->type == 'small') { echo Html::beginTag('div', ['class' => 'icon']); echo '<i class="' . $this->icon . '"></i>'; echo Html::endTag('div'); Html::addCssClass($this->footerOptions, 'small-box-footer'); echo Html::a($this->footer, $this->link, $this->footerOptions); } else { if ($this->type == 'tiles') { } else { Html::addCssClass($this->footerOptions, 'box-footer'); echo Html::beginTag('div', $this->footerOptions); echo $this->footer; echo Html::endTag('div'); } } echo Html::endTag('div'); BootstrapPluginAsset::register($this->getView()); }
<?php use yii\helpers\Html; $this->registerJsFile('@web/resources/space/colorpicker/js/bootstrap-colorpicker-modified.js', ['position' => yii\web\View::POS_BEGIN, 'depends' => [\yii\bootstrap\BootstrapPluginAsset::className()]]); $this->registerCssFile('@web/resources/space/colorpicker/css/bootstrap-colorpicker.min.css', ['position' => yii\web\View::POS_BEGIN, 'depends' => [\yii\bootstrap\BootstrapPluginAsset::className()]]); $ts = time(); $inputId = $ts . 'space-color-picker-edit'; $containerId = $ts . 'space-color-chooser-edit'; $addonClass = $ts . 'input-group-addon'; if ($model->color == null) { $model->color = '#d1d1d1'; } ?> <div id="<?php echo $containerId; ?> " class="form-group space-color-chooser-edit" style="margin-top: 5px;"> <?php echo Html::activeTextInput($model, 'color', ['class' => 'form-control', 'id' => $inputId, 'value' => $model->color, 'style' => 'display:none']); ?> <?php echo $form->field($model, 'name', ['template' => ' {label} <div class="input-group"> <span class="input-group-addon"> <i></i> </span> {input} </div> {error}{hint}'])->textInput(['placeholder' => Yii::t('SpaceModule.views_create_create', 'Space name'), 'maxlength' => 45]);
/** * Renders the widget. */ public function run() { echo $this->renderItems($this->items, $this->options); BootstrapPluginAsset::register($this->getView()); }
<?php use yii\helpers\Html; use app\widgets\UserControl; use app\widgets\Nav; $this->registerAssetBundle(\yii\web\YiiAsset::className(), \yii\web\View::POS_HEAD); $this->registerAssetBundle(\yii\bootstrap\BootstrapAsset::className(), \yii\web\View::POS_HEAD); $this->registerAssetBundle(\app\assets\AppAsset::className(), \yii\web\View::POS_HEAD); $this->registerAssetBundle(\yii\bootstrap\BootstrapPluginAsset::className(), \yii\web\View::POS_HEAD); $this->beginPage(); ?> <!DOCTYPE html> <html lang="<?php echo Yii::$app->language; ?> "> <head> <meta charset="<?php echo Yii::$app->charset; ?> "/> <link rel="icon" type="image/png" href="/img/fav.png" /> <title><?php echo Html::encode($this->title); ?> </title> <?php $this->head(); ?> <?php echo Html::csrfMetaTags();
/** * Register slider-specific assets(js, css, etc.) * @return void */ public function registerAssets() { \yii\bootstrap\BootstrapPluginAsset::register($this->getView()); }
<?php use hipanel\modules\domain\models\Domain; use yii\helpers\Html; use yii\helpers\Url; use yii\web\View; /** * @var Domain $model */ $getPasswordUrl = Url::toRoute('get-password'); $changePasswordUrl = Url::toRoute('regen-password'); $errorMessage = Yii::t('hipanel', 'An error occurred. Try again please.'); $successMessage = Yii::t('hipanel:domain', 'The password has been changed'); \yii\bootstrap\BootstrapPluginAsset::register($view); $view->registerJs(<<<JS jQuery('#pincode-modal').on('shown.bs.modal', function () { \$('#pincode').focus(); }); jQuery('#pincode-modal').on('show.bs.modal', function (e) { jQuery('#pincode').val(''); jQuery('#pincode-modal .form-group').removeClass('has-error'); jQuery('#pincode-modal .help-block').text(''); }); jQuery('#get-authcode-button').on('click', function() { jQuery('#pincode-modal .form-group').removeClass('has-error'); jQuery('#pincode-modal .help-block').text(''); var btn = jQuery(this);
<?php use app\components\CategoryModel; use yii\helpers\Url; use app\modules\admin\widgets\Button; \yii\bootstrap\BootstrapPluginAsset::register($this); $this->title = Yii::$app->getModule('admin')->activeModules[$this->context->module->id]->title; $baseUrl = '/admin/' . $this->context->moduleName; $this->params['actions_buttons'] = [['tagName' => 'a', 'label' => Yii::t('admin', 'Create'), 'options' => ['href' => Url::to(['create'])], 'icon' => 'fa fa-plus', 'iconPosition' => Button::ICON_POSITION_LEFT, 'size' => Button::SIZE_SMALL, 'disabled' => false, 'block' => false, 'type' => Button::TYPE_CIRCLE]]; ?> <?php if (sizeof($cats) > 0) { ?> <table class="table table-hover"> <tbody> <?php foreach ($cats as $cat) { ?> <tr> <td width="50"><?php echo $cat->id; ?> </td> <td style="padding-left: <?php echo $cat->depth * 20; ?> px;"> <?php if (count($cat->children)) { ?>
/** * Renders the widget. */ public function run() { $tag = ArrayHelper::remove($this->containerOptions, 'tag', 'div'); echo Html::endTag($tag); if ($this->renderInnerContainer) { echo Html::endTag('div'); } $tag = ArrayHelper::remove($this->options, 'tag', 'nav'); echo Html::endTag($tag, $this->options); BootstrapPluginAsset::register($this->getView()); }
/** * Renders the widget. */ public function run() { BootstrapPluginAsset::register($this->getView()); $this->registerClientEvents(); return $this->renderItems($this->items, $this->options); }
/** * * @param \yii\web\Application $app */ public function bootstrap($app) { $app->set('view', ['class' => 'yii\\web\\View', 'theme' => ['pathMap' => ['' => '']]]); $view = $app->getView(); $pathMap = []; if (!isset($this->features['datecontrol'])) { $this->features['datecontrol'] = true; } if ($this->features['datecontrol'] != false) { $app->setModules(['datecontrol' => ['class' => '\\kartik\\datecontrol\\Module', 'displaySettings' => [\kartik\datecontrol\Module::FORMAT_DATE => 'dd-MM-yyyy', \kartik\datecontrol\Module::FORMAT_TIME => 'HH:mm:ss', \kartik\datecontrol\Module::FORMAT_DATETIME => 'dd-MM-yyyy HH:mm:ss'], 'saveSettings' => [\kartik\datecontrol\Module::FORMAT_DATE => 'php:Y-m-d', \kartik\datecontrol\Module::FORMAT_TIME => 'php:H:i:s', \kartik\datecontrol\Module::FORMAT_DATETIME => 'php:Y-m-d H:i:s'], 'autoWidget' => true, 'autoWidgetSettings' => [\kartik\datecontrol\Module::FORMAT_DATE => ['pluginOptions' => ['autoclose' => true]], \kartik\datecontrol\Module::FORMAT_DATETIME => ['pluginOptions' => ['autoclose' => true]], \kartik\datecontrol\Module::FORMAT_TIME => ['pluginOptions' => ['autoclose' => true]]]]]); Yii::$container->set('kartik\\datecontrol\\DateControl', ['ajaxConversion' => false]); } if (!isset($this->features['gridview'])) { $this->features['gridview'] = true; } if ($this->features['gridview'] != false) { $app->setModules(['gridview' => ['class' => '\\kartik\\grid\\Module']]); } if (!isset($this->features['gii'])) { $this->features['gii'] = true; } if ($this->features['gii'] != false) { $app->setModules(['gii' => ['class' => 'yii\\gii\\Module', 'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '192.168.178.20'], 'generators' => ['crud' => ['class' => 'hscstudio\\heart\\modules\\gii\\crud\\Generator', 'templates' => ['my' => '@hscstudio/heart/modules/gii/crud/default']]]]]); } if (!isset($this->features['privilege'])) { $this->features['privilege'] = true; } if ($this->features['privilege'] != false) { $authManager = ArrayHelper::remove($this->features['privilege'], 'authManager', ['class' => 'yii\\rbac\\DbManager']); $allowActions = ArrayHelper::remove($this->features['privilege'], 'allowActions', ['debug/*', 'site/*', 'gii/*', 'privilege/*', 'gridview/*']); $app->set('authManager', $authManager); $app->setModule('privilege', array_merge(['class' => '\\mdm\\admin\\Module', 'layout' => '@hscstudio/heart/views/layouts/column2'], $this->features['privilege'])); $app->attachBehavior('access', ['class' => '\\mdm\\admin\\components\\AccessControl', 'allowActions' => $allowActions]); //$app->getModule('privilege')->bootstrap($app); /* $pathMap['@mdm/admin/views'] = '@hscstudio/heart/modules/admin/views'; */ } $pathMap['@app/views/layouts'] = '@hscstudio/heart/views/layouts'; if (!empty($pathMap)) { $view->theme = Yii::createObject(['class' => 'yii\\base\\Theme', 'pathMap' => $pathMap]); } $assets = $view->assetManager->publish('@hscstudio/heart/assets/heart'); $view->registerCssFile($assets[1] . '/css/heart.css', ['depends' => [BootstrapAsset::className()]], 'css-heart'); $view->registerCssFile($assets[1] . '/css/metroui.css', ['depends' => [BootstrapAsset::className()]], 'css-metroui'); $view->registerCssFile($assets[1] . '/css/family-tree.css', ['depends' => [BootstrapAsset::className()]], 'css-family-tree'); $view->registerJsFile($assets[1] . '/js/heart.js', ['depends' => [BootstrapPluginAsset::className()]]); $css = ' .overlay, .loading-img { position: fixed; top: 0; left: 0; width: 100%; height: 100%; } .overlay { z-index: 1010; background: rgba(255, 255, 255, 0.7); } .overlay.dark { background: rgba(0, 0, 0, 0.5); } .loading-img { z-index: 1020; background: transparent url("' . $assets[1] . '/img/ajax-loader1.gif") 50% 20% no-repeat; } .bootstrap-switch { min-width:125px !important; } '; $view->registerCss($css); $view->registerJsFile($assets[1] . '/js/bootstrap-growl.min.js', ['depends' => [BootstrapPluginAsset::className()]]); \yii\base\Event::on('yii\\web\\Controller', 'beforeAction', function ($event) { if ($event->sender->uniqueId == 'site') { $event->sender->layout = 'column1'; } }); }