예제 #1
0
 public function actionRoute()
 {
     $area = Area::model()->findAll();
     $continent = Continent::model()->findAll();
     $boat = Boat::model()->findAll();
     $this->g_area = $area;
     $this->g_continent = $continent;
     $company = Company::model()->findAll();
     $this->g_company = $company;
     $s_data = $_GET['d'];
     $s_company = $_GET['c'];
     $s_area = $_GET['a'];
     $s_days = $_GET['days'];
     if (strstr($s_data, '请选择')) {
         $s_data = '全部';
     }
     if (strstr($s_company, '请选择')) {
         $s_company = '全部';
     }
     if (strstr($s_area, '请选择')) {
         $s_area = '全部';
     }
     $year = date("Y");
     $month = date('n');
     $arr = array();
     for ($i = $month; $i <= 12; $i++) {
         array_push($arr, $year . '年' . $i . '月');
     }
     $year += 1;
     for ($i = 1; $i <= 12; $i++) {
         array_push($arr, $year . '年' . $i . '月');
     }
     $criteria = new CDbCriteria();
     if ($s_company != '全部') {
         $criteria->addCondition("company = '{$s_company}' ", 'AND');
     }
     if ($s_data != '全部') {
         $d = str_replace('年', '-', $s_data);
         $d = str_replace('月', '', $d);
         $criteria->addCondition(" start_time >= '{$d}' and start_time < " . '"' . $d . '-40"', 'AND');
     }
     if ($s_area != '全部') {
         $criteria->addCondition("area = '{$s_area}' or continent = '{$s_area}' ", 'AND');
     }
     if ($s_days != '全部') {
         if ($s_days == 3) {
             $criteria->addCondition("days <= {$s_days}", 'AND');
         } else {
             if ($s_days == 11) {
                 $criteria->addCondition("days >= {$s_days}", 'AND');
             } else {
                 $criteria->addCondition("days = {$s_days}", 'AND');
             }
         }
     }
     $page = 0;
     if (isset($_GET['page'])) {
         $page = $_GET['page'];
     }
     $count = Route::model()->count($criteria);
     $criteria->limit = 10;
     $criteria->offset = $page * $criteria->limit;
     $result = Route::model()->findAll($criteria);
     $schedule = array();
     #		$item = str_replace(',', ' and id = ', $item);
     #		$item = ' id = '.$item;
     #		$c = new CDbCriteria;
     #		$c->condition = $item;
     #		$c->order = 'day asc';
     #		$c->select = 'title';
     #		$r = Schedule::model()->findAll($c);
     #		array_push($schedule, $r);
     //echo '<meta charset="UTF-8">';
     //echo $criteria->condition;
     //var_dump($result);
     $this->render('index', array('s_data' => $s_data, 's_company' => $s_company, 's_area' => $s_area, 'area' => $area, 'continent' => $continent, 'company' => $company, 'data' => $arr, 'result' => $result, 'count' => $count, 'page' => $page, 'limit' => $criteria->limit, 's_days' => $s_days, 'schedule' => $schedule));
 }
예제 #2
0
 public function actionSelect_boat()
 {
     $company = $_POST['company'];
     if (!$company) {
         exit;
     }
     $criteria = new CDbCriteria();
     // 创建CDbCriteria对象
     $criteria->select = 'name';
     $criteria->condition = 'company = "' . $company . '"';
     // 设置查询条件
     $model = Boat::model()->findAll($criteria);
     $ret = '';
     foreach ($model as $value) {
         $ret .= '<option>' . $value->name . '</option>';
     }
     echo CJSON::encode(array('option' => $ret));
 }
예제 #3
0
 public function actionSave_boat()
 {
     $source = '';
     $thumb = '';
     if (isset($_POST['source'])) {
         $source = $_POST['source'];
     }
     if (isset($_POST['thumb'])) {
         $thumb = $_POST['thumb'];
     }
     Boat::model()->updateByPk($_POST['id'], array('name' => $_POST['title'], 'zaikeshu' => $_POST['zaikeshu'], 'paishuiliang' => $_POST['paishuiliang'], 'zuigaosudu' => $_POST['zuigaosudu'], 'jiabanlouceng' => $_POST['jiabanlouceng'], 'gongzuorenyuan' => $_POST['gongzuorenyuan'], 'changdu' => $_POST['changdu'], 'kuandu' => $_POST['kuandu'], 'gaodu' => $_POST['gaodu'], 'description' => $_POST['content'], 'source' => $source, 'thumb' => $thumb, 'type' => $_POST['type']));
     echo 1;
 }
예제 #4
0
 public function actionSearch()
 {
     $keyword = $_POST['keywords'];
     $boat = $_POST['boat'];
     $str = '';
     echo header("Content-Type: text/html;charset=utf-8");
     $model = NULL;
     if ($keyword) {
         $str = 'boat like ' . '"' . '%' . $keyword . '%' . '"';
     }
     if ($boat) {
         if ($str != '') {
             $str .= ' and ';
         }
         $str .= ' boat =' . '"' . $boat . '"';
     }
     $criteria = new CDbCriteria();
     // 创建CDbCriteria对象
     $criteria->condition = $str;
     // 设置查询条件
     $model = Diary::model()->findAll($criteria);
     $boat = Boat::model()->findAll();
     $this->render('index', array('diary' => $model, 'boat' => $boat));
 }
예제 #5
0
 public function actionAdd()
 {
     $boat = Boat::model()->findAll();
     $area = Area::model()->findAll();
     $company = Company::model()->findAll();
     $port = Port::model()->findAll();
     $continent = Continent::model()->findAll();
     $this->render('add', array('boat' => $boat, 'area' => $area, 'port' => $port, 'company' => $company, 'continent' => $continent));
 }
예제 #6
0
 public function actionGet_boat()
 {
     $criteria = new CDbCriteria();
     $criteria->condition = "(type & 4) !=0";
     $criteria->limit = 8;
     $boat = Boat::model()->findAll($criteria);
     $html = '<ul class="local_trip_pro" id="local_trip_content_list" data-blockid="recommend_localjoin">';
     for ($j = 0; $j < count($boat); $j++) {
         if ($j) {
             $html .= '<li class="local_trip_pro_li wq_clearfix hide" data-content="lj' . $j . '" style="display:none;">';
         } else {
             $html .= '<li class="local_trip_pro_li wq_clearfix" data-content="lj' . $j . '">';
         }
         $arr = explode(',', $boat[$j]->source);
         for ($i = 1; $i < count($arr) && $i < 4; $i++) {
             if ($i - 1) {
                 $html .= '<a class="local_trip_right img_slide_animte_wrapper" href="';
             } else {
                 $html .= '<a class="local_trip_left_l img_slide_animte_wrapper" href="';
             }
             if ($i - 1) {
                 $html .= '#" target="_blank"> <img class="local_trip_img_s img_slide_animte first_page"  src="' . $arr[$i] . '" data-original="' . $arr[$i] . '" style="display: block;"> <span class="local_trip_mask_s"></span> <span class="local_trip_txt_s" title="' . '">' . '</span>' . '<span class="local_trip_price_s font_size12"><span class="font_size16">' . '</span></span></a>';
             } else {
                 $html .= '#" target="_blank"> <img class="local_trip_img_l img_slide_animte first_page" alt=" ' . '" src="' . $arr[$i] . '" data-original="' . $arr[$i] . '" style="display: block;"> <span class="local_trip_mask_l"></span> <span class="local_trip_bl"></span><span class="local_trip_txt_l" title="' . '">' . '</span>' . '<span class="local_trip_price_l font_size14 font_color_orange"><span class="font_size28">' . '</span></span></a>';
             }
         }
         $html .= '</li>';
     }
     $html .= '</ul>';
     echo $html;
 }