|
Moodle
2.2.1
http://www.collinsharper.com
|
Go to the source code of this file.
Namespaces | |
| namespace | tool |
Enumerations | |
| enum | PIX_FILE_UPDATED |
| enum | PIX_FILE_ERROR |
| enum | PIX_FILE_SKIPPED |
Functions | |
| my_mktempdir ($dir, $prefix='') | |
| process_directory ($dir, $userfield, $overwrite, &$results) | |
| process_file ($file, $userfield, $overwrite) | |
| my_save_profile_image ($id, $originalfile) | |
Variables | |
| $site = get_site() | |
| if(!$adminuser=get_admin()) | $strfile = get_string('file') |
| $struser = get_string('user') | |
| $strusersupdated = get_string('usersupdated', 'tool_uploaduser') | |
| $struploadpictures = get_string('uploadpictures','tool_uploaduser') | |
| $userfields | |
| $userfield = optional_param('userfield', 0, PARAM_INT) | |
| $overwritepicture = optional_param('overwritepicture', 0, PARAM_BOOL) | |
| $mform = new admin_uploadpicture_form(null, $userfields) | |
| Print the header. | |
| exit | |
| enum PIX_FILE_ERROR |
Definition at line 34 of file picture.php.
| enum PIX_FILE_SKIPPED |
Definition at line 35 of file picture.php.
| enum PIX_FILE_UPDATED |
Definition at line 33 of file picture.php.
| my_mktempdir | ( | $ | dir, |
| $ | prefix = '' |
||
| ) |
Create a unique temporary directory with a given prefix name, inside a given directory, with given permissions. Return the full path to the newly created temp directory.
| string | $dir | where to create the temp directory. |
| string | $prefix | prefix for the temp directory name (default '') |
Definition at line 127 of file picture.php.

| my_save_profile_image | ( | $ | id, |
| $ | originalfile | ||
| ) |
Try to save the given file (specified by its full path) as the picture for the user with the given id.
| integer | $id | the internal id of the user to assign the picture file to. |
| string | $originalfile | the full path of the picture file. |
Definition at line 249 of file picture.php.


| process_directory | ( | $ | dir, |
| $ | userfield, | ||
| $ | overwrite, | ||
| &$ | results | ||
| ) |
Recursively process a directory, picking regular files and feeding them to process_file().
| string | $dir | the full path of the directory to process |
| string | $userfield | the prefix_user table field to use to match picture files to users. |
| bool | $overwrite | overwrite existing picture or not. |
| array | $results | (by reference) accumulated statistics of users updated and errors. |
Definition at line 156 of file picture.php.

| process_file | ( | $ | file, |
| $ | userfield, | ||
| $ | overwrite | ||
| ) |
Given the full path of a file, try to find the user the file corresponds to and assign him/her this file as his/her picture. Make extensive checks to make sure we don't open any security holes and report back any success/error.
| string | $file | the full path of the file to process |
| string | $userfield | the prefix_user table field to use to match picture files to users. |
| bool | $overwrite | overwrite existing picture or not. |
Definition at line 199 of file picture.php.


| $mform = new admin_uploadpicture_form(null, $userfields) |
Print the header.
Definition at line 67 of file picture.php.
| $overwritepicture = optional_param('overwritepicture', 0, PARAM_BOOL) |
Definition at line 60 of file picture.php.
| $site = get_site() |
Definition at line 43 of file picture.php.
| if (!$adminuser=get_admin()) $strfile = get_string('file') |
Definition at line 49 of file picture.php.
| $struploadpictures = get_string('uploadpictures','tool_uploaduser') |
Definition at line 52 of file picture.php.
| $struser = get_string('user') |
Definition at line 50 of file picture.php.
| $strusersupdated = get_string('usersupdated', 'tool_uploaduser') |
Definition at line 51 of file picture.php.
| $userfield = optional_param('userfield', 0, PARAM_INT) |
Definition at line 59 of file picture.php.
| $userfields |
array ( 0 => 'username', 1 => 'idnumber', 2 => 'id' )
Definition at line 54 of file picture.php.
Definition at line 112 of file picture.php.