本文整理汇总了PHP中city类的典型用法代码示例。如果您正苦于以下问题:PHP city类的具体用法?PHP city怎么用?PHP city使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了city类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RFGetCitysByCid
/**
* Возвращает select со списком городов указанной страны в для фильтра регионов в каталоге фрилансеров.
*
* @param int $country название страны транслит
* @param array $attr опционально. атрибуты select например: array('name'=>'pf_city', 'class'=>'flt-p-sel',...);
*
* @return unknown
*/
function RFGetCitysByCid($country, $attr = array())
{
$objResponse = new xajaxResponse();
if (!$attr) {
$attr = array('name' => 'pf_city', 'class' => 'b-select__select');
}
$sAttr = '';
foreach ($attr as $key => $val) {
$sAttr .= ' ' . $key . '="' . $val . '"';
}
if ($country) {
$cities = city::GetCities(country::getCountryIDByTranslit($country));
}
$objResponse->script('$("b-select__city").set("html","");');
$objResponse->script('new Element("option", { value: "0", text: "Все города" }).inject($("b-select__city"));');
$js = '';
if ($cities) {
foreach ($cities as $cityid => $city) {
$js .= 'new Element("option", { value: "' . translit(strtolower($city)) . '", text: "' . $city . '" }).inject($("b-select__city"));' . "\n";
}
}
if ($js) {
$objResponse->script($js);
}
return $objResponse;
}
示例2: ChangeCity
/**
* Формирует список городов для выбранной страны.
*
* @param integer $country_id код страны
* @param integer $city_id код города
*/
function ChangeCity($country_id, $city_id)
{
$objResponse = new xajaxResponse();
// $countries = country::GetCountries();
$cities = city::GetCities($country_id);
$select = '<select name="ff_city" id="ff_city" ';
$select .= 'style="width:254px;">';
$select .= '<option value="0"';
if ($city_id == 0) {
$select .= ' selected';
}
$select .= '>Все города</option>';
if ($cities) {
foreach ($cities as $id => $city) {
$select .= '<option value="' . $id . '"';
if ($id == $city_id) {
$select .= ' selected';
}
$select .= '>' . $city . '</option>';
}
$select .= '</select>';
}
$objResponse->assign('city_select', 'innerHTML', $select);
return $objResponse;
}
示例3: ChangeCity
/**
* Формирует список городов для выбранной страны.
*
* @param integer $country_id код страны
* @param integer $city_id код города
*/
function ChangeCity($country_id, $city_id)
{
$objResponse = new xajaxResponse();
// $countries = country::GetCountries();
$cities = city::GetCities($country_id);
$select = "<select name=\"ff_city\" id=\"ff_city\" ";
$select .= "style=\"width:254px;\">";
$select .= "<option value=\"0\"";
if ($city_id == 0) {
$select .= " selected";
}
$select .= ">Все города</option>";
if ($cities) {
foreach ($cities as $id => $city) {
$select .= "<option value=\"" . $id . "\"";
if ($id == $city_id) {
$select .= " selected";
}
$select .= ">" . $city . "</option>";
}
$select .= "</select>";
}
$objResponse->assign("city_select", "innerHTML", $select);
return $objResponse;
}
示例4: getCitys
public function getCitys()
{
$citys = city::getCity(Tools::getValue());
foreach ($citys as $city) {
$this->citys[] = array('id' => $city['id_egms_city'], 'name' => $city['cityname1']);
}
}
示例5: GetCities
function GetCities($country, $city)
{
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/city.php';
$response = new xajaxResponse();
$cities = city::GetCities(intval($country));
/*$html = '<option value="0">Все города</option>';
foreach ($cities as $id=>$val) {
$html .= '<option value="'.$id.'">'.htmlspecialchars($val).'</option>';
}*/
$script = "document.getElementById('cities').options.length = 0; \n";
$script .= "document.getElementById('cities').options[0] = new Option('Все города', 0); \n";
$i = 1;
foreach ($cities as $id => $val) {
$script .= "document.getElementById('cities').options[{$i}] = new Option('" . htmlspecialchars($val) . "', {$id}); \n";
++$i;
}
$response->assign('cities', 'innerHTML', $html);
$response->assign('cities', 'disabled', false);
$script .= "document.getElementById('btnAddLocation').onclick = function() { locations.add(); return false; }; \n";
if ($city) {
$script .= "\n\t\t\tfor (var i=0; i<document.getElementById('cities').options.length; i++) {\n\t\t\t\tif (document.getElementById('cities').options[i].value == {$city}) {\n\t\t\t\t\tdocument.getElementById('cities').selectedIndex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\t\n\t\t\t} \n\n\t\t";
}
$script .= 'if (spam.busy > 1) { spam.busy = 0; spam.send(); } spam.busy = 0;';
$response->script($script);
return $response;
}
示例6: getFieldsValues
public function getFieldsValues()
{
$id_egms_city = Tools::getValue('id_egms_city');
if ($id_egms_city != false) {
$row = city::getCity($id_egms_city);
}
return array('id_egms_city' => $id_egms_city, 'cityname1' => $row[0]['cityname1'], 'cityname2' => $row[0]['cityname2'], 'cityname3' => $row[0]['cityname3'], 'psyname' => $row[0]['psyname'], 'alias' => $row[0]['alias']);
}
示例7: setupNewUser
function setupNewUser()
{
global $db;
require_once dirname(__FILE__) . '/connectDB.php';
mysql_query("INSERT INTO server_data (server_id,user_id,`key`,value) VALUES (" . $this->server->getID() . ",{$this->userid},'gold'," . $this->server->getInitialGold() . ")", $db) or die(mysql_error());
$this->gold = $this->server->getInitialGold();
mysql_query("INSERT INTO server_data (server_id,user_id,`key`,value) VALUES (" . $this->server->getID() . ",{$this->userid},'city_count',0)", $db) or die(mysql_error());
mysql_query("INSERT INTO server_data (server_id,user_id,`key`,value) VALUES (" . $this->server->getID() . ",{$this->userid},'last_online',0)", $db) or die(mysql_error());
mysql_query("INSERT INTO server_data (server_id,user_id,`key`,value) VALUES (" . $this->server->getID() . ",{$this->userid},'rank',0)", $db) or die(mysql_error());
for ($i = 0; $i < $this->server->getInitialCityCount(); $i++) {
city::build_city($this, $this->server, false);
}
//end for $i < $this->server->getInitialCities()
}
示例8: GetCitysByCid
function GetCitysByCid($country_id)
{
$objResponse = new xajaxResponse();
if ($country_id) {
$cities = city::GetCities($country_id);
}
$out_text = '<select name="city" class="apf-select"><option value="0">Не выбрано</option>';
if ($cities) {
foreach ($cities as $cityid => $city) {
$out_text .= '<option value=' . $cityid . '>' . $city . '</option>';
}
}
$out_text .= '</select>';
$objResponse->assign('frm_city', 'innerHTML', $out_text);
return $objResponse;
}
示例9: GetCitysByCid
function GetCitysByCid($country_id)
{
$objResponse = new xajaxResponse();
if ($country_id) {
$cities = city::GetCities($country_id);
}
$out_text = "<select name=\"city\" class=\"apf-select\"><option value=\"0\">Не выбрано</option>";
if ($cities) {
foreach ($cities as $cityid => $city) {
$out_text .= "<option value=" . $cityid . ">" . $city . "</option>";
}
}
$out_text .= "</select>";
$objResponse->assign("frm_city", "innerHTML", $out_text);
return $objResponse;
}
示例10: run
public function run()
{
$user = $this->order[$this->is_emp ? 'freelancer' : 'employer'];
//получаем общее кол-во отзывов
$oplinks = NULL;
$opcount = opinions::GetCounts($user['uid'], array('total'));
if (array_sum($opcount['total']) > 0) {
$oplinks = array('p' => getSortOpinionLinkEx('frl', "total", 1, $user['login'], zin($opcount['total']['p']), null, 0), 'n' => getSortOpinionLinkEx('frl', "total", 2, $user['login'], zin($opcount['total']['n']), null, 0), 'm' => getSortOpinionLinkEx('frl', "total", 3, $user['login'], zin($opcount['total']['m']), null, 0));
}
//город юзера
$city_id = $this->order['is_meet'] == 't' && $this->order['city'] > 0 ? $this->order['city'] : $user['city'];
$user['place_title'] = '';
if ($city_id > 0) {
$user['place_title'] = city::getCountryName($city_id) . ', ' . city::getCityName($city_id);
}
//собираем шаблон
$this->render('t-service-order-user-profile', array('user' => $user, 'oplinks' => $oplinks));
}
示例11: getInformationUser
public function getInformationUser($uid = false)
{
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/employer.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/freelancer.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/country.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/city.php";
if (!$uid) {
$uid = $_SESSION['uid'];
}
if (is_emp()) {
$user = new employer();
} else {
$user = new freelancer();
}
$user->GetUserByUID($uid);
$this->setFieldInfo('uname', $user->uname);
$this->setFieldInfo('usurname', $user->usurname);
$this->setFieldInfo('birthday', $user->birthday);
$this->setFieldInfo('country', $user->country);
$this->setFieldInfo('country_name', country::GetCountryName($user->country));
$this->setFieldInfo('city', $user->city);
$this->setFieldInfo('city_name', city::GetCityName($user->city));
$this->setFieldInfo('sex', $user->sex == 't' ? 1 : ($user->sex == 'f' ? 0 : -1));
$this->setFieldInfo('info_for_reg', unserialize($user->info_for_reg));
}
示例12: elseif
echo '<b>' . $message . '</b>';
} elseif ($_POST['attack_id']) {
echo '<b>Troop movements started!</b>';
}
if (!$tocity) {
echo '<h2>Select a City to Attack/Move to</h2><ul>';
if ($fromcity) {
$close_upper_bound = intval($fromcity->getValue('id')) + 25000;
$dbcities = mysql_query("SELECT user_id,city_id FROM server_cities WHERE server_id=" . $server->getID() . " AND city_id < {$close_upper_bound} ORDER BY city_id DESC LIMIT 50", $db) or die(mysql_error());
} else {
$dbcities = mysql_query("SELECT user_id,city_id FROM server_cities WHERE server_id=" . $server->getID() . " ORDER BY user_id LIMIT 50", $db) or die(mysql_error());
}
//end if-else fromcity
while ($city = mysql_fetch_assoc($dbcities)) {
$user = new user($city['user_id'], $server);
$city = new city($city['city_id']);
echo '<li>';
echo '<a href="/server/' . $server->getID() . '/attack/' . $city->getValue('id') . '+' . $cities[1] . '">';
if ($city->getValue('name')) {
echo htmlentities($city->getValue('name')) . ' / ';
}
echo 'Location: ' . str_pad($city->getValue('id'), 6, '0', STR_PAD_LEFT);
echo '</a>';
echo ' / Population: ' . $city->getValue('population') . ' / Defense: ' . (intval($city->getValue('defense')) + 1) . ' / User: <a href="/server/' . $server->getID() . '/user/' . $user->getValue('userid') . '">' . htmlentities($user->getValue('nickname')) . '</a>';
$can_access = $city->getValue('user_' . $LOGIN_DATA['user_id'] . '_access');
$can_access = $can_access === true || intval($can_access) > time();
if ($can_access) {
echo ' - <a href="/server/' . $server->getID() . '/city/' . $city->getValue('id') . '">view</a>';
}
echo '</li>';
}
示例13: tu_validation
/**
* Проверка данных из формы.
*/
function tu_validation(&$tservice, $is_exist_feedbacks = 0)
{
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/city.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/tservices/tservices_categories.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/tservices/validation.php';
$errors = array();
$validator = new validation();
$tservices_categories = new tservices_categories();
//---
//$tservice->title = trim(htmlspecialchars(InPost('title'),ENT_QUOTES,'cp1251'));
//$tservice->title = antispam(__paramInit('string', NULL, 'name', NULL, 60, TRUE));
$tservice->title = sentence_case(__paramInit('html', null, 'title', null, 100, true));
$title = trim(stripslashes(InPost('title')));
if (!$validator->required($title)) {
$errors['title'] = validation::VALIDATION_MSG_REQUIRED;
} elseif (!$validator->symbols_interval($title, 4, 100)) {
$errors['title'] = sprintf(validation::VALIDATION_MSG_SYMBOLS_INTERVAL, 4, 100);
}
//---
$tservice->price = intval(trim(InPost('price')));
if (!$validator->is_natural_no_zero($tservice->price)) {
$errors['price'] = validation::VALIDATION_MSG_REQUIRED_PRICE;
} elseif (!$validator->greater_than_equal_to($tservice->price, 300)) {
$errors['price'] = sprintf(validation::VALIDATION_MSG_PRICE_GREATER_THAN_EQUAL_TO, '300 р.');
} elseif (!$validator->less_than_equal_to($tservice->price, 999999)) {
$errors['price'] = sprintf(validation::VALIDATION_MSG_PRICE_LESS_THAN_EQUAL_TO, '999 999 р.');
}
//---
$days_db_id = intval(trim(InPost('days_db_id')));
if (!$validator->is_natural_no_zero($days_db_id) || !in_array($days_db_id, array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, 21, 30, 45, 60, 90))) {
$errors['days'] = validation::VALIDATION_MSG_FROM_LIST;
$days_db_id = 1;
}
$tservice->days = $days_db_id;
//---
//Если есть отзывы то не даем изменить категорию
if (!(InPost('action') == 'save' && $is_exist_feedbacks > 0)) {
$category_id = intval(trim(InPost('category_db_id')));
$parent_category_id = $tservices_categories->getCategoryParentId($category_id);
if ($parent_category_id === false) {
$errors['category'] = validation::VALIDATION_MSG_CATEGORY_FROM_LIST;
} else {
$tservice->category_id = $category_id;
//$this->property()->parent_category_id = $parent_category_id;
}
}
//---
$str_tags = trim(preg_replace('/\\s+/s', ' ', strip_tags(InPost('tags'))));
$tags = strlen($str_tags) > 0 ? array_unique(array_map('trim', explode(',', $str_tags))) : array();
$tags = array_filter($tags, function ($el) {
$len = strlen(stripslashes($el));
return $len < 80 && $len > 2;
});
$tags_cnt = count(array_unique(array_map('strtolower', $tags)));
$tags = array_map(function ($value) {
return htmlspecialchars($value, ENT_QUOTES, 'cp1251');
}, $tags);
$tservice->tags = $tags;
if (!$validator->required($str_tags)) {
$errors['tags'] = validation::VALIDATION_MSG_REQUIRED;
} elseif ($tags_cnt > 10) {
$errors['tags'] = sprintf(validation::VALIDATION_MSG_MAX_TAGS, 10);
}
//---
$videos = __paramInit('array', null, 'videos', array());
$videos = is_array($videos) ? array_values($videos) : array();
if (count($videos)) {
$tservice->videos = null;
foreach ($videos as $key => $video) {
if ($validator->required($video)) {
$_video_data = array('url' => $video, 'video' => false, 'image' => false);
//$_video = $validator->video_validate($video);
$_video = $validator->video_validate($video);
$is_error = true;
if ($_video) {
$_video_data['url'] = $_video;
if ($_video_meta = $validator->video_validate_with_thumbs($_video, 0)) {
$_video_data = array_merge($_video_data, $_video_meta);
$is_error = false;
}
}
if ($is_error) {
$errors['videos'][$key] = validation::VALIDATION_MSG_BAD_LINK;
}
$tservice->videos[$key] = $_video_data;
}
}
}
//---
//$tservice->description = trim(htmlspecialchars(InPost('description'),ENT_QUOTES, "cp1251"));
//$description = trim(InPost('description'));
$tservice->description = trim(__paramInit('html', null, 'description', null, 5000, true));
$description = trim(stripslashes(InPost('description')));
if (!$validator->required($description)) {
$errors['description'] = validation::VALIDATION_MSG_REQUIRED;
} elseif (!$validator->symbols_interval($description, 4, 5000)) {
$errors['description'] = sprintf(validation::VALIDATION_MSG_SYMBOLS_INTERVAL, 4, 5000);
//.........这里部分代码省略.........
示例14: city
<?php
require 'components/get_listview_referrer.php';
require 'subclasses/city.php';
$dbh_city = new city();
$dbh_city->set_where("city_id='" . quote_smart($city_id) . "'");
if ($result = $dbh_city->make_query()->result) {
$data = $result->fetch_assoc();
extract($data);
}
示例15: getAddresssave
public function getAddresssave(Request $request, $id = 0)
{
$request->session()->reflash();
$user = $request->user();
$locations = $user->locationDetected();
$citys = city::apiGet();
$userCity = City::showCity($locations['city']);
$TITLE = '添加地址';
$address = '';
if ($id) {
$TITLE = '修改地址';
$address = Address::apiFind($id);
}
return view('auth.account.addressave', ['TITLE' => $TITLE, 'META_KEYWORDS' => META_KEYWORDS, 'META_DESC' => META_DESC, 'PAGE_CODE' => 'auth.account.addressave', 'user' => $user, 'citys' => $citys, 'userCity' => $userCity, 'address' => $address, 'id' => $id]);
}