]> git.mjollnir.org Git - moodle.git/commitdiff
Some clean ups - various things to do with Topics view
authormoodler <moodler>
Sun, 4 May 2003 09:43:03 +0000 (09:43 +0000)
committermoodler <moodler>
Sun, 4 May 2003 09:43:03 +0000 (09:43 +0000)
course/lib.php
course/topics.php
course/view.php
lib/weblib.php
pix/i/hide.gif
pix/i/marker.gif
pix/i/show.gif

index ba89d49d640a7327420b777e091085dc33df7a77..c1ce3c4b5d41c731a769a5a4ee71fa265fd0cdb2 100644 (file)
@@ -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&amp;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 "&nbsp;&nbsp;";
                 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") {
index 558058c07579893e199bd689efa01f4add988273..2f3766f7410bdc69fd8457c14a314cf3a1839cfc 100644 (file)
     $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&amp;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 />";
                 }
             }
 
index f8f6cfcf10b6195f82f008f38551263c23fb0323..f5587322258701489a572ca87d83710d867b0d6c 100644 (file)
 
     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");
         }
     }
index 3bbe13a629f9f3a328797790e915b6250b9be828..2dc90d3763f6941bc840b973f2e6fa11e4502e3f 100644 (file)
@@ -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);
         }
index 92bd30abd460d226383e7062d31ca1c901ba1952..43013e1ec062a7cb72b35beff1b1d95032baed3a 100755 (executable)
Binary files a/pix/i/hide.gif and b/pix/i/hide.gif differ
index 4b81562cbea2bb7f79c82e2a82de966da2c6f479..6f0dbbf20a41932a3835c5ac28b9ae89f593f526 100755 (executable)
Binary files a/pix/i/marker.gif and b/pix/i/marker.gif differ
index 457989af48198cd9738bd5c1754f082e4d160799..b13726fd27e31aa145deb22d6395a86985ac217b 100755 (executable)
Binary files a/pix/i/show.gif and b/pix/i/show.gif differ