[ Index ]
 

Code source de Claroline 188

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/claroline/inc/lib/ -> import_csv.lib.php (sommaire)

CLAROLINE Library for import of csv user list

Author: Claro Team <cvs@claroline.net>
Author: Guillaume Lederer <guillaume@claroline.net>
Copyright: 2001-2006 Universite catholique de Louvain (UCL)
License: http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
Version: 1.8 $Revision: 1.25.2.1 $
Poids: 807 lignes (26 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

CSV:: (6 méthodes):
  CRLFclean()
  validKEY()
  stripENCLOSED()
  CSV()
  error()
  help()

Définit 6 fonctions

  array_swap_cols_and_rows()
  claro_CSV_format_ok()
  claro_check_campus_CSV_File()
  claro_disp_CSV_error_backlog()
  check_email_synthax_userlist()
  check_username_used_userlist()
  check_officialcode_used_userlist()
  check_password_userlist()
  check_mail_used_userlist()
  check_duplicate_mail_userlist()
  check_duplicate_username_userlist()
  check_duplicate_officialcode_userlist()

Classe: CSV  - X-Ref

Class needed for parsing CSV files

CRLFclean()   X-Ref
Pas de description

validKEY($v)   X-Ref
Pas de description

stripENCLOSED(&$v,$eb)   X-Ref
Pas de description

CSV($filename,$delim=";",$linedef,$enclosed_by="",$eol="\n")   X-Ref

param:
param:
param: $linedef FIRSTLINE means we take the first line of the file as the definition of the fields
param:
return: $errors : an array of boolean where $errors[$i] is TRUE if there is an error with entry $i in the given 2D array.

error($msg)   X-Ref
Pas de description

help()   X-Ref
Pas de description

Fonctions
Fonctions qui ne font pas partie d'une Classe:

array_swap_cols_and_rows( $origMatrix, $presumedColKeyList)   X-Ref
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
author: Hugues Peeters <peeters@ipm.ucl.ac.be>
param: origMartix array source array to be reverted
param: $presumedColKeyList array contain the minimum list of colum in the builded array

claro_CSV_format_ok($format, $delim, $enclosedBy)   X-Ref
test if the given format is correct to be used in claroline to add user,
if all the complusory fields are present.

param: format to test
return: boolean TRUE if format is acceptable

claro_check_campus_CSV_File($uploadTempDir, $useFirstLine, $usedFormat, $fieldSeparator, $enclosedBy)   X-Ref
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: ...

author: Guillaume Lederer <lederer@cerdecam.be>
param: $uploadTempDir : place where the folder is stored
param: $useFirstLine  : boolean true if parser should user the first line of file to know where the format is
param: $format : the used format, if empty, this means that we use first line format mode
return: 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:

claro_disp_CSV_error_backlog()   X-Ref
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>

check_email_synthax_userlist($userlist)   X-Ref
Check EMAIL SYNTHAX : if new users in Claroline with the specified parameters contains synthax error
in mail given.

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

check_username_used_userlist($userlist)   X-Ref
Check USERNAME NOT TAKEN YET : check if usernames are not already token by someone else

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

check_officialcode_used_userlist($userlist)   X-Ref
Check OFFICIAL CODE NOT TAKEN YET : check if admincode (officialCode) is not already taken by someone else

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

check_password_userlist($userlist)   X-Ref
Check PASSWORD ACCEPTABLE  : check if password is sufficently complex for this user

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

check_mail_used_userlist($userlist)   X-Ref
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>
param: $userlist must be a 2D array with the list of potential new users :
return: $errors : an array of boolean where $errors[$i] is TRUE if there is an error with entry $i in the given array.

check_duplicate_mail_userlist($userlist)   X-Ref
Check DUPLICATE EMAIL OF ADDABLE USERS : take the 2D array in param and check if  email
are all different.

param: $userlist must be a 2D array with the list of potential new users :
return: $errors : an array of boolean where $errors[$i] is TRUE if there is an error with entry $i in the given 2D array.

check_duplicate_username_userlist($userlist)   X-Ref
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>
param: $userlist must be a 2D array with the list of potential new users :
return: $errors : an array of boolean where $errors[$i] is TRUE if there is an error with entry $i in the given 2D array.

check_duplicate_officialcode_userlist($userlist)   X-Ref
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>
param: $userlist must be a 2D array with the list of potential new users :
return: $errors : an array of boolean where $errors[$i] is TRUE if there is an error with entry $i in the given 2D array.



Généré le : Thu Nov 29 14:38:42 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics