本文整理汇总了PHP中District::getDistricts方法的典型用法代码示例。如果您正苦于以下问题:PHP District::getDistricts方法的具体用法?PHP District::getDistricts怎么用?PHP District::getDistricts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类District
的用法示例。
在下文中一共展示了District::getDistricts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<ul>
<li class="org_address"><i class="md md-room c-green"></i>
<?php
//if($model->city)
echo '<strong>Адрес:</strong> ';
echo '<span><span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">';
echo '<span itemprop="addressLocality">'.$this->city->title.'</span><span itemprop="streetAddress">';
if($model->street) {
echo ', '.$model->street;
}
if($model->dom) {
echo ', '.$model->dom;
}
echo '</span></span>';
$districts = District::getDistricts($model);
if(($this->city->id==1 or $this->city->id==22) && !empty($districts) && isset($districts[1]))
{
echo '<br><span>'.$districts[1].'</span>';
}
elseif($this->city->id!=1 and $this->city->id!=22 && !empty($districts))
{
$subaddr = '';
if(!empty($model->nearest_metro) && $model->nearestmetro)
{
$subaddr .= '<br><span>Рядом с '.$model->nearestmetro->metro_name.'</span>';
}
foreach ($districts as $district)
{
if(mb_strpos($district, 'микрорайон', 0, 'UTF-8') !== false )
{
示例2: actionItem
/**
* Просмотр записи
*
* @sitemap dataSource=getSitemapRecordUrl priority=0.8 changefreq=daily
* @param $itemurl
* @throws CHttpException
*/
public function actionItem($id=null,$itemurl=null){
$model = $this->_loadItem($id, $itemurl);
$model->scenario = 'addPhoto';
$this->layout = '//layouts/zazadun';
$this->pageTitle = $model->title;
if($this->city->id){
$this->pageTitle .= ' в '.$this->city->mestpad;
if(!empty($model->nearest_metro) && $model->nearestmetro)
{
$this->pageTitle .= ', рядом с '.$model->nearestmetro->metro_name;
}
if($this->city->id == 1 and $model->orgsDistrict) // Москва
{
foreach ($model->orgsDistrict as $district)
{
if(!empty($district->districtid->socr))
$this->pageTitle .= ', '.$district->districtid->socr;
}
}
elseif($this->city->id == 22 and $model->orgsDistrict) // Санкт-Петербург
{
}
else
{
$districts = District::getDistricts($model);
if(!empty($districts))
{
$this->pageTitle .= ', '.$districts[0];
}
}
}
if($model->orgsHttp){
foreach ($model->orgsHttp as $st) {
if(!empty($st->description)){
$this->pageTitle .= ', '. $st->description;
}
}
}
$this->pageKeywords = $model->title;
if($model->categories){
foreach ($model->categories as $cat){
$this->pageKeywords .= ', '.$cat->title;
}
}
$this->pageDescription = $model->title;
if($this->city->id){
$this->pageKeywords .= ', '.$this->city->title;
if(!empty($model->nearest_metro) && $model->nearestmetro){
$this->pageDescription .= ', '.$model->nearestmetro->metro_name;
}
$this->pageDescription .= '. Адрес: '.$this->city->title.', '.$model->street;
$part_description = 'Адрес: '.$this->city->title.', '.$model->street;
if($model->dom) {
$this->pageDescription .= ', '.$model->dom;
$part_description .= ', '.$model->dom;
}
}
$titleKeywords = array();
$orgsCats = array();
if($model->categories){
foreach ($model->categories as $cat){
$orgsCats[] = $cat->id;
$rootcategory = null;
if($cat->root && $cat->root != $cat->id){
$rootcategory = Category::model()->findByPk($cat->root);
}
if($rootcategory && !empty($rootcategory->keywords)){
$keywords = MHelper::String()->toLower($rootcategory->keywords);
$kw = explode(',', $keywords);
$titleKeywords = $kw;
}
if(!empty($cat->keywords)){
$keywords = MHelper::String()->toLower($cat->keywords);
$kw = explode(',', $keywords);
$titleKeywords = array_merge($titleKeywords, $kw);
}
}
}
$titleKeywords = array_unique($titleKeywords);
if(!empty($titleKeywords)){
$tkw = implode(',', $titleKeywords);
$tkw = MHelper::String()->toUpper(MHelper::String()->substr($tkw, 0, 1, "UTF-8"), "UTF-8").MHelper::String()->substr($tkw, 1, MHelper::String()->len($tkw), "UTF-8" );
$this->pageTitle .= '. '.$tkw;
}
$count_items_near = 0;
$nearProvider = $this->getNearMetroOrg($model,$orgsCats);
$nearProviderMicroRayon = null;
//.........这里部分代码省略.........