You are here

function CMISService::updateProperties in CMIS API 6.3

Same name and namespace in other branches
  1. 6.4 cmis_common/lib/cmis_repository_wrapper.php \CMISService::updateProperties()
  2. 7 cmis_common/lib/cmis_repository_wrapper.php \CMISService::updateProperties()

File

cmis_common/lib/cmis_repository_wrapper.php, line 762

Class

CMISService

Code

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);
  $ret = $this
    ->doPut($obj_url, $put_value, MIME_ATOM_XML_ENTRY);
  $obj = $this
    ->extractObject($ret->body);
  $this
    ->cacheEntryInfo($obj);
  return $obj;
}