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"
2002-06-20 15:15:22 +00:00
include ( " ../mod/forum/lib.php " );
2002-06-19 05:04:31 +00:00
2002-07-23 16:24:12 +00:00
if ( ! $sections = get_all_sections ( $course -> id ) ) {
2002-06-25 11:49:06 +00:00
$section -> course = $course -> id ; // Create a default section.
$section -> section = 0 ;
$section -> id = insert_record ( " course_sections " , $section );
2002-07-23 16:24:12 +00:00
if ( ! $sections = get_all_sections ( $course -> id ) ) {
2002-06-25 11:49:06 +00:00
error ( " Error finding or creating section structures for this course " );
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 " );
}
}
// Layout the whole page as three big columns.
echo " <TABLE BORDER=0 CELLPADDING=3 CELLSPACING=0 WIDTH=100%> " ;
echo " <TR VALIGN=top><TD VALIGN=top WIDTH=180> " ;
// Layout the left column
// Links to people
2002-07-19 12:11:15 +00:00
$blinker = " <BLINK>*</BLINK> " ;
2002-06-19 05:04:31 +00:00
print_simple_box ( " People " , $align = " CENTER " , $width = " 100% " , $color = " $THEME->cellheading " );
$moddata [] = " <A HREF= \" ../user/index.php?id= $course->id\ " > List of all people </ A > " ;
$modicon [] = " <IMG SRC= \" ../user/users.gif \" HEIGHT=16 WIDTH=16 ALT= \" List of everyone \" > " ;
2002-07-19 12:11:47 +00:00
$editmyprofile = " <A HREF= \" ../user/view.php?id= $USER->id &course= $course->id\ " > Edit my profile </ 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 {
2002-07-19 12:11:15 +00:00
$moddata [] = $editmyprofile . $blinker ;
2002-07-19 12:08:30 +00:00
}
2002-06-19 05:04:31 +00:00
$modicon [] = " <IMG SRC= \" ../user/user.gif \" HEIGHT=16 WIDTH=16 ALT= \" Me \" > " ;
print_side_block ( " " , $moddata , " " , $modicon );
// Then all the links to module types
$moddata = array ();
$modicon = array ();
if ( $modtype ) {
foreach ( $modtype as $modname => $modfullname ) {
$moddata [] = " <A HREF= \" ../mod/ $modname /index.php?id= $course->id\ " > " . $modfullname . " s </ A > " ;
$modicon [] = " <IMG SRC= \" ../mod/ $modname /icon.gif \" HEIGHT=16 WIDTH=16 ALT= \" $modfullname\ " > " ;
}
}
print_simple_box ( " Activities " , $align = " CENTER " , $width = " 100% " , $color = " $THEME->cellheading " );
print_side_block ( " " , $moddata , " " , $modicon );
2002-07-31 14:19:35 +00:00
// Print a form to search forums
2002-06-19 05:04:31 +00:00
print_simple_box ( " Search Discussions " , $align = " CENTER " , $width = " 100% " , $color = " $THEME->cellheading " );
echo " <DIV ALIGN=CENTER> " ;
2002-08-02 09:50:53 +00:00
forum_print_search_form ( $course );
2002-06-19 05:04:31 +00:00
echo " </DIV> " ;
// Admin links and controls
if ( isteacher ( $course -> id )) {
$adminicon [] = " <IMG SRC= \" ../pix/i/edit.gif \" HEIGHT=16 WIDTH=16 ALT= \" Edit \" > " ;
2002-07-30 03:35:53 +00:00
if ( isediting ( $course -> id )) {
2002-06-19 05:04:31 +00:00
$admindata [] = " <A HREF= \" view.php?id= $course->id &edit=off \" >Turn editing off</A> " ;
} else {
$admindata [] = " <A HREF= \" view.php?id= $course->id &edit=on \" >Turn editing on</A> " ;
}
2002-08-01 03:50:27 +00:00
if ( $teacherforum = forum_get_course_forum ( $course -> id , " teacher " )) {
2002-07-04 08:30:36 +00:00
$admindata [] = " <A HREF= \" ../mod/forum/view.php?f= $teacherforum->id\ " > Teacher Forum ...</ A > " ;
$adminicon [] = " <IMG SRC= \" ../mod/forum/icon.gif \" HEIGHT=16 WIDTH=16 ALT= \" Teacher Forum \" > " ;
}
2002-06-19 05:04:31 +00:00
$admindata [] = " <A HREF= \" edit.php?id= $course->id\ " > Course settings ...</ A > " ;
2002-07-04 08:30:36 +00:00
$adminicon [] = " <IMG SRC= \" ../pix/i/settings.gif \" HEIGHT=16 WIDTH=16 ALT= \" Course settings \" > " ;
2002-06-19 05:04:31 +00:00
$admindata [] = " <A HREF= \" log.php?id= $course->id\ " > Logs ...</ A > " ;
$adminicon [] = " <IMG SRC= \" ../pix/i/log.gif \" HEIGHT=16 WIDTH=16 ALT= \" Log \" > " ;
$admindata [] = " <A HREF= \" ../files/index.php?id= $course->id\ " > Files ...</ A > " ;
$adminicon [] = " <IMG SRC= \" ../files/pix/files.gif \" HEIGHT=16 WIDTH=16 ALT= \" Files \" > " ;
print_simple_box ( " Administration " , $align = " CENTER " , $width = " 100% " , $color = " $THEME->cellheading " );
print_side_block ( " " , $admindata , " " , $adminicon );
}
// Start main column
echo " </TD><TD WIDTH= \" * \" > " ;
print_simple_box ( " Topic Outline " , $align = " CENTER " , $width = " 100% " , $color = " $THEME->cellheading " );
2002-06-25 11:49:06 +00:00
// Everything below uses "section" terminology - each "section" is a topic.
2002-06-19 05:04:31 +00:00
2002-06-25 11:49:06 +00:00
// Now all the sectionly modules
2002-06-19 05:04:31 +00:00
$timenow = time ();
2002-06-25 11:49:06 +00:00
$section = 1 ;
2002-06-19 05:04:31 +00:00
echo " <TABLE BORDER=0 CELLPADDING=8 CELLSPACING=0 WIDTH=100%> " ;
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 ) {
$highlightcolor = $THEME -> cellheading2 ;
} else {
$highlightcolor = $THEME -> cellheading ;
}
echo " <TR> " ;
echo " <TD NOWRAP BGCOLOR= \" $highlightcolor\ " VALIGN = top WIDTH = 20 > " ;
2002-06-25 11:49:06 +00:00
echo " <P ALIGN=CENTER><FONT SIZE=3><B> $section </B></FONT></P> " ;
2002-06-19 05:04:31 +00:00
echo " </TD> " ;
echo " <TD VALIGN=top BGCOLOR= \" $THEME->cellcontent\ " WIDTH = \ " 100% \" > " ;
2002-06-25 11:49:06 +00:00
if ( ! $thissection = $sections [ $section ]) {
$thissection -> course = $course -> id ; // Create a new section structure
$thissection -> section = $section ;
$thissection -> summary = " " ;
$thissection -> id = insert_record ( " course_sections " , $thissection );
2002-06-19 05:04:31 +00:00
}
2002-07-30 03:35:53 +00:00
if ( isediting ( $course -> id )) {
2002-06-25 11:49:06 +00:00
$thissection -> summary .= " <A HREF=editsection.php?id= $thissection->id ><IMG SRC= \" ../pix/t/edit.gif \" BORDER=0 ALT= \" Edit summary \" ></A></P> " ;
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
echo " <P> " ;
2002-06-25 11:49:06 +00:00
if ( $thissection -> sequence ) {
2002-06-19 05:04:31 +00:00
2002-06-25 11:49:06 +00:00
$thissectionmods = explode ( " , " , $thissection -> sequence );
2002-06-19 05:04:31 +00:00
2002-06-25 11:49:06 +00:00
foreach ( $thissectionmods as $modnumber ) {
2002-06-19 05:04:31 +00:00
$mod = $mods [ $modnumber ];
$instancename = get_field ( " $mod->modname " , " name " , " id " , " $mod->instance " );
2002-06-25 03:32:50 +00:00
echo " <IMG SRC= \" ../mod/ $mod->modname /icon.gif \" HEIGHT=16 WIDTH=16 ALT= \" $mod->modfullname\ " > " ;
echo " <A TITLE= \" $mod->modfullname\ " " ;
echo " HREF= \" ../mod/ $mod->modname /view.php?id= $mod->id\ " > $instancename </ A > " ;
2002-07-30 03:35:53 +00:00
if ( isediting ( $course -> id )) {
2002-06-19 05:04:31 +00:00
echo make_editing_buttons ( $mod -> id );
}
echo " <BR> \n " ;
}
}
echo " </UL></P> \n " ;
2002-07-30 03:35:53 +00:00
if ( isediting ( $course -> id )) {
2002-06-19 05:04:31 +00:00
echo " <DIV ALIGN=right> " ;
2002-06-25 11:49:06 +00:00
popup_form ( " $CFG->wwwroot /course/mod.php?id= $course->id §ion= $section &add= " ,
$modtypes , " section $section " , " " , " Add... " );
2002-06-19 05:04:31 +00:00
echo " </DIV> " ;
}
echo " </TD> " ;
echo " <TD NOWRAP BGCOLOR= \" $highlightcolor\ " VALIGN = top ALIGN = CENTER WIDTH = 10 > " ;
echo " <FONT SIZE=1> " ;
if ( isset ( $USER -> topic )) {
2002-06-25 11:49:06 +00:00
echo " <A HREF= \" view.php?id= $course->id &topic=all \" TITLE= \" Show all topics \" ><IMG SRC=../pix/i/all.gif BORDER=0></A><BR><BR> " ;
2002-06-19 05:04:31 +00:00
} else {
2002-06-25 11:49:06 +00:00
echo " <A HREF= \" view.php?id= $course->id &topic= $section\ " TITLE = \ " Show only topic $section\ " >< IMG SRC =../ pix / i / one . gif 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-06-25 11:49:06 +00:00
echo " <A HREF= \" view.php?id= $course->id &marker= $section\ " TITLE = \ " Mark this topic as the current topic \" ><IMG SRC=../pix/i/marker.gif BORDER=0></A><BR><BR> " ;
2002-06-19 05:04:31 +00:00
}
echo " </TD> " ;
echo " </TR> " ;
echo " <TR><TD COLSPAN=3><IMG SRC= \" ../pix/spacer.gif \" WIDTH=1 HEIGHT=1></TD></TR> " ;
2002-06-25 11:49:06 +00:00
$section ++ ;
2002-06-19 05:04:31 +00:00
}
echo " </TABLE> " ;
echo " </TD><TD WIDTH=180> " ;
// Print all the news items.
2002-08-01 03:50:27 +00:00
if ( $news = forum_get_course_forum ( $course -> id , " news " )) {
2002-06-19 05:04:31 +00:00
print_simple_box ( " Latest News " , $align = " CENTER " , $width = " 100% " , $color = " $THEME->cellheading " );
print_simple_box_start ( " CENTER " , " 100% " , " #FFFFFF " , 3 , 0 );
echo " <FONT SIZE=1> " ;
2002-08-01 03:50:27 +00:00
forum_print_latest_discussions ( $news -> id , $course -> newsitems , " minimal " , " DESC " , false );
2002-06-19 05:04:31 +00:00
echo " </FONT> " ;
print_simple_box_end ();
}
echo " <BR> " ;
// Print all the recent activity
print_simple_box ( " Recent Activity " , $align = " CENTER " , $width = " 100% " , $color = " $THEME->cellheading " );
print_simple_box_start ( " CENTER " , " 100% " , " #FFFFFF " , 3 , 0 );
print_recent_activity ( $course );
print_simple_box_end ();
echo " </TD></TR></TABLE> \n " ;
?>