public function registerRegional() { $lang = Data::getLocale(); if ($lang != 'en') { $langAsset = 'lang/' . $lang . '.js'; if (file_exists(Yii::getAlias($this->assetBundle->sourcePath . '/' . $langAsset))) { $this->assetBundle->js[] = $langAsset; $this->options['lang'] = $lang; } } }
public function actionClearModuleSettings() { $activedModules = \yii\easyii\models\Module::findAllActive(); $language = Data::getLocale(); foreach (glob(Yii::getAlias('@easyii') . DIRECTORY_SEPARATOR . 'modules/*') as $module) { $moduleName = basename($module); $moduleClass = 'yii\\easyii\\modules\\' . $moduleName . '\\' . ucfirst($moduleName) . 'Module'; $moduleConfig = $moduleClass::$installConfig; $installedModule = $activedModules[$moduleName]; $module = Module::findOne($installedModule->module_id); $module->title = !empty($moduleConfig['title'][$language]) ? $moduleConfig['title'][$language] : $moduleConfig['title']['en']; $module->settings = Yii::createObject($moduleClass, [$moduleName])->settings; $module->order_num = $moduleConfig['order_num']; $module->icon = $moduleConfig['icon']; $module->status = Module::STATUS_ON; $module->save(); } return $this->back(); }
public function registerScript() { if (empty($this->options['locale'])) { $this->options['locale'] = Data::getLocale(); } $clientOptions = count($this->options) ? Json::encode($this->options) : ''; $time = $this->model->{$this->attribute} ? $this->model->{$this->attribute} : time(); $this->getView()->registerJs(' var dtpContainer = $("#' . $this->widgetId . '"); dtpContainer.datetimepicker(' . $clientOptions . ') .on("dp.change", function (e) { $("#' . Html::getInputId($this->model, $this->attribute) . '").val(e.date.unix()); }) .data("DateTimePicker") .date(moment(' . $time * 1000 . ')); $("[type=text]", dtpContainer).focus(function(e){ dtpContainer.data("DateTimePicker").show(); }); '); }
private function installModules() { $language = Data::getLocale(); foreach (glob(Yii::getAlias('@easyii') . DIRECTORY_SEPARATOR . 'modules/*') as $module) { $moduleName = basename($module); $moduleClass = 'yii\\easyii\\modules\\' . $moduleName . '\\' . ucfirst($moduleName) . 'Module'; $moduleConfig = $moduleClass::$installConfig; $module = new Module(['name' => $moduleName, 'class' => $moduleClass, 'title' => !empty($moduleConfig['title'][$language]) ? $moduleConfig['title'][$language] : $moduleConfig['title']['en'], 'icon' => $moduleConfig['icon'], 'settings' => Yii::createObject($moduleClass, [$moduleName])->settings, 'order_num' => $moduleConfig['order_num'], 'status' => Module::STATUS_ON]); $module->save(); } }