/** * 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)); } } }
public function actionSetcover() { $m = Avto::model()->findByPk($_POST['id']); $m->picture = $_POST['file']; $m->save(); }
<?php if (Avto::model()->countByAttributes(array('uid' => $model->id, 'class' => 'premium')) > 0) { ?> <li id="premium" class="<?php echo isset($_GET['class']) && $_GET['class'] == 'premium' ? 'active' : ''; ?> " onclick="window.location.href='/id<?php echo $model->id; ?> ?class=premium';">Премиум</li> <?php } ?> <?php if (Avto::model()->countByAttributes(array('uid' => $model->id, 'class' => 'bus')) > 0) { ?> <li id="bus" class="<?php echo isset($_GET['class']) && $_GET['class'] == 'bus' ? 'active' : ''; ?> " onclick="window.location.href='/id<?php echo $model->id; ?> ?class=bus';">Автобусы</li> <?php } ?> </ul> <div class="accaunt-plus__service__list"> <?php foreach ($avto as $item) {
public function CalcUsers($id) { if (isset(Yii::app()->request->cookies['city'])) { $city = 'city_id="' . Yii::app()->request->cookies['city']->value . '" or other_city="' . Yii::app()->request->cookies['city']->value . '"'; } else { $city = 'city_id!="" or other_city!=""'; } $users = Users::model()->findAllBySql('select id from {{users}} where (' . $city . ') and activate=1 and occupation_id=' . $id); $i = 0; foreach ($users as $user) { if ($id == 1 || $id == 2 || $id == 4 || $id == 18 || $id == 19 || $id == 17) { if (Files::model()->countByAttributes(array('uid' => $user->id)) >= 4) { $i++; } } elseif ($id == 5) { if (Avto::model()->countByAttributes(array('uid' => $user->id)) >= 1) { $i++; } } else { if (Flo::model()->countByAttributes(array('uid' => $user->id)) >= 1) { $i++; } } } return $i; }