コード例 #1
0
 /**
  * @internal
  */
 static function extractObjectFromNode($xmlnode)
 {
     // Extracts the contents of an Object and organizes them into:
     //  -- Links
     //  -- Properties
     //  -- the Object ID
     // RRM -- NEED TO ADD ALLOWABLEACTIONS
     $retval = new stdClass();
     $retval->links = CMISRepositoryWrapper::getLinksArray($xmlnode);
     $retval->properties = array();
     $renditions = $xmlnode->getElementsByTagName("object")->item(0)->getElementsByTagName("rendition");
     // Add renditions to CMIS object
     $renditionArray = array();
     if ($renditions->length > 0) {
         $i = 0;
         foreach ($renditions as $rendition) {
             $rend_nodes = $rendition->childNodes;
             foreach ($rend_nodes as $rend) {
                 if ($rend->localName != NULL) {
                     $renditionArray[$i][$rend->localName] = $rend->nodeValue;
                 }
             }
             $i++;
         }
     }
     $retval->renditions = $renditionArray;
     $prop_nodes = $xmlnode->getElementsByTagName("object")->item(0)->getElementsByTagName("properties")->item(0)->childNodes;
     foreach ($prop_nodes as $pn) {
         if ($pn->attributes) {
             //supressing errors since PHP sometimes sees DOM elements as "non-objects"
             @($retval->properties[$pn->attributes->getNamedItem("propertyDefinitionId")->nodeValue] = $pn->getElementsByTagName("value")->item(0)->nodeValue);
         }
     }
     $retval->uuid = $xmlnode->getElementsByTagName("id")->item(0)->nodeValue;
     $retval->id = $retval->properties["cmis:objectId"];
     //TODO: RRM FIX THIS
     $children_node = $xmlnode->getElementsByTagName("children");
     if (is_object($children_node)) {
         $children_feed_c = $children_node->item(0);
     }
     if (is_object($children_feed_c)) {
         $children_feed_l = $children_feed_c->getElementsByTagName("feed");
     }
     if (isset($children_feed_l) && is_object($children_feed_l) && is_object($children_feed_l->item(0))) {
         $children_feed = $children_feed_l->item(0);
         $children_doc = new DOMDocument();
         $xnode = $children_doc->importNode($children_feed, true);
         // Avoid Wrong Document Error
         $children_doc->appendChild($xnode);
         $retval->children = CMISRepositoryWrapper::extractObjectFeedFromNode($children_doc);
     }
     $retval->allowableActions = CMISRepositoryWrapper::extractAllowableActionsFromNode($xmlnode);
     return $retval;
 }
コード例 #2
0
 static function extractObjectFromNode($xmlnode)
 {
     // Extracts the contents of an Object and organizes them into:
     //  -- Links
     //  -- Properties
     //  -- the Object ID
     // RRM -- NEED TO ADD ALLOWABLEACTIONS
     $retval = new stdClass();
     $retval->links = CMISRepositoryWrapper::getLinksArray($xmlnode);
     $retval->properties = array();
     $prop_nodes = $xmlnode->getElementsByTagName("object")->item(0)->getElementsByTagName("properties")->item(0)->childNodes;
     foreach ($prop_nodes as $pn) {
         if ($pn->attributes) {
             $propDefId = $pn->attributes->getNamedItem("propertyDefinitionId");
             // TODO: Maybe use ->length=0 to even detect null values
             if (!is_null($propDefId) && $pn->getElementsByTagName("value") && $pn->getElementsByTagName("value")->item(0)) {
                 if ($pn->getElementsByTagName("value")->length > 1) {
                     $retval->properties[$propDefId->nodeValue] = array();
                     for ($idx = 0; $idx < $pn->getElementsByTagName("value")->length; $idx++) {
                         $retval->properties[$propDefId->nodeValue][$idx] = $pn->getElementsByTagName("value")->item($idx)->nodeValue;
                     }
                 } else {
                     $retval->properties[$propDefId->nodeValue] = $pn->getElementsByTagName("value")->item(0)->nodeValue;
                 }
             }
         }
     }
     $retval->uuid = $xmlnode->getElementsByTagName("id")->item(0)->nodeValue;
     $retval->id = $retval->properties["cmis:objectId"];
     //TODO: RRM FIX THIS
     $children_node = $xmlnode->getElementsByTagName("children");
     if (is_object($children_node)) {
         $children_feed_c = $children_node->item(0);
     }
     if (is_object($children_feed_c)) {
         $children_feed_l = $children_feed_c->getElementsByTagName("feed");
     }
     if (isset($children_feed_l) && is_object($children_feed_l) && is_object($children_feed_l->item(0))) {
         $children_feed = $children_feed_l->item(0);
         $children_doc = new DOMDocument();
         $xnode = $children_doc->importNode($children_feed, true);
         // Avoid Wrong Document Error
         $children_doc->appendChild($xnode);
         $retval->children = CMISRepositoryWrapper::extractObjectFeedFromNode($children_doc);
     }
     $retval->allowableActions = CMISRepositoryWrapper::extractAllowableActionsFromNode($xmlnode);
     return $retval;
 }