$searchterm) { if (strlen($searchterm) < 2) { unset($searchterms[$key]); } } $search = trim(implode(" ", $searchterms)); } $site = get_site(); if ($CFG->forcelogin) { require_login(); } if (iscreator()) { if (isset($_GET['edit']) and confirm_sesskey()) { if ($edit == "on") { $USER->categoriessearchediting = true; } else if ($edit == "off") { $USER->categoriessearchediting = false; } // 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; } $creatorediting = !empty($USER->categoriessearchediting); $adminediting = (isadmin() and $creatorediting); } else { $creatorediting = false; $adminediting = false; } /// Editing functions if ($adminediting) { /// Hide or show a course if ((isset($hide) or isset($show)) and confirm_sesskey()) { if (isset($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 ($adminediting && $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 "