Пример #1
0
function do_cmis($folder, $tree, $keywords, $name)
{
    // Initialize CMIS Client
    $repo_url = get_option('cmis_repository_url');
    $repo_username = get_option('cmis_username');
    $repo_password = get_option('cmis_password');
    $client = new CMISService($repo_url, $repo_username, $repo_password);
    $query_conditions = array();
    $error_message = 'Error. Unable to show documents.';
    try {
        if ($folder) {
            $f = $client->getObjectByPath($folder);
            array_push($query_conditions, "IN_FOLDER('{$f->id}')");
        } elseif ($tree) {
            $f = $client->getObjectByPath($tree);
            array_push($query_conditions, "IN_TREE(d,'{$f->id}')");
        }
        if ($keywords) {
            array_push($query_conditions, "CONTAINS('{$keywords}')");
        }
        if ($name) {
            array_push($query_conditions, "d.cmis:name LIKE '{$name}'");
        }
        // Perform query
        if (sizeof($query_conditions)) {
            $query = "SELECT d.*, o.* FROM cmis:document AS d JOIN cm:titled AS o ON d.cmis:objectId = o.cmis:objectId WHERE " . join(" AND ", $query_conditions) . "ORDER BY d.cmis:name";
            //$query = "SELECT * FROM cmis:document WHERE " . join(" AND ", $query_conditions);
            $objs = $client->query($query);
            return display_cmis_objects($objs);
        }
    } catch (CmisObjectNotFoundException $e) {
        $error_message = "No documents found.";
    } catch (CmisRuntimeException $e) {
        $error_message = "Error. Unexpected problem when retrieving documents.";
    }
    return "<div class=\"alert\">{$error_message}</div>";
}
Пример #2
0
require_once ('cmis_repository_wrapper.php');
$repo_url = $_SERVER["argv"][1];
$repo_username = $_SERVER["argv"][2];
$repo_password = $_SERVER["argv"][3];
$repo_debug = $_SERVER["argv"][4];

$client = new CMISService($repo_url, $repo_username, $repo_password);

if ($repo_debug)
{
    print "Repository Information:\n===========================================\n";
    print_r($client->workspace);
    print "\n===========================================\n\n";
}

$objs = $client->query("select * from cmis:folder");
if ($repo_debug)
{
    print "Returned Objects\n:\n===========================================\n";
    print_r($objs);
    print "\n===========================================\n\n";
}

foreach ($objs->objectList as $obj)
{
    if ($obj->properties['cmis:baseTypeId'] == "cmis:document")
    {
        print "Document: " . $obj->properties['cmis:name'] . "\n";
    }
    elseif ($obj->properties['cmis:baseTypeId'] == "cmis:folder")
    {
Пример #3
0
$repo_username = $_SERVER["argv"][2];
$repo_password = $_SERVER["argv"][3];
$repo_search_text = $_SERVER["argv"][4];
$repo_debug = $_SERVER["argv"][5];

$client = new CMISService($repo_url, $repo_username, $repo_password);

if ($repo_debug)
{
    print "Repository Information:\n===========================================\n";
    print_r($client->workspace);
    print "\n===========================================\n\n";
}

$query = sprintf("SELECT cmis:name,score() as rel from cmis:document WHERE CONTAINS('%s')", $repo_search_text);
$objs = $client->query($query);
if ($repo_debug)
{
    print "Returned Objects\n:\n===========================================\n";
    print_r($objs);
    print "\n===========================================\n\n";
}

foreach ($objs->objectList as $obj)
{
    print "Document: " . $obj->properties['cmis:name'] . "\n";
}

if ($repo_debug > 2)
{
    print "Final State of CLient:\n===========================================\n";