hello @all,
I'm currently evaluating your classes for a project.
Testcase is Debian Etch 4.0 with php5.2.5 from dotdeb and
phpopendocument trunk (#282) [0.5.3 same problems]
Sample Script is this:
<?php
/**
* skeleton batch script
*
* Here goes a brief description of the purpose of the batch script
*
* @package dissz
* @subpackage batch
* @version $Id$
*/
// created with symfony init-batch default skeleton backend
define('SF_ROOT_DIR', realpath(dirname(__file__).'/..'));
define('SF_APP', 'backend');
define('SF_ENVIRONMENT', 'dev');
define('SF_DEBUG', 1);
require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');
// initialize database manager
//$databaseManager = new sfDatabaseManager();
//$databaseManager->initialize();
ini_set('include_path',ini_get('include_path').':../externals/php/opendocumentphp/current/src/:');
require_once('../externals/php/opendocumentphp/current/src/OpenDocumentPHP/OpenDocumentText.php');
/*
* replace the first '' with a path of your choice or the full path in
$fullpath.
*/
$fullpath = tempnam('', 'SDC');
/*
* if a parameter was given, than use this parameter as filename.
*/
if ($argc == 2) {
$fullpath = $argv[1];
}
/*
* If demo output exists, remove it first.
*/
if (file_exists($fullpath . '.odt')) {
unlink($fullpath . '.odt');
}
/*
* Open a new OpenDocumentText object with filename "$fullpath".'odt'.
*/
$text = new OpenDocumentText($fullpath . '.odt');
/* ------------- */
/* Set meta data */
/* ------------- */
$text->setDefaultMeta();
/* --------------------------- */
/* Set Font Face Declarations */
/* --------------------------- */
$text->setDefaultFontFaces();
/* ------------------ */
/* Set up some styles */
/* ------------------ */
$text->setDefaultStyles();
/* --------------------- */
/* Write some Paragraphs */
/* --------------------- */
$textbody = $text->getBody()->getTextFragment();
// First we create a headline:
$heading = $textbody->nextHeading();
$heading->setStyleName('Heading_20_1');
$heading->append('Headline');
// Now we write a short paragraph:
$paragraph = $textbody->nextParagraph();
$paragraph->setStyleName('Standard');
$paragraph->append('The first paragraph in the document. ');
$paragraph->append('And this is the 2nd part of this first paragraph.');
// *** FIX ME *** - We should do a lot of other work here...
$text->close();
/*
* remove tmp file if there is one ...
*/
if (file_exists($fullpath)) {
// unlink($fullpath);
}
echo "You can find the new simple OpenDocument file here: " .
$fullpath . "\n";
// batch process here
Error Message is this:
Warning: ZipArchive::addFromString()
[function.ZipArchive-addFromString]: Invalid or unitialized Zip object
in /var/www/project/dissz.net.trunk/externals/php/opendocumentphp/opendocumentphp_trunk/src/OpenDocumentPHP/OpenDocumentArchive.php on line 179
This is the code:
/**
* Add a file to a ZIP archive using its contents.
*
* @param string $localname The name of the entry to create.
* @param string $contents The contents to use to create the entry.
It is used in a binary safe mode.
* @param string $mimetype Mime type of the file.
* @access public
* @since 0.5.0 - 08. Feb. 2007
*/
function addFromString($localname, $contents, $mimetype = 'text/text')
{
/*
* First add to ZipArchive ...
*/
$ret = parent :: addFromString($localname, $contents);
Somebody any ideas?
lars
|