2002-12-07 07:27:18 +00:00
|
|
|
<?PHP // $Id$
|
|
|
|
// index.php - the front page.
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2003-01-05 14:19:20 +00:00
|
|
|
require_once("config.php");
|
|
|
|
require_once("course/lib.php");
|
|
|
|
require_once("mod/resource/lib.php");
|
|
|
|
require_once("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
|
|
|
}
|
2003-05-03 05:57:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (empty($USER->id)) {
|
|
|
|
$loginstring = "<font size=2><a href=\"$CFG->wwwroot/login/index.php\">".get_string("login")."</a></font>";
|
2002-08-17 07:02:35 +00:00
|
|
|
} else {
|
2003-05-03 05:57:29 +00:00
|
|
|
$loginstring = "<font size=1>".user_login_string($site)."</font>";
|
2002-06-16 03:25:10 +00:00
|
|
|
}
|
2003-01-20 08:01:46 +00:00
|
|
|
|
2003-05-03 06:50:29 +00:00
|
|
|
if (empty($CFG->langmenu)) {
|
|
|
|
$langmenu = "";
|
|
|
|
} else {
|
|
|
|
$currlang = current_language();
|
|
|
|
$langs = get_list_of_languages();
|
|
|
|
$langmenu = popup_form ("$CFG->wwwroot/?lang=", $langs, "chooselang", $currlang, "", "", "", true);
|
|
|
|
}
|
2003-01-20 08:01:46 +00:00
|
|
|
|
2003-06-03 03:23:29 +00:00
|
|
|
print_header(strip_tags($site->fullname), "$site->fullname", "home", "",
|
2003-05-17 03:46:31 +00:00
|
|
|
"<meta name=\"description\" content=\"".s(strip_tags($site->summary))."\">",
|
2003-05-03 05:57:29 +00:00
|
|
|
true, "", "<div align=right>$loginstring$langmenu</div>");
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2002-12-29 17:32:32 +00:00
|
|
|
$firstcolumn = false; // for now
|
2003-08-07 16:15:14 +00:00
|
|
|
$lastcolumn = false; // for now
|
2002-12-09 12:09:33 +00:00
|
|
|
$side = 175;
|
2002-08-23 03:55:49 +00:00
|
|
|
|
2003-08-07 16:15:14 +00:00
|
|
|
if (isediting($site->id)) {
|
|
|
|
$site->summary .= "<br><center><a href=\"admin/site.php\"><img src=\"pix/i/edit.gif\" border=0></a>";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($site->summary) {
|
|
|
|
$lastcolumn = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-22 06:23:56 +00:00
|
|
|
?>
|
|
|
|
|
2001-11-25 15:45:35 +00:00
|
|
|
|
2003-05-03 05:57:29 +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);
|
|
|
|
|
2003-05-03 05:57:29 +00:00
|
|
|
if ($site->newsitems > 0 or $sections[0]->sequence or isediting($site->id) or isadmin()) {
|
2002-08-26 20:38:56 +00:00
|
|
|
|
2003-05-03 05:57:29 +00:00
|
|
|
echo "<td width=\"$side\" valign=top nowrap>";
|
2002-12-29 17:32:32 +00:00
|
|
|
$firstcolumn=true;
|
2002-08-26 20:38:56 +00:00
|
|
|
|
|
|
|
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],
|
2003-07-12 06:52:26 +00:00
|
|
|
$mods, $modnames, $modnamesused, true, $side);
|
2002-08-26 20:38:56 +00:00
|
|
|
}
|
2002-08-03 08:40:25 +00:00
|
|
|
|
2003-05-03 05:57:29 +00:00
|
|
|
if (isadmin()) {
|
|
|
|
echo "<div align=\"center\">".update_course_icon($site->id)."</div>";
|
|
|
|
echo "<br />";
|
|
|
|
}
|
|
|
|
|
2003-07-30 13:02:45 +00:00
|
|
|
switch ($CFG->frontpage) {
|
|
|
|
case FRONTPAGENEWS: // print news links on the side
|
|
|
|
print_courses_sideblock(0, "$side");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FRONTPAGECOURSELIST:
|
|
|
|
case FRONTPAGECATEGORYNAMES:
|
|
|
|
if ($site->newsitems) {
|
|
|
|
if ($news = forum_get_course_forum($site->id, "news")) {
|
|
|
|
print_side_block_start(get_string("latestnews"), $side, "sideblocklatestnews");
|
|
|
|
echo "<font size=\"-2\">";
|
|
|
|
forum_print_latest_discussions($news->id, $site->newsitems, "minimal", "", false);
|
|
|
|
echo "</font>";
|
|
|
|
print_side_block_end();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2002-08-26 20:38:56 +00:00
|
|
|
}
|
|
|
|
print_spacer(1,$side);
|
|
|
|
}
|
|
|
|
|
2003-02-24 18:48:55 +00:00
|
|
|
if (iscreator()) {
|
2002-08-26 20:38:56 +00:00
|
|
|
if (!$firstcolumn) {
|
2003-05-03 05:57:29 +00:00
|
|
|
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) {
|
2003-05-03 05:57:29 +00:00
|
|
|
echo "</td>";
|
2002-08-26 20:38:56 +00:00
|
|
|
}
|
2003-08-07 16:15:14 +00:00
|
|
|
if ($lastcolumn) {
|
|
|
|
echo "<td width=\"70%\" valign=\"top\">";
|
|
|
|
} else {
|
|
|
|
echo "<td width=\"100%\" valign=\"top\">";
|
|
|
|
}
|
2002-08-26 20:38:56 +00:00
|
|
|
|
2003-07-30 13:02:45 +00:00
|
|
|
switch ($CFG->frontpage) { /// Display the main part of the front page.
|
|
|
|
case FRONTPAGENEWS:
|
|
|
|
if (! $newsforum = forum_get_course_forum($site->id, "news")) {
|
|
|
|
error("Could not find or create a main news forum for the site");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($USER->id)) {
|
|
|
|
$SESSION->fromdiscussion = "$CFG->wwwroot";
|
|
|
|
if (forum_is_subscribed($USER->id, $newsforum->id)) {
|
|
|
|
$subtext = get_string("unsubscribe", "forum");
|
|
|
|
} else {
|
|
|
|
$subtext = get_string("subscribe", "forum");
|
|
|
|
}
|
|
|
|
$headertext = "<table border=0 width=100% cellpadding=0 cellspacing=0><tr>
|
|
|
|
<td>$newsforum->name</td>
|
|
|
|
<td align=right><font size=1>
|
|
|
|
<a href=\"mod/forum/subscribe.php?id=$newsforum->id\">$subtext</a>
|
|
|
|
</td></tr></table>";
|
2002-06-16 09:44:22 +00:00
|
|
|
} else {
|
2003-07-30 13:02:45 +00:00
|
|
|
$headertext = $newsforum->name;
|
2002-06-16 09:44:22 +00:00
|
|
|
}
|
2003-07-30 13:02:45 +00:00
|
|
|
print_heading_block($headertext);
|
|
|
|
print_spacer(8,1);
|
|
|
|
forum_print_latest_discussions($newsforum->id, $site->newsitems);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FRONTPAGECOURSELIST:
|
|
|
|
case FRONTPAGECATEGORYNAMES:
|
|
|
|
if (isset($USER->id) and !isset($USER->admin)) {
|
|
|
|
print_heading_block(get_string("mycourses"));
|
|
|
|
print_spacer(8,1);
|
|
|
|
print_my_moodle();
|
|
|
|
} else {
|
|
|
|
print_heading_block(get_string("availablecourses"));
|
|
|
|
print_spacer(8,1);
|
|
|
|
if (count_records("course_categories") > 1) {
|
2003-08-07 16:15:14 +00:00
|
|
|
print_simple_box_start("center", "100%");
|
2003-07-30 13:02:45 +00:00
|
|
|
print_whole_category_list();
|
2003-08-07 16:15:14 +00:00
|
|
|
print_simple_box_end();
|
2003-08-12 16:44:22 +00:00
|
|
|
print_course_search();
|
2003-07-30 13:02:45 +00:00
|
|
|
} else {
|
|
|
|
print_courses(0, "100%");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2002-08-26 20:38:56 +00:00
|
|
|
}
|
|
|
|
|
2003-05-03 05:57:29 +00:00
|
|
|
echo "</td>";
|
2002-08-26 20:38:56 +00:00
|
|
|
|
2003-08-07 16:15:14 +00:00
|
|
|
if ($lastcolumn) {
|
|
|
|
echo "<td width=\"30%\" valign=\"top\">";
|
|
|
|
print_simple_box($site->summary, "", "100%", $THEME->cellcontent2, 5, "siteinfo");
|
|
|
|
print_spacer(1,$side);
|
|
|
|
echo "</td>";
|
|
|
|
}
|
2002-08-26 20:38:56 +00:00
|
|
|
?>
|
2002-06-10 05:19:03 +00:00
|
|
|
|
2003-05-03 05:57:29 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
2001-11-22 06:23:56 +00:00
|
|
|
|
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
|
|
|
|