本文整理汇总了PHP中company::get_all_locations方法的典型用法代码示例。如果您正苦于以下问题:PHP company::get_all_locations方法的具体用法?PHP company::get_all_locations怎么用?PHP company::get_all_locations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类company
的用法示例。
在下文中一共展示了company::get_all_locations方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: definition
public function definition()
{
global $CFG, $OUTPUT;
$mform =& $this->_form;
$company = new company($this->selectedcompany);
if (!($parentnode = company::get_company_parentnode($company->id))) {
// Company has not been set up, possibly from before an upgrade.
company::initialise_departments($company->id);
}
$regionlistarr = array('' => get_string('choose'));
if ($this->departmentid != $parentnode->id) {
$regionlist = company::get_my_region($this->departmentid);
if ($regionlist) {
$regionlistarr[$regionlist->id] = $regionlist->name;
}
} else {
$regionlist = company::get_all_regions($company->id);
foreach ($regionlist as $region) {
$regionlistarr[$region->id] = $region->name;
}
}
/* if(!$regionlist){
print_error("invalidaccess","block_iomad_admin");
}
*/
$department = '';
$subdepartmenthtml = "<div class='locationlist_container checkboxcontainer'>";
// echo "Region id" . $this->regionid;
$departments = '';
if (!$regionlist || $this->regionid) {
$regionid = $this->regionid ? $this->regionid : $this->departmentid;
if ($this->regionid) {
$departments = company::get_all_locations($regionid);
} else {
$departments[] = company::get_departmentbyid($regionid);
}
$subdepartmenthtml .= "<p>" . get_string('locations', 'block_iomad_company_admin') . "</p>";
$locationcount = 0;
foreach ($departments as $department) {
if ($department && $department->level == 1) {
// check foe the location
// Create the sub department checkboxes html.
$locationcount++;
$subdepartmenthtml .= '<input type = "checkbox" name = "locationids[]" value="' . $department->id . '" /> ' . $department->name . '</br>';
//if ($this->departmentid == $parentnode->id) {
//}
}
}
if ($departments && $locationcount > 1) {
$subdepartmenthtml .= '<p><br/><input type="checkbox" id="selectallcheckbox" />Select all / Deselect All</p>';
}
/* } else if ($this->departmentid != $parentnode->id) {
echo $OUTPUT->header();
echo $OUTPUT->notification(get_string('noaccesslocation', 'block_iomad_company_admin'));
echo $OUTPUT->footer();
die;
} */
// echo $subdepartmenthtml;
}
$subdepartmenthtml .= '</div>';
// Then show the fields about where this block appears.
$mform->addElement('header', 'header', get_string('companylocation', 'block_iomad_company_admin'));
//GWL : Remove Company Name
//$mform->addElement('html',$subdepartmenthtml);
$mform->addElement('hidden', 'departmentid', $this->departmentid);
$mform->setType('departmentid', PARAM_INT);
$attr = array('class' => 'editdepart');
$attr1 = array();
if ($regionlist) {
$mform->addElement('select', 'deptid', get_string('region', 'block_iomad_company_admin'), $regionlistarr, array('class' => 'region_select'));
if ($this->regionid) {
$mform->setDefault('deptid', $this->regionid);
}
$mform->addRule('deptid', get_string('regionnotselect', 'block_iomad_company_admin'), 'required', null, 'client');
// $attr['disabled'] = 'disabled';
// $attr1['disabled'] = 'disabled';
} else {
if ($this->departmentid != $parentnode->id) {
//$attr1['disabled'] = 'disabled';
}
}
if (!$departments) {
$attr['disabled'] = 'disabled';
$attr1['disabled'] = 'disabled';
}
$mform->addElement('html', $subdepartmenthtml);
$buttonarray = array();
if ($this->departmentid == $parentnode->id || $regionlist) {
$buttonarray[] = $mform->createElement('submit', 'create', get_string('createlocation', 'block_iomad_company_admin'), array('class' => 'checkboxcontainer'));
}
//if (!empty($subdepartmentslist)) {
$buttonarray[] = $mform->createElement('submit', 'edit', get_string('editlocations', 'block_iomad_company_admin'), $attr);
$buttonarray[] = $mform->createElement('submit', 'delete', get_string('deletelocation', 'block_iomad_company_admin'), $attr1);
// }
$mform->addGroup($buttonarray, '', array(' '), ' ', false);
}
示例2: definition
public function definition()
{
global $CFG, $DB;
$mform =& $this->_form;
// Then show the fields about where this block appears.
$mform->addElement('header', 'header', get_string('companyuser', 'block_iomad_company_admin'));
$mform->addElement('hidden', 'companyid', $this->selectedcompany);
$mform->setType('companyid', PARAM_INT);
// Code added by sumit
$mform->addElement('hidden', 'returnurl', $this->returnurl);
$mform->setType('returnurl', PARAM_LOCALURL);
// end of code
/* copied from /user/editlib.php */
$strrequired = get_string('required');
$mform->addElement('hidden', 'id', $this->userid);
$mform->setType('id', PARAM_INT);
// Deal with the name order sorting and required fields.
$necessarynames = useredit_get_required_name_fields();
foreach ($necessarynames as $necessaryname) {
$mform->addElement('text', $necessaryname, get_string($necessaryname), 'maxlength="100" size="30"');
$mform->addRule($necessaryname, $strrequired, 'required', null, 'client');
$mform->setType($necessaryname, PARAM_NOTAGS);
}
// Do not show email field if change confirmation is pending.
if (!empty($CFG->emailchangeconfirmation) and !empty($user->preference_newemail)) {
$notice = get_string('auth_emailchangepending', 'auth_email', $user);
$notice .= '<br /><a href="edit.php?cancelemailchange=1&id=' . $user->id . '">' . get_string('auth_emailchangecancel', 'auth_email') . '</a>';
$mform->addElement('static', 'emailpending', get_string('email'), $notice);
} else {
$mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"');
$mform->addRule('email', $strrequired, 'required', null, 'client');
$mform->setType('email', PARAM_EMAIL);
}
/* GWL : Add Field for Username while edit the user */
$mform->addElement('text', 'username', get_string('phone'), 'size="20"');
// GWL : Change get_string('username') to 'phone'
$mform->addRule('username', $strrequired, 'required', null, 'client');
$mform->setType('username', PARAM_RAW);
/* GWL : Add Field for Username while edit the user */
/* /copied from /user/editlib.php */
$mform->addElement('static', 'blankline', '', '');
if (!empty($CFG->passwordpolicy)) {
$mform->addElement('static', 'passwordpolicyinfo', '', print_password_policy());
}
$mform->addElement('passwordunmask', 'newpassword', get_string('newpassword'), 'size="20"');
$mform->addHelpButton('newpassword', 'newpassword');
$mform->setType('newpassword', PARAM_RAW);
$mform->addElement('static', 'generatepassword', '', get_string('leavepasswordemptytogenerate', 'block_iomad_company_admin'));
$mform->addElement('advcheckbox', 'preference_auth_forcepasswordchange', get_string('forcepasswordchange'));
$mform->addHelpButton('preference_auth_forcepasswordchange', 'forcepasswordchange');
// $mform->setDefault('preference_auth_forcepasswordchange', 1);
$mform->addElement('selectyesno', 'sendnewpasswordemails', get_string('sendnewpasswordemails', 'block_iomad_company_admin'));
$mform->setDefault('sendnewpasswordemails', 1);
$mform->disabledIf('sendnewpasswordemails', 'newpassword', 'eq', '');
// Deal with company optional fields.
$mform->addElement('header', 'category_id', format_string(get_string('companyprofilefields', 'block_iomad_company_admin')));
// Department drop down.
// $mform->addElement('select', 'userdepartment', get_string('department', 'block_iomad_company_admin'), $this->subhierarchieslist, $this->userdepartment);
// Add in company/department manager checkboxes.
$departmentlist = company_department::get_department_list($this->selectedcompany);
$titlelist = company_title::get_title_list($this->selectedcompany);
if ($departmentlist) {
$mform->addElement('select', 'userdepartment', get_string('department', 'block_iomad_company_admin'), $departmentlist);
}
if ($titlelist) {
$mform->addElement('select', 'usertitle', get_string('title', 'local_manage_company_dept_title'), $titlelist);
}
$managerarray = array();
if (iomad::has_capability('block/iomad_company_admin:assign_department_manager', context_system::instance())) {
$managerarray['0'] = get_string('user', 'block_iomad_company_admin');
$managerarray['2'] = get_string('regionlocationmanager', 'block_iomad_company_admin');
}
if (iomad::has_capability('block/iomad_company_admin:assign_company_manager', context_system::instance())) {
if (empty($managearray)) {
$managerarray['0'] = get_string('user', 'block_iomad_company_admin');
}
$managerarray['1'] = get_string('companymanager', 'block_iomad_company_admin');
$managerarray['3'] = get_string('companyinstructor', 'block_iomad_company_admin');
//GWL : Add Instructor
}
if (!empty($managerarray)) {
$mform->addElement('select', 'managertype', get_string('managertype', 'block_iomad_company_admin'), $managerarray, 0);
$mform->addHelpButton('managertype', 'managertype', 'block_iomad_company_admin');
} else {
$mform->addElement('hidden', 'managertype', 0);
}
// get region list
$regionslistobj = company::get_all_regions($this->selectedcompany);
$regionlist = array('' => get_string('regionnotselect', 'block_iomad_company_admin'));
foreach ($regionslistobj as $region) {
$regionlist[$region->id] = $region->name;
}
// Code added by sumit display region and location drop downs list
$locationlist = array('' => get_string('choose'));
if (!empty($this->regionid)) {
$locationlistarr = company::get_all_locations($this->regionid);
foreach ($locationlistarr as $location) {
$locationlist[$location->id] = $location->name;
}
}
//.........这里部分代码省略.........
示例3: required_param
$resulttype = required_param('resulttype', PARAM_INT);
require_login();
$PAGE->set_context($context);
if (!empty($SESSION->currenteditingcompany)) {
$companyid = $SESSION->currenteditingcompany;
} else {
if (company_user::is_company_user()) {
$companyid = company_user::companyid();
}
}
$company = new company($companyid);
if (!empty($region) && !company::check_valid_department($company->id, $region)) {
print_error('invalidregion', 'block_iomad_company_admin');
}
//iomad::require_capability('block/iomad_company_admin:edit_departments', $context);
$locationlist = company::get_all_locations($region);
$regiondropdownhtml = '<option value="">' . get_string('choose') . '</option>';
$regionlisthtml = '';
$enablebutton = 0;
if (!empty($locationlist)) {
$regionlisthtml = "<p>" . get_string('locations', 'block_iomad_company_admin') . "</p>";
$locationcount = 0;
foreach ($locationlist as $location) {
$locationcount++;
if ($resulttype === 1) {
// Return the checkbox list of locations
$regionlisthtml .= '<input type = "checkbox" name = "locationids[]" value="' . $location->id . '" /> ' . $location->name . '</br>';
} else {
if ($resulttype === 2) {
// Return drop down values for locations
$enablebutton = 1;