Add epub loader resource
This commit is contained in:
parent
fd774948fb
commit
987d73ccb8
7 changed files with 1387 additions and 0 deletions
69
resources/epub-loader/CsvExport.class.php
Normal file
69
resources/epub-loader/CsvExport.class.php
Normal file
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
/**
|
||||
* CsvExport class
|
||||
*
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
* @author Didier Corbière <didier.corbiere@opale-concept.com>
|
||||
*/
|
||||
|
||||
require_once(realpath(dirname(__FILE__)) . '/BaseExport.class.php');
|
||||
|
||||
class CsvExport extends BaseExport
|
||||
{
|
||||
private $mLines = null;
|
||||
|
||||
const CsvSeparator = "\t";
|
||||
|
||||
/**
|
||||
* Open an export file (or create if file does not exist)
|
||||
*
|
||||
* @param string Export file name
|
||||
* @param boolean Force file creation
|
||||
*/
|
||||
public function __construct($inFileName)
|
||||
{
|
||||
$this->mSearch = array("\r", "\n", self::CsvSeparator);
|
||||
$this->mReplace = array('', '<br />', '');
|
||||
|
||||
// Init container
|
||||
$this->mLines = array();
|
||||
|
||||
parent::__construct($inFileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the current properties into the export content
|
||||
* and reset the properties
|
||||
*/
|
||||
public function AddContent()
|
||||
{
|
||||
$text = '';
|
||||
foreach ($this->mProperties as $key => $value) {
|
||||
$info = '';
|
||||
if (is_array($value)) {
|
||||
foreach ($value as $value1) {
|
||||
$text .= $value1 . self::CsvSeparator;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
$info = $value;
|
||||
}
|
||||
$text .= $info . self::CsvSeparator;
|
||||
}
|
||||
|
||||
$this->mLines[] = $text;
|
||||
|
||||
$this->ClearProperties();
|
||||
}
|
||||
|
||||
protected function GetContent()
|
||||
{
|
||||
$text = implode("\n", $this->mLines) . "\n";
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue