MDL-19786 Renamed user_picture and action_icon component classes to moodle_user_picture and moodle_action_icon. Also moved around the classes in a more logical order in outputcomponents.php

This commit is contained in:
nicolasconnault 2009-08-10 06:37:29 +00:00
parent 94056d9dbe
commit beb56299ec
7 changed files with 1235 additions and 1235 deletions

View File

@ -1,7 +1,7 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
@ -121,13 +121,13 @@ foreach($feeds as $feed) {
'<div class="url">' . $OUTPUT->link($feed->url, $feed->url) .'</div>' .
'<div class="description">' . $feed->description . '</div>';
$editaction = new action_icon();
$editaction = new moodle_action_icon();
$editaction->link->url = $CFG->wwwroot .'/blocks/rss_client/editfeed.php?rssid=' . $feed->id . $extraparams;
$editaction->link->title = get_string('edit');
$editaction->image->src = $OUTPUT->old_icon_url('t/edit');
$editaction->image->alt = get_string('edit');
$deleteaction = new action_icon();
$deleteaction = new moodle_action_icon();
$deleteaction->link->url = $CFG->wwwroot .'/blocks/rss_client/managefeeds.php?deleterssid=' . $feed->id .
'&sesskey=' . sesskey() . $extraparams;
$deleteaction->link->title = get_string('delete');

View File

@ -388,7 +388,7 @@ EOD;
$user->lastname = $c->lastname;
$user->imagealt = $c->imagealt;
$c->content = format_text($c->content, $c->format);
$userpic = new user_picture();
$userpic = new moodle_user_picture();
$userpic->user = $user;
$userpic->courseid = $this->course->id;
$userpic->link = true;

View File

@ -2675,7 +2675,7 @@ function print_user_picture($user, $courseid, $picture=NULL, $size=0, $return=fa
// debugging('print_user_picture() has been deprecated. Please change your code to use $OUTPUT->user_picture($user, $courseid).');
$userpic = new user_picture();
$userpic = new moodle_user_picture();
$userpic->user = $user;
$userpic->courseid = $courseid;
$userpic->size = $size;
@ -3287,7 +3287,7 @@ function popup_form($baseurl, $options, $formid, $selected='', $nothing='choose'
$baseurl = new moodle_url($baseurl);
$select = moodle_select::make_popup_form($baseurl, $name, $options, $formid, $selected);
$select->disabled = $disabled;
if (!empty($submitvalue)) {
$select->form->button->text = $submitvalue;
}

File diff suppressed because it is too large Load Diff

View File

@ -1221,7 +1221,7 @@ class moodle_core_renderer extends moodle_renderer_base {
*/
public function doc_link($path, $text=false, $iconpath=false) {
global $CFG, $OUTPUT;
$icon = new action_icon();
$icon = new moodle_action_icon();
$icon->linktext = $text;
$icon->image->alt = $text;
$icon->image->add_class('iconhelp');
@ -1242,9 +1242,9 @@ class moodle_core_renderer extends moodle_renderer_base {
}
/**
* Given a action_icon object, outputs an image linking to an action (URL or AJAX).
* Given a moodle_action_icon object, outputs an image linking to an action (URL or AJAX).
*
* @param action_icon $icon An action_icon object
* @param moodle_action_icon $icon A moodle_action_icon object
* @return string HTML fragment
*/
public function action_icon($icon) {
@ -1402,7 +1402,7 @@ class moodle_core_renderer extends moodle_renderer_base {
* This method can be used in two ways:
* <pre>
* // Option 1:
* $userpic = new user_picture();
* $userpic = new moodle_user_picture();
* // Set properties of $userpic
* $OUTPUT->user_picture($userpic);
*
@ -1414,20 +1414,20 @@ class moodle_core_renderer extends moodle_renderer_base {
* @param object $userpic Object with at least fields id, picture, imagealt, firstname, lastname
* If any of these are missing, or if a userid is passed, the database is queried. Avoid this
* if at all possible, particularly for reports. It is very bad for performance.
* A user_picture object is a better parameter.
* A moodle_user_picture object is a better parameter.
* @param int $courseid courseid Used when constructing the link to the user's profile. Required if $userpic
* is not a user_picture object
* is not a moodle_user_picture object
* @return string HTML fragment
*/
public function user_picture($userpic, $courseid=null) {
// Instantiate a user_picture object if $user is not already one
if (!($userpic instanceof user_picture)) {
// Instantiate a moodle_user_picture object if $user is not already one
if (!($userpic instanceof moodle_user_picture)) {
if (empty($courseid)) {
throw new coding_exception('Called $OUTPUT->user_picture with a $user object but no $courseid.');
}
$user = $userpic;
$userpic = new user_picture();
$userpic = new moodle_user_picture();
$userpic->user = $user;
$userpic->courseid = $courseid;
} else {

View File

@ -1187,7 +1187,7 @@ class moodle_core_renderer_test extends UnitTestCase {
$this->assert(new ContainsTagWithContents('option', 'value3'), $html);
$this->assert(new ContainsTagWithContents('option', 'value4'), $html);
}
public function test_userpicture() {
global $CFG;
// Set up the user with the required fields
@ -1197,7 +1197,7 @@ class moodle_core_renderer_test extends UnitTestCase {
$user->picture = false;
$user->imagealt = false;
$user->id = 1;
$userpic = new user_picture();
$userpic = new moodle_user_picture();
$userpic->user = $user;
$userpic->courseid = 1;
$userpic->url = true;

View File

@ -233,7 +233,7 @@ case 'plugins':
echo '<div><ul>';
foreach($repos as $repo) {
$info = $repo->get_meta();
$icon = new action_icon();
$icon = new moodle_action_icon();
$icon->image->src = $info->icon;
$icon->image->style = 'height: 16px; width: 16px;';
$icon->link->url = clone($url);