2001-11-22 06:23:56 +00:00
|
|
|
<?PHP // $Id$
|
|
|
|
|
|
|
|
// Display the course home page.
|
|
|
|
|
|
|
|
require("../config.php");
|
|
|
|
require("lib.php");
|
|
|
|
|
|
|
|
|
|
|
|
require_login($id);
|
|
|
|
|
|
|
|
if (! $course = get_record("course", "id", $id) ) {
|
|
|
|
error("That's an invalid course id");
|
|
|
|
}
|
|
|
|
|
2002-05-31 09:34:50 +00:00
|
|
|
add_to_log($course->id, "course", "view", "view.php?id=$course->id", "$course->id");
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2002-04-03 06:36:04 +00:00
|
|
|
if ( isteacher($course->id) ) {
|
2001-11-22 06:23:56 +00:00
|
|
|
if ($edit == "on") {
|
|
|
|
$USER->editing = true;
|
|
|
|
} else if ($edit == "off") {
|
|
|
|
$USER->editing = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($help == "on") {
|
|
|
|
$USER->help = true;
|
|
|
|
} else if ($help == "off") {
|
|
|
|
$USER->help = false;
|
|
|
|
}
|
|
|
|
|
2001-11-25 15:48:24 +00:00
|
|
|
if (! $course->category) { // This course is not a real course.
|
|
|
|
redirect("$CFG->wwwroot");
|
|
|
|
}
|
|
|
|
|
2002-07-04 07:52:06 +00:00
|
|
|
$courseword = get_string("course");
|
|
|
|
|
|
|
|
print_header("$courseword: $course->fullname", "$course->fullname", "$course->shortname", "search.search", "", true,
|
2002-06-08 06:52:00 +00:00
|
|
|
update_course_icon($course->id));
|
2001-11-22 06:23:56 +00:00
|
|
|
|
|
|
|
if (! $modtypes = get_records_sql_menu("SELECT name,fullname FROM modules ORDER BY fullname") ) {
|
|
|
|
error("No modules are installed!");
|
|
|
|
}
|
|
|
|
|
2002-07-23 16:24:12 +00:00
|
|
|
get_all_mods($course->id, $mods, $modtype);
|
|
|
|
|
|
|
|
if (isset($modtype["forum"]) and isset($modtype["discuss"])) { // Only need to display one
|
|
|
|
unset($modtype["discuss"]);
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch ($course->format) {
|
2002-06-25 11:49:06 +00:00
|
|
|
case "weeks":
|
2001-11-22 06:23:56 +00:00
|
|
|
include("weeks.php");
|
|
|
|
break;
|
2002-06-25 11:49:06 +00:00
|
|
|
case "social":
|
2002-02-26 06:34:29 +00:00
|
|
|
include("social.php");
|
|
|
|
break;
|
2002-06-25 11:49:06 +00:00
|
|
|
case "topics":
|
2002-06-19 05:04:31 +00:00
|
|
|
include("topics.php");
|
|
|
|
break;
|
2002-02-26 06:34:29 +00:00
|
|
|
default:
|
|
|
|
error("Course format not defined yet!");
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
print_footer($course);
|
|
|
|
|
|
|
|
|
|
|
|
/// FUNCTIONS ////////
|
|
|
|
|
|
|
|
|
|
|
|
function make_editing_buttons($moduleid) {
|
2002-07-04 07:52:06 +00:00
|
|
|
$delete = get_string("delete");
|
|
|
|
$moveup = get_string("moveup");
|
|
|
|
$movedown = get_string("movedown");
|
|
|
|
$update = get_string("update");
|
2001-11-22 06:23:56 +00:00
|
|
|
return "
|
|
|
|
<A HREF=mod.php?delete=$moduleid><IMG
|
2002-07-04 07:52:06 +00:00
|
|
|
SRC=../pix/t/delete.gif BORDER=0 ALT=\"$delete\"></A>
|
2001-11-22 06:23:56 +00:00
|
|
|
<A HREF=mod.php?id=$moduleid&move=-1><IMG
|
2002-07-04 07:52:06 +00:00
|
|
|
SRC=../pix/t/up.gif BORDER=0 ALT=\"$moveup\"></A>
|
2001-11-22 06:23:56 +00:00
|
|
|
<A HREF=mod.php?id=$moduleid&move=1><IMG
|
2002-07-04 07:52:06 +00:00
|
|
|
SRC=../pix/t/down.gif BORDER=0 ALT=\"$movedown\"></A>
|
2001-11-22 06:23:56 +00:00
|
|
|
<A HREF=mod.php?update=$moduleid><IMG
|
2002-07-04 07:52:06 +00:00
|
|
|
SRC=../pix/t/edit.gif BORDER=0 ALT=\"$update\"></A>";
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function print_side_block($heading="", $list=NULL, $footer="", $icons=NULL) {
|
|
|
|
|
|
|
|
echo "<TABLE WIDTH=100%>\n";
|
|
|
|
echo "<TR><TD COLSPAN=2><P><B><FONT SIZE=2>$heading</TD></TR>\n";
|
|
|
|
if ($list) {
|
|
|
|
foreach($list as $key => $string) {
|
|
|
|
echo "<TR><TD VALIGN=top WIDTH=12>";
|
|
|
|
if ($icons[$key]) {
|
|
|
|
echo $icons[$key];
|
|
|
|
} else {
|
|
|
|
echo "";
|
|
|
|
}
|
2002-06-25 16:42:34 +00:00
|
|
|
echo "</TD>\n<TD WIDTH=100% VALIGN=top>";
|
2002-06-25 06:47:34 +00:00
|
|
|
echo "<P><FONT SIZE=2>$string</FONT></P>";
|
2001-11-22 06:23:56 +00:00
|
|
|
echo "</TD></TR>\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($footer) {
|
|
|
|
echo "<TR><TD></TD><TD ALIGN=left><P><FONT SIZE=2>$footer</TD></TR>\n";
|
|
|
|
}
|
|
|
|
echo "</TABLE><BR>\n\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|