ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
SimpleExcel\SimpleExcel Class Reference
+ Collaboration diagram for SimpleExcel\SimpleExcel:

Public Member Functions

 __construct ($filetype= 'XML')
 SimpleExcel constructor method.
 constructParser ($filetype)
 Construct a SimpleExcel Parser.
 constructWriter ($filetype)
 Construct a SimpleExcel Writer.
 convertTo ($filetype)
 Change writer type to convert to another format.

Data Fields

 $parser
 $writer

Protected Attributes

 $validParserTypes = array('XML', 'CSV', 'TSV', 'HTML', 'JSON')
 $validWriterTypes = array('XML', 'CSV', 'TSV', 'HTML', 'JSON')

Detailed Description

Definition at line 53 of file SimpleExcel.php.

Constructor & Destructor Documentation

SimpleExcel\SimpleExcel::__construct (   $filetype = 'XML')

SimpleExcel constructor method.

Parameters
string$filetypeSet the filetype of the file which will be parsed (XML/CSV/TSV/HTML/JSON)
Returns
void

Definition at line 80 of file SimpleExcel.php.

{
$this->constructParser($filetype);
$this->constructWriter($filetype);
}

Member Function Documentation

SimpleExcel\SimpleExcel::constructParser (   $filetype)

Construct a SimpleExcel Parser.

Parameters
string$filetypeSet the filetype of the file which will be parsed (XML/CSV/TSV/HTML/JSON)
Exceptions
ExceptionIf filetype is neither XML/CSV/TSV/HTML/JSON

Definition at line 91 of file SimpleExcel.php.

References SimpleExcel\Exception\SimpleExcelException\FILETYPE_NOT_SUPPORTED.

{
$filetype = strtoupper($filetype);
if(!in_array($filetype, $this->validParserTypes)){
throw new \Exception('Filetype '.$filetype.' is not supported', SimpleExcelException::FILETYPE_NOT_SUPPORTED);
}
$parser_class = 'SimpleExcel\\Parser\\'.$filetype.'Parser';
$this->parser = new $parser_class();
}
SimpleExcel\SimpleExcel::constructWriter (   $filetype)

Construct a SimpleExcel Writer.

Parameters
string$filetypeSet the filetype of the file which will be written (XML/CSV/TSV/HTML/JSON)
Returns
bool
Exceptions
ExceptionIf filetype is neither XML/CSV/TSV/HTML/JSON

Definition at line 107 of file SimpleExcel.php.

References SimpleExcel\Exception\SimpleExcelException\FILETYPE_NOT_SUPPORTED.

{
$filetype = strtoupper($filetype);
if(!in_array($filetype, $this->validWriterTypes)){
throw new \Exception('Filetype '.$filetype.' is not supported', SimpleExcelException::FILETYPE_NOT_SUPPORTED);
}
$writer_class = 'SimpleExcel\\Writer\\'.$filetype.'Writer';
$this->writer = new $writer_class();
}
SimpleExcel\SimpleExcel::convertTo (   $filetype)

Change writer type to convert to another format.

Parameters
string$filetypeSet the filetype of the file which will be written (XML/CSV/TSV/HTML/JSON)

Definition at line 122 of file SimpleExcel.php.

{
$this->constructWriter($filetype);
$this->writer->setData($this->parser->getField());
}

Field Documentation

SimpleExcel\SimpleExcel::$parser

Definition at line 59 of file SimpleExcel.php.

SimpleExcel\SimpleExcel::$validParserTypes = array('XML', 'CSV', 'TSV', 'HTML', 'JSON')
protected

Definition at line 71 of file SimpleExcel.php.

SimpleExcel\SimpleExcel::$validWriterTypes = array('XML', 'CSV', 'TSV', 'HTML', 'JSON')
protected

Definition at line 72 of file SimpleExcel.php.

SimpleExcel\SimpleExcel::$writer

Definition at line 65 of file SimpleExcel.php.


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