PHP Class ODTTemplateManager

Afficher le fichier Open project: openeyes/openeyes Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( $filename, $templateDir, $outputDir, $outputName )
changeImageFromGDObject ( $imageName, $image ) * Change an existing image in document by GD object
exchangeAllStringValuesByStyleName ( $texts )
exchangeGeneratedTablesWithTextNodes ( $data )
exchangeStringValueByStyleName ( $styleName, $value ) * Change variables in odt xml by style-name property
exchangeStringValues ( $data ) * Change ${} variables in odt xml to the param value
fillTableByName ( $name, $data, $type = 'name' ) * Find table in xml and fill it with data values
generatePDF ( ) * Generate pdf file from odt and delete temporary folder
generatePDFPageN ( $pageNumber = 1 ) * Convert the generated pdf N page
generateXmlTables ( $dataTables ) private
getPDF ( ) * Get generated pdf
imgReplaceByName ( $imageName, $newImageUrl ) * Change an existing image in document by new image url
saveContentXML ( ) * Save xml file content after edit
storePDF ( ) : ProtectedFile Store the PDF as a ProtectedFile in the system

Méthodes protégées

Méthode Description
cleanUp ( ) deletes all the files generated in the process of generating the final output
getImageHrefFromImageNode ( $imageName ) * Get image path from the xml document

Private Methods

Méthode Description
addStyleToHeader ( $tableName, $style ) * Add a new style to the office:automatic-styles node
createDirs ( $path ) * Create directoy by path
createNode ( $xml, $tag, $attribs, $value = '' ) * Create new element,set attributes and append to xml node
createSingleOrMultilineTextNode ( $node, $string, $existingStyleName = null )
deleteDir ( $path ) * Delete temporary files by path
getTableColsCount ( $firstRow ) * Count table columns
getTableVariableNode ( $nodeValue, $text ) * Find and change ${} varibale in table
openContentXML ( ) * Open xml file
replaceTableNode ( $templateVariableName, $tableXml )
unZip ( $createZipNameDir = true, $overwrite = true ) * Unzip odt file into the temporary directory
zipOdtFile ( ) * Zip xml files

Method Details

__construct() public méthode

public __construct ( $filename, $templateDir, $outputDir, $outputName )
$filename
$templateDir
$outputDir
$outputName

changeImageFromGDObject() public méthode

* Change an existing image in document by GD object
public changeImageFromGDObject ( $imageName, $image )
$imageName
$image

cleanUp() protected méthode

deletes all the files generated in the process of generating the final output
protected cleanUp ( )

exchangeAllStringValuesByStyleName() public méthode

exchangeGeneratedTablesWithTextNodes() public méthode

exchangeStringValueByStyleName() public méthode

* Change variables in odt xml by style-name property
public exchangeStringValueByStyleName ( $styleName, $value )
$styleName
$value

exchangeStringValues() public méthode

* Change ${} variables in odt xml to the param value
public exchangeStringValues ( $data )
$data

fillTableByName() public méthode

* Find table in xml and fill it with data values
public fillTableByName ( $name, $data, $type = 'name' )
$name
$data

generatePDF() public méthode

* Generate pdf file from odt and delete temporary folder
public generatePDF ( )

generatePDFPageN() public méthode

* Convert the generated pdf N page
public generatePDFPageN ( $pageNumber = 1 )
$pageNumber

generateXmlTables() public méthode

private
public generateXmlTables ( $dataTables )

getImageHrefFromImageNode() protected méthode

* Get image path from the xml document
protected getImageHrefFromImageNode ( $imageName )
$imageName

getPDF() public méthode

* Get generated pdf
public getPDF ( )

imgReplaceByName() public méthode

* Change an existing image in document by new image url
public imgReplaceByName ( $imageName, $newImageUrl )
$imageName
$newImageUrl

saveContentXML() public méthode

* Save xml file content after edit
public saveContentXML ( )

storePDF() public méthode

Store the PDF as a ProtectedFile in the system
public storePDF ( ) : ProtectedFile
Résultat ProtectedFile