$companyid = iomad::get_my_companyid($context); // Work out department level. $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()) || !empty($SESSION->currenteditingcompany)) { $userhierarchylevel = $parentlevel->id; } else { $userlevel = company::get_userlevel($USER); $userhierarchylevel = $userlevel->id; } if ($departmentid == 0) { $departmentid = $userhierarchylevel; } // Get the company additional optional user parameter names. $foundobj = iomad::add_user_filter_params($params, $companyid); $idlist = $foundobj->idlist; $foundfields = $foundobj->foundfields; // Set the url. //company_admin_fix_breadcrumb($PAGE, $strcompletion, $url); require_once $CFG->libdir . '/adminlib.php'; /*GWL : Add condition to provide access for Site admin*/ if (!has_capability('block/iomad_company_admin:manageallcompany', context_system::instance())) { admin_externalpage_setup('completionreportsettings'); } /*GWL : Add condition to provide access for Site admin*/ // Get the appropriate list of departments. $selectparams = $params; $selectparams['courseid'] = 0; $selecturl = new moodle_url('/local/report_completion/index.php', $selectparams); $subhierarchieslist = company::get_all_subdepartments($userhierarchylevel);