Some work so far on the assignment module ... NOT FINISHED YET!
[moodle.git] / index.php
CommitLineData
f9903ed0 1<? // $Id$
2 // index.php - the front page.
3
4 require("config.php");
30e1a2ee 5 include("course/lib.php");
693c02d0 6 include("mod/reading/lib.php");
f93f848a 7 include("mod/forum/lib.php");
f9903ed0 8
8553b700 9 if (! $site = get_site()) {
f9903ed0 10 redirect("$CFG->wwwroot/admin/");
11 }
12
79a69a3a 13 if (isset($USER->id)) {
a325bd2b 14 $headerbutton = update_course_icon($site->id);
15 } else {
ed5ab9f7 16 $headerbutton = "<FONT SIZE=2><A HREF=\"login/\">".get_string("login")."</A></FONT>";
a325bd2b 17 }
c8138d90 18 print_header("$site->fullname", "$site->fullname", "", "",
de973a18 19 "<META NAME=\"Description\" CONTENT=\"".stripslashes(strip_tags($site->summary))."\">",
a325bd2b 20 true, $headerbutton);
f9903ed0 21
3054741a 22
f9903ed0 23?>
24
3054741a 25
f9903ed0 26<TABLE WIDTH="100%" BORDER="0" CELLSPACING="5" CELLPADDING="5">
27 <TR>
89997e59 28 <TD VALIGN="TOP" NOWRAP>
e4b5c8c0 29 <? $readings = list_all_readings();
30
2c309dc2 31 if ($site->newsitems > 0 or $readings or isediting($site->id)) {
e4b5c8c0 32
ed5ab9f7 33 print_simple_box(get_string("mainmenu"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
e4b5c8c0 34
b5fe4c93 35 if ($site->newsitems > 0 ) {
ed5ab9f7 36 echo "<LI><A TITLE=\"".
37 get_string("availablecourses").
38 "\" HREF=\"course/\"><B>".
39 get_string("courses").
40 "</B></A><BR></LI>";
e4b5c8c0 41 }
42
43 if ($readings) {
44 foreach ($readings as $reading) {
45 echo "<LI>$reading";
46 }
693c02d0 47 }
2c309dc2 48 if (isediting($site->id)) {
ed5ab9f7 49 echo "<P align=right><A HREF=\"$CFG->wwwroot/course/mod.php?id=$site->id&section=0&add=reading\">".
50 get_string("addreading", "reading")."</A>...</P>";
b7b6fef9 51 } else {
52 echo "<BR><BR>";
53 }
693c02d0 54 }
55
a166f060 56
a166f060 57 if (isadmin()) {
ed5ab9f7 58 print_simple_box(get_string("admin"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
59 echo "<LI><A HREF=\"$CFG->wwwroot/admin/\">".get_string("adminpage")."...</A></LI>";
60 echo "<LI><A HREF=\"$CFG->wwwroot/course/log.php?id=$site->id\">".get_string("sitelogs")."...</A></LI>";
61 echo "<LI><A HREF=\"$CFG->wwwroot/admin/site.php\">".get_string("sitesettings")."...</A></LI>";
a166f060 62 }
f9903ed0 63 ?>
64
65 </TD>
66
89997e59 67 <TD WIDTH="70%" VALIGN="TOP">
b5fe4c93 68 <? if ($site->newsitems == 0 ) {
ed5ab9f7 69 print_simple_box(get_string("availablecourses"), "CENTER", "100%", "$THEME->cellheading");
d887b5a7 70 echo "<IMG HEIGHT=8 SRC=\"pix/spacer.gif\" ALT=\"\"><BR>";
d887b5a7 71 print_all_courses();
72
73 } else {
30e1a2ee 74 if (! $newsforum = get_course_news_forum($site->id)) {
75 error("Could not find or create a main forum for the site");
76 }
77
79a69a3a 78 if (isset($USER->id)) {
501cdbd8 79 $SESSION->fromdiscussion = "$CFG->wwwroot";
30e1a2ee 80 if (is_subscribed($USER->id, $newsforum->id)) {
ed5ab9f7 81 $subtext = get_string("unsubscribe", "forum");
30e1a2ee 82 } else {
ed5ab9f7 83 $subtext = get_string("subscribe", "forum");
30e1a2ee 84 }
85 $headertext = "<TABLE BORDER=0 WIDTH=100% CELLPADDING=0 CELLSPACING=0><TR>
ed5ab9f7 86 <TD>".get_string("sitenews")."</TD>
30e1a2ee 87 <TD ALIGN=RIGHT><FONT SIZE=1>
c2fbfe6d 88 <A HREF=\"mod/forum/subscribe.php?id=$newsforum->id\">$subtext</A>
30e1a2ee 89 </TD></TR></TABLE>";
90 } else {
ed5ab9f7 91 $headertext = get_string("sitenews");
30e1a2ee 92 }
ed5ab9f7 93 print_simple_box($headertext, "CENTER", "100%", $THEME->cellheading);
d887b5a7 94 echo "<IMG HEIGHT=8 SRC=\"pix/spacer.gif\" ALT=\"\"><BR>";
b5fe4c93 95 print_forum_latest_topics($newsforum->id, $site->newsitems);
d887b5a7 96 }
f9903ed0 97 ?>
d887b5a7 98
f9903ed0 99 </TD>
100 <TD WIDTH="30%" VALIGN="TOP">
45d1cc4a 101 <?
2c309dc2 102 if (isediting($site->id)) {
45d1cc4a 103 $site->summary .= "<BR><CENTER><A HREF=\"admin/site.php\"><IMG SRC=\"pix/i/edit.gif\" BORDER=0></A>";
104 }
ed5ab9f7 105 print_simple_box($site->summary, "", "100%", $THEME->cellheading);
45d1cc4a 106 ?>
f9903ed0 107 </TD>
108 </TR>
109</TABLE>
110
3054741a 111<? include("$CFG->dirroot/theme/$CFG->theme/footer.html"); ?>
f9903ed0 112
113<P ALIGN=center>
114<A WIDTH=85 HEIGHT=25 HREF="http://moodle.com/"><IMG SRC="pix/madewithmoodle.gif" BORDER=0></A>
115</P>
116