Jacques Feix
|
Friday 13 April 2007 6:03:09 am
Here is a sample of my own ;)
$elementClass=eZContentClass::fetchByIdentifier("article");
$classAttributes =& $elementClass->fetchAttributes();
$element =& $elementClass->instantiate($userID,$sectionID,false,$languageCode);
$elementID = $element->attribute('id');
$nodeAssignement =& eZNodeAssignment::create
(array('contentobject_id' => $elementID,
'contentobject_version' => $element->attribute('current_version'),
'parent_node' => $parentID,
'is_main' => 1));
$nodeAssignement->store();
$elementVersion =& $element->version($element->attribute('current_version'));
$elementVersion->setAttribute('status', EZ_VERSION_STATUS_DRAFT);
$elementVersion->store();
$datamap = $elementVersion->dataMap();
// Titre
$attribute = $datamap["title"];
$attribute->setAttribute('data_text', $this->Nom);
$attribute->store();
// short_title
$attribute = $datamap["short_title"];
$attribute->setAttribute('data_text', $this->Nom);
$attribute->store();
//.... other attributes ..
$operationResult =& eZOperationHandler::execute
('content', 'publish',
array('object_id' => $elementID,
'version' => $element->attribute('current_version')));
|