Exemplo n.º 1
0
 public function registerAppAssets($view)
 {
     F2NginAsset::register($view);
     if ($this->assetBundles !== null) {
         if (is_array($this->assetBundles)) {
             foreach ($this->assetBundles as $bundle) {
                 call_user_func($bundle . '::register', $view);
             }
         } else {
             call_user_func($this->assetBundles . '::register', $view);
         }
     }
 }
Exemplo n.º 2
0
 public function actionSetSkin($skin)
 {
     $currentUserId = Yii::$app->user->getId();
     $settings = Yii::$app->get('settings');
     if ($skin == 'default') {
         $settings->delete('user-' . $currentUserId, 'skin');
         $settings->clearCache();
     } else {
         if (in_array('skin-' . $skin, F2NginAsset::getAvaibleSkins())) {
             $settings->set('user-' . $currentUserId, 'skin', 'skin-' . $skin);
         }
     }
     $this->goBack();
 }
Exemplo n.º 3
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     if (Yii::$app->user->isGuest) {
     } else {
         $currentUserId = Yii::$app->user->getId();
         $settings = Yii::$app->get('settings');
         $this->skin = $settings->get('user-' . $currentUserId, 'skin');
         if ($this->skin == null) {
             $this->skin = $settings->get('system', 'default-skins');
             $this->skin = $this->skin == null ? 'skin-blue' : $this->skin;
         }
         if ($this->skin) {
             if (!in_array($this->skin, F2NginAsset::getAvaibleSkins())) {
                 //throw new \yii\base\Exception('Invalid skin specified: '.$this->skin);
                 $this->skin = 'skin-blue';
             }
             $this->css[] = sprintf('css/skins/%s', $this->skin);
         }
     }
     if (YII_ENV !== 'dev') {
         foreach ($this->css as $key => $value) {
             $this->css[$key] = $value . '.min.css';
         }
         foreach ($this->js as $key => $value) {
             $this->js[$key] = $value . '.min.js';
         }
     } else {
         foreach ($this->css as $key => $value) {
             $this->css[$key] = $value . '.css';
         }
         foreach ($this->js as $key => $value) {
             $this->js[$key] = $value . '.js';
         }
     }
     parent::init();
 }
 /** @inheritdoc */
 public function rules()
 {
     return ['defaultSkinRequired' => [['default_skin'], 'required'], 'defaultSkinAvaiable' => [['default_skin'], 'in', 'range' => F2NginAsset::getAvaibleSkins()]];
 }
Exemplo n.º 5
0
<?php

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use johnitvn\f2ngin\assets\F2NginAsset;
/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model johnitvn\f2ngin\models\AdministratorConfigForm */
$form = ActiveForm::begin(['id' => 'adminstrator-config-form', 'action' => ['/f2ngin/default/save-administrator-config'], 'method' => 'post', 'enableAjaxValidation' => true, 'enableClientValidation' => false]);
?>

<?php 
echo $form->field($model, 'default_skin')->dropDownList(F2NginAsset::getAvaibleSkinLabels());
?>

<?php 
echo Html::submitButton('Save', ['class' => 'btn btn-primary btn-block btn-flat', 'name' => 'login-button']);