예제 #1
0
 public function actionCountry()
 {
     //error_log(' -------------------- country --------------------------------');
     //error_log('country_id ' . Yii::app()->request->getPost('country'));
     Filter::setCountryId(Yii::app()->request->getPost('country'));
     //error_log('get country_id ' . Filter::getCountryId());
     $data = Location::model()->selectCity(Filter::getCountryId());
     Filter::setCityId(current(array_keys($data)));
     //error_log('get city_id ' . Filter::getCityId());
     //error_log(' -------------------- end country1 --------------------------------');
     //echo "<pre>";
     //error_log(print_r($_SESSION['filter'],true));
     //echo "</pre>";
     //Yii::app()->end();
     //echo CHtml::tag('option', array('value' => 0, 'selected'=>true), CHtml::encode('All city'), true). "\n";
     $tagList = '';
     foreach ($data as $key => $value) {
         $tagList .= CHtml::tag('option', array('value' => $key), CHtml::encode($value), true) . "\n";
     }
     $this->responceAjax($tagList);
 }
예제 #2
0
 public function run()
 {
     //Filter::initialization();
     //error_log(print_r(Yii::app()->basePath,true));
     $data = array();
     $event = Events::$even;
     if (Filter::getSortByDate()) {
         usort($event, "Events::sortByDate");
     } elseif (Filter::getSortByPopularity()) {
         usort($event, "Events::sortByPopularity");
     }
     //error_log(print_r($this->controller->getViewFile('poster'),true));
     $data['ajaxContent'] = $this->controller->renderPartial('poster', array('parameters' => $event), true);
     $data['main_menu'] = $this->controller->renderPartial('main_menu', array(), true);
     $location = new Location();
     $style = new Style();
     $data['country'] = $location->selectContry();
     if (!Filter::getCountryId()) {
         Filter::setCountryId(current(array_keys($data['country'])));
     }
     $data['city'] = $location->selectCity(Filter::getCountryId());
     if (!Filter::getCityId()) {
         Filter::setCityId(0);
     }
     //Filter::setCityId(current(array_keys($data['city'])));
     $data['style'] = $style->selectStyle();
     if (!Filter::getStyleId()) {
         Filter::setStyleId(current(array_keys($data['style'])));
     }
     /*Filter::getStyleId()*/
     $data['genre'] = $style->selectGenre(Filter::getStyleId());
     if (!Filter::getGenreId()) {
         Filter::setGenreId(current(array_keys($data['genre'])));
     }
     $data['model'] = new FilterForm();
     $this->controller->render('index', $data);
     //$this->controller->render('translationUser', array('row'=>0));
 }
예제 #3
0
    <?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'FilterForm', 'enableAjaxValidation' => true, 'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => false, 'validateOnType' => false), 'htmlOptions' => array('class' => 'form'), 'action' => array('')));
?>
    <div class="filters-label">
        Фільтри:
    </div>
    <div class="filter-label">
        <?php 
echo $form->labelEx($model, 'country') . "\n";
?>
        <?php 
// echo $form->dropDownList($model,'country', $contry) . "\n";
?>
        <?php 
if (Filter::getCountryId()) {
    $options[Filter::getCountryId()] = array('selected' => true);
} else {
    $options[0] = array('selected' => true);
}
echo CHtml::dropDownList('country', '', $country, array('ajax' => array('type' => 'POST', 'url' => CController::createUrl('filter/country'), 'success' => 'function(jdata){' . 'var data = $.parseJSON(jdata);' . 'jQuery("#city").html(data.data);' . '}'), 'options' => $options));
//CHtml::dropDownList($name, $select, $data, $htmlOptions)
$options = null;
?>
        <?php 
echo $form->error($model, 'country') . "\n";
?>
    </div>
    <div class="filter-label">
        <?php 
echo $form->labelEx($model, 'city') . "\n";
?>