You are here

static function CMISRepositoryWrapper::getLinksArray in CMIS API 7

Same name and namespace in other branches
  1. 6.4 cmis_common/lib/cmis_repository_wrapper.php \CMISRepositoryWrapper::getLinksArray()
  2. 6.3 cmis_common/lib/cmis_repository_wrapper.php \CMISRepositoryWrapper::getLinksArray()
3 calls to CMISRepositoryWrapper::getLinksArray()
CMISRepositoryWrapper::extractObjectFromNode in cmis_common/lib/cmis_repository_wrapper.php
CMISRepositoryWrapper::extractTypeDefFromNode in cmis_common/lib/cmis_repository_wrapper.php
CMISRepositoryWrapper::extractWorkspaceFromNode in cmis_common/lib/cmis_repository_wrapper.php

File

cmis_common/lib/cmis_repository_wrapper.php, line 224

Class

CMISRepositoryWrapper

Code

static function getLinksArray($xmlnode) {

  // Gets the links of an object or a workspace
  // Distinguishes between the two "down" links
  //  -- the children link is put into the associative array with the "down" index
  //  -- the descendants link is put into the associative array with the "down-tree" index
  //  These links are distinquished by the mime type attribute, but these are probably the only two links that share the same rel ..
  //    so this was done as a one off
  $links = array();
  $link_nodes = $xmlnode
    ->getElementsByTagName("link");
  foreach ($link_nodes as $ln) {
    if ($ln->attributes
      ->getNamedItem("rel")->nodeValue == "down" && $ln->attributes
      ->getNamedItem("type")->nodeValue == "application/cmistree+xml") {

      //Descendents and Childredn share same "rel" but different document type
      $links["down-tree"] = $ln->attributes
        ->getNamedItem("href")->nodeValue;
    }
    else {
      $links[$ln->attributes
        ->getNamedItem("rel")->nodeValue] = $ln->attributes
        ->getNamedItem("href")->nodeValue;
    }
  }
  return $links;
}