Forums / Developer / eZInformationCollection fetch information collector data CLI

eZInformationCollection fetch information collector data CLI

Author Message

Benoit Schumacher

Wednesday 25 March 2009 3:42:06 am

Hi,

I have been trying to figure out how to use php to get information collector data as I need to export it as xml for a external application to use.

I am able to get the collection ids, but not to get the collected info for each collection.

What I probably need is simply to have this:

{def $collection=fetch( 'content', 'collected_info_collection',
                        hash( 'collection_id',    123,
                              'contentobject_id', 456 ) )}

in the php format ?

below is my script I am trying:


#!/usr/bin/env php
<?php 
 
 require 'autoload.php';
 
include_once( 'lib/ezutils/classes/ezcli.php' );
include_once( 'kernel/classes/ezscript.php' );
 
$cli =& eZCLI::instance();
$script =& eZScript::instance();
 
$script->startup();
 
$options = $script->getOptions();
 
$script->initialize();
 
	//include_once( 'kernel/classes/ezcontentobjecttreenode.php' );
	include_once( 'kernel/classes/ezcontentclass.php' );
	include_once( 'kernel/classes/ezcontentobject.php' );
	include_once( 'kernel/classes/ezinformationcollection.php' );
	
	 
	$objectID = 887;
                                                               
	$collections = eZInformationCollection::fetchCollectionsList(
											                 $objectID,
											                 false,
											                 false,
											                 array() ); 
                                                                  
	$numberOfCollections = eZInformationCollection::fetchCollectionCountForObject( $objectID ); 
	 
	 
	 /*{def $collection=fetch( 'content', 'collected_info_collection',
                        hash( 'collection_id',    123,
                              'contentobject_id', 456 ) )}*/

	
	
	/*$v0 = var_export($collections);	
	$cli->output($v0);*/

	$node = eZInformationCollection::fetch( 2 );
	
	$v0 = var_export($node);	
	$cli->output($v0);
	
	$cli->output("node2::");
	
	$node2 = eZInformationCollection::fetch( 534 );
	
	$v02 = var_export($node2);	
	$cli->output($v02);
		
	
	$cli->output("by identifier::");
	
	$node3 = eZInformationCollection::fetchByUserIdentifier( '64sbs9p4krcpe7ba0vp7ico4r2' , $objectID );
	
	$v03 = var_export($node3);	
	$cli->output($v03);
		
	/*foreach($collections as $collection) {
				
		$v2 = var_export($collection);

		$cli->output($v2);
		$cli->output("colitemID:" );
		$cli->output($collection->ID);
		
	}*/
		
	//write to file
	/*$myFile = "testWrite.php";
	$fh = fopen($myFile, 'w') or die("can't open file");
	$stringData = "Floppy Jalopy\n";
	fwrite($fh, $stringData);
	fclose($fh);*/
	 
	//$cli->output("NumberCollections:  ".$numberOfCollections );
	//$cli->output($v );
	
 
$script->shutdown();
 
?>

I have installed the extension http://projects.ez.no/cie which works well, however have tried running the cronjob and doenst work, I get errors.