Beispiel #1
0
 public function init()
 {
     $lang = Lang::getCurrent()->url;
     $model['am'] = new ProductsAm();
     $model['ru'] = new ProductsRu();
     $model['en'] = new ProductsEn();
     $this->lang = $lang;
     $this->model = $model[$lang];
 }
Beispiel #2
0
 public function getLangUrl()
 {
     if ($this->_lang_url === null) {
         $this->_lang_url = $this->getUrl();
         $url_list = explode('/', $this->_lang_url);
         $lang_url = isset($url_list[1]) ? $url_list[1] : null;
         Lang::setCurrent($lang_url);
         if ($lang_url !== null && $lang_url === Lang::getCurrent()->url && strpos($this->_lang_url, Lang::getCurrent()->url) === 1) {
             $this->_lang_url = substr($this->_lang_url, strlen(Lang::getCurrent()->url) + 1);
         }
     }
     return $this->_lang_url;
 }
Beispiel #3
0
 public function actionIndex($id)
 {
     $lang = Lang::getCurrent()->url;
     $rating = new Rating();
     $model = $this->getModel();
     $product = $model->findOne($id);
     $reviews = $this->getReviews($id);
     $menu = Menu::getItemMenu($id);
     if ($rating->load(Yii::$app->request->post()) && $rating->validate()) {
         //User::d($_POST);
         $rating->product_id = $id;
         $rating->rating = $_POST['score_score'];
         $rating->save();
         $rating->reloadRating($id);
         return $this->refresh();
     } else {
         return $this->render('index', ['model' => $product, 'lang' => $lang, 'rating' => $rating, 'reviews' => $reviews, 'menu' => $menu]);
     }
 }