Wednesday 23 April 2003 1:07:34 am
Try to look at this code:
$class =& eZContentClass::fetch( 6 );
// Create object by user 14 in section 1
$contentObject =& $class->instantiate( 14, 1 );
$nodeAssignment =& eZNodeAssignment::create( array(
'contentobject_id' => $contentObject->attribute( 'id' ),
'contentobject_version' => $contentObject->attribute( 'current_version' ),
'parent_node' => 16,
'is_main' => 1
) );
$version =& $contentObject->version( 1 ); $contentObjectAttributes =& $version->contentObjectAttributes();
$contentObjectAttributes[0]->setAttribute( 'data_text', $klubb ); $contentObjectAttributes[0]->store();
$contentObjectAttributes[1]->setAttribute( 'data_text', $distrikt ); $contentObjectAttributes[1]->store();
$version->setAttribute( 'modified', eZDateTime::currentTimeStamp() ); $version->setAttribute( 'status', EZ_VERSION_STATUS_DRAFT ); $version->store();
$nodeAssignment->store();
include_once( 'lib/ezutils/classes/ezoperationhandler.php' );
$operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $contentObject->attribute( 'id' ),
'version' => 1 ) );
$klubbObject =& eZContentObject::fetch( $contentObject->attribute( 'id' ) );
|