Exemple #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));
 }
Exemple #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;
 }
Exemple #3
0
<!-- registartion -->
<div class="registration nuclear">
    <img src="<?php 
echo Yii::app()->theme->baseUrl;
?>
/images/ban.jpg" alt="" class="bg" />
    <div class="reg-in">
        <div class="search">
            <div class="headline">Поиск</div>
            <?php 
$model = new AnketaSearch();
$model->loadDefaults();
?>
            <?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'search-form', 'action' => array('anketa/search'), 'method' => 'get', 'enableClientValidation' => true, 'clientOptions' => array('validateOnSubmit' => true)));
/** @var $form CActiveForm */
$ages = array_combine(range(18, 55), range(18, 55));
?>
                <div class="sel-block">
                    <div class="row nuclear">
                        <div class="item">
                            <b class="hd">Я</b>
                            <?php 
echo $form->dropDownList($model, 'mygender', Anketa::$getGenders);
?>
                        </div>
                        <div class="item item-rht">
                            <b class="hd">Ищу</b>
                            <?php 
echo $form->dropDownList($model, 'gender', Anketa::$getGendersGenitive);
?>