/** * Perform a search for all content within a specific category. * * @param array $categories An array of category database records. * @return object An object containing an array of folders and file node references. */ function elis_files_category_search($categories) { $return = new stdClass; $return->folders = array(); $return->files = array(); $nodes = array(); foreach ($categories as $category) { $cattitle = elis_files_ISO_9075_map($category->title); $response = elis_files_utils_invoke_service('/moodle/categorysearch/' . $cattitle); $sxml = RLsimpleXMLelement($response); if (empty($sxml)) { return false; } foreach ($sxml->node as $node) { if (!isset($nodes["$node->uuid"])) { $nodes["$node->uuid"] = "$node->title"; } } } if (!empty($nodes)) { foreach ($nodes as $uuid => $title) { $node = elis_files_node_properties($uuid); $type = elis_files_get_type($node->uuid); if ($type == ELIS_files::$type_folder) { $return->folders[] = $node; } else if ($type == ELIS_files::$type_document) { $return->files[] = $node; } } } return $return; }
/** * Is a given node a directory? * * @param string $uuid A node UUID value. * @return bool True if */ function is_dir($uuid) { if (ELIS_FILES_DEBUG_TRACE) mtrace('is_dir(' . $uuid . ')'); // Set the file and folder type if (!$this->get_defaults()) { return false; } return (elis_files_get_type($uuid) == self::$type_folder); }