function updateProperties($objectId, $properties = array(), $options = array()) { // Yes $varmap = $options; $varmap["id"] = $objectId; $objectName = $this->getTitle($objectId); $objectType = $this->getObjectType($objectId); $obj_url = $this->getLink($objectId, "edit"); $obj_url = CMISRepositoryWrapper::getOpUrl($obj_url, $options); static $entry_template; if (!isset($entry_template)) { $entry_template = CMISService::getEntryTemplate(); } if (is_array($properties)) { $hash_values = $properties; } else { $hash_values = array(); } $properties_xml = $this->processPropertyTemplates($objectType, $hash_values); if (is_array($options)) { $hash_values = $options; } else { $hash_values = array(); } $hash_values["PROPERTIES"] = $properties_xml; $hash_values["SUMMARY"] = CMISService::getSummaryTemplate(); if (!isset($hash_values['title'])) { $hash_values['title'] = $objectName; } if (!isset($hash_values['summary'])) { $hash_values['summary'] = $objectName; } $put_value = CMISRepositoryWrapper::processTemplate($entry_template, $hash_values); // print $put_value; // RRM DEBUG $ret = $this->doPut($obj_url, $put_value, MIME_ATOM_XML_ENTRY); $obj = $this->extractObject($ret->body); $this->cacheObjectInfo($obj); return $obj; }
function updateProperties($objectId, $properties = array(), $options = array()) { // Yes $varmap = $options; $varmap["id"] = $objectId; $objectName = $this->getTitle($objectId); $objectType = $this->getObjectType($objectId); $obj_url = $this->getLink($objectId, "edit"); $obj_url = CMISRepositoryWrapper::getOpUrl($obj_url, $options); static $entry_template; if (!isset($entry_template)) { $entry_template = CMISService::getEntryTemplate(); } if (is_array($properties)) { $hash_values = $properties; } else { $hash_values = array(); } $properties_xml = $this->processPropertyTemplates($objectType, $hash_values); if (is_array($options)) { $hash_values = $options; } else { $hash_values = array(); } $fixed_hash_values = array("PROPERTIES" => $properties_xml, "SUMMARY" => CMISService::getSummaryTemplate()); // merge the fixes hash values first so that the processing order is correct $hash_values = array_merge($fixed_hash_values, $hash_values); if (!isset($hash_values['title'])) { $hash_values['title'] = $objectName; } if (!isset($hash_values['summary'])) { $hash_values['summary'] = $objectName; } $put_value = CMISRepositoryWrapper::processTemplate($entry_template, $hash_values); $ret = $this->doPut($obj_url, $put_value, MIME_ATOM_XML_ENTRY); $obj = $this->extractObject($ret->body); $this->cacheEntryInfo($obj); return $obj; }
/** * Checkin * @param String $objectId Object ID * @param mixed[] $options Options * @return Object The checked in object * @api CMIS-VersionServices * @since CMIS-1.0 */ function checkIn($objectId, $properties = array()) { /* * Tal vez la forma mas prolija de hacer esto es guardar en el checkout * la propiedad $obj->links['self'], y usarla despues aca. * El problema es que se necesita mantener un contexto * entre los 2 usos del api, y ademas se rompe la logica de construccion * de URLs que en ningun caso parte de una URL provista desde afuera... */ $myURL = $this->url . "/default/entry"; $qs = array("id" => $objectId, "major" => "true", "checkin" => "true"); $myURL = CMISRepositoryWrapper::getOpUrl($myURL, $qs); $objectName = $this->getTitle($objectId); $objectType = $this->getObjectType($objectId); static $entry_template; if (!isset($entry_template)) { $entry_template = CMISService::getEntryTemplate(); } if (is_array($properties)) { $hash_values = $properties; } else { $hash_values = array(); } $properties_xml = $this->processPropertyTemplates($objectType, $hash_values); $fixed_hash_values = array("PROPERTIES" => $properties_xml, "SUMMARY" => CMISService::getSummaryTemplate()); // merge the fixes hash values first so that the processing order is correct $hash_values = array_merge($fixed_hash_values, $hash_values); if (!isset($hash_values['title'])) { $hash_values['title'] = $objectName; } if (!isset($hash_values['summary'])) { $hash_values['summary'] = $objectName; } $put_value = CMISRepositoryWrapper::processTemplate($entry_template, $hash_values); $ret = $this->doPut($myURL, $put_value, MIME_ATOM_XML_ENTRY); }