]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19797 upgraded calls to print_table, print_single_button, print_user_picture...
authornicolasconnault <nicolasconnault>
Thu, 20 Aug 2009 08:40:49 +0000 (08:40 +0000)
committernicolasconnault <nicolasconnault>
Thu, 20 Aug 2009 08:40:49 +0000 (08:40 +0000)
15 files changed:
grade/edit/letter/index.php
grade/edit/outcome/edit.php
grade/edit/outcome/import.php
grade/edit/outcome/index.php
grade/edit/scale/index.php
grade/edit/tree/index.php
grade/edit/tree/outcomeitem.php
grade/export/key.php
grade/export/keymanager.php
grade/export/lib.php
grade/import/key.php
grade/import/keymanager.php
grade/report/grader/ajaxlib.php
grade/report/grader/index.php
grade/report/grader/lib.php

index d3c53b3c6554dafb0690aa5d47f46011831e757c..b2d500a8ddd37f0bb7a8f0e44d82aa8c4ece4c25 100644 (file)
@@ -53,13 +53,13 @@ foreach($letters as $boundary=>$letter) {
     $max = $boundary - 0.01;
 }
 
-$table = new object();
+$table = new html_table();
 $table->head  = array(get_string('max', 'grades'), get_string('min', 'grades'), get_string('letter', 'grades'));
 $table->size  = array('30%', '30%', '40%');
 $table->align = array('left', 'left', 'left');
 $table->width = '30%';
 $table->data  = $data;
-print_table($table);
+echo $OUTPUT->table($table);
 
 echo $OUTPUT->footer();
 
index d522183fd6c91f8ea8627e05a29761eff1d6b2e0..c00b73b019960f65d543e2e0ccba0e278e3b5bab 100644 (file)
@@ -124,7 +124,7 @@ if ($courseid) {
 }
 
 if (!grade_scale::fetch_all_local($courseid) && !grade_scale::fetch_all_global()) {
-    notice_yesno(get_string('noscales', 'grades'), $CFG->wwwroot.'/grade/edit/scale/edit.php?courseid='.$courseid, $returnurl);
+    echo $OUTPUT->confirm(get_string('noscales', 'grades'), $CFG->wwwroot.'/grade/edit/scale/edit.php?courseid='.$courseid, $returnurl);
     echo $OUTPUT->footer();
     die();
 }
index d01ca29a9241966255bffd0ded459bd589f40e22..0cd188002104f31818018588ed20ff26813bcff7 100644 (file)
@@ -135,7 +135,7 @@ if ($handle = fopen($imported_file['userfile']['tmp_name'], 'r')) {
             if ($error) {
                 echo $OUTPUT->box_start('generalbox importoutcomenofile');
                 echo get_string('importoutcomenofile', 'grades', $line);
-                echo print_single_button($CFG->wwwroot.'/grade/edit/outcome/index.php', array('id'=> $courseid), get_string('back'), 'get', '_self', true);
+                echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/grade/edit/outcome/index.php', array('id'=> $courseid), get_string('back'), 'get'));
                 echo $OUTPUT->box_end();
                 $fatal_error = true;
                 break;
@@ -154,7 +154,7 @@ if ($handle = fopen($imported_file['userfile']['tmp_name'], 'r')) {
         if ( count($csv_data) != count($file_headers) ) {
             echo $OUTPUT->box_start('generalbox importoutcomenofile');
             echo get_string('importoutcomenofile', 'grades', $line);
-            echo print_single_button($CFG->wwwroot.'/grade/edit/outcome/index.php', array('id'=> $courseid), get_string('back'), 'get', '_self', true);
+            echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/grade/edit/outcome/index.php', array('id'=> $courseid), get_string('back'), 'get'));
             echo $OUTPUT->box_end();
             $fatal_error = true;
             //echo $OUTPUT->box(var_export($csv_data, true) ."<br />". var_export($header, true));
@@ -166,7 +166,7 @@ if ($handle = fopen($imported_file['userfile']['tmp_name'], 'r')) {
             if ($csv_data[$imported_headers[$header]] == '') {
                 echo $OUTPUT->box_start('generalbox importoutcomenofile');
                 echo get_string('importoutcomenofile', 'grades', $line);
-                echo print_single_button($CFG->wwwroot.'/grade/edit/outcome/index.php', array('id'=> $courseid), get_string('back'), 'get', '_self', true);
+                echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/grade/edit/outcome/index.php', array('id'=> $courseid), get_string('back'), 'get'));
                 echo $OUTPUT->box_end();
                 $fatal_error = true;
                 break;
index bf1fbdfe1992a87af388e247c8a455dc8a8e8d9e..141b99cb311f0978585300c59d3498eaa531e2b3 100644 (file)
@@ -97,13 +97,13 @@ switch ($action) {
 
         if(!$deleteconfirmed){
             print_header(get_string('outcomedelete', 'grades'));
-            notice_yesno(get_string('outcomeconfirmdelete', 'grades', $outcome->fullname),
-                    "index.php?id={$courseid}", "index.php?id={$courseid}",
-                    array('outcomeid' => $outcome->id,
-                        'action'=> 'delete',
-                        'sesskey' =>  sesskey(),
-                        'deleteconfirmed'=> 1)
-                    );
+            $confirmurl = new moodle_url('index.php', array(
+                    'id' => $courseid, 'outcomeid' => $outcome->id,
+                    'action'=> 'delete',
+                    'sesskey' =>  sesskey(),
+                    'deleteconfirmed'=> 1));
+
+            echo $OUTPUT->confirm(get_string('outcomeconfirmdelete', 'grades', $outcome->fullname), $confirmurl, "index.php?id={$courseid}");
             echo $OUTPUT->footer();
             die;
         }else{
@@ -170,13 +170,13 @@ if ($courseid and $outcomes = grade_outcome::fetch_all_local($courseid)) {
 
         $data[] = $line;
     }
-    $table = new object();
+    $table = new html_table();
     $table->head  = array($strfullname, $strshortname, $strscale, $stritems, $stredit);
     $table->size  = array('30%', '20%', '20%', '20%', '10%' );
     $table->align = array('left', 'left', 'left', 'center', 'center');
     $table->width = '90%';
     $table->data  = $data;
-    $return .= print_table($table, true);
+    $return .= $OUTPUT->table($table);
     $outcomes_tables[] = $return;
 }
 
@@ -226,13 +226,13 @@ if ($outcomes = grade_outcome::fetch_all_global()) {
 
         $data[] = $line;
     }
-    $table = new object();
+    $table = new html_table();
     $table->head  = array($strfullname, $strshortname, $strscale, $strcourses, $stritems, $stredit);
     $table->size  = array('30%', '20%', '20%', '10%', '10%', '10%');
     $table->align = array('left', 'left', 'left', 'center', 'center', 'center');
     $table->width = '90%';
     $table->data  = $data;
-    $return .= print_table($table, true);
+    $return .= $OUTPUT->table($table);
     $outcomes_tables[] = $return;
 }
 
@@ -245,12 +245,12 @@ foreach($outcomes_tables as $table) {
     print($table);
 }
 
-echo '<div class="buttons">';
-print_single_button('edit.php', array('courseid'=>$courseid), $strcreatenewoutcome);
+echo $OUTPUT->container_start('buttons');
+echo $OUTPUT->button(html_form::make_button('edit.php', array('courseid'=>$courseid), $strcreatenewoutcome));
 if ( !empty($outcomes_tables) ) {
-    print_single_button('export.php', array('id'=>$courseid, 'sesskey'=>sesskey()),  get_string('exportalloutcomes', 'grades'));
+    echo $OUTPUT->button(html_form::make_button('export.php', array('id'=>$courseid, 'sesskey'=>sesskey()),  get_string('exportalloutcomes', 'grades')));
 }
-echo '</div>';
+echo $OUTPUT->container_end();
 
 $upload_form->display();
 
index 88a568ed285fe5c1923ce00b95ca9abf7feb8668..b14489eb5cb64643162875d61d84fbcbc0df7c06 100644 (file)
@@ -77,8 +77,8 @@ if (!$courseid) {
     admin_externalpage_print_header();
 }
 
-$table = new stdClass();
-$table2 = new stdClass();
+$table = new html_table();
+$table2 = new html_table();
 $heading = '';
 
 if ($courseid and $scales = grade_scale::fetch_all_local($courseid)) {
@@ -145,11 +145,10 @@ if ($courseid) {
 }
 
 echo $OUTPUT->heading($strcustomscales, 3, 'main');
-print_table($table);
+echo $OUTPUT->table($table);
 echo $OUTPUT->heading($strstandardscale, 3, 'main');
-print_table($table2);
-echo '<div class="buttons">';
-print_single_button('edit.php', array('courseid'=>$courseid), $srtcreatenewscale);
-echo '</div>';
-
+echo $OUTPUT->table($table2);
+echo $OUTPUT->container_start('buttons');
+echo $OUTPUT->button(html_form::make_button('edit.php', array('courseid'=>$courseid), $srtcreatenewscale));
+echo $OUTPUT->container_end(); 
 echo $OUTPUT->footer(); 
index 284b36b1c2fcd0d1d1c5e01ed6d1dcaf1c6e5db7..38edc602c1a12a0f7cb56519407ceaab365895bc 100644 (file)
@@ -144,7 +144,9 @@ switch ($action) {
                 $strdeletecheckfull = get_string('deletecheck', '', $object->get_name());
                 $optionsyes = array('eid'=>$eid, 'confirm'=>1, 'sesskey'=>sesskey(), 'id'=>$course->id, 'action'=>'delete');
                 $optionsno  = array('id'=>$course->id);
-                notice_yesno($strdeletecheckfull, 'index.php', 'index.php', $optionsyes, $optionsno, 'post', 'get');
+                $formcontinue = html_form::make_button('index.php', $optionsyes, get_string('yes'));
+                $formcancel = html_form::make_button('index.php', $optionsno, get_string('no'), 'get');
+                echo $OUTPUT->confirm($strdeletecheckfull, $formcontinue, $formcancel);
                 echo $OUTPUT->footer();
                 die;
             }
@@ -329,22 +331,22 @@ echo '</div></form>';
 echo $OUTPUT->box_end();
 
 // Print action buttons
-echo '<div class="buttons">';
+echo $OUTPUT->container_start('buttons');
 
 if ($moving) {
-    print_single_button('index.php', array('id'=>$course->id), get_string('cancel'), 'get');
+    echo $OUTPUT->button(html_form::make_button('index.php', array('id'=>$course->id), get_string('cancel'), 'get'));
 } else {
-    print_single_button('category.php', array('courseid'=>$course->id), get_string('addcategory', 'grades'), 'get');
-    print_single_button('item.php', array('courseid'=>$course->id), get_string('additem', 'grades'), 'get');
+    echo $OUTPUT->button(html_form::make_button('category.php', array('courseid'=>$course->id), get_string('addcategory', 'grades'), 'get'));
+    echo $OUTPUT->button(html_form::make_button('item.php', array('courseid'=>$course->id), get_string('additem', 'grades'), 'get'));
 
     if (!empty($CFG->enableoutcomes)) {
-        print_single_button('outcomeitem.php', array('courseid'=>$course->id), get_string('addoutcomeitem', 'grades'), 'get');
+        echo $OUTPUT->button(html_form::make_button('outcomeitem.php', array('courseid'=>$course->id), get_string('addoutcomeitem', 'grades'), 'get'));
     }
 
     //print_single_button('index.php', array('id'=>$course->id, 'action'=>'autosort'), get_string('autosort', 'grades'), 'get');
 }
 
-echo '</div>';
+echo $OUTPUT->container_end();
 
 echo $OUTPUT->footer();
 
index 29daf9708d41967f78908371c239c2df2c3e136d..279f7977f70fa8d8541dd833f14dc978d6de0a58 100644 (file)
@@ -204,7 +204,7 @@ if ($data = $mform->get_data()) {
 print_grade_page_head($courseid, 'edittree', null, $heading);
 
 if (!grade_outcome::fetch_all_available($COURSE->id)) {
-    notice_yesno(get_string('nooutcomes', 'grades'), $CFG->wwwroot.'/grade/edit/outcome/course.php?id='.$courseid, $returnurl);
+    echo $OUTPUT->confirm(get_string('nooutcomes', 'grades'), $CFG->wwwroot.'/grade/edit/outcome/course.php?id='.$courseid, $returnurl);
     echo $OUTPUT->footer();
     die();
 }
index 8cee15694b1b97c119095a85b4c1290cdbf1c51a..69382778ec77061d028e87bf6982f35cc98c78c6 100644 (file)
@@ -64,7 +64,9 @@ if ($id and $delete) {
         print_header(get_string('deleteselectedkey'), get_string('deleteselectedkey'));
         $optionsyes = array('id'=>$id, 'delete'=>1, 'courseid'=>$courseid, 'sesskey'=>sesskey(), 'confirm'=>1);
         $optionsno  = array('id'=>$courseid);
-        notice_yesno(get_string('deletekeyconfirm', 'userkey', $key->value), 'key.php', 'keymanager.php', $optionsyes, $optionsno, 'get', 'get');
+        $formcontinue = html_form::make_button('key.php', $optionsyes, get_string('yes'), 'get');
+        $formcancel = html_form::make_button('keymanager.php', $optionsno, get_string('no'), 'get');
+        echo $OUTPUT->confirm(get_string('deletekeyconfirm', 'userkey', $key->value), $formcontinue, $formcancel);
         echo $OUTPUT->footer();
         die;
 
index 29ef1ddcc9c146e250757590cad5af96597a4e75..cb0e812bc3b74ea0a3436abf008d86fee6d9a107 100644 (file)
@@ -53,16 +53,17 @@ if ($keys) {
         $data[] = $line;
     }
 }
+$table = new html_table();
 $table->head  = array(get_string('keyvalue', 'userkey'), get_string('keyiprestriction', 'userkey'), get_string('keyvaliduntil', 'userkey'), $stredit);
 $table->size  = array('50%', '30%', '10%', '10%');
 $table->align = array('left', 'left', 'left', 'center');
 $table->width = '90%';
 $table->data  = $data;
-print_table($table);
+echo $OUTPUT->table($table);
 
-echo '<div class="buttons">';
-print_single_button('key.php', array('courseid'=>$course->id), get_string('newuserkey', 'userkey'));
-echo '</div>';
+echo $OUTPUT->container_start('buttons');
+echo $OUTPUT->button(html_form::make_button('key.php', array('courseid'=>$course->id), get_string('newuserkey', 'userkey')));
+echo $OUTPUT->container_end();
 
 echo $OUTPUT->footer();
 ?>
index 452e5163be0a3de470539b479f1cef573ed56cc1..274027ba68813178ab2bac66846317c70b3702fe 100755 (executable)
@@ -288,29 +288,29 @@ abstract class grade_export {
     public function print_continue() {
         global $CFG, $OUTPUT;
 
-        $params = $this->get_export_params();
-
+        $params = $this->get_export_params(); 
 
         echo $OUTPUT->heading(get_string('export', 'grades'));
 
-        echo '<div class="gradeexportlink">';
+        echo $OUTPUT->container_start('gradeexportlink');
+
         if (!$this->userkey) {      // this button should trigger a download prompt
-            print_single_button($CFG->wwwroot.'/grade/export/'.$this->plugin.'/export.php',
-                                $params, get_string('download', 'admin'));
+            echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/grade/export/'.$this->plugin.'/export.php',
+                                $params, get_string('download', 'admin')));
 
         } else {
             $paramstr = '';
             $sep = '?';
             foreach($params as $name=>$value) {
                 $paramstr .= $sep.$name.'='.$value;
-                $sep = '&amp;';
+                $sep = '&';
             }
 
-            $link = $CFG->wwwroot.'/grade/export/'.$this->plugin.'/dump.php'.$paramstr.'&amp;key='.$this->userkey;
+            $link = $CFG->wwwroot.'/grade/export/'.$this->plugin.'/dump.php'.$paramstr.'&key='.$this->userkey;
 
-            echo get_string('download', 'admin').': <a href="'.$link.'">'.$link.'</a>';
+            echo get_string('download', 'admin').': ' . $OUTPUT->link(html_link::make($link, $link));
         }
-        echo '</div>';
+        echo $OUTPUT->container_end();
     }
 }
 
index 0929d1675e607f0950007818f5e3ee2b82245425..b70950adec1a33a6389cf15ddae8e547c002f2b0 100644 (file)
@@ -64,7 +64,9 @@ if ($id and $delete) {
         print_header(get_string('deleteselectedkey'), get_string('deleteselectedkey'));
         $optionsyes = array('id'=>$id, 'delete'=>1, 'courseid'=>$courseid, 'sesskey'=>sesskey(), 'confirm'=>1);
         $optionsno  = array('id'=>$courseid);
-        notice_yesno(get_string('deletekeyconfirm', 'userkey', $key->value), 'key.php', 'keymanager.php', $optionsyes, $optionsno, 'get', 'get');
+        $formcontinue = html_form::make_button('key.php', $optionsyes, get_string('yes'), 'get');
+        $formcancel = html_form::make_button('keymanager.php', $optionsno, get_string('no'), 'get');
+        echo $OUTPUT->confirm(get_string('deletekeyconfirm', 'userkey', $key->value), $formcontinue, $formcancel);
         echo $OUTPUT->footer();
         die;
 
index 3f5a0cb14f429fac11670e94c09b03f37e274dc2..cdf7fff93a9c97c014a9b13c2cead156281c75d7 100644 (file)
@@ -52,16 +52,17 @@ if ($keys = $DB->get_records_select('user_private_key', "script='grade/import' A
         $data[] = $line;
     }
 }
+$table = new html_table();
 $table->head  = array(get_string('keyvalue', 'userkey'), get_string('keyiprestriction', 'userkey'), get_string('keyvaliduntil', 'userkey'), $stredit);
 $table->size  = array('50%', '30%', '10%', '10%');
 $table->align = array('left', 'left', 'left', 'center');
 $table->width = '90%';
 $table->data  = $data;
-print_table($table);
+echo $OUTPUT->table($table);
 
-echo '<div class="buttons">';
-print_single_button('key.php', array('courseid'=>$course->id), get_string('newuserkey', 'userkey'));
-echo '</div>';
+echo $OUTPUT->container_start('buttons');
+echo $OUTPUT->button(html_form::make_button('key.php', array('courseid'=>$course->id), get_string('newuserkey', 'userkey')));
+echo $OUTPUT->container_end();
 
 echo $OUTPUT->footer();
 ?>
index 23794f93ef25d23c061bf62f086671149b3edb07..4b7411e71970bd4d2730bea5a04bfafb206a140f 100644 (file)
@@ -158,7 +158,7 @@ class grade_report_grader_ajax extends grade_report_grader {
      * @return string
      */
     function get_studentrowhtml($user) {
-        global $CFG, $USER;
+        global $CFG, $USER, $OUTPUT;
         $showuserimage = $this->get_pref('showuserimage');
         $showuseridnumber = $this->get_pref('showuseridnumber');
         $fixedstudents = empty($USER->screenreader) && $this->get_pref('fixedstudents');
@@ -183,7 +183,7 @@ class grade_report_grader_ajax extends grade_report_grader {
             // Student name and link
             $user_pic = null;
             if ($showuserimage) {
-                $user_pic = '<div class="userpic">' . print_user_picture($user, $this->courseid, true, 0, true) . '</div>';
+                $user_pic = '<div class="userpic">' . $OUTPUT->user_picture(moodle_user_picture::make($user, $this->courseid)) . '</div>';
             }
 
             $studentrowhtml .= '<tr class="r'.$this->rowcount++ . $row_classes[$this->rowcount % 2] . '">'
index bad78c153a4b5c37ce6ebefd13e068ec968212ca..31d4ef2ba4444a23c9a31218c5da831d162896f5 100644 (file)
@@ -84,7 +84,7 @@ if (has_capability('moodle/grade:edit', $context)) {
         $string = get_string('turneditingon');
     }
 
-    $buttons = print_single_button('index.php', $options, $string, 'get', '_self', true);
+    $buttons = $OUTPUT->button(html_form::make_button('index.php', $options, $string, 'get'));
 
 } else {
     $USER->gradeediting[$course->id] = 0;
index 131029b28fc5ec705e2d1d334ec30da05ef6c5e3..7a8480bfd97e0a9862e8913558ef8896620f7ee4 100644 (file)
@@ -740,7 +740,7 @@ class grade_report_grader extends grade_report {
                 // Student name and link
                 $user_pic = null;
                 if ($showuserimage) {
-                    $user_pic = '<div class="userpic">' . print_user_picture($user, $this->courseid, null, 0, true) . '</div>';
+                    $user_pic = '<div class="userpic">' . $OUTPUT->user_picture(moodle_user_picture::make($user, $this->courseid)) . '</div>';
                 }
 
                 $studentshtml .= '<tr class="r'.$this->rowcount++ . $row_classes[$this->rowcount % 2] . '">'
@@ -1015,7 +1015,7 @@ class grade_report_grader extends grade_report {
 
                 $user_pic = null;
                 if ($showuserimage) {
-                    $user_pic = '<div class="userpic">' . print_user_picture($user, $this->courseid, NULL, 0, true) . "</div>\n";
+                    $user_pic = '<div class="userpic">' . $OUTPUT->user_picture(moodle_user_picture::make($user, $this->courseid)) . "</div>\n";
                 }
 
                 $studentshtml .= '<tr class="r'.$this->rowcount++ . $row_classes[$this->rowcount % 2] . '">'
@@ -1448,7 +1448,7 @@ class grade_report_grader extends grade_report {
 
         return true;
     }
-    
+
     /**
      * Returns whether or not to display fixed students column.
      * Includes a browser check, because IE6 doesn't support the scrollbar.
@@ -1457,13 +1457,13 @@ class grade_report_grader extends grade_report {
      */
     public function is_fixed_students() {
         global $USER, $CFG;
-        return empty($USER->screenreader) && $CFG->grade_report_fixedstudents && 
-            (check_browser_version('MSIE', '7.0') || 
+        return empty($USER->screenreader) && $CFG->grade_report_fixedstudents &&
+            (check_browser_version('MSIE', '7.0') ||
              check_browser_version('Firefox', '2.0') ||
              check_browser_version('Gecko', '2006010100') ||
              check_browser_version('Camino', '1.0') ||
              check_browser_version('Opera', '6.0') ||
-             check_browser_version('Safari', '2.0')); 
+             check_browser_version('Safari', '2.0'));
     }
 }
 ?>