本文整理汇总了PHP中Region::getCountries方法的典型用法代码示例。如果您正苦于以下问题:PHP Region::getCountries方法的具体用法?PHP Region::getCountries怎么用?PHP Region::getCountries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Region
的用法示例。
在下文中一共展示了Region::getCountries方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDistributionTypes
/**
*
* @param type $db - ADONewConnection
* @param type $cropID - Crop ID to search from concepts table.
* @return array - Array of DistributionType objects representing a geographical distribution.
*/
public function getDistributionTypes($cropID)
{
global $db;
$query = "SELECT Type FROM distribution WHERE Taxon_ID = " . $cropID . " AND Country IS NOT NULL GROUP BY Type ORDER BY Type ASC";
$db_regionTypes = $db->getAll($query);
$distributionTypes = array();
foreach ($db_regionTypes as $db_regionType) {
$distributionType = new DistributionType($db_regionType["Type"]);
// search for Regions, countries and details.
$query = "SELECT d.ID, c.Code, c.Name, c.Region, c.ISO_Alpha2,\n GROUP_CONCAT(dd.Detail SEPARATOR ', ') as Details\n FROM distribution d\n INNER JOIN countries c ON d.Country = c.Code\n LEFT JOIN distribution_detail dd ON d.Detail_ID = dd.ID\n WHERE d.Taxon_ID = " . $cropID . "\n AND d.Type = '" . $distributionType->getName() . "'\n group by c.Code\n ORDER BY c.Region, c.Code, dd.Detail";
$db_regions = $db->getAll($query);
$regions = array();
$currentRegion = "";
// loop regions
foreach ($db_regions as $db_region) {
if ($db_region["Region"] != $currentRegion) {
// Add last region. The variable $region must have been created before.
$currentRegion != "" ? array_push($regions, $region) : false;
$currentRegion = $db_region["Region"];
$region = new Region($currentRegion);
}
// create a country for the current region.
$country = new Country($db_region["Code"]);
$country->setName(trim($db_region["Name"]));
$country->setIso2(trim($db_region["ISO_Alpha2"]));
if (!empty($db_region["Details"])) {
// details are separated by commas, taked directly from the database.
$country->setDetails($db_region["Details"]);
}
$countries = $region->getCountries();
array_push($countries, $country);
$region->setCountries($countries);
}
array_push($regions, $region);
$distributionType->setRegions($regions);
// insert region type object to the array.
array_push($distributionTypes, $distributionType);
}
return $distributionTypes;
}
示例2: array
<?php
echo Html::formGroup($model, 'name', array('class' => 'col-lg-3 col-md-6'), $form->labelEx($model, 'name', array('label' => '英文名')), Html::activeTextField($model, 'name'), $form->error($model, 'name', array('class' => 'text-danger')));
?>
<div class="clearfix hidden-lg"></div>
<?php
echo Html::formGroup($model, 'email', array('class' => 'col-lg-3 col-md-6'), $form->labelEx($model, 'email', array('label' => '邮箱')), Html::activeTextField($model, 'email'), $form->error($model, 'email', array('class' => 'text-danger')));
?>
<?php
echo Html::formGroup($model, 'mobile', array('class' => 'col-lg-3 col-md-6'), $form->labelEx($model, 'mobile', array('label' => '手机号码')), Html::activeTextField($model, 'mobile'), $form->error($model, 'mobile', array('class' => 'text-danger')));
?>
<div class="clearfix"></div>
<?php
echo Html::formGroup($model, 'wcaid', array('class' => 'col-lg-3 col-md-6'), $form->labelEx($model, 'wcaid', array('label' => 'WCA ID')), Html::activeTextField($model, 'wcaid'), $form->error($model, 'wcaid', array('class' => 'text-danger')));
?>
<?php
echo Html::formGroup($model, 'country_id', array('class' => 'col-lg-3 col-md-6'), $form->labelEx($model, 'country_id', array('label' => '国家')), $form->dropDownList($model, 'country_id', Region::getCountries(), array('prompt' => '', 'class' => 'form-control')), $form->error($model, 'country_id', array('class' => 'text-danger')));
?>
<div class="clearfix hidden-lg"></div>
<?php
echo Html::formGroup($model, 'province_id', array('class' => 'col-lg-3 col-md-6'), $form->labelEx($model, 'province_id', array('label' => '省份')), $form->dropDownList($model, 'province_id', Region::getProvinces(), array('class' => 'form-control', 'prompt' => '')), $form->error($model, 'province_id', array('class' => 'text-danger')));
?>
<?php
echo Html::formGroup($model, 'city_id', array('class' => 'col-lg-3 col-md-6'), $form->labelEx($model, 'city_id', array('label' => '城市')), $form->dropDownList($model, 'city_id', isset($cities[$model->province_id]) ? $cities[$model->province_id] : array(), array('prompt' => '', 'class' => 'form-control')), $form->error($model, 'city_id', array('class' => 'text-danger')));
?>
<div class="clearfix"></div>
<?php
echo Html::formGroup($model, 'gender', array('class' => 'col-lg-3 col-md-6'), $form->labelEx($model, 'gender', array('label' => '性别')), $form->dropDownList($model, 'gender', $genders, array('prompt' => '', 'class' => 'form-control')), $form->error($model, 'gender', array('class' => 'text-danger')));
?>
<?php
echo Html::formGroup($model, 'birthday', array('class' => 'col-lg-3 col-md-6'), $form->labelEx($model, 'birthday', array('label' => '生日')), Html::activeTextField($model, 'birthday', array('class' => 'datetime-picker', 'data-date-format' => 'yyyy-mm-dd', 'data-min-view' => '2')), $form->error($model, 'birthday', array('class' => 'text-danger')));
?>
示例3: array
</div>
</div>
<?php
$form = $this->beginWidget('ActiveForm', array('id' => 'register-form', 'htmlOptions' => array('role' => 'form')));
?>
<?php
echo Html::formGroup($model, 'email', array(), $form->labelEx($model, 'email'), Html::activeTextField($model, 'email', array('type' => 'email')), Yii::app()->language === 'zh_cn' ? '<div class="text-danger">请检查所填写的邮箱正确并有效。QQ邮箱请注意不要带“<strong>www.</strong>”。</div>' : '', $form->error($model, 'email', array('class' => 'text-danger')));
?>
<?php
echo Html::formGroup($model, 'password', array(), $form->labelEx($model, 'password'), Html::activeTextField($model, 'password', array('type' => 'password')), $form->error($model, 'password', array('class' => 'text-danger')));
?>
<?php
echo Html::formGroup($model, 'repeatPassword', array(), $form->labelEx($model, 'repeatPassword'), Html::activeTextField($model, 'repeatPassword', array('type' => 'password')), $form->error($model, 'repeatPassword', array('class' => 'text-danger')));
?>
<?php
echo Html::formGroup($model, 'country_id', array(), $form->labelEx($model, 'country_id'), $form->dropDownList($model, 'country_id', Region::getCountries(), array('class' => 'form-control', 'readonly' => $model->wcaid != '', 'prompt' => '')), $form->error($model, 'country_id', array('class' => 'text-danger')));
?>
<?php
echo Html::formGroup($model, 'name', array('id' => 'name'), $form->labelEx($model, 'name'), Html::activeTextField($model, 'name', array('readonly' => $model->wcaid != '')), Html::tag('div', array('class' => 'hide clearfix', 'id' => 'name-help'), Html::tag('div', array('class' => 'text-info'), Yii::t('common', 'Please choose the correct English name below'))), $form->error($model, 'name', array('class' => 'text-danger')));
?>
<?php
echo Html::formGroup($model, 'local_name', array('id' => 'local_name'), $form->labelEx($model, 'local_name'), Html::activeTextField($model, 'local_name', array('readonly' => $model->wcaid != '' && $model->local_name != '')), Yii::app()->language === 'zh_cn' && ($model->wcaid == '' || $model->local_name == '') ? '<div class="text-danger">请使用真实姓名注册粗饼网并报名比赛。</div>' : '', $form->error($model, 'local_name', array('class' => 'text-danger')));
?>
<?php
echo Html::formGroup($model, 'gender', array(), $form->labelEx($model, 'gender'), $form->dropDownList($model, 'gender', User::getGenders(), array('class' => 'form-control', 'prompt' => '')), $form->error($model, 'gender', array('class' => 'text-danger')));
?>
<?php
echo Html::formGroup($model, 'birthday', array(), $form->labelEx($model, 'birthday'), Html::activeTextField($model, 'birthday', array('class' => 'date-picker', 'data-date-format' => 'yyyy-mm-dd', 'placeholder' => Yii::t('common', 'The format is YYYY-MM-DD'))), $form->error($model, 'birthday', array('class' => 'text-danger')));
?>
<?php
echo Html::formGroup($model, 'province_id', array('class' => 'hide', 'id' => 'province'), $form->labelEx($model, 'province_id'), $form->dropDownList($model, 'province_id', Region::getProvinces(), array('class' => 'form-control', 'prompt' => '')), $form->error($model, 'province_id', array('class' => 'text-danger')));