function getObjectParents($repositoryId, $objectId, $includeAllowableActions, $includeRelationships, $filter = '')
 {
     $ancestry = array();
     $objectId = CMISUtil::decodeObjectId($objectId, $typeId);
     // TODO - what about other types?  only implementing folders and documents at the moment so ignore for now
     switch ($typeId) {
         case 'Document':
             $document = $this->ktapi->get_document_by_id($objectId);
             $parent = $document->ktapi_folder;
             $ancestry[] = $parent;
             break;
         case 'Folder':
             $folder = $this->ktapi->get_folder_by_id($objectId);
             $parent = $this->ktapi->get_folder_by_id($folder->get_parent_folder_id());
             $ancestry[] = $parent;
             break;
     }
     $ancestry = CMISUtil::createParentObjectHierarchy($ancestry, $repository->getRepositoryURI, $this->ktapi);
     return $ancestry;
 }
Пример #2
0
 public static function createParentObjectHierarchy($input, $repositoryURI, &$ktapi)
 {
     $CMISArray = array();
     if (count($input) <= 0) {
         return $CMISArray;
     }
     $object = array_shift($input);
     $detail = $object->get_detail();
     if (isset($detail['id'])) {
         $CMISObject = new CMISFolderObject($detail['id'], $ktapi, $repositoryURI);
         $CMISElement['object'] = $CMISObject;
         // if more parent elements
         if (count($input) > 0) {
             $CMISElement['items'] = CMISUtil::createParentObjectHierarchy($input, $repositoryURI, $ktapi);
         }
         $CMISArray[] = $CMISElement;
     }
     return $CMISArray;
 }