本文整理汇总了PHP中company::can_manage_department方法的典型用法代码示例。如果您正苦于以下问题:PHP company::can_manage_department方法的具体用法?PHP company::can_manage_department怎么用?PHP company::can_manage_department使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类company
的用法示例。
在下文中一共展示了company::can_manage_department方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_string
}
echo get_string('departmentnoselect', 'block_iomad_company_admin');
$mform->display();
echo $OUTPUT->footer();
die;
}
}
}
}
} else {
if ($createdata = $editform->get_data()) {
// Create or update the department.
if ($deptid && !$createdata->chosenid) {
$departmentid = $deptid;
}
if (!company::can_manage_department($departmentid)) {
print_error("notallowedtoedit", 'block_iomad_company_admin');
}
if (!$createdata->chosenid) {
// We are creating a new department.
company::create_department($createdata->chosenid, $companyid, $createdata->fullname, $createdata->shortname, $departmentid, 2);
} else {
// We are editing a current department.
company::create_department($createdata->departmentid, $companyid, $createdata->fullname, $createdata->shortname, 0);
}
$mform = new department_display_form($PAGE->url, $companyid, $departmentid);
// Redisplay the form.
$blockpage->display_header();
// Check the department is valid.
if (!empty($departmentid) && !company::check_valid_department($companyid, $departmentid)) {
print_error('invaliddepartment', 'block_iomad_company_admin');
示例2: print_error
if (!empty($departmentid) && !company::check_valid_department($companyid, $departmentid)) {
print_error('invalidlocation', 'block_iomad_company_admin');
}
echo get_string('locationnoselect', 'block_iomad_company_admin');
$mform->display();
echo $OUTPUT->footer();
die;
}
}
}
}
} else {
if ($createdata = $editform->get_data()) {
// Create or update the department.
$locationid = $createdata->chosenid ? $createdata->chosenid : $createdata->departmentid;
if (!company::can_manage_department($locationid)) {
print_error("notallowedtoedit", 'block_iomad_company_admin');
}
if (!$createdata->chosenid) {
// We are creating a new department.
company::create_department($createdata->chosenid, $companyid, $createdata->fullname, $createdata->shortname, $departmentid, 1);
} else {
// We are editing a current department.
company::create_department($createdata->departmentid, $companyid, $createdata->fullname, $createdata->shortname, $departmentid, 1);
}
$mform = new location_display_form($PAGE->url, $companyid, $departmentid);
// Redisplay the form.
$blockpage->display_header();
// Check the department is valid.
if (!empty($departmentid) && !company::check_valid_department($companyid, $departmentid)) {
print_error('invalidlocation', 'block_iomad_company_admin');
示例3: 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);
}
$notcompanymanager = 0;
if ($this->departmentid != $parentnode->id) {
$regionlist = company::get_my_region($this->departmentid);
$notcompanymanager = 1;
} else {
$regionlist = company::get_all_regions($company->id);
}
//print_object($regionlist);
//die;
$companieslist = company::get_companies_select();
// Then show the fields about where this block appears.
$mform->addElement('header', 'header', get_string('companyregion', 'block_iomad_company_admin'));
//GWL : Remove Company Name
//$mform->addElement('select', 'deptid', get_string('company', 'block_iomad_company_admin'), $companieslist);
// $mform->addElement('html', $subdepartmenthtml);
$regionlisthtml = '';
if (!empty($regionlist)) {
$regionlisthtml = "<p>" . get_string('regions', 'block_iomad_company_admin') . "</p>";
$regioncount = 0;
if (!$notcompanymanager) {
$regionlisthtml = "<div class='locationlist_container checkboxcontainer'>";
foreach ($regionlist as $region) {
$regioncount++;
$regionlisthtml .= '<input type = "checkbox" name = "regionids[]" value="' . $region->id . '" /> ' . $region->name . '</br>';
}
} else {
$regionlisthtml .= '<input type = "checkbox" name = "regionids[]" value="' . $regionlist->id . '" /> ' . $regionlist->name . '</br>';
}
$regionlisthtml .= '</div>';
if ($this->departmentid == $parentnode->id && $regioncount > 1) {
$regionlisthtml .= '<p><br/><input type="checkbox" id="selectallcheckbox" />Select all / Deselect All</p>';
}
} else {
if (!company::can_manage_department($parentnode->id)) {
echo $OUTPUT->header();
echo $OUTPUT->notification(get_string('notaccessregion', 'block_iomad_company_admin'));
echo $OUTPUT->footer();
die;
}
}
$mform->addElement('html', $regionlisthtml);
$buttonarray = array();
if ($this->departmentid == $parentnode->id) {
$buttonarray[] = $mform->createElement('submit', 'create', get_string('createregion', 'block_iomad_company_admin'));
}
if (!empty($regionlist)) {
$buttonarray[] = $mform->createElement('submit', 'edit', get_string('editregions', 'block_iomad_company_admin'), array('class' => 'editdepart'));
if ($this->departmentid == $parentnode->id) {
$buttonarray[] = $mform->createElement('submit', 'delete', get_string('deleteregion', 'block_iomad_company_admin'));
}
}
$mform->addGroup($buttonarray, '', array(' '), ' ', false);
}