From dfec7b013f6b12d056c43d7e4e0717cc9ce28e09 Mon Sep 17 00:00:00 2001 From: moodler <moodler> Date: Sun, 4 May 2003 09:43:03 +0000 Subject: [PATCH] Some clean ups - various things to do with Topics view --- course/lib.php | 14 +++++++------- course/topics.php | 34 +++++++++++++++++++++------------- course/view.php | 14 +++++++++----- lib/weblib.php | 23 ++++++++++++----------- pix/i/hide.gif | Bin 352 -> 337 bytes pix/i/marker.gif | Bin 327 -> 269 bytes pix/i/show.gif | Bin 84 -> 81 bytes 7 files changed, 49 insertions(+), 36 deletions(-) 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 = "<DIV ALIGN=right>$editmenu</DIV>"; + $editmenu = "<div align=right>$editmenu</div>"; } else { $editmenu = ""; } @@ -595,7 +595,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false, $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); @@ -612,20 +612,20 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false, } 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") { 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 "<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>"; } @@ -195,23 +199,27 @@ 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 />"; } } 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 = "<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); } diff --git a/pix/i/hide.gif b/pix/i/hide.gif index 92bd30abd460d226383e7062d31ca1c901ba1952..43013e1ec062a7cb72b35beff1b1d95032baed3a 100755 GIT binary patch delta 120 zcmV-;0EhqJ0?`7H;Bjt1m2gNb8jnaKCs|wyokpj02z92eSIo1CNlCtvM{1fHiAWMf zBB79wL?b7vgO((&i7%;xQl(5KXbM;<Z6qZoS0^555QBvfZXPEoejg!d3knJgZXq9) aLK`3%6bJzU2oxD08%2b$p-i*1K>$0004IF_ delta 136 zcmV;30C)e<0^kCW;D3EUm2gNb8jr|Sil{`YmP060s%#3a&n19xI1m8YA_wy@6bgn1 zhEp7gG?hjo(Wq!dqamt8vPh~a5*8#KC{HFOBn}FI3JxSCCQ2tBBoPn{0|N{Y5hNZb qODP{A7ZVEt0t*utAs<p3AQ==00RadU86X=)fWA^r!NNj800BD;ge4RJ diff --git a/pix/i/marker.gif b/pix/i/marker.gif index 4b81562cbea2bb7f79c82e2a82de966da2c6f479..6f0dbbf20a41932a3835c5ac28b9ae89f593f526 100755 GIT binary patch delta 52 zcmV-40L%Z!0*wNY;4Lb^fN)4G8jr{%5}+gkn9aZws(ebPSgJJ%-ExQCBlUXChRadm Kxteafg8(~Jf*240 delta 110 zcmV-!0FnQV0>=W7;AdpOfN)48LNvvsaMQXdi3Jc$@*Eycv`1BVNZ~5mzySrwga;;o zM`<8(03||kl5#nO7yzqX`~Uzd0SYrW6iNaie-<JDBvlA605Lf>5nCO903cxrH2^XU QVF4p64Wa=H2Vp?~J9|<fKL7v# diff --git a/pix/i/show.gif b/pix/i/show.gif index 457989af48198cd9738bd5c1754f082e4d160799..b13726fd27e31aa145deb22d6395a86985ac217b 100755 GIT binary patch delta 42 ycmWFuoS>tsG^c;%>9_ogV;s8*<B#QCpBo}7)Z^wU>BPXGuDogjr=K$;gEatd^bXMg delta 45 zcmWFxnV_SgI;Vf->9_ogW1J2|tv}l<Ey&`bp_Y(2p@W_2z{7*O35JCM{_czn)&Qzt B5fK0Y -- 2.39.5