// Set the url. $linkurl = new moodle_url('/blocks/iomad_company_admin/editusers.php'); // Build the nav bar. //company_admin_fix_breadcrumb($PAGE, $linktext, $linkurl); require_once $CFG->libdir . '/adminlib.php'; admin_externalpage_setup('managecompanyusersetting'); // Print the page header. $blockpage = new blockpage($PAGE, $OUTPUT, 'iomad_company_admin', 'block', 'company_edit_users_title'); $blockpage->setup(); // Set the companyid $companyid = iomad::get_my_companyid($systemcontext); require_login(null, false); // Adds to $PAGE, creates $OUTPUT. $baseurl = new moodle_url(basename(__FILE__), $params); $returnurl = $baseurl; $blockpage->display_header(); // GWL : Check the department is valid. if (!empty($departmentid) && !company::check_valid_department($companyid, $departmentid)) { print_error('invaliddepartment', 'block_iomad_company_admin'); } // Get the associated department id. $company = new company($companyid); $parentlevel = company::get_company_parentnode($company->id); $companydepartment = $parentlevel->id; if (iomad::has_capability('block/iomad_company_admin:edit_all_departments', context_system::instance())) { $userhierarchylevel = $parentlevel->id; } else { $userlevel = company::get_userlevel($USER); $userhierarchylevel = $userlevel->id; } if ($departmentid == 0) {