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


PHP Location::getCityInfo方法代码示例

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


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

示例1: editAction

 public function editAction()
 {
     if (!$this->hasACL('edit_employee')) {
         $this->doNoAccessError();
     }
     $db = $this->dbfunc();
     $status = ValidationContainer::instance();
     $params = $this->getAllParams();
     $id = $params['id'];
     #// restricted access?? only show partners by organizers that we have the ACL to view
     #$org_allowed_ids = allowed_org_access_full_list($this);
     #if ($org_allowed_ids && $this->view->mode != 'add') { // doesnt have acl 'training_organizer_option_all'
     #	$validID = $db->fetchCol("SELECT partner.id FROM partner WHERE partner.id = $id AND partner.organizer_option_id in ($org_allowed_ids)"); // check for both
     #	if(empty($validID))
     #		$this->doNoAccessError ();
     #}
     if ($this->getRequest()->isPost()) {
         //validate then save
         $params['location_id'] = regionFiltersGetLastID('', $params);
         $params['dob'] = $this->_date_to_sql($params['dob']);
         $params['agreement_end_date'] = $this->_date_to_sql($params['agreement_end_date']);
         $params['transition_date'] = $this->_date_to_sql($params['transition_date']);
         $params['transition_complete_date'] = $this->_date_to_sql($params['transition_complete_date']);
         $params['site_id'] = $params['facilityInput'];
         $params['option_nationality_id'] = $params['lookup_nationalities_id'];
         $params['facility_type_option_id'] = $params['employee_site_type_option_id'];
         $status->checkRequired($this, 'first_name', t('Frist Name'));
         $status->checkRequired($this, 'last_name', t('Last Name'));
         $status->checkRequired($this, 'last_name', t('Name'));
         $status->checkRequired($this, 'dob', t('Name'));
         if ($this->setting('display_employee_nationality')) {
             $status->checkRequired($this, 'lookup_nationalities_id', t('Employee Nationality'));
         }
         $status->checkRequired($this, 'employee_qualification_option_id', t('Staff Cadre'));
         if ($this->setting('display_employee_salary')) {
             $status->checkRequired($this, 'salary', t('Salary'));
         }
         if ($this->setting('display_employee_benefits')) {
             $status->checkRequired($this, 'benefits', t('Benefits'));
         }
         if ($this->setting('display_employee_additional_expenses')) {
             $status->checkRequired($this, 'additional_expenses', t('Additional Expenses'));
         }
         if ($this->setting('display_employee_stipend')) {
             $status->checkRequired($this, 'stipend', t('Stipend'));
         }
         if ($this->setting('display_employee_partner')) {
             $status->checkRequired($this, 'partner_id', t('Partner'));
         }
         if ($this->setting('display_employee_sub_partner')) {
             $status->checkRequired($this, 'subpartner_id', t('Sub Partner'));
         }
         if ($this->setting('display_employee_intended_transition')) {
             $status->checkRequired($this, 'employee_transition_option_id', t('Intended Transition'));
         }
         if ($this->setting('display_employee_base') && !$params['employee_base_option_id'] || !$this->setting('display_employee_base')) {
             // either one is OK, javascript disables regions if base is on & has a value choice
             $status->checkRequired($this, 'province_id', t('Region A (Province)'));
         }
         if ($this->setting('display_employee_base')) {
             $status->checkRequired($this, 'employee_base_option_id', t('Employee Based at'));
         }
         if (!$status->hasError()) {
             $id = $this->_findOrCreateSaveGeneric('employee', $params);
             if (!$id) {
                 $status->setStatusMessage(t('That person could not be saved.'));
             } else {
                 # converted to optionlist, link table not needed TODO. marking for removal.
                 #MultiOptionList::updateOptions ( 'employee_to_role', 'employee_role_option', 'employee_id', $id, 'employee_role_option_id', $params['employee_role_option_id'] );
                 $status->setStatusMessage(t('The person was saved.'));
                 $this->_redirect("employee/edit/id/{$id}");
             }
         } else {
             $status->setStatusMessage(t('That person could not be saved.'));
         }
     }
     if ($id && !$status->hasError()) {
         // read data from db
         $sql = 'SELECT * FROM employee WHERE employee.id = ' . $id;
         $row = $db->fetchRow($sql);
         if ($row) {
             $params = $row;
         } else {
             $status->setStatusMessage(t('Error finding that record in the database.'));
         }
         $region_ids = Location::getCityInfo($params['location_id'], $this->setting('num_location_tiers'));
         $region_ids = Location::regionsToHash($region_ids);
         $params = array_merge($params, $region_ids);
         #$params['roles'] = $db->fetchCol("SELECT employee_role_option_id FROM employee_to_role WHERE employee_id = $id");
     }
     // assign form drop downs
     $params['dob'] = formhelperdate($params['dob']);
     $params['agreement_end_date'] = formhelperdate($params['agreement_end_date']);
     $params['transition_date'] = formhelperdate($params['transition_date']);
     $params['transition_complete_date'] = formhelperdate($params['transition_complete_date']);
     $params['courses'] = $this->getCourses($id);
     $params['lookup_nationalities_id'] = $params['option_nationality_id'];
     $params['employee_site_type_option_id'] = $params['facility_type_option_id'];
     $this->viewAssignEscaped('employee', $params);
     $validCHWids = $db->fetchCol("select id from employee_qualification_option qual\r\n\t\t\t\t\t\t\t\t\t\tinner join (select id as success from employee_qualification_option where qualification_phrase in ('Community Based Worker','Community Health Worker','NC02 -Community health workers')) parentIDs\r\n\t\t\t\t\t\t\t\t\t\ton (parentIDs.success = qual.id)");
//.........这里部分代码省略.........
开发者ID:falafflepotatoe,项目名称:trainsmart-code,代码行数:101,代码来源:EmployeeController.php

示例2: editAction

 public function editAction()
 {
     if (!$this->hasACL('edit_employee')) {
         $this->doNoAccessError();
     }
     $db = $this->dbfunc();
     $status = ValidationContainer::instance();
     $params = $this->getAllParams();
     $id = $params['id'];
     #// restricted access?? only show partners by organizers that we have the ACL to view // - removed 5/1/13, they dont want this, its used by site-rollup (datashare), and user-restrict by org.
     #$org_allowed_ids = allowed_org_access_full_list($this); // doesnt have acl 'training_organizer_option_all'
     #$site_orgs = allowed_organizer_in_this_site($this); // for sites to host multiple training organizers on one domain
     #$siteOrgsClause = $site_orgs ? " AND partner.organizer_option_id IN ($site_orgs)" : "";
     #if ($org_allowed_ids && $this->view->mode != 'add') {
     #	$validID = $db->fetchCol("SELECT partner.id FROM partner WHERE partner.id = $id AND partner.organizer_option_id in ($org_allowed_ids) $siteOrgsClause");
     #	if(empty($validID))
     #		$this->doNoAccessError ();
     #
     #}
     if ($this->getRequest()->isPost()) {
         //validate then save
         $status->checkRequired($this, 'partner', t('Partner'));
         if ($this->setting('display_partner_type')) {
             $status->checkRequired($this, 'partner_type_option_id', t('Type of Partner'));
         }
         $status->checkRequired($this, 'address1', t('Address 1'));
         $status->checkRequired($this, 'address2', t('Address 2'));
         $status->checkRequired($this, 'province_id', t('Region A (Province)'));
         $status->checkRequired($this, 'phone', t('Phone'));
         $status->checkRequired($this, 'fax', t('Fax'));
         if ($this->setting('display_employee_funder')) {
             $status->checkRequired($this, 'partner_funder_option_id[]', t('Funder'));
         }
         #$status->checkRequired ( $this, 'funding_end_date[]',             t ( 'Funding End Date' ) );
         #if ($this->setting('display_employee_intended_transition'))
         #	$status->checkRequired ( $this, 'employee_transition_option_id',  t ( 'Intended Transition' ) );
         if ($this->setting('display_employee_agreement_end_date')) {
             $status->checkRequired($this, 'agreement_end_date', t('Agreement End Date'));
         }
         if ($this->setting('display_employee_importance')) {
             $status->checkRequired($this, 'partner_importance_option_id', t('Importance'));
         }
         #$status->checkRequired ( $this, 'comments',                       t ( 'Partner Comments' ) );
         #$status->checkRequired ( $this, 'subpartner_id[]',                t ( 'Sub Partner' ) );
         $params['funding_end_date'] = $this->_array_me($params['funding_end_date']);
         foreach ($params['funding_end_date'] as $i => $value) {
             $params['funding_end_date'][$i] = $this->_date_to_sql($value);
         }
         $params['transition_confirmed'] = $params['transition_confirmed'] == 'on' ? 1 : 0;
         $params['agreement_end_date'] = $this->_date_to_sql($params['agreement_end_date']);
         $params['subpartner_id'] = $this->_array_me($params['subpartner_id']);
         foreach ($params['subpartner_id'] as $i => $value) {
             // strip empty values (it breaks MultiOptionList apparently)
             if (empty($value)) {
                 unset($params['subpartner_id'][$i]);
             }
         }
         //location save stuff
         $params['location_id'] = regionFiltersGetLastID(null, $params);
         // formprefix, criteria
         if ($params['city']) {
             $params['location_id'] = Location::insertIfNotFound($params['city'], $params['location_id'], $this->setting('num_location_tiers'));
         }
         if (!$status->hasError()) {
             $id = $this->_findOrCreateSaveGeneric('partner', $params);
             if (!$id) {
                 $status->setStatusMessage(t('That partner could not be saved.'));
             } else {
                 MultiOptionList::updateOptions('partner_to_funder', 'partner_funder_option', 'partner_id', $id, 'partner_funder_option_id', $params['partner_funder_option_id'], 'funder_end_date', $params['funding_end_date']);
                 $db->query("DELETE FROM partner_to_subpartner WHERE partner_id = {$id}");
                 // updateOptions is not clearing the old options, I dont know why... todo
                 MultiOptionList::updateOptions('partner_to_subpartner', 'partner', 'partner_id', $id, 'subpartner_id', $params['subpartner_id']);
                 $status->setStatusMessage(t('The partner was saved.'));
                 $this->_redirect("partner/edit/id/{$id}");
             }
         }
     }
     if ($id) {
         // read data from db
         #// restricted access?? only show partners by organizers that we have the ACL to view
         #$org_allowed_ids = allowed_org_access_full_list($this); // doesnt have acl 'training_organizer_option_all'
         #$orgWhere = ($org_allowed_ids) ? " AND partner.organizer_option_id in ($org_allowed_ids) " : "";
         #// restricted access?? only show organizers that belong to this site if its a multi org site
         #$site_orgs = allowed_organizer_in_this_site($this); // for sites to host multiple training organizers on one domain
         #$allowedWhereClause .= $site_orgs ? " AND partner.organizer_option_id in ($site_orgs) " : "";
         // continue reading data
         $sql = 'SELECT * FROM partner WHERE id = ' . $id . space . $orgWhere;
         $row = $db->fetchRow($sql);
         if (!$row) {
             $status->setStatusMessage(t('Error finding that record in the database.'));
         } else {
             $params = $row;
             // reassign form data
             $region_ids = Location::getCityInfo($params['location_id'], $this->setting('num_location_tiers'));
             $params['city'] = $region_ids[0];
             $region_ids = Location::regionsToHash($region_ids);
             $params = array_merge($params, $region_ids);
             //get linked table data from option tables
             $sql = "SELECT partner_funder_option_id,funder_end_date FROM partner_to_funder WHERE partner_id = {$id}";
             $params['funder'] = $db->fetchAll($sql);
//.........这里部分代码省略.........
开发者ID:falafflepotatoe,项目名称:trainsmart-code,代码行数:101,代码来源:PartnerController.php

示例3: personsAction

 public function personsAction()
 {
     try {
         require_once 'models/table/Person.php';
         $personTable = new Person();
         $select = $personTable->select()->from('person', array('*'))->setIntegrityCheck(false);
         $rowRay = $personTable->fetchAll($select);
         $rowRay = @$rowRay->toArray();
         //sort by id
         $sorted = array();
         foreach ($rowRay as $row) {
             unset($row['suffix_option_id']);
             unset($row['title_option_id']);
             $sorted[$row['id']] = $row;
         }
         /*
         $sorted = $personTable->_fill_lookup($sorted, 'location_city', 'home_city_id', 'city_name');
         $sorted = $personTable->_fill_lookup($sorted, 'location_district', 'home_district_id', 'district_name');
         $sorted = $personTable->_fill_lookup($sorted, 'location_province', 'home_province_id', 'province_name');
         */
         $locations = Location::getAll();
         foreach ($sorted as $id => $row) {
             $city_info = Location::getCityInfo($row['home_location_id'], $this->setting('num_location_tiers'), $locations);
             if (count($city_info)) {
                 if ($city_info[0]) {
                     $sorted[$id]['city_name'] = $city_info[0];
                 }
                 if ($city_info[1]) {
                     $sorted[$id]['province_name'] = $locations[$city_info[1]]['name'];
                 }
                 if ($city_info[2]) {
                     $sorted[$id]['district_name'] = $locations[$city_info[2]]['name'];
                 }
                 if ($city_info[3]) {
                     $sorted[$id]['region_c_name'] = $locations[$city_info[3]]['name'];
                 }
                 if ($city_info[4]) {
                     $sorted[$id]['region_d_name'] = $locations[$city_info[4]]['name'];
                 }
                 if ($city_info[5]) {
                     $sorted[$id]['region_e_name'] = $locations[$city_info[5]]['name'];
                 }
                 if ($city_info[6]) {
                     $sorted[$id]['region_f_name'] = $locations[$city_info[6]]['name'];
                 }
                 if ($city_info[7]) {
                     $sorted[$id]['region_g_name'] = $locations[$city_info[7]]['name'];
                 }
                 if ($city_info[8]) {
                     $sorted[$id]['region_h_name'] = $locations[$city_info[8]]['name'];
                 }
                 if ($city_info[9]) {
                     $sorted[$id]['region_i_name'] = $locations[$city_info[9]]['name'];
                 }
             }
             unset($sorted[$id]['home_location_id']);
         }
         $sorted = $personTable->_fill_lookup($sorted, 'person_qualification_option', 'primary_qualification_option_id', 'qualification_phrase');
         $sorted = $personTable->_fill_lookup($sorted, 'person_primary_responsibility_option', 'primary_responsibility_option_id', 'responsibility_phrase');
         $sorted = $personTable->_fill_lookup($sorted, 'person_secondary_responsibility_option', 'secondary_responsibility_option_id', 'responsibility_phrase');
         $sorted = $personTable->_fill_lookup($sorted, 'person_custom_1_option', 'person_custom_1_option_id', 'custom1_phrase');
         $sorted = $personTable->_fill_lookup($sorted, 'person_custom_2_option', 'person_custom_2_option_id', 'custom2_phrase');
         $sorted = $personTable->_fill_lookup($sorted, 'facility', 'facility_id', 'facility_name');
         //fill participants
         $select = $personTable->select()->from('person', array('id'))->setIntegrityCheck(false)->join(array('pt' => 'person_to_training'), "pt.person_id = person.id", array('training_id'))->join(array('t' => 'training'), "pt.training_id = t.id", array())->join(array('tt' => 'training_title_option'), "t.training_title_option_id = tt.id", array('training_title_phrase'));
         $rows = $personTable->fetchAll($select);
         foreach ($rows as $row) {
             $pid = $row->id;
             $ra = $row->toArray();
             unset($ra['id']);
             $sorted[$pid]['courses'][] = $ra;
         }
         //fill trainers
         $select = $personTable->select()->from('trainer', array('person_id'))->setIntegrityCheck(false)->join(array('pt' => 'training_to_trainer'), "pt.trainer_id = trainer.person_id", array('training_id'))->join(array('t' => 'training'), "pt.training_id = t.id", array())->join(array('tt' => 'training_title_option'), "t.training_title_option_id = tt.id", array('training_title_phrase'));
         $rows = $personTable->fetchAll($select);
         foreach ($rows as $row) {
             $pid = $row->person_id;
             $ra = $row->toArray();
             unset($ra['person_id']);
             $sorted[$pid]['trained'][] = $ra;
         }
         if ($this->getSanParam('outputType') == 'csv') {
             $this->sendData($this->reportHeaders(false, $sorted));
         }
         $this->view->assign('data', $sorted);
     } catch (Exception $e) {
         echo $e->getMessage() . "<br>" . PHP_EOL;
     }
 }
开发者ID:falafflepotatoe,项目名称:trainsmart-code,代码行数:89,代码来源:DataController.php

示例4: viewlocationAction

 function viewlocationAction()
 {
     if (!$this->hasACL('edit_course')) {
         $this->view->assign('viewonly', 'disabled="disabled"');
     }
     require_once 'models/table/TrainingLocation.php';
     $this->view->assign('id', $this->_getParam('id'));
     if ($this->_getParam('id')) {
         require_once 'views/helpers/DropDown.php';
         $rowLocation = TrainingLocation::selectLocation($this->_getParam('id'))->toArray();
         //locations
         list($cname, $prov, $dist, $regc) = Location::getCityInfo($rowLocation['location_id'], $this->setting('num_location_tiers'));
         $rowLocation['city_name'] = $cname;
         $rowLocation['region_c_id'] = $regc;
         $rowLocation['district_id'] = $dist;
         $rowLocation['province_id'] = $prov;
         $this->viewAssignEscaped('rowLocation', $rowLocation);
         //see if it is referenced anywhere
         $this->view->assign('okToDelete', !TrainingLocation::isReferenced($this->_getParam('id')));
     }
     // location drop-down
     $locations = TrainingLocation::selectAllLocations($this->setting('num_location_tiers'));
     $this->viewAssignEscaped('tlocations', $locations);
 }
开发者ID:falafflepotatoe,项目名称:trainsmart-code,代码行数:24,代码来源:PsfacilityController.php

示例5: rosterAction

 /**
  * Training Roster
  */
 public function rosterAction()
 {
     $training_id = $this->_getParam('id');
     $this->view->assign('url', Settings::$COUNTRY_BASE_URL . "/training/roster/id/{$training_id}");
     $tableObj = new Training();
     $rowRay = $tableObj->getTrainingInfo($training_id);
     // calculate end date
     switch ($rowRay['training_length_interval']) {
         case 'week':
             $days = $rowRay['training_length_value'] * 7;
             break;
         case 'day':
             $days = $rowRay['training_length_value'] - 1;
             // start day counts as a day?
             break;
         default:
             $days = false;
             break;
     }
     if ($days) {
         $rowRay['training_end_date'] = strtotime("+{$days} day", strtotime($rowRay['training_start_date']));
         $rowRay['training_end_date'] = date('Y-m-d', $rowRay['training_end_date']);
     } else {
         $rowRay['training_end_date'] = $rowRay['training_start_date'];
     }
     $rowRay['duration'] = $rowRay['training_length_value'] . ' ' . $rowRay['training_length_interval'] . ($rowRay['training_length_value'] == 1 ? "" : "s");
     $this->viewAssignEscaped('row', $rowRay);
     // trainer/person tables
     require_once 'views/helpers/EditTableHelper.php';
     /* Trainers */
     $trainers = TrainingToTrainer::getTrainers($training_id)->toArray();
     $trainerFields = array('last_name' => $this->tr('Last Name'), 'first_name' => $this->tr('First Name'), 'duration_days' => t('Days'));
     $colStatic = array_keys($trainerFields);
     // all
     $editLinkInfo = array('disabled' => 1);
     // no edit/remove links
     $html = EditTableHelper::generateHtmlTraining('Trainer', $trainers, $trainerFields, $colStatic, array(), $editLinkInfo);
     $this->view->assign('tableTrainers', $html);
     /* Participants */
     $persons = PersonToTraining::getParticipants($training_id)->toArray();
     $personsFields = array('last_name' => $this->tr('Last Name'), 'first_name' => $this->tr('First Name'));
     if ($this->setting('module_attendance_enabled')) {
         if (strtotime($rowRay['training_start_date']) < time()) {
             $personsFields = array_merge($personsFields, array('duration_days' => t('Days')));
             // already had class(es) - show the days attended
         }
         $personsFields['award_phrase'] = $this->tr('Complete');
     }
     $personsFields = array_merge($personsFields, array('birthdate' => t('Date of Birth'), 'facility_name' => t('Facility')));
     if ($this->setting('display_viewing_location')) {
         $personsFields['location_phrase'] = $this->tr('Viewing Location');
     }
     if ($this->setting('display_budget_code')) {
         $personsFields['budget_code_phrase'] = $this->tr('Budget Code');
     }
     //if ($this->setting ( 'display_region_b' ))
     $personsFields['location_name'] = t('Location');
     //add location
     $locations = Location::getAll();
     foreach ($persons as $pid => $person) {
         $region_ids = Location::getCityInfo($person['location_id'], $this->setting('num_location_tiers'));
         $ordered_l = array($region_ids['cityname']);
         foreach ($region_ids as $key => $value) {
             if (!empty($value) && isset($locations[$value]['name'])) {
                 $ordered_l[] = $locations[$value]['name'];
             } else {
                 break;
             }
         }
         $persons[$pid]['location_name'] = implode(', ', $ordered_l);
     }
     $colStatic = array_keys($personsFields);
     // all
     $editLinkInfo = array('disabled' => 1);
     // no edit/remove links
     $html = EditTableHelper::generateHtmlTraining('Persons', $persons, $personsFields, $colStatic, array(), $editLinkInfo);
     $this->view->assign('tablePersons', $html);
     if ($this->_getParam('outputType') && $this->_getParam('trainers')) {
         $this->sendData($trainers);
     }
     if ($this->_getParam('outputType') && $this->_getParam('persons')) {
         $this->sendData($persons);
     }
 }
开发者ID:falafflepotatoe,项目名称:trainsmart-code,代码行数:87,代码来源:TrainingController.php

示例6: _attach_locations

 private function _attach_locations($rowArray)
 {
     if ($rowArray) {
         $num_tiers = $this->setting('num_location_tiers');
         $locations = Location::getAll();
         foreach ($rowArray as $id => $row) {
             $region_ids = Location::getCityInfo($row['location_id'], $num_tiers);
             //todo rUserious? ::getcityinfo is such an expensive call(I think), it loads the entire Location table every call... todo investigate
             $rowArray[$id]['province_name'] = $locations[$region_ids['province_id']]['name'];
             $rowArray[$id]['district_name'] = $locations[$region_ids['district_id']]['name'];
             $rowArray[$id]['region_c_name'] = $locations[$region_ids['region_c_id']]['name'];
             $rowArray[$id]['region_d_name'] = $locations[$region_ids['region_d_id']]['name'];
             $rowArray[$id]['region_e_name'] = $locations[$region_ids['region_e_id']]['name'];
             $rowArray[$id]['region_f_name'] = $locations[$region_ids['region_f_id']]['name'];
             $rowArray[$id]['region_g_name'] = $locations[$region_ids['region_g_id']]['name'];
             $rowArray[$id]['region_h_name'] = $locations[$region_ids['region_h_id']]['name'];
             $rowArray[$id]['region_i_name'] = $locations[$region_ids['region_i_id']]['name'];
         }
     }
     return $rowArray;
 }
开发者ID:falafflepotatoe,项目名称:trainsmart-code,代码行数:21,代码来源:PersonController.php

示例7: psFacilityReportAction


//.........这里部分代码省略.........
             $query .= " WHERE " . implode(" AND ", $where);
         }
         if (count($sort) > 0) {
             $query .= " ORDER BY " . implode(", ", $sort);
         }
         //echo $query . "<br>";
         $rows = $db->fetchAll($query);
         $regions = array();
         #			var_dump ($rows);
         // Filtering by locations
         if ($region_c_id != "" || $district_id != "" || $province_id != "") {
             $__rows = array();
             if ($region_c_id != "") {
                 // 3 levels selected. Going with this one first
                 $regions = explode("_", $region_c_id[0]);
             } elseif ($district_id != "") {
                 // 2 levels selected
                 $regions = explode("_", $district_id[0]);
             } elseif ($province_id != "") {
                 // 1 level selected
                 $regions = explode("_", $province_id[0]);
             }
             // Include headers once
             if ($showProvince) {
                 $headers[] = @$translation['Region A (Province)'];
             }
             if ($showDistrict) {
                 $headers[] = @$translation['Region B (Health District)'];
             }
             if ($showRegionC) {
                 $headers[] = @$translation['Region C (Local Region)'];
             }
             foreach ($rows as $row) {
                 list($cname, $prov, $dist, $regc) = Location::getCityInfo($row['location_id'], $this->setting('num_location_tiers'));
                 if ($showProvince) {
                     $loc = $locations[$prov];
                     $row[@$translation['Region A (Province)']] = $loc['name'];
                 }
                 if ($showDistrict) {
                     $loc = $locations[$dist];
                     $row[@$translation['Region B (Health District)']] = $loc['name'];
                 }
                 if ($showRegionC) {
                     $loc = $locations[$regc];
                     $row[@$translation['Region C (Local Region)']] = $loc['name'];
                 }
                 unset($row['location_id']);
                 $userow = true;
                 if (count($regions) > 0) {
                     switch (count($regions)) {
                         case 1:
                             // Selected province
                             if ($prov != $regions[0]) {
                                 $userow = false;
                             }
                             break;
                         case 2:
                             // Selected province, district
                             if ($prov != $regions[0] || $dist != $regions[1]) {
                                 $userow = false;
                             }
                             break;
                         case 3:
                             // Selected province, district, regionc
                             if ($prov != $regions[0] || $dist != $regions[1] || $regc != $regions[2]) {
                                 $userow = false;
开发者ID:falafflepotatoe,项目名称:trainsmart-code,代码行数:67,代码来源:ReportsController.php

示例8: viewlocationAction

 function viewlocationAction()
 {
     if (!$this->hasACL('edit_course')) {
         $this->view->assign('viewonly', 'disabled="disabled"');
     }
     require_once 'models/table/TrainingLocation.php';
     $this->view->assign('id', $this->_getParam('id'));
     if ($this->_getParam('id')) {
         require_once 'views/helpers/DropDown.php';
         $rowLocation = TrainingLocation::selectLocation($this->_getParam('id'))->toArray();
         //locations
         $this->viewAssignEscaped('locations', Location::getAll());
         $region_ids = Location::getCityInfo($rowLocation['location_id'], $this->setting('num_location_tiers'));
         $rowLocation['city_name'] = $region_ids[0];
         $region_ids = Location::regionsToHash($region_ids);
         $rowLocation = array_merge($rowLocation, $region_ids);
         $this->viewAssignEscaped('rowLocation', $rowLocation);
         //see if it is referenced anywhere
         $this->view->assign('okToDelete', !TrainingLocation::isReferenced($this->_getParam('id')));
     }
     // location drop-down
     $locations = TrainingLocation::selectAllLocations($this->setting('num_location_tiers'));
     $this->viewAssignEscaped('tlocations', $locations);
 }
开发者ID:falafflepotatoe,项目名称:trainsmart-code,代码行数:24,代码来源:FacilityController.php


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