当前位置: 首页>>代码示例>>PHP>>正文


PHP District::model方法代码示例

本文整理汇总了PHP中District::model方法的典型用法代码示例。如果您正苦于以下问题:PHP District::model方法的具体用法?PHP District::model怎么用?PHP District::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在District的用法示例。


在下文中一共展示了District::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionView

 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'province_id=' . $id;
     $district = new CActiveDataProvider(District::model(), array('criteria' => $criteria));
     $this->render('view', array('model' => $this->loadModel($id), 'district' => $district));
 }
开发者ID:aantonw,项目名称:dcourier.system,代码行数:11,代码来源:ProvinceController.php

示例2: getLocation

 public static function getLocation($ward_id, $district_id, $province_id)
 {
     $ward_type = null;
     $ward_name = null;
     $district_type = null;
     $district_name = null;
     $province_type = null;
     $province_name = null;
     if (isset($ward_id)) {
         $ward = Ward::model()->findByPk($ward_id);
         if ($ward) {
             $ward_type = $ward->type;
             $ward_name = $ward->name;
         }
     }
     if (isset($district_id)) {
         $district = District::model()->findByPk($district_id);
         if ($district) {
             $district_type = $district->type;
             $district_name = $district->name;
         }
     }
     if (isset($province_id)) {
         $province = Province::model()->findByPk($province_id);
         if ($province) {
             $province_type = $province->type;
             $province_name = $province->name;
         }
     }
     return $ward_type . " " . $ward_name . ", " . $district_type . " " . $district_name . ", " . $province_type . " " . $province_name;
 }
开发者ID:huynt57,项目名称:vksnd,代码行数:31,代码来源:Util.php

示例3: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Notices();
     $model->setScenario('create');
     //int_r($_FILES);exit;
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $path = Yii::app()->basePath . '/../uploads';
     if (!is_dir($path)) {
         mkdir($path);
     }
     if (isset($_POST['Notices'])) {
         $model->attributes = $_POST['Notices'];
         $model->user_id = Yii::app()->User->Id;
         $user = User::model()->findByPk(Yii::app()->User->Id);
         $state = State::model()->findByAttributes(array('statecode' => $user->statecode));
         $dist = District::model()->findByAttributes(array('distcode' => $user->distcode));
         $est = Establishments::model()->findByAttributes(array('id' => $user->est_id));
         $model->state = $state->statename;
         $model->district_court_complex = $dist->distname;
         $model->establishment = $est->est_name;
         $model->notice_date = date("Y-m-d H:i:s", time());
         $user = User::model()->findByPk(Yii::app()->User->Id);
         $model->judge_name = $user->judge;
         $court_no = CourtT::model()->findAllByAttributes(array('judge_id' => $user->judge_id));
         $court = '';
         foreach ($court_no as $i) {
             $court = $i['court_no'];
             break;
         }
         $model->court = $court;
         if ($model->validate($_POST['Notices'])) {
             //exit("ASd");
             if (@(!empty($_FILES['Notices']['name']['pdf_file']))) {
                 $model->pdf_file = $_POST['Notices']['pdf_file'];
                 $model->pdf_file = CUploadedFile::getInstance($model, 'pdf_file');
                 //$filename = time() . '_' . str_replace(' ', '_', strtolower($model->pdf_file));
                 if ($_POST['Notices']['notice_type'] == "Advertisment") {
                     $type = 1;
                 } elseif ($_POST['Notices']['notice_type'] == "Sale Notices") {
                     $type = 2;
                 } else {
                     $type = 3;
                 }
                 $filename = $type . "-" . str_replace(' ', '_', $_POST['Notices']['case_type']) . "-" . date("d-m-Y_H:i:s", time()) . ".pdf";
                 $model->pdf_file->saveAs($path . '/' . $filename);
                 $model->pdf_file = $filename;
                 $model->created = date("Y-m-d H:i:s", time());
                 $model->notice_date = date("Y-m-d H:i:s", strtotime($model->notice_date));
                 $model->appear_date = date("Y-m-d H:i:s", strtotime($model->appear_date));
             }
         }
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:harpreet39,项目名称:challan,代码行数:62,代码来源:NoticesController.php

示例4: getDistrict

 public static function getDistrict($id)
 {
     $value = District::model()->findByAttributes(array('id' => $id));
     if (empty($value->title)) {
         return 'Not set';
     } else {
         return $value->title;
     }
 }
开发者ID:optimosolution,项目名称:jasorbd,代码行数:9,代码来源:District.php

示例5: getDropdown

 public function getDropdown()
 {
     global $dataDropdown;
     $dataDropdown = array();
     $parents = District::model()->findALl('t.status=1');
     foreach ($parents as $parent) {
         $dataDropdown[$parent->id] = $parent->name;
     }
     return $dataDropdown;
 }
开发者ID:phantsang,项目名称:xzsUuJg0keDWW5Rx679PHBVBJ,代码行数:10,代码来源:District.php

示例6: actionGetDistrict

 /**
  * 获取地区
  */
 public function actionGetDistrict()
 {
     $city_id = intval($this->_gets->getPost('city_id'));
     $district = District::model()->findAll(array('select' => array('id', 'name'), 'condition' => 'city_id=:city_id', 'params' => array(':city_id' => $city_id)));
     $options = '';
     if (!empty($district)) {
         foreach ($district as $val) {
             $options .= "<option value='{$val['id']}'>{$val['name']}</option>";
         }
     }
     echo $options;
 }
开发者ID:zywh,项目名称:maplecity,代码行数:15,代码来源:AjaxController.php

示例7: actionLoadDistricts

 public function actionLoadDistricts()
 {
     $data = District::model()->findAll('province=:province', array(':province' => (int) $_POST['province']));
     $data = CHtml::listData($data, 'id', 'name');
     $district = (int) $_POST['district'];
     echo "<option value=''>Chọn quận/huyện</option>";
     foreach ($data as $value => $name) {
         if ($value == $district) {
             echo CHtml::tag('option', array('value' => $value, 'selected' => 'selected'), CHtml::encode($name), true);
         } else {
             echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true);
         }
     }
 }
开发者ID:phantsang,项目名称:xzsUuJg0keDWW5Rx679PHBVBJ,代码行数:14,代码来源:ArticleOfAreaController.php

示例8: actionInputPharmacy

 public function actionInputPharmacy()
 {
     $this->checkLogin();
     $ward = Ward::model()->findAll();
     $district = District::model()->findAll();
     $province = Province::model()->findAll();
     $this->render('inputPharmacy', array('ward' => $ward, 'district' => $district, 'province' => $province));
 }
开发者ID:huynt57,项目名称:meboo_nhaplieu,代码行数:8,代码来源:UserController.php

示例9: array

<div class="form">

    <?php 
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'complex-form', 'enableAjaxValidation' => false));
?>

    <p class="help-block">Fields with <span class="required">*</span> are required.</p>

    <?php 
echo $form->errorSummary($model);
?>

            <?php 
echo $form->dropDownListControlGroup($model, 'state', CHtml::listData(State::model()->findAll(array('order' => 'statecode ASC')), 'statecode', 'statename'), array('ajax' => array('type' => 'POST', 'url' => CController::createUrl('site/dynamicdistrict1'), 'update' => '#Complex_district'), 'empty' => 'Select State'), array('span' => 5));
$dist = CHtml::listData(District::model()->findAllByAttributes(array('statecode' => $model->state), array('order' => 'distname ASC')), 'distcode', 'distname');
?>

             <?php 
echo $form->dropDownListControlGroup($model, 'district', $dist, array());
?>

            <?php 
//echo $form->textFieldControlGroup($model,'type',array('span'=>5,'maxlength'=>45));
?>
  <?php 
echo $form->dropDownListControlGroup($model, 'type', array('TC' => 'Taluka Court Complex', 'DC' => 'District Court Complex'), array());
?>
            <?php 
echo $form->textFieldControlGroup($model, 'name', array('span' => 5, 'maxlength' => 245));
?>
开发者ID:harpreet39,项目名称:challan,代码行数:30,代码来源:_form.php

示例10: loadModel

 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = District::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:aantonw,项目名称:dcourier.system,代码行数:13,代码来源:DistrictController.php

示例11: actionUpdateDistricts

 public function actionUpdateDistricts()
 {
     $data = District::model()->findAll('idCity=:idCity', array(':idCity' => (int) $_POST['idCity']));
     $data = CHtml::listData($data, 'idDistrict', 'name');
     echo "<option value=''>Select District</option>";
     foreach ($data as $value => $name) {
         echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true);
     }
 }
开发者ID:rikohz,项目名称:Project1,代码行数:9,代码来源:UserController.php

示例12: getDistrictLinks

    public function getDistrictLinks($rubr,$module = 'catalog')
    {
    	$districts = District::model()->findAll(array('condition'=>'city_id=:city_id','params'=>array(':city_id'=>$this->id)));
   		$links = '';
   		if($districts)
   		{
   			foreach ($districts as $district) 
   			{
   				if((mb_strpos($district->district_name, 'район', 0, 'UTF-8') !== false) && (mb_strpos($district->district_name, 'микрорайон', 0, 'UTF-8') === false))
				{
					$url = Yii::app()->createAbsoluteUrl('/'.$module.'/catalog/district', array('city'=>$this->url,  'url'=>$rubr->url, 'district'=>'rayon'));
					$links .= '<a class="parentCategoryElement" href="'.$url.'">'.$rubr->title.' по районам города</a>';
					break;
				}
   			}
   			foreach ($districts as $district) 
   			{
   				if(mb_strpos($district->district_name, 'микрорайон', 0, 'UTF-8') !== false )
				{
					$url = Yii::app()->createAbsoluteUrl('/'.$module.'/catalog/district', array('city'=>$this->url,  'url'=>$rubr->url, 'district'=>'mikrorayon'));
					$links .= '<a class="parentCategoryElement" href="'.$url.'">'.$rubr->title.' по микрорайонам города</a>';
					break;
				}
   			}
   			foreach ($districts as $district) 
   			{
   				if(mb_strpos($district->district_name, 'округ', 0, 'UTF-8') !== false )
				{
					$url = Yii::app()->createAbsoluteUrl('/'.$module.'/catalog/district', array('city'=>$this->url,  'url'=>$rubr->url, 'district'=>'okrug'));
					$links .= '<a class="parentCategoryElement" href="'.$url.'">'.$rubr->title.' по округам</a>';
					break;
				}
   			}

   		}
   		 if($module == 'catalog'){
	   		$metros = Metro::model()->find(array('condition'=>'city_id=:city_id','params'=>array(':city_id'=>$this->id)));
	   		if($metros)
	   		{
	   			$url = Yii::app()->createAbsoluteUrl('/'.$module.'/catalog/district', array('city'=>$this->url,  'url'=>$rubr->url, 'district'=>'metro'));
				$links .= '<a class="parentCategoryElement" href="'.$url.'">'.$rubr->title.' по станциям метро</a>';
	   		}
	   	}
   		return $links;
    }
开发者ID:Aplay,项目名称:Fastreview_site,代码行数:45,代码来源:City.php

示例13: actionGetMapHouse


//.........这里部分代码省略.........
             } elseif ($_POST['housetype'] == 4) {
                 $criteria->addCondition('type_own1_out="Semi-Detached" or type_own1_out="Link" or type_own1_out="Duplex"');
             } elseif ($_POST['housetype'] == 5) {
                 $criteria->addCondition('type_own1_out="Cottage" or type_own1_out="Rural Resid"');
             } elseif ($_POST['housetype'] == 6) {
                 $criteria->addCondition('type_own1_out="Farm"');
             } elseif ($_POST['housetype'] == 7) {
                 $criteria->addCondition('type_own1_out="Vacant Land"');
             } elseif ($_POST['housetype'] == 8) {
                 $criteria->addCondition('type_own1_out="Mobile/Trailer" or type_own1_out="Det W/Com Elements" or type_own1_out="Store W/Apt/offc"');
             }
             // $criteria->addCondition("t.propertyType_id = :propertyType_id");
             //   $criteria->params += array(':propertyType_id' => intval($_POST['housetype']));
         }
         //根据地区名字搜索
         if (!empty($_POST['city']) && trim($_POST['city']) != '州名/市名(中英)') {
             $city = trim($_POST['city']);
             $criteria->addCondition("t.addr like '%" . $city . "%' OR b.pinyin like '%" . $city . "%' OR b.englishName like '%" . $city . "%'");
         }
         //建造年份
         if (!empty($_POST['houseyear'])) {
             $year = explode(',', $_POST['houseyear']);
             $minYear = intval($year[0]);
             $maxYear = intval($year[1]);
             if ($maxYear != 0 || $minYear != 0) {
                 if ($maxYear > $minYear) {
                     $criteria->addCondition("t.yr <= :maxYear");
                     $criteria->params += array(':maxYear' => $maxYear);
                 }
                 $criteria->addCondition("t.yr >= :minYear");
                 $criteria->params += array(':minYear' => $minYear);
             }
         }
         $house = House::model()->findAll($criteria);
         //经纬度范围
         if ((empty($_POST['city']) || trim($_POST['city']) == '州名/市名(中英)') && empty($_POST['country']) && !empty($_POST['city'])) {
             if (!empty($house)) {
                 $bound = explode(',', $_POST['bounds']);
                 foreach ($house as $key => $val) {
                     $jingweidu = actionGetCodeAddress2($val->country . $val->community . $val->addr);
                     if (floatval($val->latitude) >= floatval($bound[0]) && floatval($jingweidu['lat']) <= floatval($bound[2]) && floatval($jingweidu['lng']) >= floatval($bound[1]) && floatval($jingweidu['lng']) <= floatval($bound[3])) {
                     } else {
                         unset($house[$key]);
                     }
                 }
             }
         }
         $count = count($house);
         //数据重组
         if (!empty($house)) {
             $result['Message'] = '成功';
             $result['Data']['AreaHouseCount'] = array();
             $result['Data']['MapHouseList'] = array();
             foreach ($house as $key => $val) {
                 $jingweidu = actionGetCodeAddress2($val->country . $val->community . $val->addr);
                 $mapHouseList = array();
                 $mapHouseList['Beds'] = $val->br_plus;
                 $mapHouseList['Baths'] = $val->bath_tot;
                 $mapHouseList['Kitchen'] = $val->kit_plus;
                 $mapHouseList['GeocodeLat'] = $jingweidu['lat'];
                 $mapHouseList['GeocodeLng'] = $jingweidu['lng'];
                 $mapHouseList['Address'] = $val->addr;
                 $mapHouseList['Price'] = $val->lp_dol;
                 $mapHouseList['Id'] = $val->id;
                 $propertyType = PropertyType::model()->findByPk($val->propertyType_id);
                 $mapHouseList['HouseType'] = !empty($propertyType) ? $propertyType->name : '';
开发者ID:zywh,项目名称:maplecity,代码行数:67,代码来源:MapController_bak.php

示例14: array

	<div class="row">
		<?php 
echo $form->label($model, 'en_name');
?>
		<?php 
echo $form->textField($model, 'en_name', array('maxlength' => 255));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'district_id');
?>
		<?php 
echo $form->dropDownList($model, 'district_id', GxHtml::listDataEx(District::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All')));
?>
	</div>

	<div class="row buttons">
		<?php 
echo GxHtml::submitButton(Yii::t('app', 'Search'));
?>
	</div>

<?php 
$this->endWidget();
?>

</div><!-- search-form -->
开发者ID:hanihh,项目名称:vvs_v2,代码行数:29,代码来源:_search.php

示例15: actionAjaxGetDistricts

 public function actionAjaxGetDistricts()
 {
     $city_id = Yii::app()->request->getPost('city_id');
     $district_list = array();
     if (!empty($city_id)) {
         $district_list = District::model()->findAll('city_id=:city_id', array(':city_id' => $city_id));
     } else {
         $district_list = District::model()->findAll();
     }
     echo CJSON::encode(array('data' => $district_list));
 }
开发者ID:zywh,项目名称:maplecity,代码行数:11,代码来源:ColumnController.php


注:本文中的District::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。