2002-12-07 07:27:18 +00:00
|
|
|
<?PHP // $Id$
|
|
|
|
// index.php - the front page.
|
2001-11-22 06:23:56 +00:00
|
|
|
|
|
|
|
require("config.php");
|
2002-12-02 01:12:06 +00:00
|
|
|
require("course/lib.php");
|
|
|
|
require("mod/resource/lib.php");
|
|
|
|
require("mod/forum/lib.php");
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2002-07-11 05:30:57 +00:00
|
|
|
if (! $site = get_site()) {
|
2002-09-22 05:33:54 +00:00
|
|
|
redirect("$CFG->wwwroot/admin/index.php");
|
2001-11-22 06:23:56 +00:00
|
|
|
}
|
|
|
|
|
2002-08-09 02:45:15 +00:00
|
|
|
if (isadmin()) {
|
|
|
|
if (moodle_needs_upgrading()) {
|
2002-09-22 05:33:54 +00:00
|
|
|
redirect("$CFG->wwwroot/admin/index.php");
|
2002-08-09 02:45:15 +00:00
|
|
|
}
|
2002-06-16 03:25:10 +00:00
|
|
|
$headerbutton = update_course_icon($site->id);
|
2002-08-17 07:02:35 +00:00
|
|
|
} else {
|
|
|
|
if (isset($USER->id)) {
|
|
|
|
$headerbutton = "<FONT SIZE=2><A HREF=\"$CFG->wwwroot/login/logout.php\">".get_string("logout")."</A></FONT>";
|
|
|
|
} else {
|
2002-09-16 13:03:31 +00:00
|
|
|
$headerbutton = "<FONT SIZE=2><A HREF=\"$CFG->wwwroot/login/index.php\">".get_string("login")."</A></FONT>";
|
2002-08-17 07:02:35 +00:00
|
|
|
}
|
2002-06-16 03:25:10 +00:00
|
|
|
}
|
2002-09-23 15:41:06 +00:00
|
|
|
print_header("$site->fullname", "$site->fullname", "home", "",
|
2002-06-10 05:41:36 +00:00
|
|
|
"<META NAME=\"Description\" CONTENT=\"".stripslashes(strip_tags($site->summary))."\">",
|
2002-11-10 07:57:11 +00:00
|
|
|
true, "", $headerbutton);
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2002-12-09 07:48:12 +00:00
|
|
|
$side = 165;
|
2002-08-23 03:55:49 +00:00
|
|
|
|
2001-11-22 06:23:56 +00:00
|
|
|
?>
|
|
|
|
|
2001-11-25 15:45:35 +00:00
|
|
|
|
2001-11-22 06:23:56 +00:00
|
|
|
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="5" CELLPADDING="5">
|
|
|
|
<TR>
|
2002-12-07 07:27:18 +00:00
|
|
|
<?PHP
|
2002-08-26 20:38:56 +00:00
|
|
|
$sections = get_all_sections($site->id);
|
|
|
|
|
|
|
|
if ($site->newsitems > 0 or $sections[0]->sequence or isediting($site->id)) {
|
|
|
|
|
|
|
|
echo "<TD WIDTH=\"$side\" VALIGN=TOP NOWRAP>"; $firstcolumn=true;
|
|
|
|
|
|
|
|
if ($sections[0]->sequence or isediting($site->id)) {
|
|
|
|
get_all_mods($site->id, $mods, $modnames, $modnamesplural, $modnamesused);
|
2002-12-09 07:35:40 +00:00
|
|
|
print_section_block(get_string("mainmenu"), $site, $sections[0],
|
|
|
|
$mods, $modnames, $modnamesused, true, $side, isediting($site->id));
|
2002-08-26 20:38:56 +00:00
|
|
|
}
|
2002-08-03 08:40:25 +00:00
|
|
|
|
2002-08-26 20:38:56 +00:00
|
|
|
if ($site->newsitems > 0 ) {
|
2002-09-09 11:48:11 +00:00
|
|
|
$categories = get_all_categories();
|
|
|
|
if (count($categories) > 1) {
|
|
|
|
print_course_categories($categories, "none", $side);
|
|
|
|
} else {
|
|
|
|
$category = array_shift($categories);
|
2002-12-09 07:51:31 +00:00
|
|
|
print_all_courses($category->id, "minimal", 10, $side);
|
2002-09-09 11:48:11 +00:00
|
|
|
}
|
2002-08-26 20:38:56 +00:00
|
|
|
}
|
|
|
|
print_spacer(1,$side);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isadmin()) {
|
|
|
|
if (!$firstcolumn) {
|
|
|
|
echo "<TD WIDTH=\"$side\" VALIGN=TOP NOWRAP>"; $firstcolumn=true;
|
2002-02-26 06:35:18 +00:00
|
|
|
}
|
2002-08-26 20:38:56 +00:00
|
|
|
print_admin_links($site->id, $side);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($firstcolumn) {
|
|
|
|
echo "</TD>";
|
|
|
|
}
|
2002-08-26 20:41:02 +00:00
|
|
|
echo "<TD WIDTH=70% VALIGN=TOP>";
|
2002-08-26 20:38:56 +00:00
|
|
|
|
|
|
|
if ($site->newsitems == 0 ) {
|
2002-12-09 07:35:40 +00:00
|
|
|
print_heading_block(get_string("availablecourses"));
|
2002-08-26 20:38:56 +00:00
|
|
|
print_spacer(8,1);
|
2002-09-10 13:47:56 +00:00
|
|
|
$categories = get_all_categories();
|
|
|
|
if (count($categories) > 1) {
|
|
|
|
print_course_categories($categories, "index");
|
|
|
|
} else {
|
|
|
|
print_all_courses("all");
|
|
|
|
}
|
2002-08-26 20:38:56 +00:00
|
|
|
|
|
|
|
} else {
|
|
|
|
if (! $newsforum = forum_get_course_forum($site->id, "news")) {
|
|
|
|
error("Could not find or create a main news forum for the site");
|
2001-12-11 04:30:58 +00:00
|
|
|
}
|
2002-06-10 05:19:03 +00:00
|
|
|
|
2002-08-26 20:38:56 +00:00
|
|
|
if (isset($USER->id)) {
|
|
|
|
$SESSION->fromdiscussion = "$CFG->wwwroot";
|
|
|
|
save_session("SESSION");
|
|
|
|
if (forum_is_subscribed($USER->id, $newsforum->id)) {
|
|
|
|
$subtext = get_string("unsubscribe", "forum");
|
2002-06-16 09:44:22 +00:00
|
|
|
} else {
|
2002-08-26 20:38:56 +00:00
|
|
|
$subtext = get_string("subscribe", "forum");
|
2002-06-16 09:44:22 +00:00
|
|
|
}
|
2002-08-26 20:38:56 +00:00
|
|
|
$headertext = "<TABLE BORDER=0 WIDTH=100% CELLPADDING=0 CELLSPACING=0><TR>
|
|
|
|
<TD>".get_string("sitenews")."</TD>
|
|
|
|
<TD ALIGN=RIGHT><FONT SIZE=1>
|
|
|
|
<A HREF=\"mod/forum/subscribe.php?id=$newsforum->id\">$subtext</A>
|
|
|
|
</TD></TR></TABLE>";
|
|
|
|
} else {
|
|
|
|
$headertext = get_string("sitenews");
|
2002-06-10 05:19:03 +00:00
|
|
|
}
|
2002-12-09 07:35:40 +00:00
|
|
|
print_heading_block($headertext);
|
2002-08-26 20:38:56 +00:00
|
|
|
print_spacer(8,1);
|
|
|
|
forum_print_latest_discussions($newsforum->id, $site->newsitems);
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "</TD>";
|
|
|
|
echo "<TD WIDTH=30% VALIGN=TOP>";
|
|
|
|
|
|
|
|
if (isediting($site->id)) {
|
|
|
|
$site->summary .= "<BR><CENTER><A HREF=\"admin/site.php\"><IMG SRC=\"pix/i/edit.gif\" BORDER=0></A>";
|
|
|
|
}
|
|
|
|
|
2002-12-09 07:45:45 +00:00
|
|
|
print_simple_box($site->summary, "", "100%", $THEME->cellcontent2);
|
2002-08-26 20:38:56 +00:00
|
|
|
print_spacer(1,$side);
|
|
|
|
echo "</TD>";
|
|
|
|
?>
|
2002-06-10 05:19:03 +00:00
|
|
|
|
2001-11-22 06:23:56 +00:00
|
|
|
</TR>
|
|
|
|
</TABLE>
|
|
|
|
|
2002-12-07 07:27:18 +00:00
|
|
|
<?PHP print_footer("home"); // Please do not modify this line ?>
|
2001-11-22 06:23:56 +00:00
|
|
|
|