mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
Fix for front page case when no left column
This commit is contained in:
parent
9ab327d6f7
commit
670fddf176
2 changed files with 81 additions and 76 deletions
|
@ -504,7 +504,7 @@ function print_side_block($heading="", $list=NULL, $footer="", $icons=NULL, $wid
|
||||||
echo "</TABLE><BR>\n\n";
|
echo "</TABLE><BR>\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function print_admin_links ($siteid, $width=190) {
|
function print_admin_links ($siteid, $width=180) {
|
||||||
global $THEME, $CFG;
|
global $THEME, $CFG;
|
||||||
|
|
||||||
print_simple_box(get_string("administration"), $align="CENTER", $width, $color="$THEME->cellheading");
|
print_simple_box(get_string("administration"), $align="CENTER", $width, $color="$THEME->cellheading");
|
||||||
|
|
155
index.php
155
index.php
|
@ -26,95 +26,100 @@
|
||||||
"<META NAME=\"Description\" CONTENT=\"".stripslashes(strip_tags($site->summary))."\">",
|
"<META NAME=\"Description\" CONTENT=\"".stripslashes(strip_tags($site->summary))."\">",
|
||||||
true, $headerbutton);
|
true, $headerbutton);
|
||||||
|
|
||||||
|
|
||||||
$side = 180;
|
$side = 180;
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="5" CELLPADDING="5">
|
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="5" CELLPADDING="5">
|
||||||
<TR>
|
<TR>
|
||||||
<TD WIDTH=<?=$side?> VALIGN="TOP" NOWRAP>
|
<?
|
||||||
<?
|
$sections = get_all_sections($site->id);
|
||||||
|
|
||||||
|
if ($site->newsitems > 0 or $sections[0]->sequence or isediting($site->id)) {
|
||||||
|
|
||||||
$sections = get_all_sections($site->id);
|
echo "<TD WIDTH=\"$side\" VALIGN=TOP NOWRAP>"; $firstcolumn=true;
|
||||||
|
|
||||||
if ($site->newsitems > 0 or $sections[0]->sequence or isediting($site->id)) {
|
if ($sections[0]->sequence or isediting($site->id)) {
|
||||||
|
get_all_mods($site->id, $mods, $modnames, $modnamesplural, $modnamesused);
|
||||||
if ($sections[0]->sequence or isediting($site->id)) {
|
print_simple_box(get_string("mainmenu"), "CENTER", $side, "$THEME->cellheading");
|
||||||
get_all_mods($site->id, $mods, $modnames, $modnamesplural, $modnamesused);
|
}
|
||||||
print_simple_box(get_string("mainmenu"), "CENTER", $side, "$THEME->cellheading");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($sections[0]->sequence) {
|
if ($sections[0]->sequence) {
|
||||||
print_section($site->id, $sections[0], $mods, $modnamesused, true, $side);
|
print_section($site->id, $sections[0], $mods, $modnamesused, true, $side);
|
||||||
}
|
|
||||||
|
|
||||||
if (isediting($site->id)) {
|
|
||||||
echo "<DIV ALIGN=right>";
|
|
||||||
popup_form("$CFG->wwwroot/course/mod.php?id=$site->id§ion=0&add=",
|
|
||||||
$modnames, "section0", "", "Add...");
|
|
||||||
echo "</DIV>";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($site->newsitems > 0 ) {
|
|
||||||
print_simple_box(get_string("courses"), "CENTER", "100%", "$THEME->cellheading");
|
|
||||||
print_all_courses($cat=1, "minimal", 10);
|
|
||||||
}
|
|
||||||
print_spacer(1,$side);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isadmin()) {
|
|
||||||
print_admin_links($site->id);
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
</TD>
|
|
||||||
|
|
||||||
<TD WIDTH="70%" VALIGN="TOP">
|
|
||||||
<? if ($site->newsitems == 0 ) {
|
|
||||||
print_simple_box(get_string("availablecourses"), "CENTER", "100%", "$THEME->cellheading");
|
|
||||||
print_spacer(8,1);
|
|
||||||
print_all_courses();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
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";
|
|
||||||
save_session("SESSION");
|
|
||||||
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>".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");
|
|
||||||
}
|
|
||||||
print_simple_box($headertext, "CENTER", "100%", $THEME->cellheading);
|
|
||||||
print_spacer(8,1);
|
|
||||||
forum_print_latest_discussions($newsforum->id, $site->newsitems);
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
</TD>
|
|
||||||
<TD WIDTH="30%" VALIGN="TOP">
|
|
||||||
<?
|
|
||||||
if (isediting($site->id)) {
|
if (isediting($site->id)) {
|
||||||
$site->summary .= "<BR><CENTER><A HREF=\"admin/site.php\"><IMG SRC=\"pix/i/edit.gif\" BORDER=0></A>";
|
echo "<DIV ALIGN=right>";
|
||||||
|
popup_form("$CFG->wwwroot/course/mod.php?id=$site->id§ion=0&add=",
|
||||||
|
$modnames, "section0", "", "Add...");
|
||||||
|
echo "</DIV>";
|
||||||
}
|
}
|
||||||
print_simple_box($site->summary, "", "100%", $THEME->cellheading);
|
|
||||||
|
if ($site->newsitems > 0 ) {
|
||||||
|
print_simple_box(get_string("courses"), "CENTER", "100%", "$THEME->cellheading");
|
||||||
|
print_all_courses($cat=1, "minimal", 10);
|
||||||
|
}
|
||||||
print_spacer(1,$side);
|
print_spacer(1,$side);
|
||||||
?>
|
}
|
||||||
</TD>
|
|
||||||
|
if (isadmin()) {
|
||||||
|
if (!$firstcolumn) {
|
||||||
|
echo "<TD WIDTH=\"$side\" VALIGN=TOP NOWRAP>"; $firstcolumn=true;
|
||||||
|
}
|
||||||
|
print_admin_links($site->id, $side);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($firstcolumn) {
|
||||||
|
echo "</TD>";
|
||||||
|
echo "<TD WIDTH=70% VALIGN=TOP>";
|
||||||
|
} else {
|
||||||
|
echo "<TD WIDTH=100% VALIGN=TOP>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($site->newsitems == 0 ) {
|
||||||
|
print_simple_box(get_string("availablecourses"), "CENTER", "100%", "$THEME->cellheading");
|
||||||
|
print_spacer(8,1);
|
||||||
|
print_all_courses();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
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";
|
||||||
|
save_session("SESSION");
|
||||||
|
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>".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");
|
||||||
|
}
|
||||||
|
print_simple_box($headertext, "CENTER", "100%", $THEME->cellheading);
|
||||||
|
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>";
|
||||||
|
}
|
||||||
|
|
||||||
|
print_simple_box($site->summary, "", "100%", $THEME->cellheading);
|
||||||
|
print_spacer(1,$side);
|
||||||
|
echo "</TD>";
|
||||||
|
?>
|
||||||
|
|
||||||
</TR>
|
</TR>
|
||||||
</TABLE>
|
</TABLE>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue