From fa18e81b127f098ff1ae4f84314fc10cba62243c Mon Sep 17 00:00:00 2001 From: patrickslee Date: Wed, 12 Oct 2005 03:11:49 +0000 Subject: [PATCH] Course search page now handles course show/hide actions itself so that user can stay at the same page after action is performed --- course/search.php | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/course/search.php b/course/search.php index 41013708497..fb97e4aa541 100644 --- a/course/search.php +++ b/course/search.php @@ -40,6 +40,29 @@ $adminediting = (isadmin() and $creatorediting); } +/// 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; } @@ -160,10 +183,10 @@ echo "id\"> "; if (!empty($course->visible)) { - echo "category&hide=$course->id&sesskey=$USER->sesskey\">id&sesskey=$USER->sesskey\"> "; } else { - echo "category&show=$course->id&sesskey=$USER->sesskey\">id&sesskey=$USER->sesskey\"> "; }