]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19812 upgraded calls to print_table, print_single_button, print_user_picture...
authornicolasconnault <nicolasconnault>
Thu, 20 Aug 2009 08:45:33 +0000 (08:45 +0000)
committernicolasconnault <nicolasconnault>
Thu, 20 Aug 2009 08:45:33 +0000 (08:45 +0000)
mod/lesson/action/confirmdelete.php
mod/lesson/edit.php
mod/lesson/essay.php
mod/lesson/highscores.php
mod/lesson/index.php
mod/lesson/lib.php
mod/lesson/report.php

index 3e1608c6b5b08a8029859c95199e9d7d0b20b4b7..0005cba6435088c43c5f82cf2f2085e81d127639 100644 (file)
@@ -25,7 +25,7 @@
             echo $title."<br />\n";
         }
     }
-    notice_yesno(get_string("confirmdeletionofthispage","lesson"), 
-         "lesson.php?action=delete&amp;id=$cm->id&amp;pageid=$pageid&amp;sesskey=".sesskey(),
+    echo $OUTPUT->confirm(get_string("confirmdeletionofthispage","lesson"), 
+         "lesson.php?action=delete&id=$cm->id&pageid=$pageid",
          "view.php?id=$cm->id");
 ?>
index 308606ee4e5661d559a4a80ae7000378ee8e2c35..cdf71fdaac5e88eb3bf7a347af120b7c73eff050 100644 (file)
@@ -62,7 +62,7 @@
         
         switch ($mode) {
             case 'collapsed':
-                $table = new stdClass;
+                $table = new html_table();
                 $table->head = array(get_string('pagetitle', 'lesson'), get_string('qtype', 'lesson'), get_string('jumps', 'lesson'), get_string('actions', 'lesson'));
                 $table->align = array('left', 'left', 'left', 'center');
                 $table->wrap = array('', 'nowrap', '', 'nowrap');
@@ -98,7 +98,7 @@
                     $pageid = $page->nextpageid;
                 }
                 
-                print_table($table);
+                echo $OUTPUT->table($table);
                 break;
                 
             case 'single':
index a72a769363d6a19a80addcf56f755d340da79b68..d4f55a31c1c51af2f5d8a6dd3a01afd39a74e271 100644 (file)
             }
             
             // Setup table
-            $table = new stdClass;
+            $table = new html_table();
             $table->head = array(get_string('name'), get_string('essays', 'lesson'), get_string('email', 'lesson'));
             $table->align = array('left', 'left', 'left');
             $table->wrap = array('nowrap', 'nowrap', 'nowrap');
                 // email link for this user
                 $emaillink = "<a href=\"$CFG->wwwroot/mod/lesson/essay.php?id=$cm->id&amp;mode=email&amp;userid=$userid&amp;sesskey=".sesskey().'">'.get_string('emailgradedessays', 'lesson').'</a>';
 
-                $table->data[] = array(print_user_picture($userid, $course->id, $users[$userid]->picture, 0, true).$studentname, implode("<br />\n", $essaylinks), $emaillink);
+                $table->data[] = array($OUTPUT->user_picture(moodle_user_picture::make($users[$userid], $course->id)).$studentname, implode("<br />\n", $essaylinks), $emaillink);
             }
             // email link for all users
             $emailalllink = "<a href=\"$CFG->wwwroot/mod/lesson/essay.php?id=$cm->id&amp;mode=email&amp;sesskey=".sesskey().'">'.get_string('emailallgradedessays', 'lesson').'</a>';
 
             $table->data[] = array(' ', ' ', $emailalllink);
             
-            print_table($table);
+            echo $OUTPUT->table($table);
             break;
         case 'grade':
             // Grading form
                   <input type="hidden" name="sesskey" value="'.sesskey().'" />';    
 
             // All tables will have these settings
-            $table = new stdClass;
-            $table->align = array('left');
-            $table->wrap = array();
-            $table->width = '50%';
-            $table->size = array('100%');
-            $table->class = 'generaltable gradetable';
+            $originaltable = new html_table();
+            $originaltable->align = array('left');
+            $originaltable->wrap = array();
+            $originaltable->width = '50%';
+            $originaltable->size = array('100%');
+            $originaltable->add_class('generaltable gradetable');
 
             // Print the question
+            $table = clone($originaltable);
             $table->head = array(get_string('question', 'lesson'));
             $options = new stdClass;
             $options->noclean = true;
             $table->data[] = array(format_text($page->contents, FORMAT_MOODLE, $options));
 
-            print_table($table);
-
-            unset($table->data);
+            echo $OUTPUT->table($table);
             
             // Now the user's answer
             $essayinfo = unserialize($attempt->useranswer);
             
+            $table = clone($originaltable);
+            $table = new html_table();
             $table->head = array(get_string('studentresponse', 'lesson', fullname($user, true)));
             $table->data[] = array(s($essayinfo->answer));
 
-            print_table($table);
-
-            unset($table->data);
+            echo $OUTPUT->table($table);
 
             // Now a response box and grade drop-down for grader
+            $table = clone($originaltable);
             $table->head = array(get_string('comments', 'lesson'));
             $table->data[] = array(print_textarea(false, 15, 60, 0, 0, 'response', $essayinfo->response, $course->id, true));
             $options = array();
             $select->nothingvalue = '';
             $table->data[] = array(get_string('essayscore', 'lesson').': '.$OUTPUT->select($select));
 
-            print_table($table);
+            echo $OUTPUT->table($table);
             echo '<div class="buttons">
                   <input type="submit" name="cancel" value="'.get_string('cancel').'" />
                   <input type="submit" value="'.get_string('savechanges').'" />
index 7a5a9c8097ba503276b05771946af3c2032defbb..d0569c4fd9cf0e6e21eb78d5b72eda488d7fc675 100644 (file)
                 }
                 krsort($topscores);
                        
-                $table = new stdClass;
+                $table = new html_table();
                 $table->align = array('center', 'left', 'right');
                 $table->wrap = array();
                 $table->width = "30%";
                         break;
                     }
                 }
-                print_table($table);
+                echo $OUTPUT->table($table);
             }
         
             if (!has_capability('mod/lesson:manage', $context)) {  // teachers don't need the links
index b4a347576e94ed66f8102dffe123c82d3a7205e6..f81bf85c7488bb82b3b8902f0e580ca6b8294c78 100644 (file)
@@ -52,7 +52,7 @@
     $strweek  = get_string("week");
     $strtopic  = get_string("topic");
     $strnodeadline = get_string("nodeadline", "lesson");
-    $table = new stdClass;
+    $table = new html_table();
 
     if ($course->format == "weeks") {
         $table->head  = array ($strweek, $strname, $strgrade, $strdeadline);
 
     echo "<br />";
 
-    print_table($table);
+    echo $OUTPUT->table($table);
 
 /// Finish the page
 
index 024d1eef05397f1bd7c39840cbd47a1c4afd30c3..678c6ad94ca084303f68630e017bcf78ad35877c 100644 (file)
@@ -219,6 +219,7 @@ function lesson_user_complete($course, $user, $mod, $lesson) {
     if ($attempts = $DB->get_records_select("lesson_attempts", "lessonid = :lessonid AND userid = :userid", $params,
                 "retry, timeseen")) {
         echo $OUTPUT->box_start();
+        $table = new html_table();
         $table->head = array (get_string("attempt", "lesson"),  get_string("numberofpagesviewed", "lesson"),
             get_string("numberofcorrectanswers", "lesson"), get_string("time"));
         $table->width = "100%";
@@ -252,7 +253,7 @@ function lesson_user_complete($course, $user, $mod, $lesson) {
         if ($npages) {
                 $table->data[] = array($retry + 1, $npages, $ncorrect, userdate($timeseen));
         }
-        print_table($table);
+        echo $OUTPUT->table($table);
         echo $OUTPUT->box_end();
         // also print grade summary
         $params = array ("lessonid" => $lesson->id, "userid" => $user->id);
index fcf7f0092cece3a997e4779cfab6feb4329c4001..03f4103dd4441871ee2ed10d84212d4211670ad5 100644 (file)
         $lowscore      = NULL;
         $hightime      = NULL;
         $lowtime       = NULL;
-        $table         = new stdClass;
+
+        $table = new html_table();
 
         // set up the table object
         $table->head = array(get_string('name'), get_string('attempts', 'lesson'), get_string('highscore', 'lesson'));
                    <input type=\"hidden\" name=\"id\" value=\"$cm->id\" />\n
                    <input type=\"hidden\" name=\"id\" value=\"$cm->id\" />\n";
         }
-        print_table($table);
+        echo $OUTPUT->table($table);
         
         if (has_capability('mod/lesson:edit', $context)) {
             echo '<br /><table width="90%" align="center"><tr><td>'.
         $stattable->width = "90%";
         $stattable->data[] = array($avescore.'%', $avetime, $highscore.'%', $lowscore.'%', $hightime, $lowtime);
 
-        print_table($stattable);
+        echo $OUTPUT->table($stattable);
 }
     /**************************************************************************
     this action is for a student detailed view and for the general detailed view
         }
 
         /// actually start printing something
-        $table = new stdClass;
+        $table = new html_table();
         $table->wrap = array();
         $table->width = "60%";
 
                 
                 $gradeinfo = lesson_grade($lesson, $try, $user->id);
                 
-                $table->data[] = array(get_string('name').':', print_user_picture($user->id, $course->id, $user->picture, 0, true).fullname($user, true));
+                $table->data[] = array(get_string('name').':', $OUTPUT->user_picture(moodle_user_picture::make($user, $course->id)).fullname($user, true));
                 $table->data[] = array(get_string("timetaken", "lesson").":", format_time($timetotake));
                 $table->data[] = array(get_string("completed", "lesson").":", userdate($completed));
                 $table->data[] = array(get_string('rawgrade', 'lesson').':', $gradeinfo->earned.'/'.$gradeinfo->total);
                 $table->data[] = array(get_string("grade", "lesson").":", $grade."%");
             }
-            print_table($table);
+            echo $OUTPUT->table($table);
             
             // Don't want this class for later tables
-            unset($table->class);
+            $table->set_classes();
             echo "<br />";
         }
 
                 $table->data[] = array($fontstart.get_string("response", "lesson").": <br />".$fontend.$fontstart2.format_text($page->answerdata->response,FORMAT_MOODLE,$formattextdefoptions).$fontend2, " ");
             }
             $table->data[] = array($page->answerdata->score, " ");
-            print_table($table);
+            echo $OUTPUT->table($table);
             echo "<br />";
         }
     }