]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19825 upgraded calls to print_table, print_single_button, print_user_picture...
authornicolasconnault <nicolasconnault>
Thu, 20 Aug 2009 08:50:22 +0000 (08:50 +0000)
committernicolasconnault <nicolasconnault>
Thu, 20 Aug 2009 08:50:22 +0000 (08:50 +0000)
12 files changed:
user/addnote.php
user/edit_form.php
user/editadvanced_form.php
user/extendenrol.php
user/groupextendenrol.php
user/index.php
user/policy.php
user/portfolio.php
user/portfoliologs.php
user/profile/index.php
user/repository.php
user/view.php

index 0505967f9c409f0da3fa4ad9e5fe67cd859d7a21..23b6d3c26ed87051374989d6601300bb86e987f0 100644 (file)
@@ -61,6 +61,7 @@ echo '<fieldset class="invisiblefieldset">';
 echo '<input type="hidden" name="id" value="'.$course->id.'" />';
 echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
 echo '</fieldset>';
+$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 '<div style="width:100%;text-align:center;"><input type="submit" value="' . get_string('savechanges'). '" /></div></form>';
 echo $OUTPUT->footer();
 ?>
index e1f578ef4155124bf4bb0260be50d3fb7e37224c..4326c3065b59b9bea04498ede06586c29475d49f 100644 (file)
@@ -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);
 
index f3ae17d58e0a8f3b557913eb69025c25bdc5fc8d..0a82c749485a0cee3207d47ad08c9911844a135a 100644 (file)
@@ -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'));
             }
index eb6795c069f52bbf594cefbf9d80e948b689809d..e37d15b24d521267f78c26267e85c9e41b2ea990 100644 (file)
@@ -116,6 +116,7 @@ echo $OUTPUT->heading($title . $OUTPUT->help_icon(moodle_help_icon::make('extend
 echo "<form method=\"post\" action=\"extendenrol.php\">\n";
 echo '<input type="hidden" name="id" value="'.$course->id.'" />';
 echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
+$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<div style=\"width:100%;text-align:center;\"><input type=\"submit\" value=\"".get_string('savechanges')."\" /></div>\n</form>\n";
 
 echo $OUTPUT->footer();
index 54ea3877fdc987191a25e378309042892f1e45f5..ecbbde310689bec1ed5bd8904dbabd1fca14e053 100755 (executable)
@@ -113,6 +113,7 @@ echo $OUTPUT->heading($title . $OUTPUT->help_icon(moodle_help_icon::make('groupe
 echo '<form method="post" action="groupextendenrol.php">';
 echo '<input type="hidden" name="id" value="'.$course->id.'" />';
 echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
+$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 '<div style="width:100%;text-align:center;"><strong>';
 echo get_string('extendperiod') . ' ';
 echo $OUTPUT->select(html_select::make($periodmenu, 'extendperiod'));
index 1463c86637aa8285e6f9ec53db749b11839244b9..91852c2b73a7a6e905bd08b0980d774dcac93508 100644 (file)
                     $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');
 
                     $profilelink = '<strong>'.fullname($user).'</strong>';
                 }
 
-                $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;
index 9dcd765bc4aab65c82c09be9a57217b5bc2b4a7e..fa1944048a799446fcaba1a9a16f4170db6a3bd1 100644 (file)
     // we can not use our popups here, because the url may be arbitrary, see MDL-9823
     echo '<a href="'.$CFG->sitepolicy.'" onclick="this.target=\'_blank\'">'.$strpolicyagreementclick.'</a>';
     echo '</object></div>';
-
-    $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();
 
index 93d80b43df1061825b46016a21b7bdcd9d00041b..a8f9ccb3df23b33decc516e3b15425719a97c3d2 100644 (file)
@@ -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();
 
index 1affd069e0c97b44bca4aa59f3716af479762840..6e20d0ec551d56fb924c6755c9d1d8816246b7c0 100644 (file)
@@ -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);
 
 }
index f2388839b0f6d23f2fa4b1c0040ad9c701763bbe..1ec39aa8d0830ba5469283deb8fc29fff0b65ef1 100644 (file)
@@ -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 '</div>';
 
index a2b42a362269efa1d2e9ffaa0c4a1ea4debe423c..45c302be899ffc0e8c5fce1d3c1dc989c2ba8ac7 100644 (file)
@@ -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').'</a>' : '');
 }
 
-print_table($table);
+echo $OUTPUT->table($table);
 echo $OUTPUT->footer();
 
 ?>
index 6e22971327470cbad1711ec63dc91726b7a67bc0..7bd1d04f01a1e55440f277c813ce4b82760517ee 100644 (file)
@@ -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');
             }
     echo '<table width="80%" class="userinfobox" summary="">';
     echo '<tr>';
     echo '<td class="side">';
-    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 '</td><td class="content">';
 
     // Print the description
         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));
     }
 
 /// 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);
         }
     }