예제 #1
0
/**
 * Get the parent of a specific node.
 *
 * @param string $uuid Unique identifier for a node.
 * @return object|bool An object representing the parent node or False.
 */
    function get_parent($uuid) {
        if (ELIS_FILES_DEBUG_TRACE) mtrace('get_parent(' . $uuid . ')');

        if (!$this->get_defaults()) {
            return false;
        }

        if (self::is_version('3.2')) {
            return elis_files_get_parent($uuid);
        } else if (self::is_version('3.4')) {
            if ($uuid == $this->root->uuid) {
                // At the top level, so there is no parent
                return false;
            }

            if (!$node = $this->cmis->getFolderParent('workspace://SpacesStore/' . $uuid)) {
                return false;
            }

            $type = '';
            return elis_files_process_node_new($node, $type);
        }
    }
예제 #2
0
파일: lib.php 프로젝트: jamesmcq/elis
/**
 * Recursively get the path to a specific node (folder or document) from the root of the repository down.
 *
 * @param string $uuid The UUID of the node we are processing
 * @param string $path The assmebled path we are building (empty to start)
 * @return string The path to the requested location from the root of the repository
 */
function elis_files_node_path($uuid, $path = '') {
    // If we're starting out and the current node is a folder, include it in the path
    if (empty($path)) {
        $path = '';
        $node = elis_files_node_properties($uuid);
        if (!$node || !property_exists($node, 'type')) {
            return ''; // TBD
        }
        if ($node->type == ELIS_files::$type_folder) {
            $path = $node->title;
        }
    }

    // Get the parents for the given node
    while ($response = elis_files_get_parent($uuid)) {
        $path = $response->title . (!empty($path) ? '/'. $path : '');
        $uuid = $response->uuid;
    }

    //error_log("elis_files_node_path() => /{$path}");
    return '/'. $path;
}
예제 #3
0
 /**
  * This funciton uploads a file asserts some tests.
  * @param ELIS_files $repo an instance of ELIS_files
  * @param string $upload   The array index of the uploaded file.
  * @param string $path     The full path to the file on the local filesystem.
  * @param string $uuid     The UUID of the folder where the file is being uploaded to.
  * @return object Node values for the uploaded file.
  */
 protected function call_upload_file($repo, $upload, $path, $uuid) {
     $response = elis_files_upload_file($upload, $path, $uuid);
     if ($response && !empty($response->uuid)) {
         $this->createduuids[] = $response->uuid;
         $node = elis_files_get_parent($response->uuid);
         $this->assertTrue($node && !empty($node->uuid));
         $this->assertEquals($uuid, $node->uuid);
     }
     return $response;
 }