Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
tool_uploaduser\process Class Reference

Process CSV file with users data, this will create/update users, enrol them into courses, etc. More...

Public Member Functions

 __construct (\csv_import_reader $cir, string $progresstrackerclass=null)
 process constructor.
 
 get_bulk ()
 Setting to select for bulk actions (not available in CLI)
 
 get_file_columns ()
 Returns the list of columns in the file.
 
 get_stats ()
 Summary about the whole process (how many users created, skipped, updated, etc)
 
 process ()
 Process the CSV file.
 
 process_line (array $line)
 Process one line from CSV file.
 
 set_form_data (\stdClass $formdata)
 Set data from the form (or from CLI options)
 

Protected Member Functions

 find_profile_fields ()
 Profile fields.
 
 find_standard_fields ()
 Standard user fields.
 
 get_allow_deletes ()
 Setting to allow deletes.
 
 get_allow_email_duplicates ()
 Setting to allow email duplicates.
 
 get_allow_renames ()
 Setting to allow deletes.
 
 get_allow_suspends ()
 Setting to allow suspends.
 
 get_create_paswords ()
 Setting to allow create passwords.
 
 get_match_on_email ()
 Setting to allow matching user accounts on email.
 
 get_normalise_user_names ()
 Setting to normalise user names.
 
 get_operation_type ()
 Operation type.
 
 get_reset_passwords ()
 Setting for reset password.
 
 get_string_yes_no ($value)
 Helper method to return Yes/No string.
 
 get_update_passwords ()
 Setting to allow update passwords.
 
 get_update_type ()
 Setting for update type.
 
 prepare_user_record (array $line)
 Prepare one line from CSV file as a user record.
 

Protected Attributes

profile_field_base[] $allprofilefields = []
 
array $ccache = []
 course cache - do not fetch all courses here, we will not probably use them all anyway
 
csv_import_reader $cir
 
array $cohorts = []
 
int $deleteerrors = 0
 
int $deletes = 0
 
array $filecolumns = null
 
stdClass $formdata
 
array $manualcache = []
 cache of used manual enrol plugins in each course
 
enrol_plugin null $manualenrol = null
 
array $profilefields = []
 
string uu_progress_tracker null $progresstrackerclass = null
 
int $renameerrors = 0
 
int $renames = 0
 
array $rolecache = []
 Course roles lookup cache.
 
array $standardfields = []
 
array $supportedauths = []
 officially supported plugins that are enabled
 
array $sysrolecache = []
 System roles lookup cache.
 
int $today
 
uu_progress_tracker $upt
 
int $userserrors = 0
 
int $usersnew = 0
 
int $usersskipped = 0
 
int $usersupdated = 0
 
int $usersuptodate = 0
 /not printed yet anywhere
 
int $weakpasswords = 0
 

Detailed Description

Process CSV file with users data, this will create/update users, enrol them into courses, etc.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

tool_uploaduser\process::__construct ( \csv_import_reader $cir,
string $progresstrackerclass = null )

process constructor.

Parameters
csv_import_reader$cir
string | null$progresstrackerclass
Exceptions
coding_exception

Member Function Documentation

◆ get_allow_deletes()

tool_uploaduser\process::get_allow_deletes ( )
protected

Setting to allow deletes.

Return values
bool

◆ get_allow_email_duplicates()

tool_uploaduser\process::get_allow_email_duplicates ( )
protected

Setting to allow email duplicates.

Return values
bool

◆ get_allow_renames()

tool_uploaduser\process::get_allow_renames ( )
protected

Setting to allow deletes.

Return values
bool

◆ get_allow_suspends()

tool_uploaduser\process::get_allow_suspends ( )
protected

Setting to allow suspends.

Return values
bool

◆ get_bulk()

tool_uploaduser\process::get_bulk ( )

Setting to select for bulk actions (not available in CLI)

Return values
bool

◆ get_create_paswords()

tool_uploaduser\process::get_create_paswords ( )
protected

Setting to allow create passwords.

Return values
bool

◆ get_file_columns()

tool_uploaduser\process::get_file_columns ( )

Returns the list of columns in the file.

Return values
array

◆ get_match_on_email()

tool_uploaduser\process::get_match_on_email ( )
protected

Setting to allow matching user accounts on email.

Return values
bool

◆ get_normalise_user_names()

tool_uploaduser\process::get_normalise_user_names ( )
protected

Setting to normalise user names.

Return values
bool

◆ get_operation_type()

tool_uploaduser\process::get_operation_type ( )
protected

Operation type.

Return values
int

◆ get_reset_passwords()

tool_uploaduser\process::get_reset_passwords ( )
protected

Setting for reset password.

Return values
intUU_PWRESET_NONE, UU_PWRESET_WEAK, UU_PWRESET_ALL

◆ get_stats()

tool_uploaduser\process::get_stats ( )

Summary about the whole process (how many users created, skipped, updated, etc)

Return values
array

◆ get_string_yes_no()

tool_uploaduser\process::get_string_yes_no ( $value)
protected

Helper method to return Yes/No string.

Parameters
bool$value
Return values
string

◆ get_update_passwords()

tool_uploaduser\process::get_update_passwords ( )
protected

Setting to allow update passwords.

Return values
bool

◆ get_update_type()

tool_uploaduser\process::get_update_type ( )
protected

Setting for update type.

Return values
int

◆ prepare_user_record()

tool_uploaduser\process::prepare_user_record ( array $line)
protected

Prepare one line from CSV file as a user record.

Parameters
array$line
Return values
stdClass|null

◆ process_line()

tool_uploaduser\process::process_line ( array $line)

Process one line from CSV file.

Parameters
array$line
Exceptions
coding_exception
dml_exception
moodle_exception

◆ set_form_data()

tool_uploaduser\process::set_form_data ( \stdClass $formdata)

Set data from the form (or from CLI options)

Parameters
stdClass$formdata

The documentation for this class was generated from the following file: