/ Published in: PHP
This snippet exports all TemplaVoila Template Objects and Data Structures associated with a specific template package to a T3D file.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$packageRow = t3lib_BEfunc::getRecord("tx_wectemplateadmin_package", $this->packageID); $this->export = t3lib_div::makeInstance('tx_wectemplateadmin_impexp'); $this->export->init(0, 'export'); $this->export->setCharset($GLOBALS['LANG']->charSet); $this->export->extensionDependencies = 'templavoila'; $this->export->showStaticRelations = 0; $this->export->includeExtFileResources = 0; $this->export->relStaticTables[]="tx_templavoila_datastructure"; $this->export->includeExtFileResources = 0; if ($packageRow['thumbnail']) { $this->export->addThumbnail(PATH_site.'uploads/tx_wectemplateadmin/'.$packageRow['thumbnail']); } t3lib_div::loadTCA('tx_templavoila_tmplobj'); foreach($uids as $uid) { if($uid > 0) { $table = 'tx_templavoila_tmplobj'; } else { $table = 'tx_templavoila_datastructure'; } $recordRow = t3lib_BEfunc::getRecord($table, $uid); $this->export->export_addRecord($table, $recordRow); $this->export->export_addFilesFromRelations(); // MUST be after the DBrelations are set so that file from ALL added records are included! } $this->export->export_addDBRelations(); $this->export->setHeaderBasics(); // Meta data setting: $this->export->setMetaData( $packageRow['title'], $packageRow['description'], '', // Notes are empty $GLOBALS['BE_USER']->user['username'], $GLOBALS['BE_USER']->user['realName'], $GLOBALS['BE_USER']->user['email'] ); if($packageRow['filename']) { $filename = 'uploads/tx_wectemplateadmin/'.$packageRow['filename']; } else { } // Now the internal DAT array is ready to export: // Write export $out = $this->export->compileMemoryToFileContent('t3d'); t3lib_div::writeFile(PATH_site.$filename, $out); return $filename;