本文整理汇总了PHP中District::getDistrict方法的典型用法代码示例。如果您正苦于以下问题:PHP District::getDistrict方法的具体用法?PHP District::getDistrict怎么用?PHP District::getDistrict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类District
的用法示例。
在下文中一共展示了District::getDistrict方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: insertRandomRow
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;
}
示例3: getRegion
public static function getRegion($job)
{
/* job -> DistrictId => District row -> RegionId => Region row -> region_name */
/* -> is array access; => is query access */
return Region::getRegionName(Region::getRegion(District::getRegionId(District::getDistrict(self::getDistrictId($job)))));
}
示例4: Directory
<div class="widget-box">
<div class="widget-header">
<h5>Details Directory (<?php
echo $model->title;
?>
)</h5>
<div class="widget-toolbar">
<a data-action="settings" href="#"><i class="icon-cog"></i></a>
<a data-action="reload" href="#"><i class="icon-refresh"></i></a>
<a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a>
<a data-action="close" href="#"><i class="icon-remove"></i></a>
</div>
<div class="widget-toolbar">
<?php
echo CHtml::link('<i class="icon-pencil"></i>', array('update', 'id' => $model->id), array('data-rel' => 'tooltip', 'title' => 'Edit', 'data-placement' => 'bottom'));
?>
</div>
<div class="widget-toolbar">
<?php
echo CHtml::link('<i class="icon-plus"></i>', array('create'), array('data-rel' => 'tooltip', 'title' => 'Add', 'data-placement' => 'bottom'));
?>
</div>
</div><!--/.widget-header -->
<div class="widget-body">
<div class="widget-main">
<?php
$this->widget('zii.widgets.CDetailView', array('htmlOptions' => array('class' => 'table table-striped table-condensed table-hover'), 'data' => $model, 'attributes' => array('id', array('name' => 'category', 'type' => 'raw', 'value' => DirectoryCategory::getDirectoryCategory($model->category)), 'title', 'address', 'postcode', array('name' => 'country', 'type' => 'raw', 'value' => Country::getCountry($model->country)), array('name' => 'state', 'type' => 'raw', 'value' => State::getState($model->state)), array('name' => 'city', 'type' => 'raw', 'value' => City::getCity($model->city)), array('name' => 'district', 'type' => 'raw', 'value' => District::getDistrict($model->district)), array('name' => 'thana', 'type' => 'raw', 'value' => Thana::getThana($model->thana)), 'telephone', 'mobile', 'email', 'fax', 'website', 'details', array('name' => 'created_by', 'type' => 'raw', 'value' => UserAdmin::get_user_name($model->created_by)), array('name' => 'created_on', 'type' => 'raw', 'value' => UserAdmin::get_date_time($model->created_on)), array('name' => 'modified_by', 'type' => 'raw', 'value' => UserAdmin::get_user_name($model->modified_by)), array('name' => 'modified_on', 'type' => 'raw', 'value' => UserAdmin::get_date_time($model->modified_on)), array('name' => 'published', 'value' => $model->published ? "Yes" : "No"), 'hits')));
?>
</div>
</div><!--/.widget-body -->
</div><!--/.widget-box -->
示例5: Thana
<div class="widget-box">
<div class="widget-header">
<h5>Details Thana (<?php
echo $model->title;
?>
)</h5>
<div class="widget-toolbar">
<a data-action="settings" href="#"><i class="icon-cog"></i></a>
<a data-action="reload" href="#"><i class="icon-refresh"></i></a>
<a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a>
<a data-action="close" href="#"><i class="icon-remove"></i></a>
</div>
<div class="widget-toolbar">
<?php
echo CHtml::link('<i class="icon-pencil"></i>', array('update', 'id' => $model->id), array('data-rel' => 'tooltip', 'title' => 'Edit', 'data-placement' => 'bottom'));
?>
</div>
<div class="widget-toolbar">
<?php
echo CHtml::link('<i class="icon-plus"></i>', array('create'), array('data-rel' => 'tooltip', 'title' => 'Add', 'data-placement' => 'bottom'));
?>
</div>
</div><!--/.widget-header -->
<div class="widget-body">
<div class="widget-main">
<?php
$this->widget('zii.widgets.CDetailView', array('htmlOptions' => array('class' => 'table table-striped table-condensed table-hover'), 'data' => $model, 'attributes' => array('id', array('name' => 'country_id', 'type' => 'raw', 'value' => Country::getCountry($model->country_id)), array('name' => 'state_id', 'type' => 'raw', 'value' => State::getState($model->state_id)), array('name' => 'city_id', 'type' => 'raw', 'value' => City::getCity($model->city_id)), array('name' => 'district_id', 'type' => 'raw', 'value' => District::getDistrict($model->district_id)), 'title', array('name' => 'published', 'value' => $model->published ? "Yes" : "No"))));
?>
</div>
</div><!--/.widget-body -->
</div><!--/.widget-box -->
示例6: save
public function save()
{
$i = 0;
$valid = $this->_validate_submission();
if ($valid == false) {
$this->add();
} else {
$editing = false;
$diseases = Disease::getAllObjects();
$weekending = $this->input->post("week_ending");
$reporting_year = $this->input->post("reporting_year");
$epiweek = $this->input->post("epiweek");
$district = $this->input->post("district");
$reportingfacilities = $this->input->post("reporting_facilities");
$expectedfacilities = $this->input->post("expected_facilities");
$lmcase = $this->input->post("lmcase");
$lfcase = $this->input->post("lfcase");
$lmdeath = $this->input->post("lmdeath");
$lfdeath = $this->input->post("lfdeath");
$gmcase = $this->input->post("gmcase");
$gfcase = $this->input->post("gfcase");
$gmdeath = $this->input->post("gmdeath");
$gfdeath = $this->input->post("gfdeath");
$sickness = $this->input->post("disease");
$reported_by = $this->input->post("reported_by");
$designation = $this->input->post("designation");
$lab_id = $this->input->post("lab_id");
$surveillance_ids = $this->input->post("surveillance_ids");
$data_exists = Surveillance::getDistrictData($epiweek, $reporting_year, $district);
if ($lab_id > 0) {
$editing = true;
}
if ($data_exists->id && $editing == false) {
$data = array();
$data['duplicate_district'] = District::getDistrict($district);
$data['duplicate_epiweek'] = $epiweek;
$data['duplicate_reporting_year'] = $reporting_year;
$data['existing_data'] = true;
$this->add($data);
return;
}
$total_diseases = Disease::getTotal();
$timestamp = date('d/m/Y');
$i = 0;
foreach ($diseases as $disease) {
if ($editing == true) {
$surveillance = Surveillance::getSurveillance($surveillance_ids[$i]);
} else {
$surveillance = new Surveillance();
}
$surveillance->Week_Ending = $weekending;
$surveillance->Epiweek = $epiweek;
$surveillance->District = $district;
$surveillance->Submitted = $reportingfacilities;
$surveillance->Expected = $expectedfacilities;
$surveillance->Lmcase = $lmcase[$i];
$surveillance->Lfcase = $lfcase[$i];
$surveillance->Lmdeath = $lmdeath[$i];
$surveillance->Lfdeath = $lfdeath[$i];
if (isset($gmcase[$i])) {
$surveillance->Gmcase = $gmcase[$i];
$surveillance->Gfcase = $gfcase[$i];
$surveillance->Gmdeath = $gmdeath[$i];
$surveillance->Gfdeath = $gfdeath[$i];
}
$surveillance->Disease = $disease;
$surveillance->Reporting_Year = $reporting_year;
$surveillance->Created_By = $this->session->userdata('user_id');
$surveillance->Date_Created = date("Y-m-d");
$surveillance->Reported_By = $reported_by;
$surveillance->Designation = $designation;
$surveillance->Total_Diseases = $total_diseases;
$surveillance->Date_Reported = $timestamp;
$surveillance->save();
$i++;
}
//end foreach
//Lab Data
if ($editing == true) {
$labdata = Lab_Weekly::getLabObject($lab_id);
} else {
$labdata = new Lab_Weekly();
}
$totaltestedlessfive = $this->input->post("total_tested_less_than_five");
$totaltestedgreaterfive = $this->input->post("total_tested_greater_than_five");
$totalpositivelessfive = $this->input->post("total_positive_less_than_five");
$totalpositivegreaterfive = $this->input->post("total_positive_greater_than_five");
$remarks = $this->input->post("remarks");
$labdata->Epiweek = $epiweek;
$labdata->Week_Ending = $weekending;
$labdata->District = $district;
$labdata->Malaria_Below_5 = $totaltestedlessfive;
$labdata->Malaria_Above_5 = $totaltestedgreaterfive;
$labdata->Positive_Below_5 = $totalpositivelessfive;
$labdata->Positive_Above_5 = $totalpositivegreaterfive;
$labdata->Remarks = $remarks;
$labdata->Reporting_Year = $reporting_year;
$labdata->Date_Created = date("Y-m-d");
$labdata->save();
if ($editing) {
//.........这里部分代码省略.........
示例7: array
<?php
$this->breadcrumbs = array('Youtubes' => array('admin'), $model->youtube_id);
$this->menu = array(array('label' => 'Manage', 'url' => array('admin'), 'active' => true, 'icon' => 'icon-home'), array('label' => 'New', 'url' => array('create'), 'active' => true, 'icon' => 'icon-file'), array('label' => 'Edit', 'url' => array('update', 'id' => $model->id), 'active' => true, 'icon' => 'icon-pencil'), array('label' => 'Delete', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?'), 'active' => true, 'icon' => 'icon-remove'));
?>
<div class="form-actions">
<h2><?php
echo $model->youtube_id;
?>
</h2>
</div>
<?php
$this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'attributes' => array('id', 'youtube_id', array('name' => 'district', 'type' => 'raw', 'value' => District::getDistrict($model->district)), array('name' => 'thana', 'type' => 'raw', 'value' => Thana::getThana($model->thana)), array('name' => 'published', 'type' => 'raw', 'value' => $model->published ? "Yes" : "No"), array('name' => 'featured', 'type' => 'raw', 'value' => $model->featured ? "Yes" : "No"), array('name' => 'created_on', 'type' => 'raw', 'value' => date("F j, Y, g:i A", strtotime($model->created_on))), 'created_by')));
示例8: generate
public function generate()
{
$bata_buffer = "";
$year = $this->input->post('year_from');
$epiweek = $this->input->post('epiweek_to');
$province = $this->input->post('province');
$district = $this->input->post('district');
$display_type = $this->input->post('display_type');
$weekending = Surveillance::getWeekEnding($year, $epiweek);
$provinces = array();
$districts = array();
//Check if a province has been specified
if ($province > 0) {
//if so, retrieve it's details from the database
$provinces = Province::getProvince($province);
} else {
//if not, retrieve all provinces
$provinces = Province::getAll();
}
//Check if a district has been specified
if ($district > 0) {
//if so, retrieve it's details from the database
$districts = District::getDistrict($district);
//also, retrieve the province details for this district
$provinces = Province::getProvince($districts[0]['Province']);
} else {
//if not, empty the array
$districts = array();
}
//Start displaying the header of the table
$bata_buffer .= " <table class='data-table'>\n <tr style='background: #F5D2AE;'>\n <th rowspan=2>Province</th>\n <th rowspan=2>District</th>\n <th rowspan=2>Reports Expected</th>\n <th rowspan=2>Reports Received</th>\n <th rowspan=2>%RR</th>";
$diseases["reports"] = "reports";
$diseases["submitted"] = "submitted";
$diseases["percentage"] = "percentage";
$disease_array = Disease::getAll();
foreach ($disease_array as $disease) {
if ($disease['Name'] == 'Malaria') {
$diseases[$disease['id']] = $disease['Name'];
$diseases["tested"] = "tested";
$diseases["positive"] = "positive";
$bata_buffer .= "<th rowspan=2>" . $disease['Name'] . "</th>";
$bata_buffer .= "<th colspan=2 style='color:green;'>" . $disease['Name'] . " Indicators</th>";
} else {
$diseases[$disease['id']] = $disease['Name'];
$bata_buffer .= "<th rowspan=2>" . $disease['Name'] . "</th>";
}
}
//Finish Displaying the Header
$bata_buffer .= " </tr>\n <tr style='background: #F5D2AE'>\n <th >Tested</th><th >Positive</th>\n </tr>\n\t\t";
//Start retrieving all the rows for the data
foreach ($provinces as $province_object) {
$bata_buffer .= "<tr class='even'><td style='font-weight:bold; font-size:14px'>" . $province_object->Name . "</td></tr>";
$province_districts = array();
//check if a district was specified
if (count($districts) > 0) {
$province_districts = $districts;
} else {
//Get all the districts for this province
$province_districts = district::getProvinceDistrict($province_object->id);
}
//loop through all the districts to get their data
foreach ($province_districts as $province_district) {
$available_data = array();
$surveillance_counter = 2;
$bata_buffer .= "<tr class='even' style='background:#C4E8B7'><td></td><td>" . $province_district['Name'] . "</td>";
$surveillance_data = Surveillance::getWeeklySummaries($year, $epiweek, $province_district['id']);
//Check if any surveillance data exists
if (isset($surveillance_data[0])) {
$available_data['reports'] = $surveillance_data[0]['Expected'];
$available_data['submitted'] = $surveillance_data[0]['Submitted'];
//Calculate the reporting
$available_data['percentage'] = floor($available_data['submitted'] / $available_data['reports'] * 100);
//Display these Parameters
$bata_buffer .= "<td>" . $available_data['reports'] . "</td><td>" . $available_data['submitted'] . "</td><td>" . $available_data['percentage'] . "</td>";
} else {
$bata_buffer .= "<td>DNR</td><td>DNR</td><td>0</td>";
}
//Check if there is any surveillance data
if (isset($surveillance_data[0])) {
//Loop through all the surveillance data returned
foreach ($surveillance_data as $disease_data) {
$bata_buffer .= "<td>" . $disease_data['Cases'] . "(" . $disease_data['Deaths'] . ")</td>";
//Check if the disease is malaria and if so, get the lab data and display it
if ($disease_data['Disease'] == 1) {
//Get malaria data
$lab_weekly_data = Lab_Weekly::getWeeklyLabData($year, $epiweek, $province_district['id']);
//Check if any data exists
if (isset($lab_weekly_data)) {
$bata_buffer .= "<td>" . $lab_weekly_data['Tested'] . "</td><td>" . $lab_weekly_data['Positive'] . "</td>";
} else {
$bata_buffer .= "<td>DNR</td><td>DNR</td>";
}
}
}
} else {
$total_diseases = count($disease_array);
$total_elements = $total_diseases + 1;
for ($x = 0; $x <= $total_elements; $x++) {
$bata_buffer .= "<td>DNR</td>";
}
//.........这里部分代码省略.........