From cd6137d7078a68e2e35c75844295635e0c434408 Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Thu, 20 Aug 2009 08:43:34 +0000 Subject: [PATCH] MDL-19806 upgraded calls to print_table, print_single_button, print_user_picture, print_container* and notice_yesno --- mod/data/comment.php | 7 +++---- mod/data/field.php | 7 ++++--- mod/data/index.php | 4 +++- mod/data/lib.php | 6 +++--- mod/data/preset.php | 19 ++++++++----------- mod/data/report.php | 6 ++++-- mod/data/view.php | 4 ++-- 7 files changed, 27 insertions(+), 26 deletions(-) diff --git a/mod/data/comment.php b/mod/data/comment.php index e211cbde5ce..1d65c6d2cfc 100755 --- a/mod/data/comment.php +++ b/mod/data/comment.php @@ -113,10 +113,9 @@ print_header(); data_print_comment($data, $comment, $page); - notice_yesno(get_string('deletecomment','data'), - 'comment.php?rid='.$record->id.'&commentid='.$comment->id.'&page='.$page. - '&sesskey='.sesskey().'&mode=delete&confirm=1', - 'view.php?rid='.$record->id.'&page='.$page); + echo $OUTPUT->confirm(get_string('deletecomment','data'), + 'comment.php?rid='.$record->id.'&commentid='.$comment->id.'&page='.$page.'&mode=delete&confirm=1', + 'view.php?rid='.$record->id.'&page='.$page); echo $OUTPUT->footer(); } die; diff --git a/mod/data/field.php b/mod/data/field.php index c42e9d98945..0878ff474ed 100755 --- a/mod/data/field.php +++ b/mod/data/field.php @@ -184,8 +184,8 @@ // Print confirmation message. $field = data_get_field_from_id($fid, $data); - notice_yesno(''.$field->name().': '.$field->field->name.'

'. get_string('confirmdeletefield','data'), - 'field.php?d='.$data->id.'&mode=delete&fid='.$fid.'&sesskey='.sesskey().'&confirm=1', + echo $OUTPUT->confirm(''.$field->name().': '.$field->field->name.'

'. get_string('confirmdeletefield','data'), + 'field.php?d='.$data->id.'&mode=delete&fid='.$fid.'&confirm=1', 'field.php?d='.$data->id); echo $OUTPUT->footer(); @@ -246,6 +246,7 @@ } else { //else print quiz style list of fields + $table = new html_table(); $table->head = array(get_string('fieldname','data'), get_string('type','data'), get_string('fielddescription', 'data'), get_string('action','data')); $table->align = array('left','left','left', 'center'); $table->wrap = array(false,false,false,false); @@ -273,7 +274,7 @@ ); } } - print_table($table); + echo $OUTPUT->table($table); } diff --git a/mod/data/index.php b/mod/data/index.php index 399f79624bb..12c4b8ae824 100755 --- a/mod/data/index.php +++ b/mod/data/index.php @@ -61,6 +61,8 @@ $strentries = get_string('entries', 'data'); $strnumnotapproved = get_string('numnotapproved', 'data'); + $table = new html_table(); + if ($course->format == 'weeks') { $table->head = array ($strweek, $strname, $strdescription, $strentries, $strnumnotapproved); $table->align = array ('center', 'center', 'center', 'center', 'center'); @@ -137,7 +139,7 @@ } echo "
"; - print_table($table); + echo $OUTPUT->table($table); echo $OUTPUT->footer(); ?> diff --git a/mod/data/lib.php b/mod/data/lib.php index 6a674619bea..49568f5e0ec 100755 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -1505,7 +1505,7 @@ function data_print_ratings($data, $record) { if ($data->scale < 0) { if ($scale = $DB->get_record('scale', array('id'=>abs($data->scale)))) { - echo $OUTPUT->help_button(helpbutton::make_scale_menu($data->course, $scale)); + echo $OUTPUT->help_button(moodle_help_icon::make_scale_menu($data->course, $scale)); } } @@ -1699,7 +1699,7 @@ function data_print_comments($data, $record, $page=0, $mform=false) { * @return void Output is echo'd */ function data_print_comment($data, $comment, $page=0) { - global $USER, $CFG, $DB; + global $USER, $CFG, $DB, $OUTPUT; $cm = get_coursemodule_from_instance('data', $data->id); $context = get_context_instance(CONTEXT_MODULE, $cm->id); @@ -1712,7 +1712,7 @@ function data_print_comment($data, $comment, $page=0) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo ''; - echo ''; + echo ''; echo ''; echo "\n"; } diff --git a/mod/data/view.php b/mod/data/view.php index 1c2db455cd9..09dbdfb20dd 100755 --- a/mod/data/view.php +++ b/mod/data/view.php @@ -338,8 +338,8 @@ } else { // Print a confirmation page if ($deleterecord = $DB->get_record('data_records', array('id'=>$delete))) { // Need to check this is valid if ($deleterecord->dataid == $data->id) { // Must be from this database - notice_yesno(get_string('confirmdeleterecord','data'), - 'view.php?d='.$data->id.'&delete='.$delete.'&confirm=1&sesskey='.sesskey(), + echo $OUTPUT->confirm(get_string('confirmdeleterecord','data'), + 'view.php?d='.$data->id.'&delete='.$delete.'&confirm=1', 'view.php?d='.$data->id); $records[] = $deleterecord;
'; - print_user_picture($user, $data->course, $user->picture); + echo $OUTPUT->user_picture(moodle_user_picture::make($user, $data->course)); echo '
'; diff --git a/mod/data/preset.php b/mod/data/preset.php index 046ee51e579..da735ec359a 100644 --- a/mod/data/preset.php +++ b/mod/data/preset.php @@ -91,15 +91,12 @@ switch ($action) { $strwarning = get_string('deletewarning', 'data').'
'. data_preset_name($shortname, $path); - $options = new object(); - $options->fullname = $userid.'/'.$shortname; - $options->action = 'delete'; - $options->d = $data->id; - $options->sesskey = sesskey(); - - $optionsno = new object(); - $optionsno->d = $data->id; - notice_yesno($strwarning, 'preset.php', 'preset.php', $options, $optionsno, 'post', 'get'); + $optionsyes = array('fullname' => $userid.'/'.$shortname, + 'action' => 'delete', + 'd' => $data->id); + + $optionsno = array('d' => $data->id); + echo $OUTPUT->confirm($strwarning, new moodle_url('preset.php', $optionsyes), new moodle_url('preset.php', $optionsno)); echo $OUTPUT->footer(); exit(0); break; @@ -302,7 +299,7 @@ $options = new object(); $options->action = 'export'; $options->d = $data->id; $options->sesskey = sesskey(); -print_single_button('preset.php', $options, $strexport, 'post'); +echo $OUTPUT->button(html_form::make_button('preset.php', $options, $strexport)); echo '
'; @@ -312,7 +309,7 @@ $options = new object(); $options->action = 'save1'; $options->d = $data->id; $options->sesskey = sesskey(); -print_single_button('preset.php', $options, $strsave, 'post'); +echo $OUTPUT->button(html_form::make_button('preset.php', $options, $strsave)); echo '

'.$strimport.'

'; diff --git a/mod/data/report.php b/mod/data/report.php index a255b9e93e4..8ff382b4a63 100755 --- a/mod/data/report.php +++ b/mod/data/report.php @@ -66,9 +66,11 @@ echo '
'; - print_user_picture($rating->id, $data->course, $rating->picture, false, false, true); + $userpic = moodle_user_picture::make($rating, $data->course); + $userpic->link = true; + echo $OUTPUT->user_picture($userpic); echo ''.fullname($rating).'' . $OUTPUT->link($CFG->wwwroot.'/user/view.php?id='.$rating->id.'&course='.$data->course, fullname($rating)) . ''.$scalemenu[$rating->rating].'