Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Course search page now handles course show/hide actions itself so tha…
…t user can stay at the same page after action is performed
  • Loading branch information
patrickslee committed Oct 12, 2005
1 parent ee0378b commit fa18e81
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions course/search.php
Expand Up @@ -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;
}
Expand Down Expand Up @@ -160,10 +183,10 @@
echo "<a title=\"".get_string("delete")."\" href=\"delete.php?id=$course->id\"><img".
" src=\"$pixpath/t/delete.gif\" height=\"11\" width=\"11\" border=\"0\"></a> ";
if (!empty($course->visible)) {
echo "<a title=\"".get_string("hide")."\" href=\"category.php?id=$course->category&hide=$course->id&amp;sesskey=$USER->sesskey\"><img".
echo "<a title=\"".get_string("hide")."\" href=\"search.php?search=$search&amp;perpage=$perpage&amp;page=$page&amp;hide=$course->id&amp;sesskey=$USER->sesskey\"><img".
" src=\"$pixpath/t/hide.gif\" height=\"11\" width=\"11\" border=\"0\"></a> ";
} else {
echo "<a title=\"".get_string("show")."\" href=\"category.php?id=$course->category&show=$course->id&amp;sesskey=$USER->sesskey\"><img".
echo "<a title=\"".get_string("show")."\" href=\"search.php?search=$search&amp;perpage=$perpage&amp;page=$page&amp;show=$course->id&amp;sesskey=$USER->sesskey\"><img".
" src=\"$pixpath/t/show.gif\" height=\"11\" width=\"11\" border=\"0\"></a> ";
}

Expand Down

0 comments on commit fa18e81

Please sign in to comment.