Moodle  2.2.1
http://www.collinsharper.com
csv_import_reader Class Reference

Public Member Functions

 csv_import_reader ($iid, $type)
 load_csv_content (&$content, $encoding, $delimiter_name, $column_validation=null)
 get_columns ()
 init ()
 next ()
 close ()
 get_error ()
 cleanup ($full=false)
 get_encoded_delimiter ($delimiter_name)
 get_new_iid ($type)

Static Public Member Functions

static get_delimiter_list ()
static get_delimiter ($delimiter_name)

Data Fields

 $_iid
 $_type
 $_error
 $_columns
 $_fp

Detailed Description

Definition at line 37 of file csvlib.class.php.


Member Function Documentation

cleanup ( full = false)

Cleanup temporary data

object object

Parameters:
boolean$fulltrue means do a full cleanup - all sessions for current user, false only the active iid

Definition at line 246 of file csvlib.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

close ( )

Release iteration related resources

Returns:
void

Definition at line 223 of file csvlib.class.php.

Here is the caller graph for this function:

csv_import_reader ( iid,
type 
)

Contructor

Parameters:
int$iidimport identifier
string$typewhich script imports?

Definition at line 65 of file csvlib.class.php.

Returns list of columns

Returns:
array

Definition at line 157 of file csvlib.class.php.

Here is the caller graph for this function:

static get_delimiter ( delimiter_name) [static]

Get delimiter character

Parameters:
stringseparator name
Returns:
string delimiter char

Definition at line 276 of file csvlib.class.php.

Here is the caller graph for this function:

static get_delimiter_list ( ) [static]

Get list of cvs delimiters

Returns:
array suitable for selection box

Definition at line 261 of file csvlib.class.php.

Here is the caller graph for this function:

get_encoded_delimiter ( delimiter_name)

Get encoded delimiter character

object

Parameters:
stringseparator name
Returns:
string encoded delimiter char

Definition at line 294 of file csvlib.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_error ( )

Get last error

Returns:
string error text of null if none

Definition at line 235 of file csvlib.class.php.

get_new_iid ( type)

Create new import id

object

Parameters:
stringwho imports?
Returns:
int iid

Definition at line 310 of file csvlib.class.php.

Here is the call graph for this function:

init ( )

Init iterator.

object object

Returns:
bool Success

Definition at line 185 of file csvlib.class.php.

Here is the call graph for this function:

load_csv_content ( &$  content,
encoding,
delimiter_name,
column_validation = null 
)

Parse this content

object object

Parameters:
string$contentpassed by ref for memory reasons, unset after return
string$encodingcontent encoding
string$delimiter_nameseparator (comma, semicolon, colon, cfg)
string$column_validationname of function for columns validation, must have one param $columns
Returns:
bool false if error, count of data lines if ok; use get_error() to get error string

Definition at line 81 of file csvlib.class.php.

Here is the call graph for this function:

next ( )

Get next line

Returns:
mixed false, or an array of values

Definition at line 207 of file csvlib.class.php.


Field Documentation

$_columns

Definition at line 53 of file csvlib.class.php.

$_error

Definition at line 49 of file csvlib.class.php.

$_fp

Definition at line 57 of file csvlib.class.php.

$_iid

Definition at line 41 of file csvlib.class.php.

$_type

Definition at line 45 of file csvlib.class.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations