Ejemplo n.º 1
0
 public function actionShow($id)
 {
     $model = Photo::findOne($id);
     $marks = AdminPhoto::getMarks($id);
     $comments = AdminCommon::getComments('photo', $id, 0, 5);
     $content = ['content_type' => 'photo', 'content_id' => $id];
     $categories = Category::getAllCategory();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $model->save();
     }
     $photo = AdminPhoto::getPhotoInfo($id);
     if (!isset($photo['photo_id'])) {
         return $this->render('error.404.php');
     }
     return $this->render('show', ['photo' => $photo, 'marks' => $marks, 'comments' => $comments, 'model' => $model, 'categories' => $categories, 'content' => $content]);
 }