|
static | fields ($tableprefix='', array $extrafields=NULL, $idalias='id', $fieldprefix='') |
| Returns a list of required user fields, useful when fetching required user info from db. More...
|
|
static | unalias (stdClass $record, array $extrafields=null, $idalias='id', $fieldprefix='') |
| Extract the aliased user fields from a given record. More...
|
|
|
bool | $alttext = true |
| Add non-blank alt-text to the image. More...
|
|
string | $class = 'userpicture' |
| Image class attribute.
|
|
int | $courseid |
| The course id. More...
|
|
bool | $includefullname = false |
| Whether to include the fullname in the user picture link.
|
|
mixed | $includetoken = false |
| Include user authentication token. More...
|
|
bool | $link = true |
| Add course profile link to image.
|
|
bool | $popup = false |
| Whether or not to open the link in a popup window.
|
|
int | $size = 35 |
| Size in pixels. More...
|
|
stdClass | $user |
| A user object with at least fields all columns specified in $fields array constant set.
|
|
bool | $visibletoscreenreaders = true |
| Whether to be visible to screen readers.
|
|
|
static array | $fields |
| List of mandatory fields in user record here. More...
|
|
◆ __construct()
user_picture::__construct |
( |
stdClass |
$user | ) |
|
User picture constructor.
- Parameters
-
stdClass | $user | user record with at least id, picture, imagealt, firstname and lastname set. It is recommended to add also contextid of the user for performance reasons. |
◆ fields()
static user_picture::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 | $tableprefix | name of database table prefix in query |
array | $extrafields | extra fields to be included in result (do not include TEXT columns because it would break SELECT DISTINCT in MSSQL and ORACLE) |
string | $idalias | alias of id field |
string | $fieldprefix | prefix to add to all columns in their aliases, does not apply to 'id' |
- Return values
-
◆ get_url()
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
-
- Return values
-
◆ unalias()
static user_picture::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 | $record | containing user picture fields |
array | $extrafields | extra fields included in the $record |
string | $idalias | alias of the id field |
string | $fieldprefix | prefix added to all columns in their aliases, does not apply to 'id' |
- Return values
-
stdClass | object with unaliased user fields |
◆ $alttext
bool user_picture::$alttext = true |
Add non-blank alt-text to the image.
Default true, set to false when image alt just duplicates text in screenreaders.
◆ $courseid
int user_picture::$courseid |
The course id.
Used when constructing the link to the user's profile, page course id used if not specified.
◆ $fields
array user_picture::$fields |
|
staticprotected |
Initial value:= array('id', 'picture', 'firstname', 'lastname', 'firstnamephonetic', 'lastnamephonetic',
'middlename', 'alternatename', 'imagealt', 'email')
List of mandatory fields in user record here.
(do not include TEXT columns because it would break SELECT DISTINCT in MSSQL and ORACLE)
◆ $includetoken
mixed user_picture::$includetoken = false |
Include user authentication token.
True indicates to generate a token for current user, and integer value indicates to generate a token for the user whose id is the value indicated.
◆ $size
int user_picture::$size = 35 |
Size in pixels.
Special values are (true/1 = 100px) and (false/0 = 35px) for backward compatibility.
The documentation for this class was generated from the following file: