本文整理汇总了PHP中country类的典型用法代码示例。如果您正苦于以下问题:PHP country类的具体用法?PHP country怎么用?PHP country使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了country类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: list_countries
function list_countries()
{
$query = $this->con->genericQuery("select * from " . $this->table . " order by name");
$objReturn = array();
foreach ($query as $value) {
$country = new country();
$country->open($value);
$objReturn[] = $country;
}
return $objReturn;
}
示例2: pickrandom
function pickrandom($time)
{
$active = contest::active();
$activeCountries = country::stateSortVotes('active');
if ($activeCountries->count() == 0) {
$final = country::stateSortVotes('finale');
$finalCount = $final->count();
$ranks = [1 => 'gold', 2 => 'silver', 3 => 'bronze'];
for ($i = 1; $i <= 3 && $i <= $finalCount; $i++) {
$final->found();
new medal(['type' => $ranks[$i], 'votes' => $final->votes, 'contest#' => $active->id, 'country#' => $final->id]);
}
country::resetVotes();
$active->end = $time;
$new = contest::nextActive();
$new->start = $time;
$new->update();
pickFromQueue();
} else {
$activeCountries->state = 'finale';
$activeCountries->votes = 0;
while ($activeCountries->found()) {
$activeCountries->state = 'eliminated';
}
pickFromQueue();
}
}
示例3: 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;
}
示例4: actionAjaxState
public function actionAjaxState()
{
$country = country::model()->findByPk($_POST['address']['address_country_ID']);
if ($country && $country->contain_states == 1) {
echo CHtml::dropDownList('address[address_state_ID]', '', state::items($country->country_ID), array('id' => 'state'));
} else {
echo CHtml::dropDownList('address[address_state_ID]', '', array(0 => '----------------------------------------'), array('id' => 'state'));
}
}
示例5: loadModel
public function loadModel()
{
if ($this->_model == null) {
if (isset($_GET['id'])) {
$condition = '';
$this->_model = country::model()->findByPk($_GET['id'], $condition);
}
if ($this->_model == null) {
throw new CHttpException(404, "The requested page does not exist!");
}
}
return $this->_model;
}
示例6: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Request $request)
{
$insert = $request->all();
$safeName = false;
//upload image
if ($file = Input::file('image')) {
$fileName = $file->getClientOriginalName();
$extension = $file->getClientOriginalExtension() ?: 'png';
$folderName = '/uploads/';
$destinationPath = Config::get('app.path') . $folderName;
$safeName = time() . "_" . str_random(10) . '.' . $extension;
$file->move($destinationPath, $safeName);
$insert['image'] = $safeName ? $folderName . $safeName : '';
}
if (isset(Country::$boolean)) {
foreach (country::$boolean as $field) {
if (isset($insert[$field]) && $insert[$field] == "on") {
$insert[$field] = 1;
}
}
}
country::create($insert);
return redirect('admin/countries')->with('success', Lang::get('message.success.create'));
}
示例7: 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));
}
示例8: processRequest
//.........这里部分代码省略.........
$membuf->add($memkey, $result, $expire);
}
return json_encode($result);
case 'getprofessions':
$n = __paramInit('integer', '', 'id');
if ($n !== false) {
$membuf = new memBuff();
$memkey = "b-combo-getprofbygroup{$n}";
$result = $membuf->get($memkey);
if (!$result) {
$rows = professions::GetProfs($n);
$result = array(0 => iconv('WINDOWS-1251', 'UTF-8//IGNORE', 'Все специальности'));
foreach ($rows as $k => $i) {
$result[$i['id']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['name']);
}
$membuf->add($memkey, $result, $expire);
}
$data = array(array('parentId' => "{$n}"), $result);
return json_encode($data);
}
case 'get_pro_types':
$membuf = new memBuff();
$memkey = 'b-combo-get_pro_type';
$result = $membuf->get($memkey);
if (!$result) {
$rows = op_codes::getCodes(array(47, 48, 49, 50, 51));
$result = array();
foreach ($rows as $k => $i) {
$result[$i['id']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['op_name']);
}
$result[76] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', 'На несколько недель');
$membuf->add($memkey, $result, $expire);
}
return json_encode($result);
case 'getcountries':
case 'getrelevantcountries':
$membuf = new memBuff();
$memkey = 'b-combo-getcountriesr';
$result = $membuf->get($memkey);
if (!$result) {
$rows = country::GetCountriesByCountUser();
$result = array();
foreach ($rows as $k => $i) {
$result[$i['id']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['name']);
}
$membuf->add($memkey, $result, $expire);
}
return json_encode($result);
case 'getcities':
$n = __paramInit('integer', '', 'id');
if ($n !== false) {
$membuf = new memBuff();
$memkey = "b-combo-getcitybycountry{$n}";
$result = $membuf->get($memkey);
if (!$result) {
$rows = city::GetCities($n);
$result = array('0' => iconv('WINDOWS-1251', 'UTF-8//IGNORE', 'Все города'));
if (is_array($rows)) {
foreach ($rows as $k => $i) {
$result[$k] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i);
}
}
$membuf->add($memkey, $result, $expire);
}
$data = array(array('parentId' => "{$n}"), $result);
return json_encode($data);
}
case 'getcitiesbyid':
$n = __paramInit('integer', '', 'id');
if ($n !== false) {
$membuf = new memBuff();
$memkey = "b-combo-getcitybycountry{$n}";
$result = $membuf->get($memkey);
if (!$result) {
$rows = city::GetCities($n);
$result = array('0' => iconv('WINDOWS-1251', 'UTF-8//IGNORE', 'Все города'));
foreach ($rows as $k => $i) {
$result[$k] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i);
}
$membuf->add($memkey, $result, $expire);
}
return json_encode($result);
}
case 'getuserlistbysbr':
case 'getuserlistold':
case 'getuserlist':
return $this->getUsersList($_POST['word'], (int) $_POST['limit'], (int) $_POST['userType'], (int) $_POST['scope']);
case 'get_user_info':
return json_encode(users::GetUserShortInfo((int) $_POST['uid']));
case 'getusersandcompanies':
return $this->getUsersAndCompany($_POST['word'], (int) $_POST['limit'], (int) $_POST['userType'], (int) $_POST['scope'], false);
case 'get_user_or_company_info':
return $this->getUserOrCompanyRecord();
case 'getsms':
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/registration.php';
$registration = new registration();
$registration->listenerAction(__paramInit('string', null, 'action'));
}
return false;
}
示例9: foreach
<div class="b-menu b-menu_line b-menu_relative b-menu_padbot_10 b-menu__cat b-menu_zindex_6" >
<?php
if (false) {
$region_filter_txt = '<strong>Все</strong>';
if ($filter_apply) {
$region_filter_country_id = $mFilter['country'];
$region_filter_city_id = $mFilter['city'];
} else {
$region_filter_country_id = $_SESSION['region_filter_country'];
$region_filter_city_id = $_SESSION['region_filter_city'];
}
$_SESSION['region_filter_country'] = $region_filter_country_id;
$_SESSION['region_filter_city'] = $region_filter_city_id;
$region_filter_countries = country::GetCountries();
if ($region_filter_country_id) {
$region_filter_cities = city::GetCities($region_filter_country_id);
}
if ($region_filter_country_id) {
foreach ($region_filter_countries as $countid => $country) {
if ($countid == $region_filter_country_id) {
$region_filter_country_txt = $country;
}
}
$region_filter_txt = '<strong>' . $region_filter_country_txt . '</strong>';
if ($region_filter_city_id) {
foreach ($region_filter_cities as $cityid => $city) {
if ($cityid == $region_filter_city_id) {
$region_filter_city_txt = $city;
}
示例10: bankAction
/**
* Перевод для юр лиц - "Банковский перевод для юридических лиц (рубли)".
*/
public function bankAction()
{
front::og('tpl')->page = 'index';
$act = $this->uri[0];
if ($act == 'delete') {
unset($_SESSION['sum']);
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/reqv.php';
$did = intval($this->uri[1]);
if ($did) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/reqv.php';
$reqv = new reqv();
$reqv->Del($did, " AND user_id='" . get_uid() . "'");
header("Location: /{$this->name_page}/bank/");
exit;
}
unset($reqv);
}
if ($_POST['sum'] > 0) {
$_SESSION['sum'] = floatval($_POST['sum']);
} else {
front::og('tpl')->sum = floatval($_SESSION['sum']);
}
// Обработка подстраницы редактирования данных для перевода
if ($act == 'edit') {
/**
* Подключение всех необходимых классов для вывода данной страницы.
*/
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/reqv.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/country.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/city.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/reqv_ordered.php';
if ($_POST['update']) {
$reqv = new reqv();
$reqv->BindRequest($_POST);
$error = $reqv->CheckInput();
if (!$error) {
$reqv->user_id = get_uid();
$reqv->Update($reqv->id, " AND user_id='" . get_uid() . "'");
header("Location: /{$this->name_page}/bank/#reqv" . $reqv->id);
exit;
} else {
$action = 'edit';
$edit_mode = 1;
$eid = intval($reqv->id);
}
front::og('tpl')->error = $error;
}
front::og('tpl')->countries = country::GetCountries();
$reqvs = new reqv();
$reqvByUid = $reqvs->GetByUid(get_uid());
$reqvs_ord = new reqv_ordered();
$billNum = sizeof($reqvs_ord->GetByUid(get_uid()));
$sum = trim($this->uri[2]);
$norisk_id = intval(trim($_REQUEST['noriskId']));
front::og('tpl')->reqvs = $reqvs;
front::og('tpl')->sum = $sum;
front::og('tpl')->reqvByUid = $reqvByUid;
front::og('tpl')->reqvs_ord = $reqvs_ord;
front::og('tpl')->billNum = $billNum;
front::og('tpl')->norisk_id = $norisk_id;
front::og('tpl')->edit_mode = $edit_mode = 1;
front::og('tpl')->eid = $eid = intval($this->uri[1]);
// Событие нажатия кнопки - Обновить
if (!$_POST['update']) {
foreach ($reqvByUid as $ikey => $value) {
$reqvs->BindRequest($value);
if ($edit_mode && $reqvs->id == $eid) {
$reqvkey = $ikey;
}
}
$reqv = new reqv();
if ($act == 'edit' && !$error) {
$reqv->BindRequest($reqvByUid[$reqvkey]);
} elseif ($error) {
$reqv->BindRequest($_POST);
}
}
front::og('tpl')->reqv = $reqv;
front::og('tpl')->display('bill/bill_bank_step2.tpl');
exit;
} else {
// Иначе выводим главную страницу, где необходимо заполнять поля
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/reqv.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/city.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/reqv_ordered.php';
front::og('tpl')->countries = country::GetCountries();
$reqvs = new reqv();
$reqvByUid = $reqvs->GetByUid(get_uid());
$reqvs_ord = new reqv_ordered();
$billNum = sizeof($reqvs_ord->GetByUid(get_uid()));
$sum = trim(!$_POST['sum'] ? $_SESSION['sum'] : floatval($_POST['sum']));
$norisk_id = intval(trim($_REQUEST['noriskId']));
front::og('tpl')->reqvs = $reqvs;
front::og('tpl')->sum = $sum;
front::og('tpl')->reqvByUid = $reqvByUid;
front::og('tpl')->reqvs_ord = $reqvs_ord;
front::og('tpl')->billNum = $billNum;
//.........这里部分代码省略.........
示例11: print
$_SESSION['no_of_room'] = $no_of_room;
$room_type_id = $_REQUEST['room_type_id'];
print("
<script type='text/javascript'>
var check_in_date='" . $check_in_date . "';
var check_out_date='" . $check_out_date . "';
var room_type_id='" . $room_type_id . "';
var room_bed_type='" . $room_bed_type . "';
var room_meal_type='" . $_SESSION['room_meal_type'] . "';
var num_rooms='" . $no_of_room . "';
</script>
");
$hotel_room_type = new HotelRoomType();
$hotel = new Hotels();
$country = new country();
$hotel->setHotelId($hotels_id);
$hotel->extractor($hotel->getHotelFromId());
$country->setCountryId($_SESSION['country_id']);
$hotel_room_type->setRoomTypeId($room_type_id);
$hotel_room_type->extractor($hotel_room_type->getHotelRoomTypeFromId());
if ($hotels_id != $hotel_room_type->roomTypeHotelId()) {
echo "Error";
die();
}
示例12: completeData
public function completeData($type_role = 1)
{
if ($this->isDisable()) {
header("Location: /wizard/registration/?step=1");
exit;
}
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/employer.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/freelancer.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/city.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/country.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/commune.php";
$themes_blogs = blogs::getRandomThemes(5);
$themes_commune = commune::getRandomCommunes(3);
$month = array('1' => 'января', '2' => 'февраля', '3' => 'марта', '4' => 'апреля', '5' => 'мая', '6' => 'июня', '7' => 'июля', '8' => 'августа', '9' => 'сентября', '10' => 'октября', '11' => 'ноября', '12' => 'декабря');
if ($type_role == step_wizard_registration::TYPE_WIZARD_EMP) {
$user = new employer();
$checkPRO = $this->checkWizardPRO(array(step_employer::OP_CODE_PRO));
$pro_emp = $checkPRO['id'] > 0 ? 1 : 0;
if ($pro_emp) {
$week_pro = round($checkPRO['ammount'] / 10);
}
} else {
$user = new freelancer();
$checkPRO = $this->checkWizardPRO(step_freelancer::getOperationCodePRO());
$pro_frl = $checkPRO['id'] > 0 ? 1 : 0;
if ($pro_frl) {
$op_code = $checkPRO['op_code'];
}
}
$user->GetUserByUID(wizard::getUserIDReg());
$info_for_reg = unserialize($user->info_for_reg);
$uname = $user->uname;
$usurname = $user->usurname;
$sex = $user->sex == 't' ? 1 : ($user->sex == 'f' ? 0 : -1);
$birthday = strtotime($user->birthday);
if ($birthday) {
$bday = date('d', $birthday);
$bmonth = (int) date('m', $birthday);
$bmonth_value = $month[$bmonth];
$byear = date('Y', $birthday);
} else {
$bday = '';
$bmonth = (int) date('m', $birthday);
$bmonth_value = $month[$bmonth];
$byear = '';
}
$city = $user->city;
if ($city) {
$city_value = city::GetCityName($city);
}
$country = $user->country;
if ($country) {
$country_value = country::GetCountryName($country);
}
if ($type_role == step_wizard_registration::TYPE_WIZARD_EMP) {
$company = $user->compname;
$about_company = $user->company;
$logo_name = $user->logo;
$dir = "users/" . substr($user->login, 0, 2) . "/" . $user->login . "/logo/";
$logo_path = WDCPREFIX . "/" . $dir . $user->logo;
}
$info['site'] = $this->loadMultiVal('site', 'site', $user);
$info['email'] = $this->loadMultiVal('second_email', 'email', $user);
$info['phone'] = $this->loadMultiVal('phone', 'phone', $user);
$info['icq'] = $this->loadMultiVal('icq', 'icq', $user);
$info['skype'] = $this->loadMultiVal('skype', 'skype', $user);
$info['jabber'] = $this->loadMultiVal('jabber', 'jabber', $user);
$info['lj'] = $this->loadMultiVal('ljuser', 'lj', $user);
$action = __paramInit('string', null, 'action');
if ($action == 'upd_info') {
$info_for_reg = $_POST['info_for_reg'];
if ($info_for_reg['email_0'] !== null) {
$info_for_reg['second_email'] = $info_for_reg['email_0'];
unset($info_for_reg['email_0']);
}
if ($info_for_reg['phone_0'] !== null) {
$info_for_reg['phone'] = $info_for_reg['phone_0'];
unset($info_for_reg['phone_0']);
}
if ($info_for_reg['site_0'] !== null) {
$info_for_reg['site'] = $info_for_reg['site_0'];
unset($info_for_reg['site_0']);
}
if ($info_for_reg['lj_0'] !== null) {
$info_for_reg['ljuser'] = $info_for_reg['lj_0'];
unset($info_for_reg['lj_0']);
}
if ($info_for_reg['jabber_0'] !== null) {
$info_for_reg['jabber'] = $info_for_reg['jabber_0'];
unset($info_for_reg['jabber_0']);
}
if ($info_for_reg['skype_0'] !== null) {
$info_for_reg['skype'] = $info_for_reg['skype_0'];
unset($info_for_reg['skype_0']);
}
if ($info_for_reg['icq_0'] !== null) {
$info_for_reg['icq'] = $info_for_reg['icq_0'];
unset($info_for_reg['icq_0']);
}
//.........这里部分代码省略.........
示例13: elseif
if (!($info_for_reg['country'] && !$uid) && $user->country) {
?>
<div class="b-layout__hover_bg_f0ffdf b-layout_padlr_10 b-layout_pad_3">
<div class="b-layout__txt b-layout__txt_padleft_35 b-layout__txt_lineheight_1 b-layout__txt_padtop_1">
<span class="b-icon b-icon__cont b-icon__cont_map b-icon_margleft_-35"></span>
<?php
if ($info_for_reg['country'] && !$uid) {
?>
<?php
echo $reg_string;
?>
<?php
} elseif ($user->country) {
?>
<?php
echo country::GetCountryName($user->country);
if ($user->city && !($info_for_reg['city'] && !$uid)) {
?>
, <?php
echo city::GetCityName($user->city);
}
?>
<?php
}
?>
</div>
</div>
<?php
}
?>
示例14: country
</div>
</div>
<div class="<?php
echo $color[$c++ % 2];
?>
" id="leaderboard">
<div class="headconbody">
<div class="row">
<div class="description">
<h3>[nav_leaderboard]</h3>
<p>[leaderboarddesc]</p>
<div class="contentrow">
<?php
$country = new country(false);
while ($country->found()) {
?>
<div class="col-md-4">
<div class="conx">
<h1><?php
echo $country->name;
?>
</h1>
<div class="medals">
<p><?php
echo $country->medal()->count();
?>
示例15: country
<?php
$a = $_POST['Data'];
include_once '../config/country.php';
$ob = new country();
$res = $ob->select_location($a);
echo '<option value="0">--Select--</option>';
while ($r = mysqli_fetch_array($res)) {
echo '<option value="' . $r['id'] . '">' . $r['location'] . "</option>";
}