]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-7861, xhtml strict for survey
authortoyomoyo <toyomoyo>
Mon, 8 Jan 2007 05:47:12 +0000 (05:47 +0000)
committertoyomoyo <toyomoyo>
Mon, 8 Jan 2007 05:47:12 +0000 (05:47 +0000)
mod/survey/lib.php
mod/survey/report.php
mod/survey/view.php
theme/standard/styles_layout.css

index cf5fd689deb9dedf24120e77fc92cdf0b1d373e3..c14dbe087aaadbdcc00c3961121ccbd7a217c73e 100644 (file)
@@ -353,9 +353,9 @@ function survey_print_multi($question) {
     $stripreferthat = get_string("ipreferthat", "survey");
     $strifoundthat = get_string("ifoundthat", "survey");
     echo "<br />\n";
-    echo "<font size=\"4\"><b>$question->text</b></font><br />";
-
-    echo "<table align=\"center\" width=\"90%\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\">";
+    echo "<span class='questiontext'><b>$question->text</b></span><br />";
+    echo "<div style=\"text-align:center\">";
+    echo "<table width=\"90%\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\">";
 
     $options = explode( ",", $question->options);
     $numoptions = count($options);
@@ -374,7 +374,7 @@ function survey_print_multi($question) {
     }
 
     while (list ($key, $val) = each ($options)) {
-        echo "<td width=\"10%\" align=\"center\"><font size=\"1\">$val</font></td>\n";
+        echo "<td class=\"smalltextcell\"><span class='smalltext'>$val</span></td>\n";
     }
     echo "<td align=\"center\">&nbsp;</td></tr>\n";
 
@@ -390,37 +390,37 @@ function survey_print_multi($question) {
         echo "<tr class=\"$rowclass\">";
         if ($oneanswer) {
 
-            echo "<td width=\"10\" valign=\"top\"><b>$qnum</b></td>";
+            echo "<td class=\"qnumtopcell\"><b>$qnum</b></td>";
             echo "<td valign=\"top\">$q->text</td>";
             for ($i=1;$i<=$numoptions;$i++) {            
                 $screenreader = !empty($USER->screenreader)?"<label for=\"q$P$q->id".$i."\">".$options[$i-1]."</label><br/>":'';
-                echo "<td width=\"10%\" align=\"center\">".$screenreader."<input type=\"radio\" name=\"q$P$q->id\" id=\"q$P$q->id".$i."\" value=\"$i\" alt=\"$i\" /></td>";
+                echo "<td class=\"screenreadertext\">".$screenreader."<input type=\"radio\" name=\"q$P$q->id\" id=\"q$P$q->id".$i."\" value=\"$i\" alt=\"$i\" /></td>";
             }
             echo "<td bgcolor=\"white\"><input type=\"radio\" name=\"q$P$q->id\" value=\"0\" checked=\"checked\" alt=\"0\" /></td>";
             $checklist["q$P$q->id"] = $numoptions;
         
         } else { 
             // yu : fix for MDL-7501, possibly need to use user flag as this is quite ugly.
-            echo "<td width=\"10\" valign=\"middle\"><b>$qnum</b></td>";
+            echo "<td class=\"qnummiddlecell\"><b>$qnum</b></td>";
             $qnum++;
-            echo "<td width=\"10%\" nowrap=\"nowrap\"><font size=\"1\">$stripreferthat&nbsp;</font></td>";
-            echo "<td width=\"40%\" valign=\"middle\">$q->text</td>";
+            echo "<td class=\"preferthat\"><span class='smalltext'>$stripreferthat&nbsp;</span></td>";
+            echo "<td class=\"optioncell\">$q->text</td>";
             for ($i=1;$i<=$numoptions;$i++) {
                 $screenreader = !empty($USER->screenreader)?"<label for=\"qP$q->id".$i."\">".$options[$i-1]."</label><br/>":'';
-                echo "<td width=\"10%\" align=\"center\">".$screenreader."<input type=\"radio\" name=\"qP$q->id\" id=\"qP$q->id".$i."\" value=\"$i\" alt=\"$i\"/></td>";
+                echo "<td class=\"screenreadertext\">".$screenreader."<input type=\"radio\" name=\"qP$q->id\" id=\"qP$q->id".$i."\" value=\"$i\" alt=\"$i\"/></td>";
             }
             echo "<td><input type=\"radio\" name=\"qP$q->id\" value=\"0\" checked=\"checked\" alt=\"0\" /></td>";
             echo "</tr>";
 
             echo "<tr class=\"$rowclass\">";
-            echo "<td width=\"10\" valign=\"middle\"><b>$qnum</b></td>";
-            echo "<td width=\"10%\" nowrap=\"nowrap\"><font size=\"1\">$strifoundthat&nbsp;</font></td>";
-            echo "<td width=\"40%\" valign=\"middle\">$q->text</td>";
+            echo "<td class=\"qnumtopcell\"><b>$qnum</b></td>";
+            echo "<td class=\"foundthat\"><span class='smalltext'>$strifoundthat&nbsp;</span></td>";
+            echo "<td class=\"optioncell\">$q->text</td>";
             for ($i=1;$i<=$numoptions;$i++) {
                 $screenreader = !empty($USER->screenreader)?"<label for=\"q$q->id".$i."\">".$options[$i-1]."</label><br/>":'';
-                echo "<td width=\"10%\" align=\"center\">".$screenreader."<input type=\"radio\" name=\"q$q->id\" id=\"q$q->id".$i."\" value=\"$i\" alt=\"$i\" /></td>";
+                echo "<td class=\"screenreadertext\">".$screenreader."<input type=\"radio\" name=\"q$q->id\" id=\"q$q->id".$i."\" value=\"$i\" alt=\"$i\" /></td>";
             }
-            echo "<td width=\"5%\"><input type=\"radio\" name=\"q$q->id\" value=\"0\" checked=\"checked\" alt=\"0\" /></td>";
+            echo "<td class=\"buttoncell\"><input type=\"radio\" name=\"q$q->id\" value=\"0\" checked=\"checked\" alt=\"0\" /></td>";
             $checklist["qP$q->id"] = $numoptions;
             $checklist["q$q->id"] = $numoptions;            
         }
@@ -428,6 +428,7 @@ function survey_print_multi($question) {
         
     }
     echo "</table>";
+    echo "</div>";
 }
 
 
@@ -440,11 +441,11 @@ function survey_print_single($question) {
     $qnum++;
 
     echo "<br />\n";
-    echo "<table align=\"center\" width=\"90%\" cellpadding=\"4\" cellspacing=\"0\">\n";
+    echo "<table width=\"90%\" cellpadding=\"4\" cellspacing=\"0\">\n";
     echo "<tr class=\"$rowclass\">";
     echo "<td valign=\"top\"><b>$qnum</b></td>";
-    echo "<td width=\"50%\" valign=\"top\">$question->text</td>\n";
-    echo "<td width=\"50%\" valign=\"top\"><font size=\"+1\">\n";
+    echo "<td class=\"questioncell\">$question->text</td>\n";
+    echo "<td class=\"questioncell\"><span class='smalltext'>\n";
 
 
     if ($question->type == 0) {           // Plain text field
@@ -466,7 +467,7 @@ function survey_print_single($question) {
         notify("This question type not supported yet");
     }
 
-    echo "</font></td></tr></table>";
+    echo "</span></td></tr></table>";
 
 }
 
@@ -486,7 +487,7 @@ function survey_print_graph($url) {
         echo "(".get_string("gdneed").")";
 
     } else {
-        echo "<img height=\"$SURVEY_GHEIGHT\" width=\"$SURVEY_GWIDTH\" border=\"1\"".
+        echo "<img class='resultgraph' height=\"$SURVEY_GHEIGHT\" width=\"$SURVEY_GWIDTH\"".
              " src=\"$CFG->wwwroot/mod/survey/graph.php?$url\" alt=\"".get_string("surveygraph", "survey")."\" />";
     }
 }
index 21f5056dc03b0a597c587d6ae966a58c5c3b105f..f2abe247e7db2acf3d72a95eb33ef3c0e3a88eee 100644 (file)
         print_heading($strsummary);
 
         if (survey_count_responses($survey->id, $currentgroup)) {
-            echo "<center><a href=\"report.php?action=scales&amp;id=$id\">";
+            echo "<div class='reportsummary'><a href=\"report.php?action=scales&amp;id=$id\">";
             survey_print_graph("id=$id&amp;group=$currentgroup&amp;type=overall.png");
-            echo "</a></center>";
+            echo "</a></div>";
         } else {
             notify(get_string("nobodyyet","survey"));
         }
                     if (!empty($virtualscales) && $question->type > 0) {  // Don't show non-virtual scales if virtual
                         continue;
                     }
-                    echo "<p align=\"center\"><a title=\"$strseemoredetail\" href=\"report.php?action=questions&amp;id=$id&amp;qid=$question->multi\">";
+                    echo "<p class=\"centerpara\"><a title=\"$strseemoredetail\" href=\"report.php?action=questions&amp;id=$id&amp;qid=$question->multi\">";
                     survey_print_graph("id=$id&amp;qid=$question->id&amp;group=$currentgroup&amp;type=multiquestion.png");
                     echo "</a></p><br />";
                 }
                     foreach ($subquestionorder as $key => $val) {
                         $subquestion = $subquestions[$val];
                         if ($subquestion->type > 0) {
-                            echo "<p align=\"center\">";
+                            echo "<p class=\"centerpara\">";
                             echo "<a title=\"$strseemoredetail\" href=\"report.php?action=question&amp;id=$id&amp;qid=$subquestion->id\">";
                             survey_print_graph("id=$id&amp;qid=$subquestion->id&amp;group=$currentgroup&amp;type=question.png");
                             echo "</a></p>";
                         }
                     }
                 } else if ($question->type > 0 ) {
-                    echo "<p align=\"center\">";
+                    echo "<p class=\"centerpara\">";
                     echo "<a title=\"$strseemoredetail\" href=\"report.php?action=question&amp;id=$id&amp;qid=$question->id\">";
                     survey_print_graph("id=$id&amp;qid=$question->id&amp;group=$currentgroup&amp;type=question.png");
                     echo "</a></p>";
                     if ($aaa = survey_get_user_answers($survey->id, $question->id, $currentgroup, "sa.time ASC")) {
                         foreach ($aaa as $a) {
                             $contents .= "<tr>";
-                            $contents .= '<td nowrap="nowrap" width="10%" valign="top">'.fullname($a).'</td>';
+                            $contents .= '<td class="fullnamecell">'.fullname($a).'</td>';
                             $contents .= '<td valign="top">'.$a->answer1.'</td>';
                             $contents .= "</tr>";
                         }
              }
          }
 
-         echo "<p align=\"center\">";
+         echo "<p <p class=\"centerpara\">";
          print_user_picture($user->id, $course->id, $user->picture, true);
          echo "</p>";
 
 
          if ($showscales) {
              // Print overall summary
-             echo "<p align=\"center\">";
+             echo "<p <p class=\"centerpara\">>";
              survey_print_graph("id=$id&amp;sid=$student&amp;type=student.png");
              echo "</p>";
 
                      if ($virtualscales && $question->type > 0) {  // Don't show non-virtual scales if virtual
                          continue;
                      }
-                     echo "<p align=\"center\">";
+                     echo "<p class=\"centerpara\">";
                      echo "<a title=\"$strseemoredetail\" href=\"report.php?action=questions&amp;id=$id&amp;qid=$question->multi\">";
                      survey_print_graph("id=$id&amp;qid=$question->id&amp;sid=$student&amp;type=studentmultiquestion.png");
                      echo "</a></p><br />";
             $notes = "";
          }
          echo "<hr noshade=\"noshade\" size=\"1\" />";
-         echo "<center>";
+         echo "<div class='studentreport'>";
          echo "<form action=\"report.php\" method=\"post\">";
          echo "<h3>$strnotes:</h3>";
          echo "<blockquote>";
          echo "<input type=\"submit\" value=\"".get_string("savechanges")."\" />";
          echo "</blockquote>";
          echo "</form>";
-         echo "</center>";
+         echo "</div>";
 
 
          break;
 
         require_capability('mod/survey:download', $context);
 
-        echo '<p align="center">'.get_string("downloadinfo", "survey").'</p>';
+        echo '<p class="centerpara">'.get_string("downloadinfo", "survey").'</p>';
 
-        echo '<center>';
+        echo '<div class="reportbuttons">';
         $optons = array();
         $options["id"] = "$cm->id";
         $options["group"] = $currentgroup;
 
         $options["type"] = "txt";
         print_single_button("download.php", $options, get_string("downloadtext"));
-        echo '</center>';
+        echo '</div>';
 
         break;
 
index 942056b3aa569936a337ecea339db7b6062f0655..6345827db111d26f2f18293db5c17474f6838783 100644 (file)
@@ -70,9 +70,9 @@
         if ($showscales) {
             print_heading(get_string("surveycompleted", "survey"));
             print_heading(get_string("peoplecompleted", "survey", $numusers));
-            echo "<center>";
+            echo '<div class="resultgraph">';
             survey_print_graph("id=$cm->id&amp;sid=$USER->id&amp;group=$currentgroup&amp;type=student.png");
-            echo "</center>";
+            echo '</div>';
 
         } else {
 
     add_to_log($course->id, "survey", "view form", "view.php?id=$cm->id", $survey->id, $cm->id);
 
     echo "<form method=\"post\" action=\"save.php\">";
+    echo '<div>';
     echo "<input type=\"hidden\" name=\"id\" value=\"$id\" />";
 
     print_simple_box(format_text($survey->intro), 'center', '70%', '', 5, 'generalbox', 'intro');
     }
 
     if (isguest()) {
+        echo '</div>';  
         echo "</form>";
         print_footer($course);
         exit;
 
 ?>
 
-<center>
 <br />
 <script type="text/javascript">
-<!-- // BEGIN
+<![CDATA[
 function checkform() {
 
     var error=false;
@@ -182,17 +183,19 @@ function checkform() {
 
 <?php echo "document.write('<input type=\"button\" value=\"".get_string("clicktocontinuecheck", "survey")."\" onClick=\"checkform()\" />');";  ?>
 
-// END -->
+// END -->    
+]]>
 </script>
 
 <noscript>
     <!-- Without Javascript, no checking is done -->
+    <div>
     <input type="submit" value="<?php  get_string("clicktocontinue", "survey") ?>" />
+    </div>
 </noscript>
 
-</center>
-
 <?php
+   echo '</div>';
    echo "</form>";
 
    print_footer($course);
index ef29c2385ef820a6dfb73608ebf3914e9202b6f7..6652bf703a5d412584863638c8b92ab6cca9a83b 100644 (file)
@@ -1971,7 +1971,7 @@ body#user-index .rolesform {
 .userpicture,
 .picture user,
 .picture teacher {
-  width:35;
+  width:35px;
   vertical-align:top;
 }
 .modform {
@@ -2466,7 +2466,70 @@ body#mod-quiz-report .controls {
 /***
  *** Modules: Survey
  ***/
+.resultgraph {
+  text-align:center;
+  border:1px solid;
+}
+
+.reportsummary,
+.studentreport,
+.reportbuttons {
+  text-align:center;  
+}
+
+.centerpara {
+  text-align:center;   
+}
+
+.fullnamecell {
+  width:10%;
+  vertical-align:top;
+  white-space: nowrap;
+}
+
+.questiontext {
+  font-size:1em;
+}
+
+.smalltext {
+  font-size:0.6em;
+}
+
+.smalltextcell,
+.screenreadertext {
+  width:10%;
+  text-align:center;
+}
+
+.foundthat, 
+.preferthat {
+  width:10%; 
+  white-space: nowrap;
+}
+
+.qnumtopcell {
+  width:10px;
+  vertical-align:top;
+}
+
+.qnummiddlecell {
+  width:10px;
+  vertical-align:middle;
+}
+
+.optioncell {
+  width:40%;
+  vertical-align:middle;  
+}
 
+.buttoncell {
+  width:5%;  
+}
+
+.questioncell {
+  width:50%;
+  vertical-align:top;  
+}
 /***
  *** Modules: Wiki
  ***/