claroline/claroline/inc/lib/import_csv.lib.php File Reference

Go to the source code of this file.

Data Structures

class  CSV

Functions

if(count(get_included_files())==1) array_swap_cols_and_rows ($origMatrix, $presumedColKeyList)
 claro_CSV_format_ok ($format, $delim, $enclosedBy)
 claro_check_campus_CSV_File ($uploadTempDir, $useFirstLine, $usedFormat, $fieldSeparator, $enclosedBy)
 claro_disp_CSV_error_backlog ()
 check_email_synthax_userlist ($userlist)
 check_username_used_userlist ($userlist)
 check_officialcode_used_userlist ($userlist)
 check_password_userlist ($userlist)
 check_mail_used_userlist ($userlist)
 check_duplicate_mail_userlist ($userlist)
 check_duplicate_username_userlist ($userlist)
 check_duplicate_officialcode_userlist ($userlist)

Function Documentation

if (count(get_included_files())==1) array_swap_cols_and_rows ( origMatrix,
presumedColKeyList 
)

CLAROLINE

Library for import of csv user list

Version:
1.9
Revision
10488

2001-2008 Universite catholique de Louvain (UCL) http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE

Author:
Claro Team <cvs@claroline.net>
Guillaume Lederer <guillaume@claroline.net>
Since:
1.6 INVERT A MATRIX function :

this function allows to invert cols and rows of a 2D array needed to treat the potentialy new users to add form a CSV file

Parameters:
origMartix array source array to be reverted
$presumedColKeyList array contain the minimum list of colum in the builded array
Author:
Hugues Peeters <peeters@ipm.ucl.ac.be>

Definition at line 34 of file import_csv.lib.php.

check_duplicate_mail_userlist ( userlist  ) 

Check DUPLICATE EMAIL OF ADDABLE USERS : take the 2D array in param and check if email are all different.

Parameters:
$userlist must be a 2D array with the list of potential new users : $userlist['email'][$i] for the email $userlist['username'][$i] for the username $userlist['officialCode'][$i] for the officialCod
Returns:
$errors : an array of boolean where $errors[$i] is TRUE if there is an error with entry $i in the given 2D array.

Definition at line 525 of file import_csv.lib.php.

check_duplicate_officialcode_userlist ( userlist  ) 

Check DUPLICATE OFFICIAL CODE OF ADDABLE USERS : take the 2D array in param and check if official codes are all different.

Author:
Guillaume Lederer <lederer@cerdecam.be>
Parameters:
$userlist must be a 2D array with the list of potential new users : $userlist['email'][$i] for the email $userlist['username'][$i] for the username $userlist['officialCode'][$i] for the officialCod
Returns:
$errors : an array of boolean where $errors[$i] is TRUE if there is an error with entry $i in the given 2D array.

Definition at line 594 of file import_csv.lib.php.

check_duplicate_username_userlist ( userlist  ) 

Check DUPLICATE USERNAMES OF ADDABLE USERS : take the 2D array in param and check if username are all different.

Author:
Guillaume Lederer <lederer@cerdecam.be>
Parameters:
$userlist must be a 2D array with the list of potential new users : $userlist['email'][$i] for the email $userlist['username'][$i] for the username $userlist['officialCode'][$i] for the officialCod
Returns:
$errors : an array of boolean where $errors[$i] is TRUE if there is an error with entry $i in the given 2D array.

Definition at line 563 of file import_csv.lib.php.

check_email_synthax_userlist ( userlist  ) 

Check EMAIL SYNTHAX : if new users in Claroline with the specified parameters contains synthax error in mail given.

Author:
Guillaume Lederer <lederer@cerdecam.be>
Parameters:
$userlist must be a 2D array with the list of potential new users : $userlist['email'][$i] for the email
Returns:
$errors : an array of boolean where $errors[$i] is TRUE if there is an error with entry $i in the given array.

Definition at line 309 of file import_csv.lib.php.

check_mail_used_userlist ( userlist  ) 

Check EMAIL NOT TAKEN YET : check if the e-mails are not already taken by someone in the plateform

Author:
Guillaume Lederer <lederer@cerdecam.be>
Parameters:
$userlist must be a 2D array with the list of potential new users :

$userlist['email'][$i] for the email

Returns:
$errors : an array of boolean where $errors[$i] is TRUE if there is an error with entry $i in the given array.

Definition at line 471 of file import_csv.lib.php.

check_officialcode_used_userlist ( userlist  ) 

Check OFFICIAL CODE NOT TAKEN YET : check if admincode (officialCode) is not already taken by someone else

Author:
Guillaume Lederer <lederer@cerdecam.be>
Parameters:
$userlist must be a 2D array with the list of potential new users :

$userlist['officialCode'][$i] for the officialCode

Returns:
$errors : an array of boolean where $errors[$i] is TRUE if there is an error with entry $i in the given array.

Definition at line 391 of file import_csv.lib.php.

check_password_userlist ( userlist  ) 

Check PASSWORD ACCEPTABLE : check if password is sufficently complex for this user

Author:
Guillaume Lederer <lederer@cerdecam.be>
Parameters:
$userlist must be a 2D array with the list of potential new users :

$userlist['username'][$i] for the username $userlist['password'][$i] for the password

Returns:
$errors : an array of boolean where $errors[$i] is TRUE if there is an error with entry $i in the given array.

Definition at line 443 of file import_csv.lib.php.

check_username_used_userlist ( userlist  ) 

Check USERNAME NOT TAKEN YET : check if usernames are not already token by someone else

Author:
Guillaume Lederer <lederer@cerdecam.be>
Parameters:
$userlist must be a 2D array with the list of potential new users : $userlist['username'][$i] for the username
Returns:
$errors : an array of boolean where $errors[$i] is TRUE if there is an error with entry $i in the given array.

Definition at line 337 of file import_csv.lib.php.

claro_check_campus_CSV_File ( uploadTempDir,
useFirstLine,
usedFormat,
fieldSeparator,
enclosedBy 
)

Check ERRORS in a CSV file uploaded of potential new user to add in Claroline

format used for line of CSV file must be stored in SESSION to use this function properly: ...

Parameters:
$uploadTempDir : place where the folder is stored
$useFirstLine : boolean true if parser should user the first line of file to know where the format is false otherwise
$format : the used format, if empty, this means that we use first line format mode
Returns:
a 2D array with the users found in the file is stored in session, 7 boolean errors arrays are created for each type of possible errors, they are stored in session too:

$_SESSION['claro_csv_userlist'] for the users to add

$_SESSION['claro_mail_synthax_error'] for mail synthax error $_SESSION['claro_mail_used_error'] for mail used in campus error $_SESSION['claro_username_used_error'] for username used in campus error $_SESSION['claro_officialcode_used_error'] for official code used error $_SESSION['claro_password_error'] for password error $_SESSION['claro_mail_duplicate_error'] for mail duplicate error $_SESSION['claro_username_duplicate_error'] for username duplicate error $_SESSION['claro_officialcode_duplicate_error'] for officialcode duplicate error

Author:
Guillaume Lederer <lederer@cerdecam.be>

Definition at line 140 of file import_csv.lib.php.

claro_CSV_format_ok ( format,
delim,
enclosedBy 
)

test if the given format is correct to be used in claroline to add user, if all the complusory fields are present.

Parameters:
format to test
Returns:
boolean TRUE if format is acceptable FALSE if format is not acceptable (missing a needed field)

Definition at line 75 of file import_csv.lib.php.

claro_disp_CSV_error_backlog (  ) 

display the errors caused by a conflict with the platform after parsing the CSV file used to add new users found in the platform. ERRORS and USERS must be saved in the session at these places :

$_SESSION['claro_csv_userlist'] for the users to add

$_SESSION['claro_mail_synthax_error'] for mail synthax error $_SESSION['claro_mail_used_error'] for mail used in campus error $_SESSION['claro_username_used_error'] for username used in campus error $_SESSION['claro_officialcode_used_error'] for official code used error $_SESSION['claro_password_error'] for password error $_SESSION['claro_mail_duplicate_error'] for mail duplicate error $_SESSION['claro_username_duplicate_error'] for username duplicate error $_SESSION['claro_officialcode_duplicate_error'] for officialcode duplicate error

Author:
Guillaume Lederer <lederer@cerdecam.be>

Definition at line 246 of file import_csv.lib.php.

Generated on Tue Jun 8 12:28:37 2010 for Claroline API by  doxygen 1.6.3