Beispiel #1
0
 public function actionSearch()
 {
     $model = new AnketaSearch();
     $model->loadDefaults();
     if (isset($_GET['AnketaSearch'])) {
         $model->attributes = $_GET['AnketaSearch'];
         $model->saveAsDefaults();
     }
     $this->render('search', array('model' => $model));
 }
Beispiel #2
0
 public function actionView($alias = false)
 {
     if ($alias) {
         $city = City::model()->findByAttributes(array('alias' => $alias));
     }
     if (!$city) {
         throw new CHttpException(404, 'Not found');
     }
     $SearchForm = new AnketaSearch();
     $SearchForm->loadDefaults();
     $SearchForm->location = $city->name;
     $SearchForm->saveAsDefaults();
     // echo $SearchForm->location; d
     $LoginForm = new LoginForm();
     $condition = 'gender=0 AND age>18 AND  NOT status_bad & 1' . " AND (location LIKE :city)";
     //last_visit>=UNIX_TIMESTAMP()-259200 AND
     $womanProvider = new CActiveDataProvider('Anketa', array('criteria' => array('limit' => 24, 'order' => 'mainphoto DESC,rand()', 'scopes' => array('published'), 'condition' => $condition, 'params' => array(':city' => '%' . $city->name . '%')), 'pagination' => false));
     $manProvider = new CActiveDataProvider('Anketa', array('criteria' => array('limit' => 16, 'order' => 'mainphoto DESC,rand()', 'scopes' => array('published'), 'condition' => 'gender=1 AND NOT status_bad & 1' . " AND (location LIKE :city)", 'params' => array(':city' => '%' . $city->name . '%')), 'pagination' => false));
     $this->render('view', compact('womanProvider', 'manProvider', 'SearchForm', 'LoginForm', 'city'));
     exit;
 }