本文整理汇总了PHP中District类的典型用法代码示例。如果您正苦于以下问题:PHP District类的具体用法?PHP District怎么用?PHP District使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了District类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionAdmin
public function actionAdmin()
{
$model = new District('search');
$model->unsetAttributes();
if (isset($_GET['District'])) {
$model->setAttributes($_GET['District']);
}
$this->render('admin', array('model' => $model));
}
示例2: updateDistrict
function updateDistrict($xmlStr)
{
if (!($domDoc = domxml_open_mem($xmlStr))) {
return false;
}
$district = new District();
$district->parseDomDocument($domDoc);
$ret = $district->updateRecord();
return $ret;
}
示例3: isexist
function isexist($zipcode)
{
$Model_B = new District();
$valid = $Model_B->find('count', array('conditions' => array('District.district_code' => $zipcode)));
if ($valid == 1) {
return true;
} else {
return false;
}
}
示例4: getDistrictDetails
function getDistrictDetails($districtID)
{
$district = new District();
$district->selectRecord($districtID);
if (!($domDoc = $district->getDomDocument())) {
return false;
} else {
$xmlStr = $domDoc->dump_mem(true);
return $xmlStr;
}
}
示例5: actionCreate
/**
* 录入
*
*/
public function actionCreate()
{
parent::_acl('district_create');
$model = new District();
if (isset($_POST['District'])) {
$model->attributes = $_POST['District'];
if ($model->save()) {
AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入地区,ID:' . $model->id));
$this->redirect(array('index'));
}
}
$this->render('create', array('model' => $model));
}
示例6: get_fees
static function get_fees($pid = null) {
$fees = unserialize(self::get_key('fees'));
if (empty($fees) || !is_array($fees)) {
return null;
}
$list_city = City::get_list(true);
$list_district = District::get_list(true, $pid);
$list_fee = array();
if (!empty($fees)) {
foreach ($fees as $did => $fee) {
if (!empty($list_district[$did])) {
$fee['city'] = $list_city[$fee['cid']];
$fee['district'] = $list_district[$did];
$fee['delivery_fee_formatted'] = EClassApi::numberFormat($fee['delivery_fee']);
$fee['min_order_formatted'] = EClassApi::numberFormat($fee['min_order']);
$fee['min_order_fee_formatted'] = EClassApi::numberFormat($fee['min_order_fee']);
$fee['free_delivery_formatted'] = EClassApi::numberFormat($fee['free_delivery']);
$list_fee[$did] = $fee;
}
}
}
return $list_fee;
}
示例7: 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;
}
示例8: 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));
}
示例9: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
District::create([]);
}
}
示例10: 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));
}
示例11: getDistrict
public static function getDistrict($id)
{
$value = District::model()->findByAttributes(array('id' => $id));
if (empty($value->title)) {
return 'Not set';
} else {
return $value->title;
}
}
示例12: processDistrict
public function processDistrict($patientquery, $visitquery, $value, $title = "")
{
if ($value != "all") {
$title .= District::find($value)->district . " District ";
$patientquery->whereIn('id', PatientReport::where('district', $value)->get()->lists('patient_id') + array('0'));
$visitquery->whereIn('id', PatientInfo::where('district', $value)->get()->lists('visit_id') + array('0'));
}
return array($patientquery, $visitquery, $title);
}
示例13: edit_district
public function edit_district($code)
{
$district = District::getDistrict($code);
$data['district'] = $district[0];
$data['title'] = "District Management::Edit " . $district->name . " District";
$data['module_view'] = "add_district_view";
$data['quick_link'] = "new_district";
$data['provinces'] = Province::getAll();
$this->base_params($data);
}
示例14: 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;
}
示例15: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$districts_data = District::lists("name", "id");
$municipality = Municipality::find($id);
if (is_null($municipality)) {
return Redirect::route('admin.municipalities.index')->withErrors(array('mainError' => 'Общината не е намерена.'));
} else {
return View::make('admin.municipality.edit')->with('municipality', $municipality)->with('districts_data', $districts_data);
}
}