Ejemplo n.º 1
0
 protected function getLanguages()
 {
     $languages = DctLanguage::find()->select(['dct_language_id as id', 'name', 'locale'])->asArray()->all();
     foreach ($languages as $lang) {
         $langList[$lang['id']] = $lang['name'];
     }
     return $languages;
 }
Ejemplo n.º 2
0
 /**
  * Lists all DctLanguage models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => DctLanguage::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
Ejemplo n.º 3
0
 public function run()
 {
     return $this->render('lang/view', ['current' => DctLanguage::getCurrent(), 'langs' => DctLanguage::find()->where(['enable' => 1])->all()]);
 }
Ejemplo n.º 4
0
 static function getLangByUrl($url = null)
 {
     if ($url === null) {
         return null;
     } else {
         $language = DctLanguage::find()->where('url = :url', [':url' => $url])->one();
         if ($language === null) {
             return null;
         } else {
             return $language;
         }
     }
 }