From: stronk7 Date: Wed, 19 May 2004 07:12:40 +0000 (+0000) Subject: Patched file. Bug 1425 closed. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=4b929531505f16b46621c89eaabefa3fbf7291b7;p=moodle.git Patched file. Bug 1425 closed. (http://moodle.org/bugs/bug.php?op=show&bugid=1425) --- diff --git a/lib/datalib.php b/lib/datalib.php index 22887a6163..4039b87001 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -1628,13 +1628,17 @@ function get_courses($categoryid="all", $sort="c.sortorder ASC", $fields="c.*") $teachertable = ""; $visiblecourses = ""; + $sqland = ""; + if (!empty($categoryselect)) { + $sqland = "AND "; + } if (!empty($USER)) { // May need to check they are a teacher if (!iscreator()) { - $visiblecourses = "AND ((c.visible > 0) OR (t.userid = '$USER->id' AND t.course = c.id))"; + $visiblecourses = "$sqland ((c.visible > 0) OR (t.userid = '$USER->id' AND t.course = c.id))"; $teachertable = ", {$CFG->prefix}user_teachers t"; } } else { - $visiblecourses = "AND c.visible > 0"; + $visiblecourses = "$sqland c.visible > 0"; } if ($categoryselect or $visiblecourses) { @@ -1667,13 +1671,17 @@ function get_courses_page($categoryid="all", $sort="c.sortorder ASC", $fields="c $teachertable = ""; $visiblecourses = ""; + $sqland = ""; + if (!empty($categoryselect)) { + $sqland = "AND "; + } if (!empty($USER)) { // May need to check they are a teacher if (!iscreator()) { - $visiblecourses = "AND ((c.visible > 0) OR (t.userid = '$USER->id' AND t.course = c.id))"; + $visiblecourses = "$sqland ((c.visible > 0) OR (t.userid = '$USER->id' AND t.course = c.id))"; $teachertable = ", {$CFG->prefix}user_teachers t"; } } else { - $visiblecourses = "AND c.visible > 0"; + $visiblecourses = "$sqland c.visible > 0"; } if ($limitfrom !== "") {