$params['departmentid'] = $departmentid; } $systemcontext = context_system::instance(); require_login(); // Correct the navbar. // Set the name for the page. $linktext = get_string('edit_users_title', 'block_iomad_company_admin'); // 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;
} } // Correct the navbar. // Set the name for the page. $linktext = get_string('course_list_title', 'block_iomad_commerce'); // Set the url. $linkurl = new moodle_url('/blocks/iomad_commerce/courselist.php'); // Build the nav bar. company_admin_fix_breadcrumb($PAGE, $linktext, $linkurl); $title = 'edit_course_shopsettings'; if ($isadding) { $title = 'addnewcourse'; } $PAGE->navbar->add(get_string($title, 'block_iomad_commerce')); $blockpage = new blockpage($PAGE, $OUTPUT, 'iomad_commerce', 'block', $title); $blockpage->setup($urlparams); require_login(null, false); // Adds to $PAGE, creates $OUTPUT. /* next line copied from /course/edit.php */ $editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $CFG->maxbytes, 'trusttext' => false, 'noclean' => true); $mform = new course_edit_form($PAGE->url, $isadding, $shopsettingsid, $course, $priceblocks, $editoroptions); $mform->set_data($shopsettings); if ($mform->is_cancelled()) { redirect($companylist); } else { if ($data = $mform->get_data()) { $data->userid = $USER->id; $transaction = $DB->start_delegated_transaction(); if ($isadding) { $shopsettingsid = $DB->insert_record('course_shopsettings', $data); } else {