From f2f085ee6810ce3524c325609dfa1cfc576ecd78 Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Thu, 20 Aug 2009 08:50:22 +0000 Subject: [PATCH] MDL-19825 upgraded calls to print_table, print_single_button, print_user_picture, print_container* and notice_yesno --- user/addnote.php | 3 ++- user/edit_form.php | 8 +++++--- user/editadvanced_form.php | 6 ++++-- user/extendenrol.php | 3 ++- user/groupextendenrol.php | 3 ++- user/index.php | 9 +++++---- user/policy.php | 10 ++++------ user/portfolio.php | 4 ++-- user/portfoliologs.php | 8 ++++---- user/profile/index.php | 17 +++++++++++------ user/repository.php | 4 ++-- user/view.php | 10 ++++++---- 12 files changed, 49 insertions(+), 36 deletions(-) diff --git a/user/addnote.php b/user/addnote.php index 0505967f9c..23b6d3c26e 100644 --- a/user/addnote.php +++ b/user/addnote.php @@ -61,6 +61,7 @@ echo '
'; echo ''; echo ''; echo '
'; +$table = new html_table(); $table->head = array (get_string('fullname'), get_string('content', 'notes') . $OUTPUT->help_icon(moodle_help_icon::make('writing', get_string('helpwriting'))), get_string('publishstate', 'notes') . $OUTPUT->help_icon(moodle_help_icon::make('status', get_string('publishstate', 'notes'), 'notes')), @@ -88,7 +89,7 @@ foreach ($users as $k => $v) { $checkbox ); } -print_table($table); +echo $OUTPUT->table($table); echo '
'; echo $OUTPUT->footer(); ?> diff --git a/user/edit_form.php b/user/edit_form.php index e1f578ef41..4326c3065b 100644 --- a/user/edit_form.php +++ b/user/edit_form.php @@ -38,7 +38,7 @@ class user_edit_form extends moodleform { } function definition_after_data() { - global $CFG, $DB; + global $CFG, $DB, $OUTPUT; $mform =& $this->_form; $userid = $mform->getElementValue('id'); @@ -72,7 +72,9 @@ class user_edit_form extends moodleform { if (!empty($CFG->gdversion)) { $image_el =& $mform->getElement('currentpicture'); if ($user and $user->picture) { - $image_el->setValue(print_user_picture($user, SITEID, $user->picture, 64,true,false,'',true)); + $userpic = moodle_user_picture::make($user, SITEID); + $userpic->size = 64; + $image_el->setValue($OUTPUT->user_picture($userpic)); } else { $image_el->setValue(get_string('none')); } @@ -96,7 +98,7 @@ class user_edit_form extends moodleform { } } } - + /// Next the customisable profile fields profile_definition_after_data($mform, $user->id); diff --git a/user/editadvanced_form.php b/user/editadvanced_form.php index f3ae17d58e..0a82c74948 100644 --- a/user/editadvanced_form.php +++ b/user/editadvanced_form.php @@ -49,7 +49,7 @@ class user_editadvanced_form extends moodleform { } function definition_after_data() { - global $USER, $CFG, $DB; + global $USER, $CFG, $DB, $OUTPUT; $mform =& $this->_form; if ($userid = $mform->getElementValue('id')) { @@ -95,7 +95,9 @@ class user_editadvanced_form extends moodleform { if (!empty($CFG->gdversion)) { $image_el =& $mform->getElement('currentpicture'); if ($user and $user->picture) { - $image_el->setValue(print_user_picture($user, SITEID, $user->picture, 64, true, false, '', true)); + $userpic = moodle_user_picture::make($user, SITEID); + $userpic->alttext = true; + $image_el->setValue($OUTPUT->user_picture($userpic)); } else { $image_el->setValue(get_string('none')); } diff --git a/user/extendenrol.php b/user/extendenrol.php index eb6795c069..e37d15b24d 100644 --- a/user/extendenrol.php +++ b/user/extendenrol.php @@ -116,6 +116,7 @@ echo $OUTPUT->heading($title . $OUTPUT->help_icon(moodle_help_icon::make('extend echo "
\n"; echo ''; echo ''; +$table = new html_table(); $table->head = array (get_string('fullnameuser'), get_string('enrolmentstart'), get_string('enrolmentend'), get_string('extendperiod'), get_string('startingfrom')); $table->align = array ('left', 'center', 'center', 'center'); $table->width = "600"; @@ -154,7 +155,7 @@ foreach ($_POST as $k => $v) { $checkbox2); } } -print_table($table); +echo $OUTPUT->table($table); echo "\n
\n
\n"; echo $OUTPUT->footer(); diff --git a/user/groupextendenrol.php b/user/groupextendenrol.php index 54ea3877fd..ecbbde3106 100755 --- a/user/groupextendenrol.php +++ b/user/groupextendenrol.php @@ -113,6 +113,7 @@ echo $OUTPUT->heading($title . $OUTPUT->help_icon(moodle_help_icon::make('groupe echo '
'; echo ''; echo ''; +$table = new html_table(); $table->head = array (get_string('fullnameuser'), get_string('enrolmentstart'), get_string('enrolmentend')); $table->align = array ('left', 'center', 'center', 'center'); $table->width = "600"; @@ -145,7 +146,7 @@ foreach ($_POST as $k => $v) { ); } } -print_table($table); +echo $OUTPUT->table($table); echo '
'; echo get_string('extendperiod') . ' '; echo $OUTPUT->select(html_select::make($periodmenu, 'extendperiod')); diff --git a/user/index.php b/user/index.php index 1463c86637..91852c2b73 100644 --- a/user/index.php +++ b/user/index.php @@ -745,7 +745,8 @@ $row = new html_table_row(); $row->cells[0] = new html_table_cell(); $row->cells[0]->add_class('left side'); - $row->cells[0]->text = print_user_picture($user, $course->id, $user->picture, true, true); + + $row->cells[0]->text = $OUTPUT->user_picture(moodle_user_picture::make($user, $course->id)); $row->cells[1] = new html_table_cell(); $row->cells[1]->add_class('content'); @@ -892,9 +893,9 @@ $profilelink = ''.fullname($user).''; } - $data = array ( - print_user_picture($user, $course->id, $user->picture, false, true, $piclink), - $profilelink . $hidden); + $userpic = moodle_user_picture::make($user, $course->id); + $userpic->link = $piclink; + $data = array ($OUTPUT->user_picture($userpic), $profilelink . $hidden); if ($mode === MODE_BRIEF && !isset($hiddenfields['city'])) { $data[] = $user->city; diff --git a/user/policy.php b/user/policy.php index 9dcd765bc4..fa1944048a 100644 --- a/user/policy.php +++ b/user/policy.php @@ -48,12 +48,10 @@ // we can not use our popups here, because the url may be arbitrary, see MDL-9823 echo ''.$strpolicyagreementclick.''; echo '
'; - - $linkyes = 'policy.php'; - $optionsyes = array('agree'=>1, 'sesskey'=>sesskey()); - $linkno = $CFG->wwwroot.'/login/logout.php'; - $optionsno = array('sesskey'=>sesskey()); - notice_yesno($strpolicyagree, $linkyes, $linkno, $optionsyes, $optionsno); + + $formcontinue = html_form::make_button('policy.php', array('agree'=>1), get_string('yes')); + $formcancel = html_form::make_button($CFG->wwwroot.'/login/logout.php', array(), get_string('no')); + echo $OUTPUT->confirm($strpolicyagree, $formcontinue, $formcancel); echo $OUTPUT->footer(); diff --git a/user/portfolio.php b/user/portfolio.php index 93d80b43df..a8f9ccb3df 100644 --- a/user/portfolio.php +++ b/user/portfolio.php @@ -81,7 +81,7 @@ if ($display) { print_error('noinstances', 'portfolio', $CFG->wwwroot . '/user/view.php'); } - $table = new StdClass; + $table = new html_table(); $table->head = array($namestr, $pluginstr, ''); $table->data = array(); @@ -94,7 +94,7 @@ if ($display) { ); } - print_table($table); + echo $OUTPUT->table($table); } echo $OUTPUT->footer(); diff --git a/user/portfoliologs.php b/user/portfoliologs.php index 1affd069e0..6e20d0ec55 100644 --- a/user/portfoliologs.php +++ b/user/portfoliologs.php @@ -36,7 +36,7 @@ include('tabs.php'); $queued = $DB->get_records('portfolio_tempdata', array('userid' => $USER->id), '', 'id, expirytime'); if (count($queued) > 0) { - $table = new stdClass; + $table = new html_table(); $table->head = array( get_string('displayarea', 'portfolio'), get_string('plugin', 'portfolio'), @@ -56,11 +56,11 @@ if (count($queued) > 0) { unset($e); // this could potentially be quite big, so free it. } echo $OUTPUT->heading(get_string('queuesummary', 'portfolio')); - print_table($table); + echo $OUTPUT->table($table); } $logcount = $DB->count_records('portfolio_log', array('userid' => $USER->id)); if ($logcount > 0) { - $table = new StdClass; + $table = new html_table(); $table->head = array( get_string('plugin', 'portfolio'), get_string('displayarea', 'portfolio'), @@ -87,7 +87,7 @@ if ($logcount > 0) { echo $OUTPUT->heading(get_string('logsummary', 'portfolio')); $pagingbar = moodle_paging_bar::make($logcount, $page, $perpage, $CFG->wwwroot . '/user/portfoliologs.php?'); echo $OUTPUT->paging_bar($pagingbar); - print_table($table); + echo $OUTPUT->table($table); echo $OUTPUT->paging_bar($pagingbar); } diff --git a/user/profile/index.php b/user/profile/index.php index f2388839b0..1ec39aa8d0 100644 --- a/user/profile/index.php +++ b/user/profile/index.php @@ -53,7 +53,10 @@ switch ($action) { $optionsyes = array ('id'=>$id, 'confirm'=>1, 'action'=>'deletecategory', 'sesskey'=>sesskey()); admin_externalpage_print_header(); echo $OUTPUT->heading('profiledeletecategory', 'admin'); - notice_yesno(get_string('profileconfirmcategorydeletion', 'admin', $fieldcount), $redirect, $redirect, $optionsyes, null, 'post', 'get'); + + $formcontinue = html_form::make_button($redirect, $optionsyes, get_string('yes'), 'post'); + $formcancel = html_form::make_button($redirect, array(), get_string('no'), 'get'); + echo $OUTPUT->confirm(get_string('profileconfirmcategorydeletion', 'admin', $fieldcount), $formcontinue, $formcancel); echo $OUTPUT->footer(); die; break; @@ -71,7 +74,9 @@ switch ($action) { $optionsyes = array ('id'=>$id, 'confirm'=>1, 'action'=>'deletefield', 'sesskey'=>sesskey()); admin_externalpage_print_header(); echo $OUTPUT->heading('profiledeletefield', 'admin'); - notice_yesno(get_string('profileconfirmfielddeletion', 'admin', $datacount), $redirect, $redirect, $optionsyes, null, 'post', 'get'); + $formcontinue = html_form::make_button($redirect, $optionsyes, get_string('yes'), 'post'); + $formcancel = html_form::make_button($redirect, array(), get_string('no'), 'get'); + echo $OUTPUT->confirm(get_string('profileconfirmfielddeletion', 'admin', $datacount), $formcontinue, $formcancel); echo $OUTPUT->footer(); die; break; @@ -109,11 +114,11 @@ if ($DB->count_records('user_info_category') == 0) { $categories = $DB->get_records('user_info_category', null, 'sortorder ASC'); foreach ($categories as $category) { - $table = new object(); + $table = new html_table(); $table->head = array(get_string('profilefield', 'admin'), get_string('edit')); $table->align = array('left', 'right'); $table->width = '95%'; - $table->class = 'generaltable profilefield'; + $table->add_class ('generaltable profilefield'); $table->data = array(); if ($fields = $DB->get_records('user_info_field', array('categoryid'=>$category->id), 'sortorder ASC')) { @@ -124,7 +129,7 @@ foreach ($categories as $category) { echo $OUTPUT->heading(format_string($category->name) .' '.profile_category_icons($category)); if (count($table->data)) { - print_table($table); + echo $OUTPUT->table($table); } else { echo $OUTPUT->notification($strnofields); } @@ -144,7 +149,7 @@ echo $OUTPUT->select(html_select::make_popup_form($popupurl, 'datatype', $option /// Create a new category link $options = array('action'=>'editcategory'); -print_single_button('index.php', $options, get_string('profilecreatecategory', 'admin')); +echo $OUTPUT->button(html_form::make_button('index.php', $options, get_string('profilecreatecategory', 'admin'))); echo ''; diff --git a/user/repository.php b/user/repository.php index a2b42a3622..45c302be89 100644 --- a/user/repository.php +++ b/user/repository.php @@ -39,7 +39,7 @@ if (!$instances = repository::get_instances($COURSE->context, $USER->id)) { print_error('noinstances', 'repository', $CFG->wwwroot . '/user/view.php'); } -$table = new StdClass; +$table = new html_table(); $table->head = array($namestr, $pluginstr, ''); $table->data = array(); @@ -51,7 +51,7 @@ foreach ($instances as $i) { .get_string('settings', 'repository').'' : ''); } -print_table($table); +echo $OUTPUT->table($table); echo $OUTPUT->footer(); ?> diff --git a/user/view.php b/user/view.php index 6e22971327..7bd1d04f01 100644 --- a/user/view.php +++ b/user/view.php @@ -97,7 +97,7 @@ } } else { // Normal course // check capabilities - if (!has_capability('moodle/user:viewdetails', $coursecontext) && + if (!has_capability('moodle/user:viewdetails', $coursecontext) && !has_capability('moodle/user:viewdetails', $usercontext)) { print_error('cannotviewprofile'); } @@ -218,7 +218,9 @@ echo ''; echo ''; echo '
'; - print_user_picture($user, $course->id, $user->picture, true, false, false); + $userpic = moodle_user_picture::make($user, $course->id); + $userpic->size = 100; + echo $OUTPUT->user_picture($userpic); echo ''; // Print the description @@ -382,7 +384,7 @@ print_row(get_string("lastaccess").":", $datestring); } /// printing roles - + if ($rolestring = get_user_roles_in_context($id, $coursecontext)) { print_row(get_string('roles').':', format_string($rolestring, false)); } @@ -404,7 +406,7 @@ /// Printing Interests if( !empty($CFG->usetags)) { - if ( $interests = tag_get_tags_csv('user', $user->id) ) { + if ( $interests = tag_get_tags_csv('user', $user->id) ) { print_row(get_string('interests') .": ", $interests); } } -- 2.39.5