From b48f834cfb8999e1aa897f899dbaf9569e52acb5 Mon Sep 17 00:00:00 2001
From: moodler
Date: Wed, 3 Sep 2003 12:13:08 +0000
Subject: [PATCH] Some cleaning up and improvement of the course listings,
especially when courses are listed under multiple categories
---
course/info.php | 6 +++-
course/lib.php | 93 ++++++++++++++++++++++++++++---------------------
lib/weblib.php | 6 ++--
3 files changed, 62 insertions(+), 43 deletions(-)
diff --git a/course/info.php b/course/info.php
index 9758fd47ba..e347c26854 100644
--- a/course/info.php
+++ b/course/info.php
@@ -53,7 +53,11 @@
if (!$teacher->role) {
$teacher->role = $course->teacher;
}
- echo "$teacher->role: wwwroot/user/view.php?id=$teacher->id&course=$site->id\">$teacher->firstname $teacher->lastname
";
+ 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 "
";
}
}
echo "
";
diff --git a/course/lib.php b/course/lib.php
index b22fc98bb0..0784ce4692 100644
--- a/course/lib.php
+++ b/course/lib.php
@@ -907,8 +907,6 @@ function print_whole_category_list($category=NULL, $displaylist=NULL, $parentsli
} else {
$category->id = "0";
- echo "";
- $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 "
";
- }
}
@@ -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 "";
- echo "";
- for ($i=0; $i<$depth;$i++) {
- echo "";
- }
-
- $catimage = "";
$catlinkcss = $category->visible ? "" : " class=\"dimmed\" ";
if ($CFG->frontpage == FRONTPAGECOURSELIST) {
$catimage = " ";
+ } else {
+ $catimage = " ";
}
- echo "$catimage wwwroot/course/category.php?id=$category->id\">$category->name";
+
+ echo "\n\n";
if ($CFG->frontpage == FRONTPAGECOURSELIST) {
- if ($courses = get_courses($category->id)) {
+ $courses = get_courses($category->id);
+
+ echo " ";
+
+ if ($depth) {
+ $indent = $depth*30;
+ $rows = count($courses) + 1;
+ echo "";
+ print_spacer(10, $indent);
+ echo " | ";
+ }
+
+ echo "$catimage | ";
+ echo "";
+ echo "wwwroot/course/category.php?id=$category->id\">$category->name";
+ echo " | ";
+ echo " | ";
+ echo " \n";
+
+ if ($courses) {
foreach ($courses as $course) {
- echo "";
- }
- echo "";
- echo "";
} else {
- for ($i=0; $i<$depth;$i++) {
- echo "";
- }
- echo "";
- echo "";
- if ($category->coursecount) {
- echo $category->coursecount;
+
+ if ($depth) {
+ $indent = $depth*20;
+ echo " | ";
+ print_spacer(10, $indent);
+ echo " | ";
}
- echo "";
- echo "";
+
+ echo "";
+ echo "wwwroot/course/category.php?id=$category->id\">$category->name";
+ echo " | ";
+ echo "$category->coursecount | ";
}
+ echo "\n \n";
}
function print_courses_sideblock($category=0, $width="100%") {
diff --git a/lib/weblib.php b/lib/weblib.php
index 8c9315ca9e..68ad3c1a8e 100644
--- a/lib/weblib.php
+++ b/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 "wwwroot$url\" ".
--
2.39.5
|