From: moodler Date: Sun, 4 May 2003 09:43:03 +0000 (+0000) Subject: Some clean ups - various things to do with Topics view X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=dfec7b013f6b12d056c43d7e4e0717cc9ce28e09;p=moodle.git Some clean ups - various things to do with Topics view --- diff --git a/course/lib.php b/course/lib.php index ba89d49d64..c1ce3c4b5d 100644 --- a/course/lib.php +++ b/course/lib.php @@ -581,7 +581,7 @@ function print_section_block($heading, $course, $section, $mods, $modnames, $mod 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 = "
$editmenu
"; + $editmenu = "
$editmenu
"; } else { $editmenu = ""; } @@ -595,7 +595,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false, $modinfo = unserialize($course->modinfo); - echo "
\n"; + echo "
\n"; if (!empty($section->sequence)) { $sectionmods = explode(",", $section->sequence); @@ -612,20 +612,20 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false, } else { $link_css = " class=\"dimmed\" "; } - echo "wwwroot/mod/$mod->modname/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"$mod->modfullname\">"; - echo " modfullname\" $link_css"; - echo " HREF=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename"; + echo "wwwroot/mod/$mod->modname/icon.gif\" height=16 width=16 alt=\"$mod->modfullname\">"; + echo " modfullname\" $link_css"; + echo " href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename"; } if (isediting($course->id)) { echo "  "; echo make_editing_buttons($mod->id, $absolute, $mod->visible); } if ($mod->visible or isteacher($course->id)) { - echo "
\n"; + echo "
\n"; } } } - echo "

\n\n"; + echo "

\n\n"; } function print_heading_block($heading, $width="100%", $class="headingblock") { diff --git a/course/topics.php b/course/topics.php index 558058c075..2f3766f741 100644 --- a/course/topics.php +++ b/course/topics.php @@ -33,8 +33,12 @@ $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. @@ -186,7 +190,7 @@ if (isediting($course->id)) { echo "
"; popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&section=$section&add=", - $modnames, "section$section", "", "$stradd...", "mods", $stractivities); + $modnames, "section$section", "", "$stradd..."); echo "
"; } @@ -195,23 +199,27 @@ echo ""; if ($displaysection == $section) { // Show the zoom box - echo "id&topic=all\" title=\"$strshowalltopics\">

"; + echo "id&topic=all\" title=\"$strshowalltopics\">". + "
"; } else { $strshowonlytopic = get_string("showonlytopic", "", $section); - echo "id&topic=$section\" title=\"$strshowonlytopic\">

"; - } - - if (isediting($course->id) and $course->marker != $section) { // Show the "tick" - $strmarkthistopic = get_string("markthistopic"); - echo "id&marker=$section\" title=\"$strmarkthistopic\">

"; + echo "id&topic=$section\" title=\"$strshowonlytopic\">". + "
"; } if (isediting($course->id)) { // Show the hide/show eye + $strmarkthistopic = get_string("markthistopic"); if ($thissection->visible) { - echo "id&hide=$section\" title=\"$strtopichide\">

"; - + echo "id&hide=$section\" title=\"$strtopichide\">". + "
"; } else { - echo "id&show=$section\" title=\"$strtopicshow\">

"; + echo "id&show=$section\" title=\"$strtopicshow\">". + "
"; + } + + if ($course->marker != $section) { // Show the "tick" + echo "id&marker=$section\" title=\"$strmarkthistopic\">". + "
"; } } diff --git a/course/view.php b/course/view.php index f8f6cfcf10..f558732225 100644 --- a/course/view.php +++ b/course/view.php @@ -75,11 +75,15 @@ 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"); } } diff --git a/lib/weblib.php b/lib/weblib.php index 3bbe13a629..2dc90d3763 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -323,34 +323,35 @@ function popup_form ($common, $options, $formname, $selected="", $nothing="choos $nothing = get_string("choose")."..."; } - $output = "
framename}\" NAME=$formname>"; - $output .= "\n"; if ($nothing != "") { - $output .= " \n"; + $output .= " \n"; } foreach ($options as $value => $label) { if (substr($label,0,1) == "-") { - $output .= "