コード例 #1
0
 /**
  * @internal
  */
 static function extractWorkspaceFromNode($xmlnode)
 {
     // Assumes only one workspace for now
     // Load up the workspace object with arrays of
     //  links
     //  URI Templates
     //  Collections
     //  Capabilities
     //  General Repository Information
     $retval = new stdClass();
     $retval->links = CMISRepositoryWrapper::getLinksArray($xmlnode);
     $retval->uritemplates = array();
     $retval->collections = array();
     $retval->capabilities = array();
     $retval->repositoryInfo = array();
     $retval->permissions = array();
     $retval->permissionsMapping = array();
     $result = CMISRepositoryWrapper::doXQueryFromNode($xmlnode, "//cmisra:uritemplate");
     foreach ($result as $node) {
         $retval->uritemplates[$node->getElementsByTagName("type")->item(0)->nodeValue] = $node->getElementsByTagName("template")->item(0)->nodeValue;
     }
     $result = CMISRepositoryWrapper::doXQueryFromNode($xmlnode, "//app:collection");
     foreach ($result as $node) {
         $retval->collections[$node->getElementsByTagName("collectionType")->item(0)->nodeValue] = $node->attributes->getNamedItem("href")->nodeValue;
     }
     $result = CMISRepositoryWrapper::doXQueryFromNode($xmlnode, "//cmis:capabilities/*");
     foreach ($result as $node) {
         $retval->capabilities[$node->nodeName] = $node->nodeValue;
     }
     $result = CMISRepositoryWrapper::doXQueryFromNode($xmlnode, "//cmisra:repositoryInfo/*[name()!='cmis:capabilities' and name()!='cmis:aclCapability']");
     foreach ($result as $node) {
         $retval->repositoryInfo[$node->nodeName] = $node->nodeValue;
     }
     $result = CMISRepositoryWrapper::doXQueryFromNode($xmlnode, "//cmis:aclCapability/cmis:permissions");
     foreach ($result as $node) {
         $retval->permissions[$node->getElementsByTagName("permission")->item(0)->nodeValue] = $node->getElementsByTagName("description")->item(0)->nodeValue;
     }
     $result = CMISRepositoryWrapper::doXQueryFromNode($xmlnode, "//cmis:aclCapability/cmis:mapping");
     foreach ($result as $node) {
         $key = $node->getElementsByTagName("key")->item(0)->nodeValue;
         $values = array();
         foreach ($node->getElementsByTagName("permission") as $value) {
             array_push($values, $value->nodeValue);
         }
         $retval->permissionsMapping[$key] = $values;
     }
     $result = CMISRepositoryWrapper::doXQueryFromNode($xmlnode, "//cmis:aclCapability/*[name()!='cmis:permissions' and name()!='cmis:mapping']");
     foreach ($result as $node) {
         $retval->repositoryInfo[$node->nodeName] = $node->nodeValue;
     }
     return $retval;
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 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;
 }
コード例 #4
0
 function removeObjectFromFolder($objectId, $targetFolderId, $options = array())
 {
     //Probably
     $hash_values = $options;
     $myURL = $this->workspace->collections['unfiled'];
     $myURL = CMISRepositoryWrapper::getOpUrl($myURL, $hash_values);
     $ret = $this->postEntry($myURL, array("cmis:objectId" => $objectId), null, null, array("removeFrom" => $targetFolderId));
     $obj = $this->extractObject($ret->body);
     $this->cacheObjectInfo($obj);
     return $obj;
 }