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
);
18 } else if (!isset($USER->id
)) {
19 $headerbutton = "<FONT SIZE=2><A HREF=\"login/\">".get_string("login")."</A></FONT>";
21 print_header("$site->fullname", "$site->fullname", "", "",
22 "<META NAME=\"Description\" CONTENT=\"".stripslashes(strip_tags($site->summary
))."\">",
29 <TABLE WIDTH
="100%" BORDER
="0" CELLSPACING
="5" CELLPADDING
="5">
31 <TD VALIGN
="TOP" NOWRAP
>
34 $sections = get_all_sections($site->id
);
36 if ($site->newsitems
> 0 or $sections[0]->sequence
or isediting($site->id
)) {
38 if ($sections[0]->sequence
or isediting($site->id
)) {
39 get_all_mods($site->id
, $mods, $modnames, $modnamesplural, $modnamesused);
40 print_simple_box(get_string("mainmenu"), "CENTER", "100%", "$THEME->cellheading");
43 if ($sections[0]->sequence
) {
44 print_section($site->id
, $sections[0], $mods, $modnamesused, true);
47 if (isediting($site->id
)) {
48 echo "<DIV ALIGN=right>";
49 popup_form("$CFG->wwwroot/course/mod.php?id=$site->id§ion=0&add=",
50 $modnames, "section0", "", "Add...");
54 if ($site->newsitems
> 0 ) {
55 print_simple_box(get_string("courses"), "CENTER", "100%", "$THEME->cellheading");
56 print_all_courses($cat=1, "minimal", 10);
58 echo "<IMG SRC=\"pix/spacer.gif\" WIDTH=200 HEIGHT=0><BR>";
62 print_admin_links($site->id
);
68 <TD WIDTH
="70%" VALIGN
="TOP">
69 <?
if ($site->newsitems
== 0 ) {
70 print_simple_box(get_string("availablecourses"), "CENTER", "100%", "$THEME->cellheading");
71 echo "<IMG HEIGHT=8 SRC=\"pix/spacer.gif\" ALT=\"\"><BR>";
75 if (! $newsforum = forum_get_course_forum($site->id
, "news")) {
76 error("Could not find or create a main news forum for the site");
79 if (isset($USER->id
)) {
80 $SESSION->fromdiscussion
= "$CFG->wwwroot";
81 save_session("SESSION");
82 if (forum_is_subscribed($USER->id
, $newsforum->id
)) {
83 $subtext = get_string("unsubscribe", "forum");
85 $subtext = get_string("subscribe", "forum");
87 $headertext = "<TABLE BORDER=0 WIDTH=100% CELLPADDING=0 CELLSPACING=0><TR>
88 <TD>".get_string("sitenews")."</TD>
89 <TD ALIGN=RIGHT><FONT SIZE=1>
90 <A HREF=\"mod/forum/subscribe.php?id=$newsforum->id\">$subtext</A>
93 $headertext = get_string("sitenews");
95 print_simple_box($headertext, "CENTER", "100%", $THEME->cellheading
);
96 echo "<IMG HEIGHT=8 SRC=\"pix/spacer.gif\" ALT=\"\"><BR>";
97 forum_print_latest_discussions($newsforum->id
, $site->newsitems
);
102 <TD WIDTH
="30%" VALIGN
="TOP">
104 if (isediting($site->id
)) {
105 $site->summary
.= "<BR><CENTER><A HREF=\"admin/site.php\"><IMG SRC=\"pix/i/edit.gif\" BORDER=0></A>";
107 print_simple_box($site->summary
, "", "100%", $THEME->cellheading
);
113 <?
include("$CFG->dirroot/theme/$CFG->theme/footer.html"); ?
>
116 <A WIDTH
=85 HEIGHT
=25 HREF
="http://moodle.com/"><IMG SRC
="pix/madewithmoodle.gif" BORDER
=0></A
>