2002-06-19 05:04:31 +00:00
|
|
|
<?PHP // $Id$
|
|
|
|
// Display the whole course as "topics" made of of modules
|
|
|
|
// In fact, this is very similar to the "weeks" format, in that
|
|
|
|
// each "topic" is actually a week. The main difference is that
|
|
|
|
// the dates aren't printed - it's just an aesthetic thing for
|
|
|
|
// courses that aren't so rigidly defined by time.
|
|
|
|
// Included from "view.php"
|
|
|
|
|
2003-01-05 14:19:20 +00:00
|
|
|
require_once("$CFG->dirroot/mod/forum/lib.php");
|
2002-06-19 05:04:31 +00:00
|
|
|
|
|
|
|
if (isset($topic)) {
|
|
|
|
if ($topic == "all") {
|
|
|
|
unset($USER->topic);
|
|
|
|
} else {
|
|
|
|
$USER->topic = $topic;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isteacher($course->id) and isset($marker)) {
|
|
|
|
$course->marker = $marker;
|
|
|
|
if (! set_field("course", "marker", $marker, "id", $course->id)) {
|
|
|
|
error("Could not mark that topic for this course");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-07 09:30:41 +00:00
|
|
|
if ($course->newsitems) {
|
|
|
|
$news = forum_get_course_forum($course->id, "news");
|
|
|
|
}
|
2002-06-19 05:04:31 +00:00
|
|
|
|
2002-11-10 07:37:15 +00:00
|
|
|
$streditsummary = get_string("editsummary");
|
|
|
|
$stradd = get_string("add");
|
|
|
|
$stractivities = get_string("activities");
|
|
|
|
|
2002-06-19 05:04:31 +00:00
|
|
|
|
2002-11-07 09:30:41 +00:00
|
|
|
/// Layout the whole page as three big columns.
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "<table border=0 cellpadding=3 cellspacing=0 width=100%>";
|
2002-06-19 05:04:31 +00:00
|
|
|
|
2002-11-07 09:30:41 +00:00
|
|
|
/// The left column ...
|
2002-07-19 12:11:15 +00:00
|
|
|
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "<tr valign=top><td valign=top width=180>";
|
2002-11-07 09:30:41 +00:00
|
|
|
|
|
|
|
/// Links to people
|
2003-04-28 04:32:55 +00:00
|
|
|
$moddata[]="<a title=\"".get_string("listofallpeople")."\" href=\"../user/index.php?id=$course->id\">".get_string("participants")."</a>";
|
|
|
|
$modicon[]="<img src=\"$pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
|
|
|
|
$editmyprofile = "<a title=\"$USER->firstname $USER->lastname\" href=\"../user/edit.php?id=$USER->id&course=$course->id\">".get_string("editmyprofile")."</a>";
|
2002-07-19 12:08:30 +00:00
|
|
|
if ($USER->description) {
|
2002-07-19 12:11:15 +00:00
|
|
|
$moddata[]= $editmyprofile;
|
2002-07-19 12:08:30 +00:00
|
|
|
} else {
|
2003-04-28 04:32:55 +00:00
|
|
|
$moddata[]= $editmyprofile." <blink>*</blink>";
|
2002-07-19 12:08:30 +00:00
|
|
|
}
|
2003-04-28 04:32:55 +00:00
|
|
|
$modicon[]="<img src=\"$pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
|
2002-12-09 07:35:40 +00:00
|
|
|
print_side_block(get_string("people"), "", $moddata, $modicon);
|
2002-06-19 05:04:31 +00:00
|
|
|
|
|
|
|
|
2002-11-07 09:30:41 +00:00
|
|
|
/// Links to all activity modules by type
|
2002-06-19 05:04:31 +00:00
|
|
|
$moddata = array();
|
|
|
|
$modicon = array();
|
2002-08-02 17:38:18 +00:00
|
|
|
if ($modnamesused) {
|
|
|
|
foreach ($modnamesused as $modname => $modfullname) {
|
2003-04-28 04:32:55 +00:00
|
|
|
$moddata[] = "<a href=\"../mod/$modname/index.php?id=$course->id\">".$modnamesplural[$modname]."</a>";
|
|
|
|
$modicon[] = "<img src=\"$modpixpath/$modname/icon.gif\" height=16 width=16 alt=\"\">";
|
2002-06-19 05:04:31 +00:00
|
|
|
}
|
|
|
|
}
|
2002-12-09 07:35:40 +00:00
|
|
|
print_side_block($stractivities, "", $moddata, $modicon);
|
2002-06-19 05:04:31 +00:00
|
|
|
|
2002-11-07 09:30:41 +00:00
|
|
|
/// Print a form to search forums
|
2002-12-09 07:35:40 +00:00
|
|
|
$searchform = forum_print_search_form($course, "", true);
|
2003-04-28 04:32:55 +00:00
|
|
|
$searchform = "<div align=\"center\">$searchform</div>";
|
2002-12-09 07:35:40 +00:00
|
|
|
print_side_block(get_string("search","forum"), $searchform);
|
2002-06-19 05:04:31 +00:00
|
|
|
|
2002-11-07 09:30:41 +00:00
|
|
|
/// Admin links and controls
|
2003-01-01 07:03:23 +00:00
|
|
|
print_course_admin_links($course);
|
2002-06-19 05:04:31 +00:00
|
|
|
|
2002-11-07 09:30:41 +00:00
|
|
|
/// Start main column
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "</td><td width=\"*\">";
|
2002-06-19 05:04:31 +00:00
|
|
|
|
2002-12-09 13:36:55 +00:00
|
|
|
print_heading_block(get_string("topicoutline"), "100%", "outlineheadingblock");
|
|
|
|
print_spacer(8, 1, true);
|
2002-08-10 13:42:12 +00:00
|
|
|
|
2002-12-09 13:45:44 +00:00
|
|
|
echo "<table class=\"topicsoutline\" border=\"0\" cellpadding=\"8\" cellspacing=\"0\" width=\"100%\">";
|
2002-11-07 09:30:41 +00:00
|
|
|
|
|
|
|
/// Print Section 0
|
|
|
|
|
|
|
|
$topic = 0;
|
|
|
|
$thistopic = $sections[$topic];
|
|
|
|
|
|
|
|
if ($thistopic->summary or $thistopic->sequence or isediting($course->id)) {
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "<tr>";
|
|
|
|
echo "<td nowrap bgcolor=\"$THEME->cellheading\" class=\"topicsoutlineside\" valign=top width=20> </td>";
|
|
|
|
echo "<td valign=top bgcolor=\"$THEME->cellcontent\" class=\"topicsoutlinecontent\" width=\"100%\">";
|
2002-11-07 09:30:41 +00:00
|
|
|
|
|
|
|
if (isediting($course->id)) {
|
2003-04-28 04:32:55 +00:00
|
|
|
$thistopic->summary .= " <a title=\"$streditsummary\" ".
|
|
|
|
"href=\"editsection.php?id=$thistopic->id\"><img src=\"$pixpath/t/edit.gif\" ".
|
|
|
|
"height=11 width=11 border=0 alt=\"$streditsummary\"></a></p>";
|
2002-11-07 09:30:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
echo text_to_html($thistopic->summary);
|
|
|
|
|
2002-11-10 07:37:15 +00:00
|
|
|
print_section($course, $thistopic, $mods, $modnamesused);
|
2002-11-07 09:30:41 +00:00
|
|
|
|
|
|
|
if (isediting($course->id)) {
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "<div align=right>";
|
2003-01-03 05:33:17 +00:00
|
|
|
popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&section=$topic&add=",
|
2002-11-10 07:37:15 +00:00
|
|
|
$modnames, "section$topic", "", "$stradd...", "mods", $stractivities);
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "</div>";
|
2002-11-07 09:30:41 +00:00
|
|
|
}
|
|
|
|
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "</td>";
|
|
|
|
echo "<td nowrap bgcolor=\"$THEME->cellheading\" class=\"topicsoutlineside\" valign=top align=center width=10> ";
|
|
|
|
echo "</td>";
|
|
|
|
echo "</tr>";
|
|
|
|
echo "<tr><td colspan=3><img src=\"../pix/spacer.gif\" width=1 height=1></td></tr>";
|
2002-11-07 09:30:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Now all the normal modules by topic
|
|
|
|
/// Everything below uses "section" terminology - each "section" is a topic.
|
|
|
|
|
|
|
|
$timenow = time();
|
|
|
|
$section = 1;
|
|
|
|
|
2002-06-25 11:49:06 +00:00
|
|
|
while ($section <= $course->numsections) {
|
2002-06-19 05:04:31 +00:00
|
|
|
|
|
|
|
if (isset($USER->topic)) { // Just display a single topic
|
2002-06-25 11:49:06 +00:00
|
|
|
if ($USER->topic != $section) {
|
|
|
|
$section++;
|
2002-06-19 05:04:31 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-25 11:49:06 +00:00
|
|
|
$currenttopic = ($course->marker == $section);
|
2002-06-19 05:04:31 +00:00
|
|
|
|
|
|
|
if ($currenttopic) {
|
2002-12-13 08:12:14 +00:00
|
|
|
$colorsides = "bgcolor=\"$THEME->cellheading2\" class=\"topicsoutlinesidehighlight\"";
|
|
|
|
$colormain = "bgcolor=\"$THEME->cellcontent\" class=\"topicsoutlinecontenthighlight\"";
|
2002-06-19 05:04:31 +00:00
|
|
|
} else {
|
2002-12-13 08:12:14 +00:00
|
|
|
$colorsides = "bgcolor=\"$THEME->cellheading\" class=\"topicsoutlineside\"";
|
|
|
|
$colormain = "bgcolor=\"$THEME->cellcontent\" class=\"topicsoutlinecontent\"";
|
2002-06-19 05:04:31 +00:00
|
|
|
}
|
|
|
|
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "<tr>";
|
|
|
|
echo "<td nowrap $colorsides valign=top width=20>";
|
|
|
|
echo "<p align=center><font size=3><b>$section</b></font></p>";
|
|
|
|
echo "</td>";
|
2002-06-19 05:04:31 +00:00
|
|
|
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "<td valign=top $colormain width=\"100%\">";
|
2002-06-19 05:04:31 +00:00
|
|
|
|
2003-03-21 04:49:29 +00:00
|
|
|
if (!empty($sections[$section])) {
|
|
|
|
$thissection = $sections[$section];
|
|
|
|
|
|
|
|
} else {
|
2003-04-17 15:46:39 +00:00
|
|
|
unset($thissection);
|
2002-06-25 11:49:06 +00:00
|
|
|
$thissection->course = $course->id; // Create a new section structure
|
|
|
|
$thissection->section = $section;
|
|
|
|
$thissection->summary = "";
|
2002-08-15 02:59:57 +00:00
|
|
|
if (!$thissection->id = insert_record("course_sections", $thissection)) {
|
|
|
|
notify("Error inserting new topic!");
|
|
|
|
}
|
2002-06-19 05:04:31 +00:00
|
|
|
}
|
|
|
|
|
2002-07-30 03:35:53 +00:00
|
|
|
if (isediting($course->id)) {
|
2003-04-28 04:32:55 +00:00
|
|
|
$thissection->summary .= " <a href=editsection.php?id=$thissection->id><img src=\"$pixpath/t/edit.gif\" border=0 height=11 width=11 alt=\"$streditsummary\"></a>";
|
2002-06-19 05:04:31 +00:00
|
|
|
}
|
|
|
|
|
2002-06-25 11:49:06 +00:00
|
|
|
echo text_to_html($thissection->summary);
|
2002-06-19 05:04:31 +00:00
|
|
|
|
2002-11-10 07:37:15 +00:00
|
|
|
print_section($course, $thissection, $mods, $modnamesused);
|
2002-06-19 05:04:31 +00:00
|
|
|
|
2002-07-30 03:35:53 +00:00
|
|
|
if (isediting($course->id)) {
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "<div align=right>";
|
2003-01-03 05:33:17 +00:00
|
|
|
popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&section=$section&add=",
|
2002-11-10 07:37:15 +00:00
|
|
|
$modnames, "section$section", "", "$stradd...", "mods", $stractivities);
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "</div>";
|
2002-06-19 05:04:31 +00:00
|
|
|
}
|
|
|
|
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "</td>";
|
|
|
|
echo "<td nowrap $colorsides valign=top align=center width=10>";
|
|
|
|
echo "<font size=1>";
|
2002-06-19 05:04:31 +00:00
|
|
|
if (isset($USER->topic)) {
|
2002-08-10 13:42:12 +00:00
|
|
|
$strshowalltopics = get_string("showalltopics");
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "<a href=\"view.php?id=$course->id&topic=all\" title=\"$strshowalltopics\"><img src=\"$pixpath/i/all.gif\" height=25 width=16 border=0></a><br><br>";
|
2002-06-19 05:04:31 +00:00
|
|
|
} else {
|
2002-08-10 13:42:12 +00:00
|
|
|
$strshowonlytopic = get_string("showonlytopic", "", $section);
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "<a href=\"view.php?id=$course->id&topic=$section\" title=\"$strshowonlytopic\"><img src=\"$pixpath/i/one.gif\" height=16 width=16 border=0></a><br><br>";
|
2002-06-19 05:04:31 +00:00
|
|
|
}
|
2002-07-30 03:35:53 +00:00
|
|
|
if (isediting($course->id) and $course->marker != $section) {
|
2002-08-10 13:42:12 +00:00
|
|
|
$strmarkthistopic = get_string("markthistopic");
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "<a href=\"view.php?id=$course->id&marker=$section\" title=\"$strmarkthistopic\"><img src=\"$pixpath/i/marker.gif\" height=16 width=16 border=0></a><br><br>";
|
2002-06-19 05:04:31 +00:00
|
|
|
}
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "</td>";
|
|
|
|
echo "</tr>";
|
|
|
|
echo "<tr><td colspan=3><img src=\"../pix/spacer.gif\" width=1 height=1></td></tr>";
|
2002-06-19 05:04:31 +00:00
|
|
|
|
2002-06-25 11:49:06 +00:00
|
|
|
$section++;
|
2002-06-19 05:04:31 +00:00
|
|
|
}
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "</table>";
|
2002-06-19 05:04:31 +00:00
|
|
|
|
|
|
|
|
2002-11-12 04:26:16 +00:00
|
|
|
if ($news or $course->showrecent) {
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "</td><td width=210>";
|
2002-11-12 04:26:16 +00:00
|
|
|
|
|
|
|
/// Print all the news items.
|
|
|
|
|
|
|
|
if ($news) {
|
2002-12-09 13:36:55 +00:00
|
|
|
print_side_block_start(get_string("latestnews"), 210, "sideblocklatestnews");
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "<font size=\"-2\">";
|
2003-04-18 07:25:58 +00:00
|
|
|
forum_print_latest_discussions($news->id, $course->newsitems, "minimal", "", false);
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "</font>";
|
2002-12-09 13:36:55 +00:00
|
|
|
print_side_block_end();
|
2002-11-12 04:26:16 +00:00
|
|
|
}
|
|
|
|
|
2002-12-09 13:36:55 +00:00
|
|
|
// Print all the recent activity
|
2002-11-12 04:26:16 +00:00
|
|
|
if ($course->showrecent) {
|
2002-12-09 13:36:55 +00:00
|
|
|
print_side_block_start(get_string("recentactivity"), 210, "sideblockrecentactivity");
|
2002-11-12 04:26:16 +00:00
|
|
|
print_recent_activity($course);
|
2002-12-09 13:36:55 +00:00
|
|
|
print_side_block_end();
|
2002-11-12 04:26:16 +00:00
|
|
|
}
|
2002-12-09 13:36:55 +00:00
|
|
|
|
|
|
|
print_spacer(1, 120, true);
|
2002-06-19 05:04:31 +00:00
|
|
|
}
|
|
|
|
|
2003-04-28 04:32:55 +00:00
|
|
|
echo "</td></tr></table>\n";
|
2002-06-19 05:04:31 +00:00
|
|
|
|
|
|
|
?>
|