if ($isediting) {
$editmenu = popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&section=$section->section&add=",
$modnames, "section0", "", get_string("add")."...", "mods", get_string("activities"), true);
- $editmenu = "<DIV ALIGN=right>$editmenu</DIV>";
+ $editmenu = "<div align=right>$editmenu</div>";
} else {
$editmenu = "";
}
$modinfo = unserialize($course->modinfo);
- echo "<TABLE WIDTH=\"$width\"><TR><TD>\n";
+ echo "<table width=\"$width\"><tr><td>\n";
if (!empty($section->sequence)) {
$sectionmods = explode(",", $section->sequence);
} else {
$link_css = " class=\"dimmed\" ";
}
- echo "<IMG SRC=\"$CFG->wwwroot/mod/$mod->modname/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"$mod->modfullname\">";
- echo " <FONT SIZE=2><A TITLE=\"$mod->modfullname\" $link_css";
- echo " HREF=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename</A></FONT>";
+ echo "<img src=\"$CFG->wwwroot/mod/$mod->modname/icon.gif\" height=16 width=16 alt=\"$mod->modfullname\">";
+ echo " <font size=2><a title=\"$mod->modfullname\" $link_css";
+ echo " href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename</a></font>";
}
if (isediting($course->id)) {
echo " ";
echo make_editing_buttons($mod->id, $absolute, $mod->visible);
}
if ($mod->visible or isteacher($course->id)) {
- echo "<BR>\n";
+ echo "<br />\n";
}
}
}
- echo "</TD></TR></TABLE><BR>\n\n";
+ echo "</td></tr></table><br />\n\n";
}
function print_heading_block($heading, $width="100%", $class="headingblock") {
$stradd = get_string("add");
$stractivities = get_string("activities");
$strshowalltopics = get_string("showalltopics");
- $strtopichide = get_string("topichide");
- $strtopicshow = get_string("topicshow");
+ $strcoursedisplay = get_string("coursedisplay");
+ if (isediting($course->id)) {
+ $strmarkthistopic = get_string("markthistopic");
+ $strtopichide = get_string("topichide", "", moodle_strtolower($course->students));
+ $strtopicshow = get_string("topicshow", "", moodle_strtolower($course->students));
+ }
/// Layout the whole page as three big columns.
if (isediting($course->id)) {
echo "<div align=right>";
popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&section=$section&add=",
- $modnames, "section$section", "", "$stradd...", "mods", $stractivities);
+ $modnames, "section$section", "", "$stradd...");
echo "</div>";
}
echo "<font size=1>";
if ($displaysection == $section) { // Show the zoom box
- echo "<a href=\"view.php?id=$course->id&topic=all\" title=\"$strshowalltopics\"><img src=\"$pixpath/i/all.gif\" height=25 width=16 border=0></a><br><br>";
+ echo "<a href=\"view.php?id=$course->id&topic=all\" title=\"$strshowalltopics\">".
+ "<img src=\"$pixpath/i/all.gif\" height=25 width=16 border=0></a><br />";
} else {
$strshowonlytopic = get_string("showonlytopic", "", $section);
- echo "<a href=\"view.php?id=$course->id&topic=$section\" title=\"$strshowonlytopic\"><img src=\"$pixpath/i/one.gif\" height=16 width=16 border=0></a><br><br>";
- }
-
- if (isediting($course->id) and $course->marker != $section) { // Show the "tick"
- $strmarkthistopic = get_string("markthistopic");
- echo "<a href=\"view.php?id=$course->id&marker=$section\" title=\"$strmarkthistopic\"><img src=\"$pixpath/i/marker.gif\" height=16 width=16 border=0></a><br><br>";
+ echo "<a href=\"view.php?id=$course->id&topic=$section\" title=\"$strshowonlytopic\">".
+ "<img src=\"$pixpath/i/one.gif\" height=16 width=16 border=0></a><br />";
}
if (isediting($course->id)) { // Show the hide/show eye
+ $strmarkthistopic = get_string("markthistopic");
if ($thissection->visible) {
- echo "<a href=\"view.php?id=$course->id&hide=$section\" title=\"$strtopichide\"><img src=\"$pixpath/i/hide.gif\" height=16 width=16 border=0></a><br><br>";
-
+ echo "<a href=\"view.php?id=$course->id&hide=$section\" title=\"$strtopichide\">".
+ "<img src=\"$pixpath/i/hide.gif\" height=16 width=16 border=0></a><br />";
} else {
- echo "<a href=\"view.php?id=$course->id&show=$section\" title=\"$strtopicshow\"><img src=\"$pixpath/i/show.gif\" height=16 width=16 border=0></a><br><br>";
+ echo "<a href=\"view.php?id=$course->id&show=$section\" title=\"$strtopicshow\">".
+ "<img src=\"$pixpath/i/show.gif\" height=16 width=16 border=0></a><br />";
+ }
+
+ if ($course->marker != $section) { // Show the "tick"
+ echo "<a href=\"view.php?id=$course->id&marker=$section\" title=\"$strmarkthistopic\">".
+ "<img src=\"$pixpath/i/marker.gif\" height=16 width=16 border=0></a><br />";
}
}
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
- if (! $sections = get_all_sections($course->id)) {
- $section->course = $course->id; // Create a default section.
- $section->section = 0;
- $section->id = insert_record("course_sections", $section);
- if (! $sections = get_all_sections($course->id) ) {
+ if (! $sections = get_all_sections($course->id)) { // No sections found
+ // Double-check to be extra sure
+ if (! $section = get_record("course_sections", "course", $course->id, "section", 0)) {
+ $section->course = $course->id; // Create a default section.
+ $section->section = 0;
+ $section->visible = 1;
+ $section->id = insert_record("course_sections", $section);
+ }
+ if (! $sections = get_all_sections($course->id) ) { // Try again
error("Error finding or creating section structures for this course");
}
}
$nothing = get_string("choose")."...";
}
- $output = "<FORM TARGET=\"{$CFG->framename}\" NAME=$formname>";
- $output .= "<SELECT NAME=popup onChange=\"top.location=document.$formname.popup.options[document.$formname.popup.selectedIndex].value\">\n";
+ $startoutput = "<form target=\"{$CFG->framename}\" name=$formname>";
+ $output = "<select name=popup onchange=\"top.location=document.$formname.popup.options[document.$formname.popup.selectedindex].value\">\n";
if ($nothing != "") {
- $output .= " <OPTION VALUE=\"javascript:void(0)\">$nothing</OPTION>\n";
+ $output .= " <option value=\"javascript:void(0)\">$nothing</option>\n";
}
foreach ($options as $value => $label) {
if (substr($label,0,1) == "-") {
- $output .= " <OPTION VALUE=\"\"";
+ $output .= " <option value=\"\"";
} else {
- $output .= " <OPTION VALUE=\"$common$value\"";
+ $output .= " <option value=\"$common$value\"";
if ($value == $selected) {
- $output .= " SELECTED";
+ $output .= " selected";
}
}
if ($label) {
- $output .= ">$label</OPTION>\n";
+ $output .= ">$label</option>\n";
} else {
- $output .= ">$value</OPTION>\n";
+ $output .= ">$value</option>\n";
}
}
- $output .= "</SELECT>";
- $output .= "</FORM>\n";
+ $output .= "</select>";
+ $output .= "</form>\n";
if ($return) {
- return $output;
+ return $startoutput.$output;
} else {
+ echo $startoutput;
if ($help) {
helpbutton($help, $helptext);
}