Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Some cleaning up and improvement of the course listings, especially when

courses are listed under multiple categories
  • Loading branch information...
commit b48f834cfb8999e1aa897f899dbaf9569e52acb5 1 parent 3af6e1d
moodler authored
Showing with 62 additions and 43 deletions.
  1. +5 −1 course/info.php
  2. +53 −40 course/lib.php
  3. +4 −2 lib/weblib.php
View
6 course/info.php
@@ -53,7 +53,11 @@
if (!$teacher->role) {
$teacher->role = $course->teacher;
}
- echo "$teacher->role: <a target=\"userinfo\" href=\"$CFG->wwwroot/user/view.php?id=$teacher->id&course=$site->id\">$teacher->firstname $teacher->lastname</a><br />";
+ echo "$teacher->role: ";
+ link_to_popup_window ("/user/view.php?id=$teacher->id&course=$site->id", "opener",
+ "$teacher->firstname $teacher->lastname", 400, 500, "$teacher->role",
+ "");
+ echo "<br />";
}
}
echo "</font></p>";
View
93 course/lib.php
@@ -907,8 +907,6 @@ function print_whole_category_list($category=NULL, $displaylist=NULL, $parentsli
} else {
$category->id = "0";
- echo "<table width=\"100%\" class=\"categorybox\">";
- $toplevel = true;
}
if ($categories = get_categories($category->id)) { // Print all the children recursively
@@ -928,10 +926,6 @@ function print_whole_category_list($category=NULL, $displaylist=NULL, $parentsli
print_whole_category_list($cat, $displaylist, $parentslist, $depth + 1);
}
}
-
- if (isset($toplevel)) {
- echo "</table>";
- }
}
@@ -940,68 +934,87 @@ function print_category_info($category, $depth) {
/// This function is only used by print_whole_category_list() above
global $CFG;
+ static $strallowguests, $strrequireskey, $strsummary;
- $strallowguests = get_string("allowguests");
- $strrequireskey = get_string("requireskey");
+ if (empty($strsummary)) {
+ $strallowguests = get_string("allowguests");
+ $strrequireskey = get_string("requireskey");
+ $strsummary = get_string("summary");
+ }
if (empty($THEME->custompix)) {
$pixpath = "$CFG->wwwroot/pix";
} else {
$pixpath = "$CFG->wwwroot/theme/$CFG->theme/pix";
}
-
- echo "<tr>";
- echo "<td valign=\"top\">";
- for ($i=0; $i<$depth;$i++) {
- echo "<ul style=\"margin-bottom:0;margin-top:0\">";
- }
-
- $catimage = "";
$catlinkcss = $category->visible ? "" : " class=\"dimmed\" ";
if ($CFG->frontpage == FRONTPAGECOURSELIST) {
$catimage = "<img src=\"$pixpath/i/course.gif\" width=16 height=16 border=0>";
+ } else {
+ $catimage = "&nbsp";
}
- echo "<font size=+1>$catimage <span class=\"categoryname\"><a $catlinkcss ".
- "href=\"$CFG->wwwroot/course/category.php?id=$category->id\">$category->name</a></span></font>";
+
+ echo "\n\n<table border=0 cellpadding=3 cellspacing=0 width=\"100%\"><tr>";
if ($CFG->frontpage == FRONTPAGECOURSELIST) {
- if ($courses = get_courses($category->id)) {
+ $courses = get_courses($category->id);
+
+ echo "<tr>";
+
+ if ($depth) {
+ $indent = $depth*30;
+ $rows = count($courses) + 1;
+ echo "<td rowspan=\"$rows\" valign=\"top\" width=\"$indent\">";
+ print_spacer(10, $indent);
+ echo "</td>";
+ }
+
+ echo "<td valign=\"top\">$catimage</td>";
+ echo "<td valign=\"top\" width=\"100%\" class=\"categoryname\"><font size=+1>";
+ echo "<a $catlinkcss href=\"$CFG->wwwroot/course/category.php?id=$category->id\">$category->name</a>";
+ echo "</font></td>";
+ echo "<td>&nbsp;</td>";
+ echo "</tr>\n";
+
+ if ($courses) {
foreach ($courses as $course) {
- echo "<ul style=\"margin-bottom:0;margin-top:0\">";
$linkcss = $course->visible ? "" : " class=\"dimmed\" ";
- echo "<span class=\"coursename\">";
+ echo "<tr><td valign=\"top\" width=\"30\">&nbsp;";
+ echo "</td>\n<td valign=\"top\" class=\"coursename\" width=\"100%\">";
echo "<a $linkcss href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname</a>";
- echo "&nbsp;&nbsp;";
+ echo "</td>\n<td align=\"right\" valign=\"top\" nowrap>";
if ($course->guest ) {
echo "<a title=\"$strallowguests\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\">";
- echo "<img alt=\"\" height=16 width=16 border=0 src=\"$pixpath/i/user.gif\"></a>";
+ echo "<img alt=\"\" height=16 width=16 border=0 src=\"$pixpath/i/user.gif\"></a> ";
}
if ($course->password) {
echo "<a title=\"$strrequireskey\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\">";
- echo "<img alt=\"\" height=16 width=16 border=0 src=\"$pixpath/i/key.gif\"></a>";
+ echo "<img alt=\"\" height=16 width=16 border=0 src=\"$pixpath/i/key.gif\"></a> ";
+ }
+ if ($course->summary) {
+ link_to_popup_window ("/course/info.php?id=$course->id", "courseinfo",
+ "<img alt=\"info\" height=16 width=16 border=0 src=\"$pixpath/i/info.gif\">",
+ 400, 500, $strsummary);
}
- echo "</span>";
- echo "</ul>";
+ echo "</td></tr>\n";
}
}
- for ($i=0; $i<$depth;$i++) {
- echo "</ul>";
- }
- echo "</td>";
- echo "</tr>";
} else {
- for ($i=0; $i<$depth;$i++) {
- echo "</ul>";
- }
- echo "</td>";
- echo "<td valign=\"top\">";
- if ($category->coursecount) {
- echo $category->coursecount;
+
+ if ($depth) {
+ $indent = $depth*20;
+ echo "<td valign=\"top\" width=\"$indent\">";
+ print_spacer(10, $indent);
+ echo "</td>";
}
- echo "</td>";
- echo "</tr>";
+
+ echo "<td valign=\"top\" width=\"100%\" class=\"categoryname\"><font size=+1>";
+ echo "<a $catlinkcss href=\"$CFG->wwwroot/course/category.php?id=$category->id\">$category->name</a>";
+ echo "</font></td>";
+ echo "<td valign=\"top\">$category->coursecount</td></tr>";
}
+ echo "\n</table>\n";
}
function print_courses_sideblock($category=0, $width="100%") {
View
6 lib/weblib.php
@@ -248,7 +248,7 @@ function frmchecked(&$var, $true_value = "checked", $false_value = "") {
function link_to_popup_window ($url, $name="popup", $linkname="click here",
- $height=400, $width=500, $title="Popup window") {
+ $height=400, $width=500, $title="Popup window", $options="none") {
/// This will create a HTML link that will work on both
/// Javascript and non-javascript browsers.
/// Relies on the Javascript function openpopup in javascript.php
@@ -256,7 +256,9 @@ function link_to_popup_window ($url, $name="popup", $linkname="click here",
global $CFG;
- $options = "menubar=0,location=0,scrollbars,resizable,width=$width,height=$height";
+ if ($options == "none") {
+ $options = "menubar=0,location=0,scrollbars,resizable,width=$width,height=$height";
+ }
$fullscreen = 0;
echo "<a target=\"$name\" title=\"$title\" href=\"$CFG->wwwroot$url\" ".
Please sign in to comment.
Something went wrong with that request. Please try again.