/** * @access public * @param string $file_name * @param string $path_save * @param string $path_templates * @param boolean $format_output * @param boolean $white_space * @return void */ public function load($file_name, $path_save, $path_templates, $format_output, $white_space) { try { $this->fileName = $file_name; $this->pathTemplates = Fonction::removeLastSlash($path_templates); $this->pathSave = Fonction::removeLastSlash($path_save); $this->core = new DOMDocument(); $this->core->preserveWhiteSpace = $white_space; $this->core->formatOutput = $format_output; if (!@$this->core->load($this->pathTemplates . '/' . $this->fileName)) { throw new Exception(''); } $this->xpath = new DOMXPath($this->core); $this->root = $this->core->documentElement; $this->nameSpaces = Fonction::getNamespace(); } catch (Exception $e) { throw $e; } }
/** * @access public * @param string $document_name * @param string $path_save * @param string $path_templates * @return object */ public function __construct($document_name, $path_save = '', $path_templates = '') { $docSave = $this->_setTempDirName(); $path_templates = $path_templates == '' ? TEMPLATE_FILE_PATH_CALC : $path_templates; $path_save = $path_save == '' ? SAVE_FILE_PATH_CALC : $path_save; $this->extension = 'ods'; $this->contentType = 'application/vnd.oasis.opendocument.spreadsheet'; $this->keepGeneratedRep = false; $this->pathTemplates = Fonction::removeLastSlash($path_templates); $this->pathSave = Fonction::removeLastSlash($path_save) . '/' . $docSave; $this->documentName = Fonction::checkFileName($document_name, $this->extension); try { $this->manifest = new Manifest($this->pathSave . '/META-INF', $this->pathTemplates . '/META-INF', true, false); $this->meta = new Meta($this->pathSave, $this->pathTemplates, true, false); $this->settings = new Settings($this->pathSave, $this->pathTemplates, true, false); $this->styles = new Styles($this->pathSave, $this->pathTemplates, true, false); $this->content = new Content($this, $this->pathSave, $this->pathTemplates, true, false); } catch (Exception $e) { echo '<br><b>Notice : </b>' . $e->getMessage() . '<br>'; } }
/** * Constructeur qui load une Picture * * @access public * @param object $core * @param object $xpath * @param string $picture_path * @param string $sheet_name * @return object */ public function __construct($core = '', $xpath = '', $picture_path = '', $sheet_name = '') { if ($core && $xpath) { $this->load('picture', $core, $xpath); $this->root = $xpath->query('//office:spreadsheet')->item(0); $path = explode('/', Fonction::removeLastSlash($picture_path)); $name = array_pop($path); //$path = (count($path) == 0) ? $path = '' : implode('/', $path); //comment $this->picturePath = implode('/', $path); $this->name = $name; $this->sheetAddress = $sheet_name; $this->type = 'simple'; $this->show = 'embed'; $this->actuate = 'onLoad'; $this->type = 'image/gif'; $this->zIndex = 0; } }