コード例 #1
0
ファイル: Widget.php プロジェクト: muvo/yii2-slider
 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\'!');
     }
 }
コード例 #2
0
ファイル: main.php プロジェクト: quynhvv/stepup
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">
コード例 #3
0
ファイル: BaseField.php プロジェクト: gromver/yii2-models
 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;
 }
コード例 #4
0
ファイル: main.php プロジェクト: tsyrya/mybriop
<?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();
コード例 #5
0
ファイル: main.php プロジェクト: DezMonT765/beacon-cms
<?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;
コード例 #6
0
<?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]);
コード例 #7
0
<?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];
コード例 #8
-1
ファイル: Module.php プロジェクト: hscstudio/yii2-heart
    /**
     * 
     * @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';
            }
        });
    }