Slight changes to userdate() function. It now uses gmstrftime() instead of
[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
9 if (! $site = get_record("course", "category", 0)) {
10 redirect("$CFG->wwwroot/admin/");
11 }
12
79a69a3a 13 if (isset($USER->id)) {
a325bd2b 14 $headerbutton = update_course_icon($site->id);
15 } else {
16 $headerbutton = "<FONT SIZE=2><A HREF=\"login/\">Log in</A></FONT>";
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
b5fe4c93 31 if ($site->newsitems > 0 or $readings or $USER->editing) {
e4b5c8c0 32
33 print_simple_box("Main Menu", $align="CENTER", $width="100%", $color="$THEME->cellheading");
34
b5fe4c93 35 if ($site->newsitems > 0 ) {
e4b5c8c0 36 echo "<LI><A TITLE=\"Available courses on this server\" HREF=\"course/\"><B>Courses</B></A><BR></LI>";
e4b5c8c0 37 }
38
39 if ($readings) {
40 foreach ($readings as $reading) {
41 echo "<LI>$reading";
42 }
693c02d0 43 }
b7b6fef9 44 if ($USER->editing) {
9ccbad71 45 echo "<P align=right><A HREF=\"$CFG->wwwroot/course/mod.php?id=$site->id&section=0&add=reading\">Add Reading</A>...</P>";
b7b6fef9 46 } else {
47 echo "<BR><BR>";
48 }
693c02d0 49 }
50
a166f060 51
a166f060 52 if (isadmin()) {
53 print_simple_box("Admin", $align="CENTER", $width="100%", $color="$THEME->cellheading");
de973a18 54 echo "<LI><A HREF=\"$CFG->wwwroot/admin/\">Admin Page...</A></LI>";
ccfa2080 55 echo "<LI><A HREF=\"$CFG->wwwroot/course/log.php?id=$site->id\">Site logs...</A></LI>";
de973a18 56 echo "<LI><A HREF=\"$CFG->wwwroot/admin/site.php\">Site settings...</A></LI>";
a166f060 57 }
f9903ed0 58 ?>
59
60 </TD>
61
89997e59 62 <TD WIDTH="70%" VALIGN="TOP">
b5fe4c93 63 <? if ($site->newsitems == 0 ) {
d887b5a7 64 print_simple_box("Available Courses", $align="CENTER", $width="100%", $color="$THEME->cellheading");
65 echo "<IMG HEIGHT=8 SRC=\"pix/spacer.gif\" ALT=\"\"><BR>";
d887b5a7 66 print_all_courses();
67
68 } else {
30e1a2ee 69 if (! $newsforum = get_course_news_forum($site->id)) {
70 error("Could not find or create a main forum for the site");
71 }
72
79a69a3a 73 if (isset($USER->id)) {
30e1a2ee 74 $SESSION->fromdiscuss = "$CFG->wwwroot";
75 if (is_subscribed($USER->id, $newsforum->id)) {
76 $subtext = "Unsubscribe from news";
77 } else {
78 $subtext = "Subscribe me by mail";
79 }
80 $headertext = "<TABLE BORDER=0 WIDTH=100% CELLPADDING=0 CELLSPACING=0><TR>
81 <TD>Site News</TD>
82 <TD ALIGN=RIGHT><FONT SIZE=1>
c2fbfe6d 83 <A HREF=\"mod/forum/subscribe.php?id=$newsforum->id\">$subtext</A>
30e1a2ee 84 </TD></TR></TABLE>";
85 } else {
86 $headertext = "Site News";
87 }
88 print_simple_box("$headertext", $align="CENTER", $width="100%", $color="$THEME->cellheading");
d887b5a7 89 echo "<IMG HEIGHT=8 SRC=\"pix/spacer.gif\" ALT=\"\"><BR>";
b5fe4c93 90 print_forum_latest_topics($newsforum->id, $site->newsitems);
d887b5a7 91 }
f9903ed0 92 ?>
d887b5a7 93
f9903ed0 94 </TD>
95 <TD WIDTH="30%" VALIGN="TOP">
45d1cc4a 96 <?
97 if ($USER->editing) {
98 $site->summary .= "<BR><CENTER><A HREF=\"admin/site.php\"><IMG SRC=\"pix/i/edit.gif\" BORDER=0></A>";
99 }
100 print_simple_box($site->summary, $align="", $width="100%", $color="$THEME->cellheading");
101 ?>
f9903ed0 102 </TD>
103 </TR>
104</TABLE>
105
3054741a 106<? include("$CFG->dirroot/theme/$CFG->theme/footer.html"); ?>
f9903ed0 107
108<P ALIGN=center>
109<A WIDTH=85 HEIGHT=25 HREF="http://moodle.com/"><IMG SRC="pix/madewithmoodle.gif" BORDER=0></A>
110</P>
111