MDL-19756 MDL-19825 MDL-19823 MDL-19794 Deprecated update_tag_button, update_categori...
authornicolasconnault <nicolasconnault>
Wed, 5 Aug 2009 02:03:50 +0000 (02:03 +0000)
committernicolasconnault <nicolasconnault>
Wed, 5 Aug 2009 02:03:50 +0000 (02:03 +0000)
course/search.php
lib/deprecatedlib.php
lib/outputlib.php
lib/weblib.php
tag/index.php
user/index.php

index 15d401ed903125a439632071c4f116fd4654bd3d..cbad211e53ea142c80dd3bbc669383cd67a7559c 100644 (file)
     $searchform = print_course_search($search, true, "navbar");
 
     if (!empty($courses) && has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM))) {
-        $searchform .= update_categories_search_button($search,$page,$perpage);
+        $searchform = '';
+        // not sure if this capability is the best  here
+        if (has_capability('moodle/category:manage', get_context_instance(CONTEXT_SYSTEM))) {
+            if ($PAGE->user_is_editing()) {
+                $string = get_string("turneditingoff");
+                $edit = "off";
+                $perpage = 30;
+            } else {
+                $string = get_string("turneditingon");
+                $edit = "on";
+            }
+
+            $form = new html_form();
+            $form->url = new moodle_url("$CFG->wwwroot/course/search.php", array(
+                    'edit' => $edit, 
+                    'sesskey' => sesskey(),
+                    'search' => s($search, true),
+                    'page' => $page,
+                    'perpage' => $perpage));
+            $form->method = 'get';
+            $form->button->text = s($string);
+            $searchform = $OUTPUT->button($form);
+        }
     }
 
     $navlinks = array();
index f30f5c1b5f58fe7415eb97e6b8d164fbdb20476f..198f9fd08656a441aa842724db785f044c65d52f 100644 (file)
@@ -3529,7 +3529,7 @@ function print_heading_with_help($text, $helppage, $module='moodle', $icon=false
     $helpicon->page = $helppage;
     $helpicon->text = $text;
     $helpicon->module = $module;
-    
+
     // Extract the src from $icon if it exists
     if (preg_match('/src="([^"]*)"/', $icon, $matches)) {
         $icon = $matches[1];
@@ -3547,14 +3547,52 @@ function print_heading_with_help($text, $helppage, $module='moodle', $icon=false
 /**
  * Returns a turn edit on/off button for course in a self contained form.
  * Used to be an icon, but it's now a simple form button
- *
  * @deprecated since Moodle 2.0
- *
- * @global object
- * @global object
- * @param int $courseid The course  to update by id as found in 'course' table
- * @return string
  */
 function update_mymoodle_icon() {
     throw new coding_exception('update_mymoodle_icon() has been completely deprecated.');
 }
+
+/**
+ * Returns a turn edit on/off button for tag in a self contained form.
+ * @deprecated since Moodle 2.0
+ */
+function update_tag_button() {
+    throw new coding_exception('update_tag_button() has been completely deprecated.');
+}
+
+
+/**
+ * Prints the 'update this xxx' button that appears on module pages.
+ *
+ * @deprecated since Moodle 2.0
+ *
+ * @param string $cmid the course_module id.
+ * @param string $ignored not used any more. (Used to be courseid.)
+ * @param string $string the module name - get_string('modulename', 'xxx')
+ * @return string the HTML for the button, if this user has permission to edit it, else an empty string.
+ */
+function update_module_button($cmid, $ignored, $string) {
+    global $OUTPUT;
+
+    // debugging('update_module_button() has been deprecated. Please change your code to use $OUTPUT->update_module_button().');
+
+    return $OUTPUT->update_module_button($cmid, $string);
+}
+
+/**
+ * Prints the editing button on search results listing
+ * For bulk move courses to another category
+ * @deprecated since Moodle 2.0
+ */
+function update_categories_search_button($search,$page,$perpage) {
+    throw new coding_exception('update_tag_button() has been completely deprecated.');
+}
+
+/**
+ * Prints a summary of a user in a nice little box.
+ * @deprecated since Moodle 2.0
+ */
+function print_user($user, $course, $messageselect=false, $return=false) {
+    throw new coding_exception('print_user() has been completely deprecated. See user/index.php for new usage.');
+}
index 0ffa1c2fb91f62889b86ad03795f2c9bf3df1b26..a524cbd7dfd5d9ed33c8d6d916c1e078a2085ed8 100644 (file)
@@ -2776,6 +2776,27 @@ class moodle_core_renderer extends moodle_renderer_base {
         return $output;
     }
 
+    /**
+     * Prints the 'update this xxx' button that appears on module pages.
+     *
+     * @param string $cmid the course_module id.
+     * @param string $modulename the module name - get_string('modulename', 'xxx')
+     * @return string the HTML for the button, if this user has permission to edit it, else an empty string.
+     */
+    public function update_module_button($cmid, $modulename) {
+        global $CFG;
+        if (has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_MODULE, $cmid))) {
+            $string = get_string('updatethis', '', $modulename);
+
+            $form = new html_form();
+            $form->url = new moodle_url("$CFG->wwwroot/course/mod.php", array('update' => $cmid, 'return' => true, 'sesskey' => sesskey()));
+            $form->button->text = $modulename;
+            return $this->button($form);
+        } else {
+            return '';
+        }
+    }
+
     /**
      * Outputs a HTML nested list
      *
@@ -3278,43 +3299,62 @@ class moodle_core_renderer extends moodle_renderer_base {
             $keys       = array_keys($table->data);
             $lastrowkey = end($keys);
             $output .= $this->output_start_tag('tbody', array()) . "\n";
+
             foreach ($table->data as $key => $row) {
-                $oddeven = $oddeven ? 0 : 1;
-                if (isset($table->rowclasses[$key])) {
-                    $classes = array_unique(moodle_html_component::clean_classes($table->rowclasses[$key]));
-                } else {
-                    $classes = array();
-                }
-                $classes[] = 'r' . $oddeven;
-                if ($key == $lastrowkey) {
-                    $classes[] = 'lastrow';
-                }
-                $output .= $this->output_start_tag('tr', array('class' => moodle_renderer_base::prepare_classes($classes))) . "\n";
                 if (($row === 'hr') && ($countcols)) {
                     $output .= $this->output_tag('td', array('colspan' => $countcols),
                                                  $this->output_tag('div', array('class' => 'tabledivider'), '')) . "\n";
-                } else {  /// it's a normal row of data
-                    $keys2 = array_keys($row);
+                } else {
+                    // Convert array rows to html_table_rows and cell strings to html_table_cell objects
+                    if (!($row instanceof html_table_row)) {
+                        $newrow = new html_table_row();
+
+                        foreach ($row as $key => $item) {
+                            $cell = new html_table_cell();
+                            $cell->text = $item;
+                            $newrow->cells[] = $cell;
+                        }
+                        $row = $newrow;
+                    }
+
+                    $oddeven = $oddeven ? 0 : 1;
+                    if (isset($table->rowclasses[$key])) {
+                        $row->add_classes(array_unique(moodle_html_component::clean_classes($table->rowclasses[$key])));
+                    }
+
+                    $row->add_class('r' . $oddeven);
+                    if ($key == $lastrowkey) {
+                        $row->add_class('lastrow');
+                    }
+
+                    $output .= $this->output_start_tag('tr', array('class' => $row->get_classes_string(), 'style' => $row->style, 'id' => $row->id)) . "\n";
+                    $keys2 = array_keys($row->cells);
                     $lastkey = end($keys2);
-                    foreach ($row as $key => $item) {
+
+                    foreach ($row->cells as $key => $cell) {
                         if (isset($table->colclasses[$key])) {
-                            $classes = array_unique(moodle_html_component::clean_classes($table->colclasses[$key]));
-                        } else {
-                            $classes = array();
+                            $cell->add_classes(array_unique(moodle_html_component::clean_classes($table->colclasses[$key])));
                         }
-                        $classes[] = 'cell';
-                        $classes[] = 'c' . $key;
+
+                        $cell->add_classes('cell');
+                        $cell->add_classes('c' . $key);
                         if ($key == $lastkey) {
-                            $classes[] = 'lastcol';
+                            $cell->add_classes('lastcol');
                         }
                         $tdstyle = '';
                         $tdstyle .= isset($table->align[$key]) ? $table->align[$key] : '';
                         $tdstyle .= isset($table->size[$key]) ? $table->size[$key] : '';
                         $tdstyle .= isset($table->wrap[$key]) ? $table->wrap[$key] : '';
-                        $output .= $this->output_tag('td',
-                                                     array('style' => $tdstyle,
-                                                           'class' => moodle_renderer_base::prepare_classes($classes)),
-                                                     $item) . "\n";
+                        $tdattributes = array(
+                                'style' => $tdstyle . $cell->style,
+                                'colspan' => $cell->colspan,
+                                'rowspan' => $cell->rowspan,
+                                'id' => $cell->id,
+                                'class' => $cell->get_classes_string(),
+                                'abbr' => $cell->abbr,
+                                'scope' => $cell->scope);
+
+                        $output .= $this->output_tag('td', $tdattributes, $cell->text) . "\n";
                     }
                 }
                 $output .= $this->output_end_tag('tr') . "\n";
@@ -4371,14 +4411,28 @@ class html_table extends moodle_html_component {
      */
     public $wrap;
     /**
-     * @var array of arrays containing the data. Alternatively, if you have
+     * @var array of arrays or html_table_row objects containing the data. Alternatively, if you have
      * $head specified, the string 'hr' (for horizontal ruler) can be used
      * instead of an array of cells data resulting in a divider rendered.
      *
-     * Example if usage:
+     * Example of usage with array of arrays:
      * $row1 = array('Harry Potter', '76 %');
      * $row2 = array('Hermione Granger', '100 %');
      * $t->data = array($row1, $row2);
+     *
+     * Example with array of html_table_row objects: (used for more fine-grained control)
+     * $cell1 = new html_table_cell();
+     * $cell1->text = 'Harry Potter';
+     * $cell1->colspan = 2;
+     * $row1 = new html_table_row();
+     * $row1->cells[] = $cell1;
+     * $cell2 = new html_table_cell();
+     * $cell2->text = 'Hermione Granger';
+     * $cell3 = new html_table_cell();
+     * $cell3->text = '100 %';
+     * $row2 = new html_table_row();
+     * $row2->cells = array($cell2, $cell3);
+     * $t->data = array($row1, $row2);
      */
     public $data;
     /**
@@ -4506,6 +4560,66 @@ class html_table extends moodle_html_component {
     }
 }
 
+/**
+ * Component representing a table row.
+ *
+ * @copyright 2009 Nicolas Connault
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @since     Moodle 2.0
+ */
+class html_table_row extends moodle_html_component {
+    /**
+     * @var array $cells Array of html_table_cell objects
+     */
+    public $cells = array();
+
+    /**
+     * @see lib/moodle_html_component#prepare()
+     * @return void
+     */
+    public function prepare() {
+        parent::prepare();
+    }
+}
+
+/**
+ * Component representing a table cell.
+ *
+ * @copyright 2009 Nicolas Connault
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @since     Moodle 2.0
+ */
+class html_table_cell extends moodle_html_component {
+    /**
+     * @var string $text The contents of the cell
+     */
+    public $text;
+    /**
+     * @var string $abbr Abbreviated version of the contents of the cell
+     */
+    public $abbr = '';
+    /**
+     * @var int $colspan Number of columns this cell should span
+     */
+    public $colspan = '';
+    /**
+     * @var int $rowspan Number of rows this cell should span
+     */
+    public $rowspan = '';
+    /**
+     * @var string $scope Defines a way to associate header cells and data cells in a table
+     */
+    public $scope = '';
+
+    /**
+     * @see lib/moodle_html_component#prepare()
+     * @return void
+     */
+    public function prepare() {
+        parent::prepare();
+    }
+}
+
 /**
  * Component representing a XHTML link.
  *
@@ -4537,6 +4651,19 @@ class html_link extends moodle_html_component {
 
         parent::prepare();
     }
+
+    /**
+     * Shortcut for creating a link component.
+     * @param mixed  $url String or moodle_url
+     * @param string $text The text of the link
+     * @return html_link The link component
+     */
+    public function make($url, $text) {
+        $link = new html_link();
+        $link->url = $url;
+        $link->text = $text;
+        return $link;
+    }
 }
 
 /**
index 6b970717ed50f8c5a4a622f31cdd34b260e9ea9e..cb39dfa851cf0e727b3d0757d40859a985357101 100644 (file)
@@ -2450,146 +2450,6 @@ function _print_custom_corners_end($idbase) {
 }
 
 
-/**
- * Prints a summary of a user in a nice little box.
- *
- * @global object
- * @global object
- * @staticvar object $string
- * @staticvar object $datestring
- * @staticvar array $countries
- * @uses CONTEXT_COURSE
- * @uses CONTEXT_USER
- * @uses SITEID
- * @param object $user A {@link $USER} object representing a user
- * @param object $course A {@link $COURSE} object representing a course
- * @param bool $messageselect
- * @param bool $return If set to true then the HTML is returned rather than echo'd
- * @return string|void Depending on the setting of $return
- */
-function print_user($user, $course, $messageselect=false, $return=false) {
-
-    global $CFG, $USER;
-
-    $output = '';
-
-    static $string;
-    static $datestring;
-    static $countries;
-
-    $context = get_context_instance(CONTEXT_COURSE, $course->id);
-    if (isset($user->context->id)) {
-        $usercontext = $user->context;
-    } else {
-        $usercontext = get_context_instance(CONTEXT_USER, $user->id);
-    }
-
-    if (empty($string)) {     // Cache all the strings for the rest of the page
-
-        $string->email       = get_string('email');
-        $string->city = get_string('city');
-        $string->lastaccess  = get_string('lastaccess');
-        $string->activity    = get_string('activity');
-        $string->unenrol     = get_string('unenrol');
-        $string->loginas     = get_string('loginas');
-        $string->fullprofile = get_string('fullprofile');
-        $string->role        = get_string('role');
-        $string->name        = get_string('name');
-        $string->never       = get_string('never');
-
-        $datestring->day     = get_string('day');
-        $datestring->days    = get_string('days');
-        $datestring->hour    = get_string('hour');
-        $datestring->hours   = get_string('hours');
-        $datestring->min     = get_string('min');
-        $datestring->mins    = get_string('mins');
-        $datestring->sec     = get_string('sec');
-        $datestring->secs    = get_string('secs');
-        $datestring->year    = get_string('year');
-        $datestring->years   = get_string('years');
-
-        $countries = get_list_of_countries();
-    }
-
-/// Get the hidden field list
-    if (has_capability('moodle/course:viewhiddenuserfields', $context)) {
-        $hiddenfields = array();
-    } else {
-        $hiddenfields = array_flip(explode(',', $CFG->hiddenuserfields));
-    }
-
-    $output .= '<table class="userinfobox">';
-    $output .= '<tr>';
-    $output .= '<td class="left side">';
-    $output .= print_user_picture($user, $course->id, $user->picture, true, true);
-    $output .= '</td>';
-    $output .= '<td class="content">';
-    $output .= '<div class="username">'.fullname($user, has_capability('moodle/site:viewfullnames', $context)).'</div>';
-    $output .= '<div class="info">';
-    if (!empty($user->role)) {
-        $output .= $string->role .': '. $user->role .'<br />';
-    }
-    if ($user->maildisplay == 1 or ($user->maildisplay == 2 and ($course->id != SITEID) and !isguest()) or
-has_capability('moodle/course:viewhiddenuserfields', $context)) {
-        $output .= $string->email .': <a href="mailto:'. $user->email .'">'. $user->email .'</a><br />';
-    }
-    if (($user->city or $user->country) and (!isset($hiddenfields['city']) or !isset($hiddenfields['country']))) {
-        $output .= $string->city .': ';
-        if ($user->city && !isset($hiddenfields['city'])) {
-            $output .= $user->city;
-        }
-        if (!empty($countries[$user->country]) && !isset($hiddenfields['country'])) {
-            if ($user->city && !isset($hiddenfields['city'])) {
-                $output .= ', ';
-            }
-            $output .= $countries[$user->country];
-        }
-        $output .= '<br />';
-    }
-
-    if (!isset($hiddenfields['lastaccess'])) {
-        if ($user->lastaccess) {
-            $output .= $string->lastaccess .': '. userdate($user->lastaccess);
-            $output .= '&nbsp; ('. format_time(time() - $user->lastaccess, $datestring) .')';
-        } else {
-            $output .= $string->lastaccess .': '. $string->never;
-        }
-    }
-    $output .= '</div></td><td class="links">';
-    //link to blogs
-    if ($CFG->bloglevel > 0) {
-        $output .= '<a href="'.$CFG->wwwroot.'/blog/index.php?userid='.$user->id.'">'.get_string('blogs','blog').'</a><br />';
-    }
-    //link to notes
-    if (!empty($CFG->enablenotes) and (has_capability('moodle/notes:manage', $context) || has_capability('moodle/notes:view', $context))) {
-        $output .= '<a href="'.$CFG->wwwroot.'/notes/index.php?course=' . $course->id. '&amp;user='.$user->id.'">'.get_string('notes','notes').'</a><br />';
-    }
-
-    if (has_capability('moodle/site:viewreports', $context) or has_capability('moodle/user:viewuseractivitiesreport', $usercontext)) {
-        $output .= '<a href="'. $CFG->wwwroot .'/course/user.php?id='. $course->id .'&amp;user='. $user->id .'">'. $string->activity .'</a><br />';
-    }
-    if (has_capability('moodle/role:assign', $context) and get_user_roles($context, $user->id, false)) {  // I can unassing and user has some role
-        $output .= '<a href="'. $CFG->wwwroot .'/course/unenrol.php?id='. $course->id .'&amp;user='. $user->id .'">'. $string->unenrol .'</a><br />';
-    }
-    if ($USER->id != $user->id && !session_is_loggedinas() && has_capability('moodle/user:loginas', $context) &&
-                                 ! has_capability('moodle/site:doanything', $context, $user->id, false)) {
-        $output .= '<a href="'. $CFG->wwwroot .'/course/loginas.php?id='. $course->id .'&amp;user='. $user->id .'&amp;sesskey='. sesskey() .'">'. $string->loginas .'</a><br />';
-    }
-    $output .= '<a href="'. $CFG->wwwroot .'/user/view.php?id='. $user->id .'&amp;course='. $course->id .'">'. $string->fullprofile .'...</a>';
-
-    if (!empty($messageselect)) {
-        $output .= '<br /><input type="checkbox" name="user'.$user->id.'" /> ';
-    }
-
-    $output .= '</td></tr></table>';
-
-    if ($return) {
-        return $output;
-    } else {
-        echo $output;
-    }
-}
-
 /**
  * Print a specified group's avatar.
  *
@@ -2763,98 +2623,6 @@ function switchroles_form($courseid) {
     return '';
 }
 
-
-/**
- * Returns a turn edit on/off button for tag in a self contained form.
- *
- * @global object
- * @global object
- * @param string $tagid The ID attribute
- * @return string
- */
-function update_tag_button($tagid) {
-
-    global $CFG, $USER;
-
-    if (!empty($USER->editing)) {
-        $string = get_string('turneditingoff');
-        $edit = '0';
-    } else {
-        $string = get_string('turneditingon');
-        $edit = '1';
-    }
-
-    return "<form $CFG->frametarget method=\"get\" action=\"$CFG->wwwroot/tag/index.php\">".
-           "<div>".
-           "<input type=\"hidden\" name=\"edit\" value=\"$edit\" />".
-           "<input type=\"hidden\" name=\"id\" value=\"$tagid\" />".
-           "<input type=\"submit\" value=\"$string\" /></div></form>";
-}
-
-/**
- * Prints the 'update this xxx' button that appears on module pages.
- *
- * @global object
- * @global object
- * @uses CONTEXT_MODULE
- * @param string $cmid the course_module id.
- * @param string $ignored not used any more. (Used to be courseid.)
- * @param string $string the module name - get_string('modulename', 'xxx')
- * @return string the HTML for the button, if this user has permission to edit it, else an empty string.
- */
-function update_module_button($cmid, $ignored, $string) {
-    global $CFG, $USER;
-
-    if (has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_MODULE, $cmid))) {
-        $string = get_string('updatethis', '', $string);
-
-        return "<form $CFG->frametarget method=\"get\" action=\"$CFG->wwwroot/course/mod.php\" onsubmit=\"this.target='{$CFG->framename}'; return true\">".//hack to allow edit on framed resources
-               "<div>".
-               "<input type=\"hidden\" name=\"update\" value=\"$cmid\" />".
-               "<input type=\"hidden\" name=\"return\" value=\"true\" />".
-               "<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />".
-               "<input type=\"submit\" value=\"$string\" /></div></form>";
-    } else {
-        return '';
-    }
-}
-
-/**
- * Prints the editing button on search results listing
- * For bulk move courses to another category
- *
- * @global object
- * @global object
- * @param string $search  The search string
- * @param string $page
- * @param string $perpage
- * @return string HTML form element
- */
-function update_categories_search_button($search,$page,$perpage) {
-    global $CFG, $PAGE;
-
-    // not sure if this capability is the best  here
-    if (has_capability('moodle/category:manage', get_context_instance(CONTEXT_SYSTEM))) {
-        if ($PAGE->user_is_editing()) {
-            $string = get_string("turneditingoff");
-            $edit = "off";
-            $perpage = 30;
-        } else {
-            $string = get_string("turneditingon");
-            $edit = "on";
-        }
-
-        return "<form $CFG->frametarget method=\"get\" action=\"$CFG->wwwroot/course/search.php\">".
-               '<div>'.
-               "<input type=\"hidden\" name=\"edit\" value=\"$edit\" />".
-               "<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />".
-               "<input type=\"hidden\" name=\"search\" value=\"".s($search, true)."\" />".
-               "<input type=\"hidden\" name=\"page\" value=\"$page\" />".
-               "<input type=\"hidden\" name=\"perpage\" value=\"$perpage\" />".
-               "<input type=\"submit\" value=\"".s($string)."\" /></div></form>";
-    }
-}
-
 /**
  * Returns a small popup menu of course activity modules
  *
index 80ee643580b19a21390d401ff6f94eb23602d953..d93f58e25b519ad01b234ad191b0266d4637422f 100644 (file)
@@ -51,7 +51,18 @@ $title = get_string('tag', 'tag') .' - '. $tagname;
 
 $button = '';
 if ($PAGE->user_allowed_editing() ) {
-    $button = update_tag_button($tag->id);
+    if (!empty($USER->editing)) {
+        $string = get_string('turneditingoff');
+        $edit = '0';
+    } else {
+        $string = get_string('turneditingon');
+        $edit = '1';
+    }
+
+    $form = new html_form();
+    $form->url = new moodle_url("$CFG->wwwroot/tag/index.php", array('edit' => $edit, 'id' => $tagid));
+    $form->button->text = $string;
+    $button = $OUTPUT->button($form);
 }
 print_header_simple($title, '', $navigation, '', '', '', $button);
 
index cd3c2906530d940509019a177f64c4cafea66723..e925d6cabb8aff53e08866482f763809535c372a 100644 (file)
                     $usersprinted[] = $user->id; /// Add new user to the array of users printed
 
                     $user = make_context_subobj($user);
-                    print_user($user, $course, $bulkoperations);
+
+                    $context = get_context_instance(CONTEXT_COURSE, $course->id);
+                    if (isset($user->context->id)) {
+                        $usercontext = $user->context;
+                    } else {
+                        $usercontext = get_context_instance(CONTEXT_USER, $user->id);
+                    }
+
+                    $countries = get_list_of_countries();
+
+                    /// Get the hidden field list
+                    if (has_capability('moodle/course:viewhiddenuserfields', $context)) {
+                        $hiddenfields = array();
+                    } else {
+                        $hiddenfields = array_flip(explode(',', $CFG->hiddenuserfields));
+                    }
+                    $table = new html_table();
+                    $table->add_class('userinfobox');
+
+                    $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[1] = new html_table_cell();
+                    $row->cells[1]->add_class('content');
+
+                    $row->cells[1]->text = $OUTPUT->container(fullname($user, has_capability('moodle/site:viewfullnames', $context)), 'username');
+                    $row->cells[1]->text .= $OUTPUT->container_start('info');
+
+                    if (!empty($user->role)) {
+                        $row->cells[1]->text .= get_string('role') .': '. $user->role .'<br />';
+                    }
+                    if ($user->maildisplay == 1 or ($user->maildisplay == 2 and ($course->id != SITEID) and !isguest()) or
+                                has_capability('moodle/course:viewhiddenuserfields', $context)) {
+                        $link = new html_link();
+                        $link->url = "mailto:$user->email";
+                        $link->text = $user->email;
+                        $row->cells[1]->text .= get_string('email') .': ' . $OUTPUT->link($link) . '<br />';
+                    }
+                    if (($user->city or $user->country) and (!isset($hiddenfields['city']) or !isset($hiddenfields['country']))) {
+                        $row->cells[1]->text .= get_string('city') .': ';
+                        if ($user->city && !isset($hiddenfields['city'])) {
+                            $row->cells[1]->text .= $user->city;
+                        }
+                        if (!empty($countries[$user->country]) && !isset($hiddenfields['country'])) {
+                            if ($user->city && !isset($hiddenfields['city'])) {
+                                $row->cells[1]->text .= ', ';
+                            }
+                            $row->cells[1]->text .= $countries[$user->country];
+                        }
+                        $row->cells[1]->text .= '<br />';
+                    }
+
+                    if (!isset($hiddenfields['lastaccess'])) {
+                        if ($user->lastaccess) {
+                            $row->cells[1]->text .= get_string('lastaccess') .': '. userdate($user->lastaccess);
+                            $row->cells[1]->text .= '&nbsp; ('. format_time(time() - $user->lastaccess, $datestring) .')';
+                        } else {
+                            $row->cells[1]->text .= get_string('lastaccess') .': '. get_string('never');
+                        }
+                    }
+
+                    $row->cells[1]->text .= $OUTPUT->container_end();
+                    
+                    $row->cells[2] = new html_table_cell();
+                    $row->cells[2]->add_class('links');
+                    $row->cells[2]->text = '';
+                    
+                    $links = array();
+
+                    if ($CFG->bloglevel > 0) {
+                        $links[] = html_link::make(new moodle_url($CFG->wwwroot.'/blog/index.php?userid='.$user->id), get_string('blogs','blog'));
+                    }
+
+                    if (!empty($CFG->enablenotes) and (has_capability('moodle/notes:manage', $context) || has_capability('moodle/notes:view', $context))) {
+                        $links[] = html_link::make(new moodle_url($CFG->wwwroot.'/notes/index.php?course=' . $course->id. '&user='.$user->id), get_string('notes','notes'));
+                    }
+
+                    if (has_capability('moodle/site:viewreports', $context) or has_capability('moodle/user:viewuseractivitiesreport', $usercontext)) {
+                        $links[] = html_link::make(new moodle_url($CFG->wwwroot.'/course/user.php?id='. $course->id .'&user='. $user->id), get_string('activity'));
+                    }
+
+                    if (has_capability('moodle/role:assign', $context) and get_user_roles($context, $user->id, false)) {  // I can unassign and user has some role
+                        $links[] = html_link::make(new moodle_url($CFG->wwwroot.'/course/unenrol.php?id='. $course->id .'&user='. $user->id), get_string('unenrol'));
+                    }
+
+                    if ($USER->id != $user->id && !session_is_loggedinas() && has_capability('moodle/user:loginas', $context) &&
+                                                 ! has_capability('moodle/site:doanything', $context, $user->id, false)) {
+                        $links[] = html_link::make(new moodle_url($CFG->wwwroot.'/course/loginas.php?id='. $course->id .'&user='. $user->id .'&sesskey='. sesskey()), get_string('loginas'));
+                    }
+
+                    $links[] = html_link::make(new moodle_url($CFG->wwwroot.'/user/view.php?id='. $user->id .'&course='. $course->id), get_string('fullprofile') . '...');
+                    
+                    foreach ($links as $link) {
+                        $row->cells[2]->text .= $OUTPUT->link($link);
+                    }
+
+                    if (!empty($messageselect)) {
+                        $row->cells[2]->text .= '<br /><input type="checkbox" name="user'.$user->id.'" /> ';
+                    }
+                    $table->data = array($row);
+                    echo $OUTPUT->print_table($table);
                 }
 
             } else {