]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19816 upgraded calls to print_table, print_single_button, print_user_picture...
authornicolasconnault <nicolasconnault>
Thu, 20 Aug 2009 08:46:16 +0000 (08:46 +0000)
committernicolasconnault <nicolasconnault>
Thu, 20 Aug 2009 08:46:16 +0000 (08:46 +0000)
mod/survey/index.php
mod/survey/lib.php
mod/survey/report.php
mod/survey/view.php

index 034b1dbd5c53d8f2c6c112cb137a10cc5bd9e883..51b0b7502ba0e05c7b6d7425e3865e77a24e7537 100644 (file)
@@ -32,6 +32,8 @@
         notice(get_string('thereareno', 'moodle', $strsurveys), "../../course/view.php?id=$course->id");
     }
 
+    $table = new html_table();
+
     if ($course->format == "weeks") {
         $table->head  = array ($strweek, $strname, $strstatus);
         $table->align = array ("CENTER", "LEFT", "LEFT");
@@ -78,7 +80,7 @@
     }
 
     echo "<br />";
-    print_table($table);
+    echo $OUTPUT->table($table);
     echo $OUTPUT->footer();
 
 ?>
index 34902e457dc85a6aa48ad4d46541068b4b56373c..55515a62f7a5f9a61924bbb86e23634db6d843b8 100644 (file)
@@ -170,11 +170,11 @@ function survey_user_outline($course, $user, $mod, $survey) {
  * @param object $survey
  */
 function survey_user_complete($course, $user, $mod, $survey) {
-    global $CFG, $DB;
+    global $CFG, $DB, $OUTPUT;
 
     if (survey_already_done($survey->id, $user->id)) {
         if ($survey->template == SURVEY_CIQ) { // print out answers for critical incidents
-            $table = NULL;
+            $table = new html_table();
             $table->align = array("left", "left");
 
             $questions = $DB->get_records_list("survey_questions", "id", explode(',', $survey->questions));
@@ -191,7 +191,7 @@ function survey_user_complete($course, $user, $mod, $survey) {
                 }
                 $table->data[] = array("<b>$questiontext</b>", $answertext);
             }
-            print_table($table);
+            echo $OUTPUT->table($table);
             
         } else {
         
@@ -463,19 +463,19 @@ function survey_count_responses($surveyid, $groupid, $groupingid) {
  * @param int $courseid
  */
 function survey_print_all_responses($cmid, $results, $courseid) {
-
-    $table = new object();
+    global $OUTPUT;
+    $table = new html_table();
     $table->head  = array ("", get_string("name"),  get_string("time"));
     $table->align = array ("", "left", "left");
     $table->size = array (35, "", "" );
 
     foreach ($results as $a) {
-        $table->data[] = array(print_user_picture($a->id, $courseid, $a->picture, false, true, false),
-               "<a href=\"report.php?action=student&amp;student=$a->id&amp;id=$cmid\">".fullname($a)."</a>"
+        $table->data[] = array($OUTPUT->user_picture(moodle_user_picture::make($a, $courseid)),
+               $OUTPUT->link("report.php?action=student&student=$a->id&id=$cmid", fullname($a))
                userdate($a->time));
     }
 
-    print_table($table);
+    echo $OUTPUT->table($table);
 }
 
 /**
index 2f0fdff5db4441f8b12690e44988d7d781b54974..64bfc95576072eca281d0ec29c44b7f0de66c6a5 100644 (file)
                     echo "</a></p>";
 
                 } else {
-                    $table = NULL;
+                    $table = new html_table();
                     $table->head = array($question->text);
                     $table->align = array ("left");
 
 
                     $table->data[] = array($contents);
 
-                    print_table($table);
+                    echo $OUTPUT->table($table);
                     print_spacer(30);
                 }
             }
         $strpreferred = get_string("preferred", "survey");
         $strdateformat = get_string("strftimedatetime");
 
-        $table = NULL;
+        $table = new html_table();
         $table->head = array("", $strname, $strtime, $stractual, $strpreferred);
         $table->align = array ("left", "left", "left", "left", "right");
         $table->size = array (35, "", "", "", "");
                 } else {
                     $answer2 = "&nbsp;";
                 }
-
+                $userpic = moodle_user_picture::make($a, $course->id);
+                $userpic->link = true;
                 $table->data[] = array(
-                       print_user_picture($a->userid, $course->id, $a->picture, false, true, true),
+                       $OUTPUT->user_picture($userpic),
                        "<a href=\"report.php?id=$id&amp;action=student&amp;student=$a->userid\">".fullname($a)."</a>",
                        userdate($a->time),
                        $answer1, $answer2);
             }
         }
 
-        print_table($table);
+        echo $OUTPUT->table($table);
 
         break;
 
          }
 
          echo "<p <p class=\"centerpara\">";
-         print_user_picture($user->id, $course->id, $user->picture, true);
+         echo $OUTPUT->user_picture(moodle_user_picture::make($user->id, $course->id));
          echo "</p>";
 
          $questions = $DB->get_records_list("survey_questions", "id", explode(',', $survey->questions));
              $question = $questions[$val];
              if ($question->type == 0 or $question->type == 1) {
                  if ($answer = survey_get_user_answer($survey->id, $question->id, $user->id)) {
-                     $table = NULL;
+                    $table = new html_table();
                      $table->head = array(get_string($question->text, "survey"));
                      $table->align = array ("left");
                      $table->data[] = array(s($answer->answer1)); // no html here, just plain text
-                     print_table($table);
-                     print_spacer(30);
+                     echo $OUTPUT->table($table);
+                     echo $OUTPUT->spacer(30);
                  }
              }
          }
 
         echo '<p class="centerpara">'.get_string("downloadinfo", "survey").'</p>';
 
-        echo '<div class="reportbuttons">';
-        $optons = array();
+        echo $OUTPUT->container_start('reportbuttons');
+        $options = array();
         $options["id"] = "$cm->id";
         $options["group"] = $currentgroup;
 
         $options["type"] = "ods";
-        print_single_button("download.php", $options, get_string("downloadods"));
+        echo $OUTPUT->button(html_form::make_button("download.php", $options, get_string("downloadods")));
 
         $options["type"] = "xls";
-        print_single_button("download.php", $options, get_string("downloadexcel"));
+        echo $OUTPUT->button(html_form::make_button("download.php", $options, get_string("downloadexcel")));
 
         $options["type"] = "txt";
-        print_single_button("download.php", $options, get_string("downloadtext"));
-        echo '</div>';
+        echo $OUTPUT->button(html_form::make_button("download.php", $options, get_string("downloadtext")));
+        echo $OUTPUT->container_end();
 
         break;
 
index 89bfc558055d4314f0395d569fd0da94b9e5df4e..44691a87b549bd59f26a38e8f11a85687c087d1b 100644 (file)
                 $question = $questions[$val];
                 if ($question->type == 0 or $question->type == 1) {
                     if ($answer = survey_get_user_answer($survey->id, $question->id, $USER->id)) {
-                        $table = NULL;
+                        $table = new html_table();
                         $table->head = array(get_string($question->text, "survey"));
                         $table->align = array ("left");
                         $table->data[] = array(s($answer->answer1));//no html here, just plain text
-                        print_table($table);
+                        echo $OUTPUT->table($table);
                         echo $OUTPUT->spacer(clone($spacer)) . '<br />';
                     }
                 }