本文整理汇总了PHP中District::getDistrictId方法的典型用法代码示例。如果您正苦于以下问题:PHP District::getDistrictId方法的具体用法?PHP District::getDistrictId怎么用?PHP District::getDistrictId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类District
的用法示例。
在下文中一共展示了District::getDistrictId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: queryConditionRegionId
protected static function queryConditionRegionId($regionId)
{
/* Only district IDs available in the job table, so have to retrieve them from the district table */
$districtRows = District::getDistrictList($regionId);
$districtList = "";
while (($districtRow = $districtRows->fetch_row()) != NULL) {
$districtList .= District::getDistrictId($districtRow) . ", ";
}
$condition = "";
if (!empty($districtList)) {
$districtList = substr($districtList, 0, -strlen(", "));
$condition = "`district_id` IN ({$districtList})";
}
return $condition;
}
示例2: jsDistrictUpdate
protected function jsDistrictUpdate()
{
$output = "";
/* create the region <-> district connection */
$output .= "var districtNames = new Array();\n";
$output .= "var districtIds = new Array();\n";
$output .= "districtNames[" . static::anyRegionCode . "] = [\"Select region first\"];\n";
$output .= "districtIds[" . static::anyRegionCode . "] = [\"" . static::anyDistrictCode . "\"];\n";
$regionList = Region::getAllRows();
$regionCount = 0;
while (($region = $regionList->fetch_row()) != NULL) {
$regionId = Region::getRegionId($region);
$districtList = District::getDistrictList($regionId);
/* first the district names */
$output .= "districtNames[{$regionId}] = [\"Any district\"";
while (($district = $districtList->fetch_row()) != NULL) {
$output .= ", \"" . District::getDistrictName($district) . "\"";
}
$output .= "];\n";
/* then the district Ids */
$output .= "districtIds[{$regionId}] = [\"" . static::anyDistrictCode . "\"";
$districtList->data_seek(0);
while (($district = $districtList->fetch_row()) != NULL) {
$output .= ", \"" . District::getDistrictId($district) . "\"";
}
$output .= "];\n";
}
/* print the districtUpdate() function */
/* the below code is JavaScript */
$output .= "\n";
$output .= "districtList = document." . static::formName . "." . static::districtIdFieldName . ";\n";
$output .= "function districtUpdate(selectedRegionId){\n";
$output .= " districtList.options.length = 0;\n";
$output .= " for (i=0; i < districtNames[selectedRegionId].length; i++) {\n";
$output .= " districtList.options[districtList.options.length] = new Option(districtNames[selectedRegionId][i],districtIds[selectedRegionId][i]);\n";
$output .= " }\n";
$output .= "}\n";
return $output;
}