2 // index.php - the front page.
5 include("course/lib.php");
6 include("mod/reading/lib.php");
7 include("mod/forum/lib.php");
9 if (! $site = get_site()) {
10 redirect("$CFG->wwwroot/admin/");
14 if (moodle_needs_upgrading()) {
15 redirect("$CFG->wwwroot/admin/");
17 $headerbutton = update_course_icon($site->id
);
19 if (isset($USER->id
)) {
20 $headerbutton = "<FONT SIZE=2><A HREF=\"$CFG->wwwroot/login/logout.php\">".get_string("logout")."</A></FONT>";
22 $headerbutton = "<FONT SIZE=2><A HREF=\"$CFG->wwwroot/login/\">".get_string("login")."</A></FONT>";
25 print_header("$site->fullname", "$site->fullname", "", "",
26 "<META NAME=\"Description\" CONTENT=\"".stripslashes(strip_tags($site->summary
))."\">",
34 <TABLE WIDTH
="100%" BORDER
="0" CELLSPACING
="5" CELLPADDING
="5">
37 $sections = get_all_sections($site->id
);
39 if ($site->newsitems
> 0 or $sections[0]->sequence
or isediting($site->id
)) {
41 echo "<TD WIDTH=\"$side\" VALIGN=TOP NOWRAP>"; $firstcolumn=true;
43 if ($sections[0]->sequence
or isediting($site->id
)) {
44 get_all_mods($site->id
, $mods, $modnames, $modnamesplural, $modnamesused);
45 print_simple_box(get_string("mainmenu"), "CENTER", $side, "$THEME->cellheading");
48 if ($sections[0]->sequence
) {
49 print_section($site->id
, $sections[0], $mods, $modnamesused, true, $side);
52 if (isediting($site->id
)) {
53 echo "<DIV ALIGN=right>";
54 popup_form("$CFG->wwwroot/course/mod.php?id=$site->id§ion=0&add=",
55 $modnames, "section0", "", "Add...");
59 if ($site->newsitems
> 0 ) {
60 print_simple_box(get_string("courses"), "CENTER", $side, "$THEME->cellheading");
61 print_all_courses($cat=1, "minimal", 10);
63 print_spacer(1,$side);
68 echo "<TD WIDTH=\"$side\" VALIGN=TOP NOWRAP>"; $firstcolumn=true;
70 print_admin_links($site->id
, $side);
76 echo "<TD WIDTH=70% VALIGN=TOP>";
78 if ($site->newsitems
== 0 ) {
79 print_simple_box(get_string("availablecourses"), "CENTER", "100%", "$THEME->cellheading");
84 if (! $newsforum = forum_get_course_forum($site->id
, "news")) {
85 error("Could not find or create a main news forum for the site");
88 if (isset($USER->id
)) {
89 $SESSION->fromdiscussion
= "$CFG->wwwroot";
90 save_session("SESSION");
91 if (forum_is_subscribed($USER->id
, $newsforum->id
)) {
92 $subtext = get_string("unsubscribe", "forum");
94 $subtext = get_string("subscribe", "forum");
96 $headertext = "<TABLE BORDER=0 WIDTH=100% CELLPADDING=0 CELLSPACING=0><TR>
97 <TD>".get_string("sitenews")."</TD>
98 <TD ALIGN=RIGHT><FONT SIZE=1>
99 <A HREF=\"mod/forum/subscribe.php?id=$newsforum->id\">$subtext</A>
102 $headertext = get_string("sitenews");
104 print_simple_box($headertext, "CENTER", "100%", $THEME->cellheading
);
106 forum_print_latest_discussions($newsforum->id
, $site->newsitems
);
110 echo "<TD WIDTH=30% VALIGN=TOP>";
112 if (isediting($site->id
)) {
113 $site->summary
.= "<BR><CENTER><A HREF=\"admin/site.php\"><IMG SRC=\"pix/i/edit.gif\" BORDER=0></A>";
116 print_simple_box($site->summary
, "", "100%", $THEME->cellheading
);
117 print_spacer(1,$side);
124 <?
print_footer("home"); // Please do not modify this line ?>