/**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $user = $this->loadModel($id);
     if ($user->occupation_id == 5) {
         //avto
         if (Yii::app()->getRequest()->getParam('class') != '') {
             $avto = Avto::model()->findAllByAttributes(array('uid' => $id, 'class' => Yii::app()->getRequest()->getParam('class')));
         } else {
             $avto = Avto::model()->findAllByAttributes(array('uid' => $id));
         }
         $this->render('view_avto', array('model' => $user, 'avto' => $avto));
     } elseif ($user->occupation_id == 6) {
         //flo
         $flo = Flo::model()->findAllByAttributes(array('uid' => $id));
         $this->render('view_flo', array('model' => $user, 'flo' => $flo));
     } elseif ($user->occupation_id == 17) {
         //studio
         //$cond_hals='type="photo" and source="hall" and visible=1';
         $hals = StudioHals::model()->with('files')->findAllByAttributes(array('uid' => $id, 'visible' => 1));
         $banners = StudioBanners::model()->findByAttributes(array('uid' => $id));
         if (isset($_GET['calendar'])) {
             $this->render('view_studio_calendar', array('model' => $user));
         } elseif (isset($_GET['equip'])) {
             $this->render('view_studio_equip', array('model' => $user, 'equips' => StudioEquip::model()->findAllByAttributes(array('uid' => $id, 'visible' => 1))));
         } elseif (isset($_GET['prices'])) {
             $this->render('view_studio_prices', array('model' => $user, 'prices' => StudioHals::model()->findAllByAttributes(array('uid' => $id, 'visible' => 1))));
         } elseif (isset($_GET['rent'])) {
             $this->render('view_studio_rent', array('model' => $user, 'rent' => StudioRent::model()->findAllByAttributes(array('uid' => $id, 'visible' => 1))));
         } elseif (isset($_GET['halls'])) {
             if (isset($_GET['hid'])) {
                 $hals = StudioHals::model()->findAllByAttributes(array('uid' => $id, 'visible' => 1));
                 $hall = StudioHals::model()->with('files')->findByAttributes(array('id' => intval($_GET['hid']), 'uid' => $id, 'visible' => 1));
                 $this->render('view_studio_hals', array('model' => $user, 'hall' => $hall, 'hals' => $hals));
             } else {
                 $this->render('view_studio', array('model' => $user, 'hals' => $hals, 'banners' => $banners));
             }
         } else {
             $this->render('view_studio', array('model' => $user, 'hals' => $hals, 'banners' => $banners));
         }
     } elseif ($user->genre_id == '') {
         //other users without genres
         $flo = Flo::model()->findAllByAttributes(array('uid' => $id));
         $this->render('view_user', array('model' => $user, 'flo' => $flo));
     } else {
         if ($user->occupation_id == 2) {
             //video operator
             /*$portfolio=Files::model()->findAllByAttributes(array('uid'=>$id,'type'=>'video','source'=>'portfolio'));
                     $this->render('view_video',array(
             			'model'=>$this->loadModel($id),
                         'portfolio'=>$portfolio,
             		));*/
             $portfolio = Video::model()->findAllByAttributes(array('uid' => $id));
             $this->render('view_video', array('model' => $this->loadModel($id), 'portfolio' => $portfolio));
         } else {
             $portfolio = Portfolio::model()->findAllByAttributes(array('uid' => $id));
             $this->render('view', array('model' => $this->loadModel($id), 'portfolio' => $portfolio));
         }
     }
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return StudioBanners the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = StudioBanners::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }