public function actionCity($city = null)
 {
     $model = new SegScheduledTours('search_f');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_POST['SegScheduledTours'])) {
         ///kent
         $city = null;
         $json_data = json_encode($_POST['SegScheduledTours']);
         Yii::app()->session->add('last_search', $json_data);
         Yii::app()->user->setState('city_data', $json_data);
     }
     if (Yii::app()->user->hasState("city_data")) {
         if (Yii::app()->user->getState("city_data")) {
             $postdata = get_object_vars(json_decode(Yii::app()->user->getState("city_data")));
             $model->setAttributes($postdata);
         }
         //var_dump($postdata);
         Yii::app()->user->setState('city_data', null);
     }
     if (!is_null($city)) {
         $model->setAttribute("city_id", $city);
     }
     if (empty($model->city_id)) {
         $this->redirect(array("index"));
     }
     //			 throw new CHttpException(403,'Must specify a city before performing this action.');
     $tours = new SegTourroutes('search');
     $tours->setAttribute("cityid", $model->city_id);
     $cur_date = 0;
     $cur_time = 0;
     if (is_null($model->date)) {
         $model->setAttribute("date", date("d-m-Y", time()));
         $cur_date = 1;
     }
     if (is_null($model->starttime)) {
         $time_bd = date('H:i:s', time());
         // now time in hosting
         $cur_time = 1;
     } else {
         $time_bd = $model->starttime;
     }
     if ($cur_time == 1 && $cur_date == 0) {
         $model->from_date = date("Y-m-d", strtotime($model->date)) . " 00:00:00";
     } else {
         $model->from_date = date("Y-m-d", strtotime($model->date)) . " " . $time_bd;
     }
     $this->render('city', array('model' => $model, 'tours' => $tours));
 }