$PAGE->navbar->add($strcategories); $PAGE->set_title("{$site->shortname}: {$strcategories}"); $PAGE->set_heading($COURSE->fullname); //$PAGE->set_button(update_category_button()); echo $OUTPUT->header(); echo $OUTPUT->heading($strcategories); echo $OUTPUT->skip_link_target(); echo $OUTPUT->box_start('categorybox'); print_whole_category_list_aceptar_solicitud(); echo $OUTPUT->box_end(); print_course_search(); } else { $PAGE->navbar->add($strfulllistofcourses); $PAGE->set_title("{$site->shortname}: {$strfulllistofcourses}"); $PAGE->set_heading($COURSE->fullname); $PAGE->set_button(update_category_button()); echo $OUTPUT->header(); echo $OUTPUT->skip_link_target(); echo $OUTPUT->box_start('courseboxes'); print_courses(0); echo $OUTPUT->box_end(); } echo $OUTPUT->container_start('buttons'); if (has_capability('moodle/course:create', $systemcontext)) { /// Print link to create a new course /// Get the 1st available category $options = array('category' => $CFG->defaultrequestcategory); echo $OUTPUT->single_button(new moodle_url('edit.php', $options), get_string('addnewcourse'), 'get'); } print_course_request_buttons($systemcontext); echo $OUTPUT->container_end();
$navigation = build_navigation($navlinks); if ($creatorediting) { if ($adminediting) { // modify this to treat this as an admin page require_once $CFG->libdir . '/adminlib.php'; admin_externalpage_setup('coursemgmt'); admin_externalpage_print_header(); } else { print_header("{$site->shortname}: {$category->name}", "{$site->fullname}: {$strcourses}", $navigation, "", "", true, $navbaritem); } } else { print_header("{$site->shortname}: {$category->name}", "{$site->fullname}: {$strcourses}", $navigation, "", "", true, $navbaritem); } /// Print button to turn editing off if ($adminediting) { echo '<div class="categoryediting button">' . update_category_button($category->id) . '</div>'; } /// Print link to roles if (has_capability('moodle/role:assign', $context)) { echo '<div class="rolelink"><a href="' . $CFG->wwwroot . '/' . $CFG->admin . '/roles/assign.php?contextid=' . $context->id . '">' . get_string('assignroles', 'role') . '</a></div>'; } /// Print the category selector $displaylist = array(); $parentlist = array(); make_categories_list($displaylist, $parentlist, ""); echo '<div class="categorypicker">'; popup_form('category.php?id=', $displaylist, 'switchcategory', $category->id, '', '', '', false, 'self', $strcategories . ':'); echo '</div>'; /// Print current category description if (!$creatorediting && $category->description) { print_box_start();
} if (!empty($CFG->allowcategorythemes) && isset($category->theme)) { // specifying theme here saves us some dbqs theme_setup($category->theme); } /// Print headings $numcategories = count_records('course_categories'); $stradministration = get_string('administration'); $strcategories = get_string('categories'); $strcategory = get_string('category'); $strcourses = get_string('courses'); $navlinks = array(); $navlinks[] = array('name' => $strcategories, 'link' => 'index.php', 'type' => 'misc'); $navlinks[] = array('name' => format_string($category->name), 'link' => null, 'type' => 'misc'); $navigation = build_navigation($navlinks); if ($editingon && update_category_button()) { // Integrate into the admin tree only if the user can edit categories at the top level, // otherwise the admin block does not appear to this user, and you get an error. require_once $CFG->libdir . '/adminlib.php'; admin_externalpage_setup('coursemgmt', $navbaritem, array('id' => $id, 'page' => $page, 'perpage' => $perpage), $CFG->wwwroot . '/course/category.php'); admin_externalpage_print_header(); } else { print_header("{$site->shortname}: {$category->name}", "{$site->fullname}: {$strcourses}", $navigation, '', '', true, $navbaritem); } /// Print link to roles if (has_capability('moodle/role:assign', $context)) { echo '<div class="rolelink"><a href="' . $CFG->wwwroot . '/' . $CFG->admin . '/roles/assign.php?contextid=' . $context->id . '">' . get_string('assignroles', 'role') . '</a></div>'; } /// Print the category selector $displaylist = array(); $notused = array();
function print_category_edit_header() { global $CFG; global $SITE; require_once $CFG->libdir . '/adminlib.php'; admin_externalpage_setup('coursemgmt', update_category_button()); admin_externalpage_print_header(); }
// trim & clean raw searched string if ($search) { $searchterms = explode(" ", $search); // Search for words independently foreach ($searchterms as $key => $searchterm) { if (strlen($searchterm) < 2) { unset($searchterms[$key]); } } $search = trim(implode(" ", $searchterms)); } $site = get_site(); if ($CFG->forcelogin) { require_login(); } if (update_category_button()) { if ($edit !== -1) { $USER->categoryediting = $edit; } $adminediting = !empty($USER->categoryediting); } else { $adminediting = false; } /// Editing functions if (has_capability('moodle/course:visibility', get_context_instance(CONTEXT_SYSTEM))) { /// Hide or show a course if ($hide or $show and confirm_sesskey()) { if ($hide) { $course = get_record("course", "id", $hide); $visible = 0; } else {
if ($countcategories > 1 || $countcategories == 1 && $DB->count_records('course') > 200) { $strcourses = get_string('courses'); $strcategories = get_string('categories'); $navlinks = array(); $navlinks[] = array('name' => $strcategories, 'link' => '', 'type' => 'misc'); $navigation = build_navigation($navlinks); print_header("{$site->shortname}: {$strcategories}", $strcourses, $navigation, '', '', true, update_category_button()); echo $OUTPUT->heading($strcategories); echo skip_main_destination(); echo $OUTPUT->box_start('categorybox'); print_whole_category_list(); echo $OUTPUT->box_end(); print_course_search(); } else { $strfulllistofcourses = get_string('fulllistofcourses'); print_header("{$site->shortname}: {$strfulllistofcourses}", $strfulllistofcourses, build_navigation(array(array('name' => $strfulllistofcourses, 'link' => '', 'type' => 'misc'))), '', '', true, update_category_button()); echo skip_main_destination(); echo $OUTPUT->box_start('courseboxes'); print_courses(0); echo $OUTPUT->box_end(); } echo $OUTPUT->container_start('buttons'); if (has_capability('moodle/course:create', $systemcontext)) { /// Print link to create a new course /// Get the 1st available category $options = array('category' => $CFG->defaultrequestcategory); $form = html_form::make_button('edit.php', $options, get_string('addnewcourse')); $form->method = 'get'; echo $OUTPUT->button($form); } print_course_request_buttons($systemcontext);