Ejemplo n.º 1
0
/**
 * 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;
}
Ejemplo n.º 2
0
    /**
     * Get info about a specific node reference.
     *
     * @param string $uuid A node UUID value.
     * @return object|bool A node object or false on error.
     */
    function get_info($uuid) {
        if (ELIS_FILES_DEBUG_TRACE) mtrace('get_info(' . $uuid . ')');

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

        if (self::is_version('3.2')) {
            $node = elis_files_node_properties($uuid);
        } else if (self::is_version('3.4')) {
            //Check that the uuid is valid before trying to get the object
            if (!elis_files_request(elis_files_get_uri($uuid, 'self'))) {
                return false;
            }
            if (!$node = $this->cmis->getObject('workspace://SpacesStore/' . $uuid)) {
                return false;
            }

            $type = '';
            $node = elis_files_process_node_new($node, $type);
            $node->type = $type;
        }

        // ELIS-5750: the following requires the updated webscript: nodeowner.get.js
        if (!empty($node->uuid) && strpos($node->type, 'document') !== false && ($response = elis_files_request('/moodle/nodeowner/'.$node->uuid))
                && ($sxml = RLsimpleXMLelement($response)) && !empty($sxml->owner)) {
            foreach ((array)$sxml->owner AS $val) {
                // error_log("nodeOwner: {$val}");
                $node->owner = $val; // ($val != 'admin') ? $val : $this->config->admin_username;
                break;
            }
        }
        return $node;
    }