You are here

static function CMISRepositoryWrapper::extractWorkspaceFromNode in CMIS API 6.3

Same name and namespace in other branches
  1. 6.4 cmis_common/lib/cmis_repository_wrapper.php \CMISRepositoryWrapper::extractWorkspaceFromNode()
  2. 7 cmis_common/lib/cmis_repository_wrapper.php \CMISRepositoryWrapper::extractWorkspaceFromNode()
1 call to CMISRepositoryWrapper::extractWorkspaceFromNode()
CMISRepositoryWrapper::extractWorkspace in cmis_common/lib/cmis_repository_wrapper.php

File

cmis_common/lib/cmis_repository_wrapper.php, line 303

Class

CMISRepositoryWrapper

Code

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();
  $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/*");
  foreach ($result as $node) {
    if ($node->nodeName != "cmis:capabilities") {
      $retval->repositoryInfo[$node->nodeName] = $node->nodeValue;
    }
  }
  return $retval;
}