$searchterm) { if (strlen($searchterm) < 2) { unset($searchterms[$key]); } } $search = trim(implode(" ", $searchterms)); } $site = get_site(); if ($CFG->forcelogin) { require_login(); } if (has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) { if ($edit !== -1) { $USER->categoryediting = $edit; // If the edit mode we are leaving has higher per page than the one we are entering, // with pages, chances are you will get a no courses found error. So when we are switching // modes, set page to 0. $page = 0; } } /// Editing functions if (has_capability('moodle/course:visibility', get_context_instance(CONTEXT_SYSTEM, SITEID))) { /// Hide or show a course if ($hide or $show and confirm_sesskey()) { if ($hide) { $course = get_record("course", "id", $hide); $visible = 0; } else { $course = get_record("course", "id", $show); $visible = 1; } if ($course) { if (! set_field("course", "visible", $visible, "id", $course->id)) { notify("Could not update that course!"); } } } } if (has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID)) && $perpage != 99999) { $perpage = 30; } $displaylist = array(); $parentlist = array(); make_categories_list($displaylist, $parentlist, ""); $strcourses = get_string("courses"); $strsearch = get_string("search"); $strsearchresults = get_string("searchresults"); $strcategory = get_string("category"); $strselect = get_string("select"); $strselectall = get_string("selectall"); $strdeselectall = get_string("deselectall"); $stredit = get_string("edit"); if (!$search) { print_header("$site->fullname : $strsearch", $site->fullname, "$strcourses -> $strsearch", "", ""); print_simple_box_start("center"); echo "
"; print_string("searchhelp"); echo "
"; echo ""; echo "".get_string("showall", "", $totalcount).""; echo "
"; $course->summary .= "$strcategory: category\">"; $course->summary .= $displaylist[$course->category]; $course->summary .= "
"; print_course($course); print_spacer(5,5); } } else { // slightly more sophisticated echo "