Ejemplo n.º 1
0
if ($repo_debug)
{
    print "Return From Create Document\n:\n===========================================\n";
    print_r($obj_doc);
    print "\n===========================================\n\n";
}

$obj_del = $client->createDocument($my_new_folder->id, "TextFileDel.txt", array (), "THIS IS A NEW DOCUMENT To Be Deleted", "text/plain");
if ($repo_debug)
{
    print "Return From Create Document\n:\n===========================================\n";
    print_r($obj_del);
    print "\n===========================================\n\n";
}

$objs = $client->getChildren($my_new_folder->id);
if ($repo_debug)
{
    print "Folder Children 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")
    {
Ejemplo n.º 2
0
if ($repo_debug)
{
    print "Folder Object:\n===========================================\n";
    print_r($myfolder);
    print "\n===========================================\n\n";
}

$obs = $client->createFolder($myfolder->id, $repo_new_folder);
if ($repo_debug)
{
    print "Return From Create Folder\n:\n===========================================\n";
    print_r($objs);
    print "\n===========================================\n\n";
}

$objs = $client->getChildren($myfolder->id);
if ($repo_debug)
{
    print "Folder Children 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")
    {
Ejemplo n.º 3
0
 /**
  * Front-end display of widget.
  *
  * @see WP_Widget::widget()
  *
  * @param array $args     Widget arguments.
  * @param array $instance Saved values from database.
  */
 public function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     }
     //echo __( 'Hello, World!', 'text_domain' );
     $showfolder = urlencode($instance['folderpath']);
     if (!empty($showfolder)) {
         $ret = "";
         try {
             $client = new CMISService(get_option('cmis_repo_url'), get_option('cmis_user'), get_option('cmis_pass'));
             $folder = $client->getObjectByPath($showfolder);
             if ($folder) {
                 if (empty($title)) {
                     $title = $folder->properties["cmis:name"];
                     echo $before_title . $title . $after_title;
                 }
                 $objs = $client->getChildren($folder->id);
                 $ret .= build_list($objs, $folder, FALSE);
             } else {
                 $ret = "Folder not found: " . $showfolder;
             }
         } catch (Exception $e) {
             $ret = "Error retrieving documents: {$e}";
         }
         echo $ret;
     }
     echo $after_widget;
 }