Exemplo n.º 1
0
 public function actionAdmin()
 {
     $model = new District('search');
     $model->unsetAttributes();
     if (isset($_GET['District'])) {
         $model->setAttributes($_GET['District']);
     }
     $this->render('admin', array('model' => $model));
 }
Exemplo n.º 2
0
 function updateDistrict($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $district = new District();
     $district->parseDomDocument($domDoc);
     $ret = $district->updateRecord();
     return $ret;
 }
Exemplo n.º 3
0
 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;
     }
 }
Exemplo n.º 4
0
 function getDistrictDetails($districtID)
 {
     $district = new District();
     $district->selectRecord($districtID);
     if (!($domDoc = $district->getDomDocument())) {
         return false;
     } else {
         $xmlStr = $domDoc->dump_mem(true);
         return $xmlStr;
     }
 }
Exemplo n.º 5
0
 /**
  * 录入
  *
  */
 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));
 }
Exemplo n.º 6
0
    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;
    }
Exemplo n.º 7
0
 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;
 }
 /**
  * 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));
 }
Exemplo n.º 9
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         District::create([]);
     }
 }
Exemplo n.º 10
0
 /**
  * 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));
 }
Exemplo n.º 11
0
 public static function getDistrict($id)
 {
     $value = District::model()->findByAttributes(array('id' => $id));
     if (empty($value->title)) {
         return 'Not set';
     } else {
         return $value->title;
     }
 }
Exemplo n.º 12
0
 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);
 }
 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);
 }
 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;
 }
 /**
  * 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);
     }
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $districts_data = District::all()->lists('municipalities', 'name');
     $city = City::find($id);
     if (is_null($city)) {
         return Redirect::route('admin.cities.index')->withErrors(array('mainError' => 'Градът/селото не е намерен.'));
     } else {
         return View::make('admin.city.edit')->with('city', $city)->with('districts_data', $districts_data);
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $districts['results'] = District::select('id', 'name as text')->get()->toArray();
     foreach ($districts['results'] as $key => $value) {
         if ($value['children'] == null) {
             unset($districts['results'][$key]);
         }
     }
     $districts['results'] = array_values(array_filter($districts['results']));
     return Response::json($districts);
 }
Exemplo n.º 18
0
 public function view_list()
 {
     $year = $this->input->post("year");
     $epiweek = $this->input->post("epiweek");
     $dnr_districts = District::getDNRDistricts($year, $epiweek);
     $provinces = Province::getAll();
     $data['provinces'] = $provinces;
     $data['dnr_districts'] = $dnr_districts;
     $data['report_view'] = "dnr_districts_v";
     $data['small_title'] = "DNR Districts in " . $year . " Epiweek " . $epiweek;
     $this->base_params($data);
 }
Exemplo n.º 19
0
 public function edit_user($id)
 {
     $user = Users::getUser($id);
     $data['user'] = $user;
     $data['title'] = "User Management::Edit " . $user->Name . "'s Details";
     $data['title'] = "User Management::Add New User";
     $data['module_view'] = "add_user_view";
     $data['levels'] = Access_Level::getAll();
     $data['districts'] = District::getAll();
     $data['provinces'] = Province::getAll();
     $this->base_params($data);
 }
Exemplo n.º 20
0
 /**
  * 获取地区
  */
 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;
 }
Exemplo n.º 21
0
 public function validate()
 {
     if (is_null($this::where('name', '=', $this->name)->first())) {
         if (!is_null(District::where('id', '=', $this->district_id)->first())) {
             return true;
         } else {
             throw new ValidationException(null, null, null, array('district_id' => "Грешен ID на областта."));
         }
     } else {
         throw new ValidationException(null, null, null, array('name' => "Общината вече съществува."));
     }
 }
Exemplo n.º 22
0
 public function insertRandomRow()
 {
     /* generate the field values */
     /* first generate the random values, then add them to query */
     $workTypeId = rand(1, WorkType::getRowsNumber());
     $districtId = rand(1, District::getRowsNumber());
     $jobSubCategoryId = rand(1, JobSubCategory::getRowsNumber());
     $salaryLow = rand(20, 200) * 1000;
     $salaryRange = rand(5, 30) * 1000;
     $daysOffset = -60 + rand(1, 90);
     $startDate = strtotime(sprintf("%+d", $daysOffset) . " day");
     $endDate = strtotime(sprintf("%+d", $daysOffset + 30) . " day");
     /* Processing this information */
     $workType = WorkType::getWorkTypeName(WorkType::getWorkType($workTypeId));
     $district = District::getDistrict($districtId);
     $districtName = District::getDistrictName($district);
     $regionName = Region::getRegionName(Region::getRegion(District::getRegionId($district)));
     $jobSubCategory = JobSubCategory::getJobSubCategory($jobSubCategoryId);
     $jobSubCategoryName = JobSubCategory::getJobSubCategoryName($jobSubCategory);
     $jobCategoryId = JobSubCategory::getJobCategoryId($jobSubCategory);
     $jobCategoryName = JobCategory::getJobCategoryName(JobCategory::getJobCategory($jobCategoryId));
     $salaryHigh = $salaryLow + $salaryRange;
     $jobTitle = "Job in {$regionName}";
     $jobDescription = "{$jobSubCategoryName} " . strtolower($workType) . " job in {$districtName}, {$regionName}, in the domain of {$jobCategoryName}, salary from \${$salaryLow} to \${$salaryHigh}.\n";
     $jobDescription .= "Posted on " . date("D, jS \\of F, Y", $startDate) . ", valid until " . date("D, jS \\of F, Y", $endDate);
     /* Now build the query with the values generated above */
     /* job_id */
     $values = "NULL";
     //AUTO_INCREMENT field
     /* job_title */
     $values .= ", '{$jobTitle}'";
     /* job_description */
     $values .= ", '{$jobDescription}'";
     /* work_type_id */
     $values .= ", '{$workTypeId}'";
     /* district_id */
     $values .= ", '{$districtId}'";
     /* subcategory_id */
     $values .= ", '{$jobSubCategoryId}'";
     /* salary_low */
     $values .= ", '{$salaryLow}'";
     /* SalaryHihg */
     $values .= ", '{$salaryHigh}'";
     /* start_ad_date */
     /* format: '2013-05-14 00:00:00' */
     $values .= ", '" . date("Y-m-d 00:00:00", $startDate) . "'";
     /* end_ad_date */
     $values .= ", '" . date("Y-m-d 00:00:00", $endDate) . "'";
     /* Build the query */
     $query = Job::insertRowQuery($values);
     return $query;
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $district = District::find($id);
     if (!is_null($district)) {
         if ($district->delete()) {
             return Redirect::route('admin.districts.index')->withErrors(array('mainSuccess' => 'Областта е успешно изтрита.'));
         } else {
             return Redirect::route('admin.districts.index')->withErrors(array('mainError' => 'Грешка с базата данни.'));
         }
     } else {
         return Redirect::route('admin.districts.index')->withErrors(array('mainError' => 'Областта не е намерена.'));
     }
 }
 function getDistrict()
 {
     $segs = $this->uri->segment_array();
     $provinceId = $segs[3];
     $districts = District::getNameAndId($provinceId);
     $allDistricts = "";
     foreach ($districts as $districts) {
         $allDistricts .= $districts->id;
         $allDistricts .= "+";
         $allDistricts .= $districts->Name;
         $allDistricts .= "_";
     }
     echo $allDistricts;
 }
 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);
         }
     }
 }
Exemplo n.º 26
0
 public function districts_post($param)
 {
     $districts = array();
     if ($result = District::query()->where([['`id_city`', '=', $param['id']]])->order_by('`name`')->get()) {
         while ($row = $result->fetch_assoc()) {
             $d = array('id' => $row['id'], 'name' => $row['name']);
             array_push($districts, $d);
         }
         $result->free();
     }
     ob_end_clean();
     //var_dump($districts);
     echo json_encode($districts);
     exit;
 }
Exemplo n.º 27
0
 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;
 }
Exemplo n.º 28
0
 public function edit_weekly_data($epiweek, $reporting_year, $facility)
 {
     $facilities = Facilities::getAll();
     $districts = District::getAll();
     $diseases = Disease::getAllObjects();
     $data['facilities'] = $facilities;
     $data['districts'] = $districts;
     $data['diseases'] = $diseases;
     $data['prediction'] = Surveillance::getPrediction();
     $data['surveillance_data'] = Surveillance::getSurveillanceDataFacility($epiweek, $reporting_year, $facility);
     $data['lab_data'] = Lab_Weekly::getWeeklyFacilityLabData($epiweek, $reporting_year, $facility);
     $data['editing'] = true;
     $data['scripts'] = array("special_date_picker.js", "validationEngine-en.js", "validator.js");
     $data["styles"] = array("validator.css");
     $this->base_params($data);
 }
Exemplo n.º 29
0
 function edit()
 {
     if (isset($_POST['save'])) {
         $id = $this->input->post('id');
         $data = array('district_name' => trim($this->input->post('district_name')), 'state' => $this->input->post('state'));
         $dataIn = $this->district_model->edit($id, $data);
         if ($dataIn) {
             $this->admintemp->write('message', 'Edited Successfully');
             redirect('district');
         } else {
             $this->admintemp->write('message', 'Error occured while editing');
             District::index();
         }
     } else {
         District::_edit();
     }
 }
 public function add()
 {
     $provinces = Province::getAll();
     $districts = District::getAll();
     $facilities = Facilities::getAll();
     $diseases = Disease::getAllObjects();
     $data['provinces'] = $provinces;
     $data['districts'] = $districts;
     $data['facilities'] = $facilities;
     $data['diseases'] = $diseases;
     $data['scripts'] = array("jquery.ui.core.js", "jquery.ui.datepicker.js", "jquery.ui.widget.js");
     $data['styles'] = array("jquery.ui.all.css");
     $data['title'] = "Line List Data";
     $data['content_view'] = "linelist_data_add_v";
     $data['banner_text'] = "Linelist Data";
     $data['link'] = "submissions_management";
     $data['quick_link'] = "linelisted_data_management";
     $this->base_params($data);
     //$this -> load -> view("template", $data);
 }