Moodle  2.2.1
http://www.collinsharper.com
user_picture Class Reference
Inheritance diagram for user_picture:
Collaboration diagram for user_picture:

Public Member Functions

 __construct (stdClass $user)
 get_url (moodle_page $page, renderer_base $renderer=null)

Static Public Member Functions

static fields ($tableprefix= '', array $extrafields=NULL, $idalias= 'id', $fieldprefix= '')
static unalias (stdClass $record, array $extrafields=null, $idalias='id', $fieldprefix='')

Data Fields

 $user
 $courseid
 $link = true
 $size = 35
 $alttext = true
 $popup = false
 $class = 'userpicture'

Static Protected Attributes

static $fields = array('id', 'picture', 'firstname', 'lastname', 'imagealt', 'email')

Detailed Description

Data structure representing a user picture.

Since:
Moodle 2.0

Definition at line 103 of file outputcomponents.php.


Constructor & Destructor Documentation

__construct ( stdClass $  user)

User picture constructor.

Parameters:
object$useruser record with at least id, picture, imagealt, firstname and lastname set.
array$optionssuch as link, size, link, ...

Definition at line 146 of file outputcomponents.php.

Here is the call graph for this function:


Member Function Documentation

static fields ( tableprefix = '',
array extrafields = NULL,
idalias = 'id',
fieldprefix = '' 
) [static]

Returns a list of required user fields, useful when fetching required user info from db.

In some cases we have to fetch the user data together with some other information, the idalias is useful there because the id would otherwise override the main id of the result record. Please note it has to be converted back to id before rendering.

Parameters:
string$tableprefixname of database table prefix in query
array$extrafieldsextra fields to be included in result (do not include TEXT columns because it would break SELECT DISTINCT in MSSQL and ORACLE)
string$idaliasalias of id field
string$fieldprefixprefix to add to all columns in their aliases, does not apply to 'id'
Returns:
string

Definition at line 184 of file outputcomponents.php.

Here is the caller graph for this function:

get_url ( moodle_page page,
renderer_base renderer = null 
)

Works out the URL for the users picture.

This method is recommended as it avoids costly redirects of user pictures if requests are made for non-existent files etc.

Parameters:
renderer_base$renderer
Returns:
moodle_url

Definition at line 272 of file outputcomponents.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static unalias ( stdClass $  record,
array extrafields = null,
idalias = 'id',
fieldprefix = '' 
) [static]

Extract the aliased user fields from a given record

Given a record that was previously obtained using self::fields() with aliases, this method extracts user related unaliased fields.

Parameters:
stdClass$recordcontaining user picture fields
array$extrafieldsextra fields included in the $record
string$idaliasalias of the id field
string$fieldprefixprefix added to all columns in their aliases, does not apply to 'id'
Returns:
stdClass object with unaliased user fields

Definition at line 231 of file outputcomponents.php.

Here is the caller graph for this function:


Field Documentation

$alttext = true

Definition at line 130 of file outputcomponents.php.

$class = 'userpicture'

Definition at line 138 of file outputcomponents.php.

Definition at line 117 of file outputcomponents.php.

$fields = array('id', 'picture', 'firstname', 'lastname', 'imagealt', 'email') [static, protected]

Definition at line 107 of file outputcomponents.php.

$link = true

Definition at line 121 of file outputcomponents.php.

$popup = false

Definition at line 134 of file outputcomponents.php.

$size = 35

Definition at line 125 of file outputcomponents.php.

$user

Definition at line 112 of file outputcomponents.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations