From: nicolasconnault Date: Tue, 8 Sep 2009 08:58:45 +0000 (+0000) Subject: MDL-19825 Upgraded some of the code to the new OUTPUT functions, and fixed a bug... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=4e487ce26c2e08e493f877b208cf7e2bf3111ee5;p=moodle.git MDL-19825 Upgraded some of the code to the new OUTPUT functions, and fixed a bug that prevented correct output --- diff --git a/user/index.php b/user/index.php index 0b5c6af6a2..d0f8949417 100644 --- a/user/index.php +++ b/user/index.php @@ -1,4 +1,4 @@ -set_url('user/index.php', compact('page', 'perpage', 'mode', 'accesssince', 'search', 'roleid', 'contextid', 'courseid')); + $PAGE->set_url('user/index.php', array( + 'page' => $page, + 'perpage' => $perpage, + 'mode' => $mode, + 'accesssince' => $accesssince, + 'search' => $search, + 'roleid' => $roleid, + 'contextid' => $contextid, + 'courseid' => $courseid)); if ($contextid) { if (! $context = get_context_instance_by_id($contextid)) { @@ -188,7 +196,6 @@ require_once($CFG->dirroot .'/user/tabs.php'); - /// Get the hidden field list if (has_capability('moodle/course:viewhiddenuserfields', $context)) { $hiddenfields = array(); // teachers and admins are allowed to see everything @@ -202,12 +209,13 @@ } /// Print settings and things in a table across the top - - echo ''; + $controlstable = new html_table(); + $controlstable->add_class('controls'); + $controlstable->cellspacing = 0; + $controlstable->data[] = new html_table_row(); /// Print my course menus if ($mycourses = get_my_courses($USER->id)) { - echo ''; + $controlstable->data[0]->cells[] = $OUTPUT->select($select); } - echo ''; + $controlstable->data[0]->cells[] = groups_print_course_menu($course, $baseurl->out()); if (!isset($hiddenfields['lastaccess'])) { // get minimum lastaccess for this course and display a dropbox to filter by lastaccess going back this far. @@ -278,11 +283,9 @@ } if (count($timeoptions) > 1) { - echo ''; + $controlstable->data[0]->cells[] = $OUTPUT->select($select); } } @@ -303,7 +306,6 @@ $mode = MODE_BRIEF; } - echo '
'; $courselist = array(); $popupurl = new moodle_url($CFG->wwwroot.'/user/index.php?roleid='.$roleid.'&sifirst=&silast='); foreach ($mycourses as $mycourse) { @@ -219,13 +227,10 @@ } $select = html_select::make_popup_form($popupurl, 'id', $courselist, 'courseform', $course->id); $select->set_label(get_string('mycourses')); - echo $OUTPUT->select($select); - echo ''; - groups_print_course_menu($course, $baseurl->out()); - echo ''; $select = html_select::make_popup_form($baseurl, 'accesssince', $timeoptions, 'timeoptions', $accesssince); $select->set_label(get_string('usersnoaccesssince')); - echo $OUTPUT->select($select); - echo ''; $formatmenu = array( '0' => get_string('brief'), '1' => get_string('userdetails')); if ($allowenroldetails) { @@ -312,24 +314,39 @@ $select = html_select::make_popup_form($baseurl, 'mode', $formatmenu, 'formatmenu', $mode); $select->nothinglabel = false; $select->set_label(get_string('userlist')); - echo $OUTPUT->select($select); - echo '
'; + $userlistcell = new html_table_cell(); + $userlistcell->add_class('right'); + $userlistcell->text = $OUTPUT->select($select); + $controlstable->data[0]->cells[] = $userlistcell; + + echo $OUTPUT->table($controlstable); if ($currentgroup and (!$isseparategroups or has_capability('moodle/site:accessallgroups', $context))) { /// Display info about the group if ($group = groups_get_group($currentgroup)) { if (!empty($group->description) or (!empty($group->picture) and empty($group->hidepicture))) { - echo '
'; - print_group_picture($group, $course->id, true, false, false); - echo ''; - echo '

'.$group->name; + $groupinfotable = new html_table(); + $groupinfotable->add_class('groupinfobox'); + $picturecell = new html_table_cell(); + $picturecell->add_classes(array('left', 'side', 'picture')); + $picturecell->text = print_group_picture($group, $course->id, true, false, false); + + $contentcell = new html_table_cell(); + $contentcell->add_class('content'); + $contentcell->text = print_group_picture($group, $course->id, true, false, false); + + $contentheading = $group->name; if (has_capability('moodle/course:managegroups', $context)) { - echo ' '; - echo ''.get_string('editgroupprofile').''; - echo ''; + $editgroupaction = new moodle_action_icon(); + $editgroupaction->link->url = new moodle_url($CFG->wwwroot.'/group/group.php', array('id' => $group->id, 'courseid' => $group->courseid)); + $editgroupaction->link->title = get_string('editgroupprofile'); + $editgroupaction->image->src = $OUTPUT->old_icon_url('t/edit'); + $editgroupaction->image->alt = get_string('editgroupprofile'); + + $contentheading .= ' ' . $OUTPUT->action_icon($editgroupaction); } - echo '

'; - echo format_text($group->description); - echo '
'; + $contentcell->text = $OUTPUT->heading($contentheading, 3) . format_text($group->description); + $groupinfotable->data[] = html_table_row::make(array($picturecell, $contentcell)); + echo $OUTPUT->table($groupinfotable); } } } @@ -990,11 +1007,11 @@ $perpageurl->remove_params('perpage'); if ($perpage == SHOW_ALL_PAGE_SIZE) { $perpageurl->param('perpage', DEFAULT_PAGE_SIZE); - echo '
'.get_string('showperpage', '', DEFAULT_PAGE_SIZE).'
'; + echo $OUTPUT->container($OUTPUT->link(html_link::make($perpageurl, get_string('showperpage', '', DEFAULT_PAGE_SIZE))), array(), 'showall'); } else if ($matchcount > 0 && $perpage < $matchcount) { $perpageurl->param('perpage', SHOW_ALL_PAGE_SIZE); - echo '
'.get_string('showall', '', $matchcount).'
'; + echo $OUTPUT->container($OUTPUT->link(html_link::make($perpageurl, get_string('showall', '', $matchcount))), array(), 'showall'); } echo $OUTPUT->footer();