/** * Run the database seeds. * * @return void */ public function run() { DB::table('Languages')->delete(); Languages::create(['id' => 1, 'prefix' => 'en', 'name' => 'English']); Languages::create(['id' => 2, 'prefix' => 'ru', 'name' => 'Русский']); Languages::create(['id' => 3, 'prefix' => 'lt', 'name' => 'Lithuanian']); }
private function _home() { $lngList = Languages::lists('prefix', 'id'); $struct = $this->_blocksArr; $partialView = View::make("blocks._home", compact('lngList', 'struct'))->render(); return $partialView; }
/** * Returns language objects. * @param boolean $active True/False according to the status of the language. * @return Languages|array */ public static function getLanguages($active = true) { if ($active) { return Languages::find()->where(['status' => static::STATUS_ACTIVE])->all(); } else { return Languages::find()->all(); } }
public function LngCompose($view) { $arrLng = Languages::all()->toArray(); $action = Route::currentRouteAction(); $params = Route::getCurrentRoute()->parameters(); $arrAction = explode("\\", $action); $controller = array_pop($arrAction); $view->with(compact('arrLng', 'action', 'controller', 'params')); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $prefix = $request->lng; $lang = Languages::lists('id', 'prefix'); if (!empty($lang[$prefix])) { self::$lng_id = $lang[$prefix]; //global $lang_id = self::$lng_id; App::setlocale($prefix); } else { //global $lang_id = self::$lng_id; } return $next($request); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Languages::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['language_id' => SORT_DESC]]]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['language_id' => $this->language_id, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by]); $query->andFilterWhere(['like', 'language_name', $this->language_name]); unset($_SESSION['exportData']); $_SESSION['exportData'] = $dataProvider; return $dataProvider; }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('Languages')->delete(); Languages::create(['id' => 1, 'prefix' => 'en', 'lang_name' => 'English']); Languages::create(['id' => 2, 'prefix' => 'ru', 'lang_name' => 'Russian']); }
/** * @return \yii\db\ActiveQuery */ public function getLanguages() { return $this->hasMany(Languages::className(), ['updated_by' => 'user_id']); }
public function getEditSlideContent($id) { $lngList = Languages::lists('lang_name', 'id')->toArray(); $keys = array_keys($lngList); $actLngId = array_shift($keys); $slideObj = Slides::findOrFail($id); $slideContent = $slideObj->slide_trl()->where('lng_id', '=', 1)->get()->shift(); return view('admin.slides.edit_slide_content', compact('slideObj', 'lngList', 'slideContent', 'actLngId')); }
</div> </div> <div class="col-xs-12 col-lg-12 col-lg-12"> <div class = "col-sm-12 col-xs-12"> <?php echo $form->field($info, 'emp_specialization')->textInput(['maxlength' => 85]); ?> </div> </div> <div class="col-xs-12 col-lg-12 col-lg-12"> <div class = "col-sm-12 col-xs-12"> <?php $data = ArrayHelper::map(Languages::find()->asArray()->all(), 'language_name', 'language_name'); foreach ($data as $d) { $langss[] = $d; } echo $form->field($info, 'emp_languages')->widget(Select2::classname(), ['name' => 'emp_languages[]', 'options' => ['placeholder' => ''], 'pluginOptions' => ['tags' => $langss, 'maximumInputLength' => 10, 'multiple' => true]]); ?> </div> </div> <div class="col-xs-12 col-lg-12 col-lg-12"> <div class = "col-sm-12 col-xs-12"> <?php echo $form->field($info, 'emp_hobbies')->textInput(['maxlength' => 35]); ?> </div>
<?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;
} ?> <?php if (Yii::$app->user->can(\app\commands\RbacController::admin)) { ?> <?php echo $form->field($model, 'groupsToBind')->textInput(['class' => '']); ?> <?php } ?> <?php echo $form->field($model, 'role')->dropDownList(Yii::$app->user->identity->getEditableRoles($model->id)); ?> <?php echo $form->field($model, 'language')->dropDownList(Languages::getLanguageNames(true)); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('general', ':create') : Yii::t('general', ':update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div> </div>
/** * * @param int $id - Structure id * @return View */ public function getEditStruct($id) { $lngList = Languages::lists('lang_name', 'id'); $struct = Structure::with('trl')->findOrFail((int) $id); return view('admin.main.edit_struct', compact('lngList', 'struct')); }
/** * Finds the Languages model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Languages the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Languages::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getLanguage0() { return $this->hasOne(Languages::className(), ['id' => 'language_id']); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function getIndex() { $langs = Languages::all(); return view('admin.lang.lang_index', compact('langs')); }
/** * Responds to requests to GET /edit */ public function Edit($id = 0) { return view('webmaster/languages/edit', ['languages' => Languages::all()]); }