/** * 返回所有大洲 * @return array */ public static function getContinentAll() { $continent_models = Continent::model()->findAll(); $continentArray = array(); foreach ($continent_models as $v) { $continentArray[$v['ID']] = $v['NameCn']; } return $continentArray; }
public function embed($server_slug, $continent_slug) { // Is valid server? if (!isset($this->servers[$server_slug])) { return App::abort('404'); } $server = $this->servers[$server_slug]; $continent = Continent::where('slug', '=', $continent_slug)->remember(1440)->first(); if (is_null($continent)) { return App::abort('404'); } return View::make('server/embed', compact('server', 'continent')); }
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)); }
/** * 管理图片 */ public function ActionAdminPicture() { //搜索条件处理 [E] $searchType = Yii::app()->request->getParam('searchType'); if ($searchType === 'page') { //判断是分页提交还是搜索列表提交的查询条件 $search = Yii::app()->request->getParam('search'); $search = unserialize(base64_decode($search)); //对分布传来的数据进行还原 } else { $search = Yii::app()->request->getParam('search'); } $search_continentid = ''; //搜索的大洲ID $search_countryid = ''; //搜索的国家ID $search_cityids = ''; //要搜索的所有城市id $search_picture_category_id = ''; //要搜索的图片类型 $search_pic_name = ''; //要搜索的图片名称或标题 $continent = array(); $country = array(); $city = array(); //得到国家名下对应的所有城市ID信息字符串 if (isset($search) && !empty($search['continent'])) { //大洲 $search_continentid = intval($search['continent']); if ($search['country']) { //大洲+国家 $search_countryid = intval($search['country']); if (empty($search['city'])) { //大洲+国家+城市 $search_cityids = AreaManage::getCityIdStrByCountryId($search_countryid); } else { //大洲+国家 $search_cityids = intval($search['city']); } } else { //只选择大洲 $search_countryid = AreaManage::getCountryStrByContinentId($search_continentid); if (empty($search['city'])) { $search_cityids = AreaManage::getCityIdStrByCountryId($search_countryid); } else { $search_cityids = trim($search['city']); } } } //得到图片类型 if (is_numeric(trim($search['picture_category_id']))) { $search_picture_category_id = trim($search['picture_category_id']); } //图片标题 if (trim($search['pic_name'])) { $search_pic_name = trim($search['pic_name']); } //所有图片类型 $picture_category = PictureCategory::model()->findAll(); $picture_category_list = array(); if (!empty($picture_category)) { foreach ($picture_category as $v) { $picture_category_list[$v['ID']] = $v; } } $continent = Continent::model()->findAll(); //获取所有的大洲信息 if (!empty($search_continentid)) { //返回搜索大洲的下级国家信息 $country = AreaManage::getCountryByContinentId($search_continentid); } if (!empty($search_countryid)) { //返回搜索国家的下级城市信息 $city = AreaManage::getCityByCountryId($search_countryid); } $picture_category = PictureCategory::model()->findAllByAttributes(array('ParentId' => 0)); // 图片二级类别列表 if (!empty($search['picture_parent_id'])) { // 如果选择了一级图片类别则根据一级类别ID 查询二级类别 $picture_children_category = PictureCategory::model()->findAllByAttributes(array('ParentId' => $search['picture_parent_id'])); } else { $picture_children_category = array(); } //搜索条件处理 [E] $criteria = new CDbCriteria(); $criteria->order = 'ID DESC'; // 增加搜索条件 [S] $cityIdArr = !empty($search_cityids) ? explode(',', $search_cityids) : array(); $criteria->compare('Valid', '0'); //对打上删除标记的数据进行过滤 if (count($cityIdArr) > 0) { $criteria->addInCondition('CityId', $cityIdArr); } if (!empty($search_picture_category_id)) { $criteria->compare('CategoryId', $search_picture_category_id); } if (!empty($search_pic_name)) { //$criteria->compare('Title',$search_pic_name,true); $criteria->addSearchCondition('Title', $search_pic_name); } //增加搜索条件 [E] $count = Picture::model()->count($criteria); $pager = new CPagination($count); if (!empty($search)) { //判断是否存在搜索条件,并对搜索条件进行数据处理(便于url传输) $pager->params = array('search' => base64_encode(serialize($search)), 'searchType' => 'page'); } $pager->pageSize = 20; $pager->applyLimit($criteria); $picture_list = Picture::model()->findAll($criteria); $picIdStr = ''; //图片ID字符串 $cityIDStr = ''; //城市ID字符串 if (!empty($picture_list)) { foreach ($picture_list as $val) { $picIdStr .= $val['ID'] . ','; $cityIDStr .= $val['CityId'] . ','; } } //得到图片地址信息列表 $picture_source = PictureSourceManage::getPicSourceArrByPicIdStr($picIdStr); //得到每张图片所在的名称:(城市-国家-大洲) $area = AreaManage::getAreaByCityid($cityIDStr); $this->render('list_picture', array('picture_list' => $picture_list, 'picture_category_list' => $picture_category_list, 'picture_source' => $picture_source, 'pages' => $pager, 'area' => $area, 'continent' => $continent, 'picture_category' => $picture_category, 'picture_children_category' => $picture_children_category, 'search' => $search, 'country' => $country, 'city' => $city)); }
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)); }
/** * 修改酒店 */ public function ActionModifyHotel() { $hotel_id = trim(Yii::app()->request->getParam('hotel_id')); // 获取酒店ID if (!empty($hotel_id) && intval($hotel_id) > 0) { // 根据酒店ID 获取要修改的酒店数据 $hotel_obj = Hotel::model()->findByPk($hotel_id); // 获取所有 大洲/国家/城市 数据 $continent = Continent::model()->findAll(); $country = AreaManage::getCountryByContinentId($hotel_obj['ContinentId']); $city = AreaManage::getCityByCountryId($hotel_obj['CountryId']); // 判断是执行修改 还是跳转至修改页 if (Yii::app()->request->isPostRequest) { // 获取提交的表单数据 $hotel_obj->attributes = Yii::app()->request->getParam('Hotel'); $hotel_obj->HotelIntroduction = $_POST['Hotel']['HotelIntroduction']; $hotel_obj->DecorationTime = $_POST['Hotel']['DecorationTime']; // 执行修改操作 if ($hotel_obj->save()) { Yii::app()->user->setFlash('message', '修改成功'); $this->redirect(array('Hotel/HotelList')); } else { Yii::app()->user->setFlash('message', '修改失败'); $this->render('modify_hotel', array('hotel_obj' => $hotel_obj, 'continent' => $continent, 'country' => $country, 'city' => $city)); } } else { // 跳转至修改酒店页 $this->render('modify_hotel', array('hotel_obj' => $hotel_obj, 'continent' => $continent, 'country' => $country, 'city' => $city)); } } }
| which may be used to do any work before or after a request into your | application. Here you may also register your custom route filters. | */ App::before(function ($request) { // Get all servers $servers = Config::get('ps2maps.servers'); View::share('servers', $servers); // Get the current session server, default to Connery // $server = Session::get('server', function(){ // return $servers['briggs']; // }); $server = $servers['briggs']; View::share('sessionServer', $server); // Get all enabled continents $continents = Continent::orderBy('name')->whereEnabled('yes')->where('slug', '!=', 'vRTraining')->remember(1440)->get(); View::share('continents', $continents); // Get all servers // $servers = Server::whereEnabled('yes') // ->orderBy('name') // ->remember(1440) // ->get(); // Faction Colors $factionColors = Session::get('faction-colors', Config::get('ps2maps.faction-colors')); View::share('factionColors', $factionColors); }); App::after(function ($request, $response) { // }); /* |--------------------------------------------------------------------------
protected function getOptions() { $options[] = ['all', null, InputOption::VALUE_NONE, 'Generate scripts for all continents.', null]; if (Schema::hasTable('continents')) { foreach (Continent::where('enabled', '=', 'yes')->orderBy('name')->get() as $continent) { $options[] = [$continent->slug, null, InputOption::VALUE_NONE, 'Generate script for ' . $continent->name . '.', null]; } } return $options; }
public function ActionRtrip2() { $continent = Continent::model()->findAll(); $this->renderPartial('rtrip2', array('continent' => $continent)); }
/** * 修改购物中心 * @param $shopping_mall_id 购物中心ID * @return bool */ public function ActionModifyShoppingMall($shopping_mall_id) { $shopping_mall_model = ShoppingMall::model(); $shopping_mall_info = $shopping_mall_model->findByPk($shopping_mall_id); // 根据ID查询出对应的购物中心数据 $old_shopping_mall_info = $shopping_mall_info; // 保存购物中心的旧数据,作为日志的新旧数据对比用 // 获取全部品牌 $brand_criteria = new CDbCriteria(); $brand_criteria->select = array('Id', 'BrandName'); $brand = IconvEncode::ObjArrChangeArray(Brand::model()->findAll($brand_criteria), 'BrandName'); // 获取全部餐厅 $restaurant_criteria = new CDbCriteria(); $restaurant_criteria->select = array('Id', 'RestaurantName'); $restaurant = IconvEncode::ObjArrChangeArray(Restaurant::model()->findAll($restaurant_criteria), 'RestaurantName'); // 获取全部优惠卡/券 $discount_criteria = new CDbCriteria(); $discount_criteria->select = array('Id', 'DiscountCardName'); $discount_card = IconvEncode::ObjArrChangeArray(DiscountCard::model()->findAll($discount_criteria), 'DiscountCardName'); // 获取所有 大洲/国家/城市 $continent = Continent::model()->findAll(); $country = AreaManage::getCountryByContinentId($shopping_mall_info['ContinentId']); $city = AreaManage::getCityByCountryId($shopping_mall_info['CountryId']); // 将 品牌/餐厅/优惠卡 ID串转为ID数组 $card_ids = explode(',', $shopping_mall_info['CardIds']); $brand_ids = explode(',', $shopping_mall_info['BrandIds']); $restaurant_ids = explode(',', $shopping_mall_info['RestaurantIds']); // 有表单提交则更新 if (isset($_POST['ShoppingMall']) && !empty($shopping_mall_id)) { $is_modify = false; // 保存时判断是否做过任意修改 $log = Yii::app()->user->name . '于 ' . date('Y-m-d H:i:s', time()) . ' 修改了 【' . $old_shopping_mall_info['Name_Cn'] . '】 购物中心,'; // 日志描述 // 替换表单数据中的值 $_POST['ShoppingMall']['BusinessTime'] = trim($_POST['ShoppingMall']['StartTime']) . '~' . trim($_POST['ShoppingMall']['EndTime']); // 整合起始与结束时间 unset($_POST['ShoppingMall']['StartTime']); // 移除StartTime unset($_POST['ShoppingMall']['EndTime']); // 移除EndTime $_POST['ShoppingMall']['CardIds'] = !empty($_POST['ShoppingMall']['CardIds']) ? implode(',', $_POST['ShoppingMall']['CardIds']) : ''; // 将优惠卡ID数组转成ID字符串 $_POST['ShoppingMall']['BrandIds'] = !empty($_POST['ShoppingMall']['BrandIds']) ? implode(',', $_POST['ShoppingMall']['BrandIds']) : ''; // 将品牌ID数组转成ID字符串 $_POST['ShoppingMall']['RestaurantIds'] = !empty($_POST['ShoppingMall']['RestaurantIds']) ? implode(',', $_POST['ShoppingMall']['RestaurantIds']) : ''; // 将餐厅ID数组转成ID字符串 // 生成日志记录 $attribute = ShoppingMall::model()->attributeLabels(); foreach ($_POST['ShoppingMall'] as $_k => $_v) { // 新旧数据不一致 则生成日志 if ($old_shopping_mall_info[$_k] != $_v) { $is_modify = true; // 赋为true 表示有数据被修改 $old_shopping_mall_info[$_k] = empty($old_shopping_mall_info[$_k]) ? '未填写' : $old_shopping_mall_info[$_k]; // 判断被修改的数据原值是否为空 $log .= '将【' . $attribute[$_k] . '】 由 【' . $old_shopping_mall_info[$_k] . '】 修改为 【' . $_v . '】,'; // 拼接日志描述 } } // 填充模型 $shopping_mall_info->attributes = $_POST['ShoppingMall']; // 执行更新 if ($shopping_mall_info->save()) { $is_modify ? OperationLogManage::AddOperationLog(trim($log, ',')) : ''; // 添加日志 Yii::app()->user->setFlash('save_sign', '修改成功'); $this->redirect(Yii::app()->createUrl('ShoppingMall/ListShoppingMall')); } else { Yii::app()->user->setFlash('save_sign', '修改失败'); // 替换 品牌/餐厅/优惠卡 ID $shopping_mall_info['CardIds'] = $card_ids; $shopping_mall_info['BrandIds'] = $brand_ids; $shopping_mall_info['RestaurantIds'] = $restaurant_ids; // 跳转至购物中心修改页 $this->render('modify_shopping_mall', array('shopping_mall_info' => $shopping_mall_info, 'continent' => $continent, 'country' => $country, 'city' => $city, 'brand' => $brand, 'restaurant' => $restaurant, 'discount_card' => $discount_card)); } } else { // 替换 品牌/餐厅/优惠卡 ID $shopping_mall_info['CardIds'] = $card_ids; $shopping_mall_info['BrandIds'] = $brand_ids; $shopping_mall_info['RestaurantIds'] = $restaurant_ids; // 跳转至购物中心修改页 $this->render('modify_shopping_mall', array('shopping_mall_info' => $shopping_mall_info, 'continent' => $continent, 'country' => $country, 'city' => $city, 'brand' => $brand, 'restaurant' => $restaurant, 'discount_card' => $discount_card)); } }
private function continents() { $class = get_class(new Continent()); $this->log($this->verb . ' Continents'); $url = $this->baseUrl . "zone?c:limit=100"; $data = $this->getCensusData($url); if (!$data) { return false; } // Collection of Eloquent objects from API $apiCollection = new Collection(); foreach ($data->zone_list as $continent) { $values = []; $values['id'] = isset($continent->zone_id) ? $continent->zone_id : null; $values['name'] = isset($continent->name->en) ? $continent->name->en : null; $values['slug'] = isset($continent->name->en) ? Str::camel($continent->name->en) : null; $values['description'] = isset($continent->description->en) ? $continent->description->en : null; $apiCollection->add(new Continent($values)); } $servers = Continent::all(); $this->addModels($class, $servers, $apiCollection); $this->deleteModels($class, $servers, $apiCollection); $this->updateModels($class, Continent::all(), $apiCollection, ['name', 'slug']); }
public function actionAdd() { $continent = Continent::model()->findAll(); $this->render('add', array('continent' => $continent)); }
public function actionGet_area() { $criteria = new CDbCriteria(); $criteria->limit = 8; $continent = Continent::model()->findAll($criteria); $html = ''; for ($j = 0; $j < count($continent); $j++) { if ($j) { $html .= '<ul class="local_trip_pro" data-content="ma' . $j . '" data-blockid="recommend_mustactive" style="display:none;"> <li class="local_trip_pro_li wq_clearfix"> '; } else { $html .= '<ul class="local_trip_pro" data-content="ma' . $j . '" data-blockid="recommend_mustactive" style="display:block;"> <li class="local_trip_pro_li wq_clearfix">'; } $connection = Yii::app()->db; $sql = "SELECT p.name, p.source, p.thumb FROM g_port p, g_area a where a.continent = '{$continent[$j]->name}' and p.area = a.name "; $command = $connection->createCommand($sql); $result = $command->queryAll(); //$criteria1 = new CDbCriteria; //$criteria1->condition = "(style & 4) !=0"; // $criteria1->addCondition('continent ="'.$continent[$j]->name.'"'); // $criteria1->limit = 3; // $area = Area::model()->findAll($criteria1); for ($i = 0; $i < count($result); $i++) { $html .= '<a class="trip_play_list img_slide_animte_wrapper" href="'; $html .= '#" target="_blank"> <img class="trip_play_img img_slide_animte first_page" src="' . $result[$i]['source'] . '" data-original="' . $result[$i]['source'] . '" alt="" style="display: block;"> <span class="trip_play_txt" title="' . $result[$i]['name'] . '">' . $result[$i]['name'] . '</span></a>'; } $html .= '</li></ul>'; } echo $html; }
public function actionSave_continent() { $source = ''; $thumb = ''; if (isset($_POST['source'])) { $source = $_POST['source']; } if (isset($_POST['thumb'])) { $thumb = $_POST['thumb']; } Continent::model()->updateByPk($_POST['id'], array('name' => $_POST['title'], 'description' => $_POST['content'], 'source' => $source, 'thumb' => $thumb)); echo 1; }
/** * 景点管理 */ public function actionListViewSpot() { //搜索条件处理 [E] $searchType = Yii::app()->request->getParam('searchType'); if ($searchType === 'page') { //判断是分页提交还是搜索列表提交的查询条件 $search = Yii::app()->request->getParam('search'); $search = unserialize(base64_decode($search)); //对分布传来的数据进行还原 } else { $search = Yii::app()->request->getParam('search'); } $search_continentid = ''; //搜索的大洲ID $search_countryid = ''; //搜索的国家ID $search_cityids = ''; //要搜索的所有城市id $search_name = ''; //要搜索的图片名称或标题 $continent = array(); $country = array(); $city = array(); //得到国家名下对应的所有城市ID信息字符串 if (isset($search) && !empty($search['continent'])) { //大洲 $search_continentid = intval($search['continent']); if ($search['country']) { //大洲+国家 $search_countryid = intval($search['country']); if (empty($search['city'])) { //大洲+国家+城市 $search_cityids = AreaManage::getCityIdStrByCountryId($search_countryid); } else { //大洲+国家 $search_cityids = intval($search['city']); } } else { //只选择大洲 $search_countryid = AreaManage::getCountryStrByContinentId($search_continentid); if (empty($search['city'])) { $search_cityids = AreaManage::getCityIdStrByCountryId($search_countryid); } else { $search_cityids = trim($search['city']); } } } //图片标题 if (trim($search['name'])) { $search_name = trim($search['name']); } //所有图片类型 $picture_category = PictureCategory::model()->findAll(); $picture_category_list = array(); if (!empty($picture_category)) { foreach ($picture_category as $v) { $picture_category_list[$v['ID']] = $v; } } $continent = Continent::model()->findAll(); //获取所有的大洲信息 if (!empty($search_continentid)) { //返回搜索大洲的下级国家信息 $country = AreaManage::getCountryByContinentId($search_continentid); } if (!empty($search_countryid)) { //返回搜索国家的下级城市信息 $city = AreaManage::getCityByCountryId($search_countryid); } //搜索条件处理 [E] $criteria = new CDbCriteria(); $criteria->order = 'ID desc'; $criteria->compare('Valid', '0', true); //增加搜索条件 [S] $cityIdArr = !empty($search_cityids) ? explode(',', $search_cityids) : array(); if (count($cityIdArr) > 0) { $criteria->addInCondition('CityID', $cityIdArr); } if (!empty($search_name)) { $criteria->addSearchCondition('NameCn', $search_name); //$criteria->addSearchCondition('NameCnShort',$search_name,true,'or'); } //增加搜索条件 [E] $view_spot_count = ViewSpot::model()->count($criteria); $pager = new CPagination($view_spot_count); if (!empty($search)) { //判断是否存在搜索条件,并对搜索条件进行数据处理(便于url传输) $pager->params = array('search' => base64_encode(serialize($search)), 'searchType' => 'page'); } $pager->pageSize = 20; $pager->applyLimit($criteria); $view_spot_models = ViewSpot::model()->findAll($criteria); $cityIDStr = ''; //城市ID字符串 if (!empty($view_spot_models)) { foreach ($view_spot_models as $val) { $cityIDStr .= $val['CityID'] . ','; } } //得到每张图片所在的名称:(城市-国家-大洲) $area = AreaManage::getAreaByCityid($cityIDStr); $this->render('list_view_spot', array('view_spot_models' => $view_spot_models, 'pager' => $pager, 'country' => $country, 'continent' => $continent, 'city' => $city, 'search' => $search, 'area' => $area)); }