Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/admin/tool/uploaduser/picture.php File Reference

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

Enumeration Type Documentation

Definition at line 34 of file picture.php.

Definition at line 35 of file picture.php.

Definition at line 33 of file picture.php.


Function Documentation

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.

Parameters:
string$dirwhere to create the temp directory.
string$prefixprefix for the temp directory name (default '')
Returns:
string The full path to the temp directory.

Definition at line 127 of file picture.php.

Here is the call graph for this function:

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.

Parameters:
integer$idthe internal id of the user to assign the picture file to.
string$originalfilethe full path of the picture file.
Returns:
bool

Definition at line 249 of file picture.php.

Here is the call graph for this function:

Here is the caller graph for this function:

process_directory ( dir,
userfield,
overwrite,
&$  results 
)

Recursively process a directory, picking regular files and feeding them to process_file().

Parameters:
string$dirthe full path of the directory to process
string$userfieldthe prefix_user table field to use to match picture files to users.
bool$overwriteoverwrite existing picture or not.
array$results(by reference) accumulated statistics of users updated and errors.
Returns:
nothing

Definition at line 156 of file picture.php.

Here is the call graph for this function:

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.

Parameters:
string$filethe full path of the file to process
string$userfieldthe prefix_user table field to use to match picture files to users.
bool$overwriteoverwrite existing picture or not.
Returns:
integer either PIX_FILE_UPDATED, PIX_FILE_ERROR or PIX_FILE_SKIPPED

Definition at line 199 of file picture.php.

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

$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
Initial value:
 array (
    0 => 'username',
    1 => 'idnumber',
    2 => 'id' )

Definition at line 54 of file picture.php.

Definition at line 112 of file picture.php.

 All Data Structures Namespaces Files Functions Variables Enumerations