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

courses are listed under multiple categories
This commit is contained in:
moodler 2003-09-03 12:13:08 +00:00
parent 3af6e1dbb8
commit b48f834cfb
3 changed files with 62 additions and 43 deletions

View File

@ -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 File

@ -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> ";
}
echo "</span>";
echo "</ul>";
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 "</td></tr>\n";
}
}
for ($i=0; $i<$depth;$i++) {
echo "</ul>";
}
echo "</td>";
echo "</tr>";
} else {
for ($i=0; $i<$depth;$i++) {
echo "</ul>";
if ($depth) {
$indent = $depth*20;
echo "<td valign=\"top\" width=\"$indent\">";
print_spacer(10, $indent);
echo "</td>";
}
echo "</td>";
echo "<td valign=\"top\">";
if ($category->coursecount) {
echo $category->coursecount;
}
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 File

@ -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\" ".