Exemplo n.º 1
0
 public function actionPhotovote()
 {
     if (!Yii::$app->user->isGuest && Yii::$app->request->post('photo') != null && Yii::$app->request->post('vote') != null) {
         QueryModel::photoVote(Yii::$app->request->post('photo'));
     }
     return PhotoRatesActiveRecord::getRates(Yii::$app->request->post('photo'));
 }
Exemplo n.º 2
0
 public function actionImage($id)
 {
     $photo = PhotoActiveRecord::findOne($id);
     $user = User::findOne($photo->userId);
     $photovote = PhotoRatesActiveRecord::getRates($id);
     $comments = QueryModel::comments($id);
     $tags = QueryModel::photoTags($id);
     $search = new SearchForm();
     if (!Yii::$app->user->isGuest) {
         $model = new CommentForm();
         if ($model->load(Yii::$app->request->post()) && $model->post()) {
             return $this->refresh();
         } else {
             return $this->render('image', ['user' => $user, 'photo' => $photo, 'photovote' => $photovote, 'comments' => $comments, 'tags' => $tags, 'search' => $search, 'model' => $model]);
         }
     } else {
         return $this->render('image', ['user' => $user, 'photo' => $photo, 'photovote' => $photovote, 'comments' => $comments, 'search' => $search, 'tags' => $tags]);
     }
 }