Public Member Functions | |
| __construct () | |
| Constructor. | |
| setSeparator ($a_sep) | |
| setDelimiter ($a_del) | |
| Set delimiter. | |
| setLength ($a_length) | |
| Set length. | |
| open ($file="") | |
| close () | |
| getDataArrayFromCSVFile () | |
| Get data as array from csv file. | |
Private Member Functions | |
| unquote ($a_str) | |
| private | |
Private Attributes | |
| $ptr_file = null | |
| $data = array() | |
| $separator = ';' | |
| $delimiter = '""' | |
| $length = 1024 | |
Definition at line 34 of file class.ilCSVReader.php.
| ilCSVReader::__construct | ( | ) |
| ilCSVReader::close | ( | ) |
Definition at line 95 of file class.ilCSVReader.php.
{
return( @fclose($this->ptr_file) );
}
| ilCSVReader::getDataArrayFromCSVFile | ( | ) |
Get data as array from csv file.
public
Definition at line 107 of file class.ilCSVReader.php.
References unquote().
{
$row = 0;
while (($line = fgetcsv($this->ptr_file, $this->length, $this->separator)) !== FALSE)
{
for ($col = 0; $col < count($line); $col++)
{
$this->data[$row][$col] = $this->unquote($line[$col]);
}
++$row;
}
return $this->data;
}
Here is the call graph for this function:| ilCSVReader::open | ( | $ | file = "" |
) |
Definition at line 90 of file class.ilCSVReader.php.
References $file, and ilUtil::stripSlashes().
{
return( $this->ptr_file = @fopen(ilUtil::stripSlashes($file), "r") );
}
Here is the call graph for this function:| ilCSVReader::setDelimiter | ( | $ | a_del | ) |
Set delimiter.
public
| string | field delimiter |
Definition at line 73 of file class.ilCSVReader.php.
{
$this->delimiter = $a_del;
}
| ilCSVReader::setLength | ( | $ | a_length | ) |
Set length.
public
| int | length |
Definition at line 85 of file class.ilCSVReader.php.
{
$this->length = $a_length;
}
| ilCSVReader::setSeparator | ( | $ | a_sep | ) |
Definition at line 61 of file class.ilCSVReader.php.
{
$this->separator = $a_sep;
}
| ilCSVReader::unquote | ( | $ | a_str | ) | [private] |
private
| string | field value |
Definition at line 130 of file class.ilCSVReader.php.
Referenced by getDataArrayFromCSVFile().
{
return str_replace($this->delimiter.$this->delimiter, $this->delimiter,$a_str);
}
Here is the caller graph for this function:ilCSVReader::$data = array() [private] |
Definition at line 37 of file class.ilCSVReader.php.
ilCSVReader::$delimiter = '""' [private] |
Definition at line 39 of file class.ilCSVReader.php.
ilCSVReader::$length = 1024 [private] |
Definition at line 40 of file class.ilCSVReader.php.
ilCSVReader::$ptr_file = null [private] |
Definition at line 36 of file class.ilCSVReader.php.
ilCSVReader::$separator = ';' [private] |
Definition at line 38 of file class.ilCSVReader.php.
1.7.1