Adding PHP SOAP Client
git-svn-id: https://svn.apache.org/repos/asf/chemistry/phpclient/trunk@1417256 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/soap/PccHTML.php b/soap/PccHTML.php
new file mode 100644
index 0000000..575824e
--- /dev/null
+++ b/soap/PccHTML.php
@@ -0,0 +1,277 @@
+<?php
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+/**
+ * PccHTML - HTML definitions for PHP CMIS Client
+ *
+ * @author Karsten Eberding
+ */
+
+class PccHTML {
+
+// Simple template mechanism for HTML code generation, {} will be replaced:
+// {$x} will be replaced by parameter x (1 - 9)
+// {$template} will be replaced by content of template "template"
+// {content} will be replaced by the eval result, e.g. {urlencode('{@cmis:objectId}')}
+// recursive brackets are allowed
+
+ private static $templates = array(
+ // HTML Code sniplets
+ 'folderUrl' => '<a href="index.php?folderid={$1}">{$2}</a>',
+ 'folderListHead' => '<tr><th>Folder Name</th><th></th>',
+ 'folderListEntry' => "<tr><td>{\$folderUrl}</td><td></td></tr>\n",
+ 'docListHead' => '<tr><th>Document Name</th><th>Last Modification Date</th><th>Actions</th>',
+ 'docListEntry' => '<tr><td><a href="index.php?action=download&objectid={$1}">{$2}</a></td><td>{$3}</td><td align="right">{$4}</td></tr>',
+ 'docListEmpty' => "<tr><td>No documents in this folder</td></tr>\n",
+ 'pageLink' => ' <a href="index.php?folderid={$1}&page={$2}">{$2}</a> ',
+ 'pageCurrent' => ' <b>{$1}</b> ',
+ 'pageList' => '<div class="paging">{$1}</div>',
+ 'downloadFrame' => '<iframe width="1" height="1" frameborder="0" src="index.php?action=download&objectid={$1}"></iframe>',
+ 'uploadAction' => '<a href="#" onclick="showModal(\'uploadFile\', \'{$1}\', \'{$2}\')">Upload</a> ',
+ 'cancelCOAction' => '<a href="#" onclick="showModal(\'cancelCO\', \'{$1}\', \'{$2}\')">CancelCO</a> ',
+ 'deleteAction' => '<a href="#" onclick="showModal(\'delete\', \'{$1}\', \'{$2}\')">Delete</a> ',
+ 'checkinAction' => '<a href="#" onclick="showModal(\'checkin\', \'{$1}\', \'{$2}\')">Check-In</a> ',
+ 'checkoutAction' => '<a href="#" onclick="showModal(\'checkout\', \'{$1}\', \'{$2}\')">Check-Out</a> ',
+ 'detailsAction' => '<a href="index.php?action=details&objectid={$1}">More</a> ',
+ 'createFolderBtn' => '<input type="button" value="Create Folder" onclick="showModal(\'createFolder\', \'{$1}\')">',
+ 'createDocumentBtn' => '<input type="button" value="Create Document" onclick="showModal(\'createDocument\', \'{$1}\')">',
+
+ // Dialogs
+ 'loginForm' => <<<EOF
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang='en_us'>
+ <head>
+ <title>Login to PHP CMIS Client</title>
+ </head>
+ <body>
+ <form action="index.php" method="post">
+ Username: <input type="text" name="username" /><br />
+ Passwort: <input type="password" name="password" /><br />
+ <input type="hidden" name="action" value="login">
+ <input type="submit" value="Login">
+ </form>
+ </body>
+</html>
+EOF
+, 'modalDialog' => <<<EOF
+ <div id="{\$1}" class="modalContainer">
+ <div class="modalBackground"></div>
+ <div class="modalWindow">
+ <div class="modalDialog">
+ <div class="dialoghead">{\$2}</div>
+ <div class="dialogbody">
+ {\$3}
+ </div>
+ </div>
+ </div>
+ </div>
+EOF
+, 'uploadFileDialog' => <<<EOF
+ Select file to upload for document<div class="dialognotice"></div>
+ <form id="{\$1}Form" method="POST" ENCTYPE="multipart/form-data" action="index.php">
+ <table><tbody><tr>
+ <td>File Name:</td><td>
+ <input type="file" name="filename" size="30" value="">
+ </td></tr><tr><td></td><td style="padding-top: 20px;">
+ <input type="hidden" name="action" value="upload">
+ <input type="submit" value="Upload">
+ <input type="reset" value="Cancel" onclick="hideModal('{\$1}');">
+ </td></tr></tbody></table>
+ </form>
+EOF
+, 'cancelCODialog' => <<<EOF
+ Confirm Cancel Check-out for document<div class="dialognotice"></div>Unsaved changes will be lost!
+ <form id="{\$1}Form" method="GET" action="index.php">
+ <table><tbody><tr><td></td><td style="padding-top: 20px;">
+ <input type="hidden" name="action" value="cancelco">
+ <input type="submit" value="Cancel Check-Out">
+ <input type="reset" value="Cancel" onclick="hideModal('{\$1}');">
+ </td></tr></tbody></table>
+ </form>
+EOF
+, 'deleteDialog' => <<<EOF
+ Confirm Deletion of All versions of document<div class="dialognotice"></div>
+ <form id="{\$1}Form" method="GET" action="index.php">
+ <table><tbody><tr><td></td><td style="padding-top: 20px;">
+ <input type="hidden" name="action" value="delete">
+ <input type="submit" value="Delete">
+ <input type="reset" value="Cancel" onclick="hideModal('{\$1}');">
+ </td></tr></tbody></table>
+ </form>
+EOF
+, 'checkoutDialog' => <<<EOF
+ Check-out document<div class="dialognotice"></div>Download will start automatically.
+ <form id="{\$1}Form" method="GET" action="index.php">
+ <table><tbody><tr><td></td><td style="padding-top: 20px;">
+ <input type="hidden" name="action" value="checkout">
+ <input type="submit" value="Check-out and Download">
+ <input type="reset" value="Cancel" onclick="hideModal('{\$1}');">
+ </td></tr></tbody></table>
+ </form>
+EOF
+, 'checkinDialog' => <<<EOF
+ Select file to upload for check-in of<div class="dialognotice"></div>(leave file name empty to check-in without uploading a file)
+ <form id="{\$1}Form" method="POST" ENCTYPE="multipart/form-data" action="index.php">
+ <table><tbody><tr>
+ <td>File Name:</td><td>
+ <input type="file" name="filename" size="30" value=""></td>
+ </tr><tr><td></td><td style="padding-top: 20px;">
+ <input type="hidden" name="action" value="checkin">
+ <input type="submit" value="Check-In">
+ <input type="reset" value="Cancel" onclick="hideModal('{\$1}');">
+ </td></tr></tbody></table>
+ </form>
+EOF
+, 'createFolderDialog' => <<<EOF
+ Create new folder in current folder<div class="dialognotice"></div>
+ <form id="{\$1}Form" method="GET" action="index.php">
+ <table><tbody><tr>
+ <td>Folder Name:</td><td>
+ <input type="text" name="createfoldername" size="30" value="">
+ </td></tr><tr><td></td><td style="padding-top: 20px;">
+ <input type="hidden" name="action" value="createfolder">
+ <input type="submit" value="Create">
+ <input type="reset" value="Cancel" onclick="hideModal('{\$1}');">
+ </td></tr></tbody></table>
+ </form>
+EOF
+, 'createDocumentDialog' => <<<EOF
+Create new document in current folder<div class="dialognotice"></div>(leave file name empty to create a document without content)
+ <form id="{\$1}Form" method="POST" ENCTYPE="multipart/form-data" action="index.php">
+ <table><tbody><tr>
+ <td>File Name:</td><td>
+ <input type="file" name="filename" size="30" value=""
+ onchange="document.getElementById('createfilename').value=this.value.replace(/^.*(\\\\|\/)/,'')"></td>
+ </tr><tr>
+ <td>Document Name:</td><td>
+ <input type="text" name="createfilename" id="createfilename" size="30" value=""></td>
+ </tr><tr><td></td><td style="padding-top: 20px;">
+ <input type="hidden" name="action" value="createdocument">
+ <input type="submit" value="Create">
+ <input type="reset" value="Cancel" onclick="hideModal('{\$1}');">
+ </td></tr></tbody></table>
+ </form>
+EOF
+,
+ // Page elements
+ 'htmlHeader' => <<<EOF
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang='en_us'>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta http-equiv="CACHE-CONTROL" CONTENT="NO-CACHE">
+ <script src="include/dialog.js" type="text/javascript"></script>
+ <title>PHP CMIS Client</title>
+ <link href="include/pcc.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+EOF
+, 'htmlFooter' => <<<EOF
+ </body>
+</html>
+EOF
+, 'pageHeader' => <<<EOF
+
+ <div class="header">
+ <div class="titleContainer">
+ <div class="moduleTitle">
+ PHP CMIS Client
+ </div>
+ <div class="moduleSubTitle">
+ (c) 2012 Karsten Eberding
+ </div>
+ <div class="logoutTitle">
+ <a href="index.php?action=logout">Logout</a>
+ </div>
+ </div>
+ {\$1}
+ <div class="headerText">
+ Content in Folder {\$2}
+ </div>
+ <form id="headButtons">
+ {\$3}
+ </form>
+ </div>
+EOF
+, 'folderList' => <<<EOF
+ <div class="folderList">
+ <table>
+ <thead>
+ {\$folderListHead}
+ </thead>
+ <tbody>
+ {\$1}
+ </tbody>
+ </table>
+ </div>
+EOF
+, 'documentList' => <<<EOF
+ <div class="documentList">
+ <table>
+ <thead>
+ {\$1}
+ </thead>
+ <tbody>
+ {\$2}
+ </tbody>
+ </table>
+ {\$3}
+ </div>
+EOF
+ );
+
+ function PccLayout() {
+ // nothing to do
+ }
+
+ /* Apply Template function, variable parameter list */
+
+ public function applyTemplate($templateName) {
+ $param = func_get_args();
+ $template = self::$templates[$templateName];
+ return $this->applyTemplateString($template, $param);
+ }
+
+ public function applyTemplateString($template, $param) {
+ // small trick to make class variables available in callback function
+ $templates = self::$templates;
+ $self = $this;
+ $callback = // Start of anonymous callback function
+ function ($match) use ($param, $templates, $self) {
+ if ($match[1] == '$') {
+ if (is_numeric($match[2])) { // Numeric, use parameter $x
+ $return = (string) $param[$match[2]];
+ } else { // non-numeric, apply template again
+ $return = $templates[$match[2]];
+ if (strpos($return, '{') !== false) {
+ $return = $self->applyTemplateString($return, $param);
+ }
+ }
+ } else { // does not start with $, eval result
+ $return = $self->applyTemplateString($match[2]);
+ $return = eval("return $return;");
+ }
+ return $return;
+ }; // End of anonymous callback function
+
+ $return = preg_replace_callback('/\{([$@]?)(((?>[^\{\}]+)|(?R))*)\}/', $callback, $template);
+ return $return;
+ }
+}
+
+?>
diff --git a/soap/README.txt b/soap/README.txt
new file mode 100644
index 0000000..068cacb
--- /dev/null
+++ b/soap/README.txt
@@ -0,0 +1,35 @@
+README for PHP CMIS Client
+
+The PHP CMIS Soap Client consists of the following files:
+
+1) CMIS Web Service Library
+
+CMISWebService.php - the main class to be included into an application
+cmisTypeDefinitions.php - the CMIS object model, used by CMISWebService.php
+CMISSoapClient.php - extends the PHP SoapClient class, used by CMISWebService.php
+CMISAlfrescoSoapClient.php - an Alfresco specific version, includes ticket support
+
+2) PHP CMIS Client
+
+index.php - the main file, includes all CMIS calls and program logic. Configuration
+ parameters, including URL for service endpoints, is configured here.
+PccHTML.php - includes all HTML presentation code, no calls to CMIS
+pcc.css - CSS file, included from PccHTML.php
+dialog.js - Java Script for dialog handling, included from PccHTML.php
+
+The PHP CMIS Client is a sample application to show the use of the CMIS library.
+Main features include folder and document list, checkin, checkout, upload,
+download, cancel checkout and delete.
+
+All CMIS functions and the program logic are included into the main file index.php.
+Changes to the HTML presentation can be done independently in PccHTML.php.
+Jacascipt is used for dialog handling, to avoid page reloads for a dialog.
+A simple templating mechanism is included, to generate the HTML output.
+
+This software is presented to the Apache Chemistry project. Licensing will
+be changed to ASF if accepted by the Chemistry project.
+
+Contact information:
+
+Karsten Eberding
+karsten@eberding.eu
\ No newline at end of file
diff --git a/soap/include/CMISAlfrescoSoapClient.php b/soap/include/CMISAlfrescoSoapClient.php
new file mode 100644
index 0000000..aeca10d
--- /dev/null
+++ b/soap/include/CMISAlfrescoSoapClient.php
@@ -0,0 +1,217 @@
+<?php
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+/**
+ * CMISAlfrescoSoapClient extends the standard SoapClient class to include message handling for CMIS for Alfresco:
+ * 1) include WebService Security (WSS) headers as required by CMIS (this part is taken from Alfresco)
+ * 2) handle multipart response messages from the repository
+ * 3) handle Alfresco tickets
+ *
+ * @author Karsten Eberding, based on sample code from Alfresco
+ */
+class CMISAlfrescoSoapClient extends SoapClient {
+
+ private static $securityExtNS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
+ private static $wsUtilityNS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
+ private static $passwordType = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText";
+
+ private static $myUsername;
+ private static $myPassword;
+ private static $ticket;
+
+ public function __construct($wsdl, $options) {
+
+ $wsdlcache = $this->get_wsdl($wsdl);
+
+ // Call the base class
+ parent::__construct($wsdlcache, $options);
+ }
+
+ public function setCredentials($url, $username, $password) {
+
+ // Store the current username, password, ticket
+ self::$myUsername = $username;
+ self::$myPassword = $password;
+
+ if (isset($_SESSION['AlfrescoTicket'])) {
+ $ticket = $_SESSION['AlfrescoTicket'];
+ return true;
+ }
+
+ // get url for ticket service
+ $u = urlencode($username);
+ $pw = urlencode($password);
+ $url = parse_url($url);
+ $path = preg_replace('#/[^/]+/?$#', '/', $url['path']); // remove last path element
+ $url = (isset($url['scheme']) ? $url['scheme'] : 'http') . '://' . $url['host'] .
+ (isset($url['port']) ? ':'.$url['port'] : '') . "{$path}service/api/login?u=$u&pw=$pw";
+
+ // get ticket
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, $url);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
+
+ $ticketxml = curl_exec($ch);
+ curl_close($ch);
+ $dom = new DOMDocument("1.0");
+ $dom->loadXML($ticketxml);
+ $ticket = $dom->getElementsByTagName('ticket')->item(0)->nodeValue;
+
+ if (isset($ticket)) {
+ self::$ticket = $ticket; // save ticket for subsequent calls
+ $_SESSION['AlfrescoTicket'] = $ticket; // save ticket for subsequent page requests
+ return true; // login success
+ }
+ return false; // login failure
+ }
+
+ public function clearCredentials() {
+ // Clear the current username, password, ticket
+ self::$myUsername = '';
+ self::$myPassword = '';
+ self::$ticket = '';
+ $_SESSION['AlfrescoTicket'] = '';
+ }
+
+ public function __call($function_name, $arguments = array()) {
+ return $this->__soapCall($function_name, $arguments);
+ }
+
+ public function __soapCall($function_name, $arguments = array(), $options = array(), $input_headers = array(), $output_headers = array()) {
+
+ // Automatically add a security header
+ $input_headers[] = new SoapHeader(self::$securityExtNS, "Security", null, 1);
+
+ $response = parent::__soapCall($function_name, $arguments, $options, $input_headers, $output_headers);
+
+ return $response;
+ }
+
+ public function __doRequest($request, $location, $action, $version) {
+ // If this request requires authentication we have to manually construct the
+ // security headers.
+ $dom = new DOMDocument("1.0");
+ $dom->loadXML($request);
+
+ $securityHeader = $dom->getElementsByTagName("Security");
+
+ if ($securityHeader->length != 1) {
+ throw new Exception("Expected length: 1, Received: " . $securityHeader->length . ". No Security Header, or more than one element called Security!");
+ }
+
+ $securityHeader = $securityHeader->item(0);
+
+ // Construct Timestamp Header
+ $timeStamp = $dom->createElementNS(self::$wsUtilityNS, "Timestamp");
+ $createdDate = date("Y-m-d\TH:i:s\Z", mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y")));
+ $expiresDate = date("Y-m-d\TH:i:s\Z", mktime(date("H") + 24, date("i"), date("s"), date("m"), date("d"), date("Y")));
+ $created = new DOMElement("Created", $createdDate, self::$wsUtilityNS);
+ $expires = new DOMElement("Expires", $expiresDate, self::$wsUtilityNS);
+ $timeStamp->appendChild($created);
+ $timeStamp->appendChild($expires);
+
+ // Construct UsernameToken Header
+ if (isset(self::$ticket) && self::$ticket != '') {
+ $username = '';
+ $password = self::$ticket;
+ } else {
+ $username = self::$myUsername;
+ $password = self::$myPassword;
+ }
+ $userNameToken = $dom->createElementNS(self::$securityExtNS, "UsernameToken");
+ $userName = new DOMElement("Username", $username, self::$securityExtNS);
+
+ $passWord = $dom->createElementNS(self::$securityExtNS, "Password");
+ $typeAttr = new DOMAttr("Type", self::$passwordType);
+ $passWord->appendChild($typeAttr);
+
+ $passWord->appendChild($dom->createTextNode($password));
+ $userNameToken->appendChild($userName);
+ $userNameToken->appendChild($passWord);
+
+ // Construct Security Header
+ $securityHeader->appendChild($timeStamp);
+ $securityHeader->appendChild($userNameToken);
+
+ // Save the XML Request
+ $request = $dom->saveXML();
+
+ $response = parent::__doRequest($request, $location, $action, $version);
+ $responseHeader = $this->__getLastResponseHeaders();
+
+ $boundary = array();
+ $start = array();
+ $contentId = array();
+ $attachment = array();
+ $match = array();
+ if (preg_match('/content-type: multipart\/related;/i', $responseHeader) === 1 &&
+ preg_match('/boundary="(.*?)";/i', $responseHeader, $boundary) === 1 &&
+ preg_match('/start="<(.*?)>";/i', $responseHeader, $start)) {
+ $parts = explode("\r\n--" . $boundary[1], $response);
+
+ foreach ($parts as $part) {
+ //if ($part == '' || $part == '--') continue;
+ $part = explode("\r\n\r\n", $part, 2); // array of part header and content
+ if (count($part) < 2)
+ continue;
+ if (preg_match('/content-id:\s*<(.*?)>/i', $part[0], $contentId) === 1) {
+ if ($contentId[1] == $start[1]) {
+ $response = $part[1];
+ } else {
+ $attachment[$contentId[1]] = $part[1];
+ //$attachment[] = $part[1];
+ }
+ }
+ }
+ if (count($attachment) > 0) {
+ if (preg_match('/<xop:include .*?href="cid:(.*?)".*?>/i', $response, $match)) {
+ $response = str_replace($match[0], base64_encode($attachment[$match[1]]), $response);
+ }
+ }
+ }
+
+ return $response;
+ }
+
+ private function get_wsdl($url) {
+ $cache_file = "/tmp/soap.wsdl." . md5($url);
+
+ //only fetch a new wsdl every hour
+ if (!file_exists($cache_file) || filectime($cache_file) < time() - 3600) {
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, $url);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
+
+ $wsdldata = curl_exec($ch);
+ curl_close($ch);
+
+ $wsdldata = str_replace('anySimpleType', 'string', $wsdldata);
+
+ file_put_contents($cache_file, $wsdldata);
+ if (!file_exists($cache_file)) {
+ throw new Exception("Couldn't load WSDL at {$url}");
+ }
+ }
+ return $cache_file;
+ }
+
+}
+
+?>
diff --git a/soap/include/CMISSoapClient.php b/soap/include/CMISSoapClient.php
new file mode 100644
index 0000000..339bec7
--- /dev/null
+++ b/soap/include/CMISSoapClient.php
@@ -0,0 +1,170 @@
+<?php
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+/**
+ * CMISSoapClient extends the standard SoapClient class to include message handling for CMIS:
+ * 1) include WebService Security (WSS) headers as required by CMIS (this part is taken from Alfresco)
+ * 2) handle multipart response messages from the repository
+ *
+ * @author Karsten Eberding, based on sample code from Alfresco
+ */
+class CMISSoapClient extends SoapClient {
+
+ private static $securityExtNS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
+ private static $wsUtilityNS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
+ private static $passwordType = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText";
+
+ private static $myUsername;
+ private static $myPassword;
+
+ public function __construct($wsdl, $options) {
+
+ $wsdlcache = $this->get_wsdl($wsdl);
+
+ // Call the base class
+ parent::__construct($wsdlcache, $options);
+ }
+
+ public function setCredentials($url, $username, $password) {
+
+ // Store the current username, password, ticket
+ self::$myUsername = $username;
+ self::$myPassword = $password;
+
+ return true; // login success
+ }
+
+ public function clearCredentials() {
+ // Clear the current username, password, ticket
+ self::$myUsername = '';
+ self::$myPassword = '';
+ }
+
+ public function __call($function_name, $arguments = array()) {
+ return $this->__soapCall($function_name, $arguments);
+ }
+
+ public function __soapCall($function_name, $arguments = array(), $options = array(), $input_headers = array(), $output_headers = array()) {
+ // Automatically add a security header
+ $input_headers[] = new SoapHeader(self::$securityExtNS, "Security", null, 1);
+
+ $response = parent::__soapCall($function_name, $arguments, $options, $input_headers, $output_headers);
+
+ return $response;
+ }
+
+ public function __doRequest($request, $location, $action, $version) {
+ // If this request requires authentication we have to manually construct the
+ // security headers.
+ $dom = new DOMDocument("1.0");
+ $dom->loadXML($request);
+
+ $securityHeader = $dom->getElementsByTagName("Security");
+
+ if ($securityHeader->length != 1) {
+ throw new Exception("Expected length: 1, Received: " . $securityHeader->length . ". No Security Header, or more than one element called Security!");
+ }
+
+ $securityHeader = $securityHeader->item(0);
+
+ // Construct Timestamp Header
+ $timeStamp = $dom->createElementNS(self::$wsUtilityNS, "Timestamp");
+ $createdDate = date("Y-m-d\TH:i:s\Z", mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y")));
+ $expiresDate = date("Y-m-d\TH:i:s\Z", mktime(date("H") + 24, date("i"), date("s"), date("m"), date("d"), date("Y")));
+ $created = new DOMElement("Created", $createdDate, self::$wsUtilityNS);
+ $expires = new DOMElement("Expires", $expiresDate, self::$wsUtilityNS);
+ $timeStamp->appendChild($created);
+ $timeStamp->appendChild($expires);
+
+ // Construct UsernameToken Header
+ $userNameToken = $dom->createElementNS(self::$securityExtNS, "UsernameToken");
+ $userName = new DOMElement("Username", self::$myUsername, self::$securityExtNS);
+ $passWord = $dom->createElementNS(self::$securityExtNS, "Password");
+ $typeAttr = new DOMAttr("Type", self::$passwordType);
+ $passWord->appendChild($typeAttr);
+ $passWord->appendChild($dom->createTextNode(self::$myPassword));
+ $userNameToken->appendChild($userName);
+ $userNameToken->appendChild($passWord);
+
+ // Construct Security Header
+ $securityHeader->appendChild($timeStamp);
+ $securityHeader->appendChild($userNameToken);
+
+ // Save the XML Request
+ $request = $dom->saveXML();
+
+ $response = parent::__doRequest($request, $location, $action, $version);
+
+ $responseHeader = $this->__getLastResponseHeaders();
+
+ $boundary = array();
+ $start = array();
+ $contentId = array();
+ $attachment = array();
+ $match = array();
+ if (preg_match('/content-type: multipart\/related;/i', $responseHeader) === 1 &&
+ preg_match('/boundary="(.*?)";/i', $responseHeader, $boundary) === 1 &&
+ preg_match('/start="<(.*?)>";/i', $responseHeader, $start)) {
+ $parts = explode("\r\n--" . $boundary[1], $response);
+
+ foreach ($parts as $part) {
+ $part = explode("\r\n\r\n", $part, 2); // array of part header and content
+ if (count($part) < 2)
+ continue;
+ if (preg_match('/content-id:\s*<(.*?)>/i', $part[0], $contentId) === 1) {
+ if ($contentId[1] == $start[1]) {
+ $response = $part[1];
+ } else {
+ $attachment[$contentId[1]] = $part[1];
+ }
+ }
+ }
+ if (count($attachment) > 0) {
+ if (preg_match('/<xop:include .*?href="cid:(.*?)".*?>/i', $response, $match)) {
+ $response = str_replace($match[0], base64_encode($attachment[$match[1]]), $response);
+ }
+ }
+ }
+
+ return $response;
+ }
+
+ private function get_wsdl($url) {
+ $cache_file = "/tmp/soap.wsdl." . md5($url);
+
+ //only fetch a new wsdl every hour
+ if (!file_exists($cache_file) || filectime($cache_file) < time() - 3600) {
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, $url);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
+
+ $wsdldata = curl_exec($ch);
+ curl_close($ch);
+
+ $wsdldata = str_replace('anySimpleType', 'string', $wsdldata);
+
+ file_put_contents($cache_file, $wsdldata);
+ if (!file_exists($cache_file)) {
+ throw new Exception("Couldn't load WSDL at {$url}");
+ }
+ }
+ return $cache_file;
+ }
+}
+?>
diff --git a/soap/include/CMISWebService.php b/soap/include/CMISWebService.php
new file mode 100644
index 0000000..dbf1622
--- /dev/null
+++ b/soap/include/CMISWebService.php
@@ -0,0 +1,2064 @@
+<?php
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+require_once('CMISSoapClient.php');
+require_once('cmisTypeDefinitions.php');
+
+/**
+ * CMISWebService class
+ *
+ *
+ *
+ * This library implements the CMIS 1.0 Web Services binding for PHP,
+ * as published by OASIS (http://www.oasis-open.org/committees/cmis/)
+ *
+ * @author Karsten Eberding
+ * @package CMISWebService
+ * @version 0.6
+ */
+
+class CMISWebService {
+
+ private $DiscoveryService;
+ private $MultiFilingService;
+ private $NavigationService;
+ private $ObjectService;
+ private $PolicyService;
+ private $RelationshipService;
+ private $RepositoryService;
+ private $VersioningService;
+ private $ACLService;
+
+ private $url;
+
+ private static $classmap = array(
+ 'enumDecimalPrecision' => 'enumDecimalPrecision',
+ 'enumContentStreamAllowed' => 'enumContentStreamAllowed',
+ 'enumCardinality' => 'enumCardinality',
+ 'enumUpdatability' => 'enumUpdatability',
+ 'enumDateTimeResolution' => 'enumDateTimeResolution',
+ 'enumPropertyType' => 'enumPropertyType',
+ 'enumBaseObjectTypeIds' => 'enumBaseObjectTypeIds',
+ 'enumCapabilityQuery' => 'enumCapabilityQuery',
+ 'enumCapabilityJoin' => 'enumCapabilityJoin',
+ 'enumCapabilityContentStreamUpdates' => 'enumCapabilityContentStreamUpdates',
+ 'enumVersioningState' => 'enumVersioningState',
+ 'enumUnfileObject' => 'enumUnfileObject',
+ 'enumRelationshipDirection' => 'enumRelationshipDirection',
+ 'enumIncludeRelationships' => 'enumIncludeRelationships',
+ 'enumPropertiesBase' => 'enumPropertiesBase',
+ 'enumPropertiesDocument' => 'enumPropertiesDocument',
+ 'enumPropertiesFolder' => 'enumPropertiesFolder',
+ 'enumPropertiesRelationship' => 'enumPropertiesRelationship',
+ 'enumPropertiesPolicy' => 'enumPropertiesPolicy',
+ 'cmisObjectType' => 'cmisObjectType',
+ 'cmisPropertiesType' => 'cmisPropertiesType',
+ 'cmisProperty' => 'cmisProperty',
+ 'cmisPropertyBoolean' => 'cmisPropertyBoolean',
+ 'cmisPropertyId' => 'cmisPropertyId',
+ 'cmisPropertyInteger' => 'cmisPropertyInteger',
+ 'cmisPropertyDateTime' => 'cmisPropertyDateTime',
+ 'cmisPropertyDecimal' => 'cmisPropertyDecimal',
+ 'cmisPropertyHtml' => 'cmisPropertyHtml',
+ 'cmisPropertyString' => 'cmisPropertyString',
+ 'cmisPropertyUri' => 'cmisPropertyUri',
+ 'cmisChoice' => 'cmisChoice',
+ 'cmisChoiceBoolean' => 'cmisChoiceBoolean',
+ 'cmisChoiceId' => 'cmisChoiceId',
+ 'cmisChoiceInteger' => 'cmisChoiceInteger',
+ 'cmisChoiceDateTime' => 'cmisChoiceDateTime',
+ 'cmisChoiceDecimal' => 'cmisChoiceDecimal',
+ 'cmisChoiceHtml' => 'cmisChoiceHtml',
+ 'cmisChoiceString' => 'cmisChoiceString',
+ 'cmisChoiceUri' => 'cmisChoiceUri',
+ 'cmisAllowableActionsType' => 'cmisAllowableActionsType',
+ 'cmisListOfIdsType' => 'cmisListOfIdsType',
+ 'cmisPropertyDefinitionType' => 'cmisPropertyDefinitionType',
+ 'cmisPropertyBooleanDefinitionType' => 'cmisPropertyBooleanDefinitionType',
+ 'cmisPropertyIdDefinitionType' => 'cmisPropertyIdDefinitionType',
+ 'cmisPropertyIntegerDefinitionType' => 'cmisPropertyIntegerDefinitionType',
+ 'cmisPropertyDateTimeDefinitionType' => 'cmisPropertyDateTimeDefinitionType',
+ 'cmisPropertyDecimalDefinitionType' => 'cmisPropertyDecimalDefinitionType',
+ 'cmisPropertyHtmlDefinitionType' => 'cmisPropertyHtmlDefinitionType',
+ 'cmisPropertyStringDefinitionType' => 'cmisPropertyStringDefinitionType',
+ 'cmisPropertyUriDefinitionType' => 'cmisPropertyUriDefinitionType',
+ 'cmisTypeDefinitionType' => 'cmisTypeDefinitionType',
+ 'cmisTypeDocumentDefinitionType' => 'cmisTypeDocumentDefinitionType',
+ 'cmisTypeFolderDefinitionType' => 'cmisTypeFolderDefinitionType',
+ 'cmisTypeRelationshipDefinitionType' => 'cmisTypeRelationshipDefinitionType',
+ 'cmisTypePolicyDefinitionType' => 'cmisTypePolicyDefinitionType',
+ 'cmisQueryType' => 'cmisQueryType',
+ 'cmisRepositoryInfoType' => 'cmisRepositoryInfoType',
+ 'cmisRepositoryCapabilitiesType' => 'cmisRepositoryCapabilitiesType',
+ 'enumTypeOfChanges' => 'enumTypeOfChanges',
+ 'enumCapabilityChanges' => 'enumCapabilityChanges',
+ 'cmisChangeEventType' => 'cmisChangeEventType',
+ 'enumACLPropagation' => 'enumACLPropagation',
+ 'enumCapabilityACL' => 'enumCapabilityACL',
+ 'enumBasicPermissions' => 'enumBasicPermissions',
+ 'cmisPermissionDefinition' => 'cmisPermissionDefinition',
+ 'cmisPermissionMapping' => 'cmisPermissionMapping',
+ 'enumAllowableActionsKey' => 'enumAllowableActionsKey',
+ 'enumUsers' => 'enumUsers',
+ 'cmisAccessControlPrincipalType' => 'cmisAccessControlPrincipalType',
+ 'cmisAccessControlEntryType' => 'cmisAccessControlEntryType',
+ 'cmisAccessControlListType' => 'cmisAccessControlListType',
+ 'cmisACLCapabilityType' => 'cmisACLCapabilityType',
+ 'enumSupportedPermissions' => 'enumSupportedPermissions',
+ 'enumCapabilityRendition' => 'enumCapabilityRendition',
+ 'enumRenditionKind' => 'enumRenditionKind',
+ 'cmisRenditionType' => 'cmisRenditionType',
+ 'cmisFaultType' => 'cmisFaultType',
+ 'enumServiceException' => 'enumServiceException',
+ 'cmisExtensionType' => 'cmisExtensionType',
+ 'cmisTypeContainer' => 'cmisTypeContainer',
+ 'cmisTypeDefinitionListType' => 'cmisTypeDefinitionListType',
+ 'cmisObjectInFolderContainerType' => 'cmisObjectInFolderContainerType',
+ 'cmisObjectListType' => 'cmisObjectListType',
+ 'cmisObjectInFolderType' => 'cmisObjectInFolderType',
+ 'cmisObjectParentsType' => 'cmisObjectParentsType',
+ 'cmisObjectInFolderListType' => 'cmisObjectInFolderListType',
+ 'cmisRepositoryEntryType' => 'cmisRepositoryEntryType',
+ 'cmisContentStreamType' => 'cmisContentStreamType',
+ 'cmisACLType' => 'cmisACLType',
+ 'getRepositories' => 'getRepositories',
+ 'getRepositoriesResponse' => 'getRepositoriesResponse',
+ 'getRepositoryInfo' => 'getRepositoryInfo',
+ 'getRepositoryInfoResponse' => 'getRepositoryInfoResponse',
+ 'getTypeChildren' => 'getTypeChildren',
+ 'getTypeChildrenResponse' => 'getTypeChildrenResponse',
+ 'getTypeDescendants' => 'getTypeDescendants',
+ 'getTypeDescendantsResponse' => 'getTypeDescendantsResponse',
+ 'getTypeDefinition' => 'getTypeDefinition',
+ 'getTypeDefinitionResponse' => 'getTypeDefinitionResponse',
+ 'getDescendants' => 'getDescendants',
+ 'getDescendantsResponse' => 'getDescendantsResponse',
+ 'getFolderTree' => 'getFolderTree',
+ 'getFolderTreeResponse' => 'getFolderTreeResponse',
+ 'getChildren' => 'getChildren',
+ 'getChildrenResponse' => 'getChildrenResponse',
+ 'getFolderParent' => 'getFolderParent',
+ 'getFolderParentResponse' => 'getFolderParentResponse',
+ 'getObjectParents' => 'getObjectParents',
+ 'getObjectParentsResponse' => 'getObjectParentsResponse',
+ 'getRenditions' => 'getRenditions',
+ 'getRenditionsResponse' => 'getRenditionsResponse',
+ 'getCheckedOutDocs' => 'getCheckedOutDocs',
+ 'getCheckedOutDocsResponse' => 'getCheckedOutDocsResponse',
+ 'createDocument' => 'createDocument',
+ 'createDocumentResponse' => 'createDocumentResponse',
+ 'createDocumentFromSource' => 'createDocumentFromSource',
+ 'createDocumentFromSourceResponse' => 'createDocumentFromSourceResponse',
+ 'createFolder' => 'createFolder',
+ 'createFolderResponse' => 'createFolderResponse',
+ 'createRelationship' => 'createRelationship',
+ 'createRelationshipResponse' => 'createRelationshipResponse',
+ 'createPolicy' => 'createPolicy',
+ 'createPolicyResponse' => 'createPolicyResponse',
+ 'getAllowableActions' => 'getAllowableActions',
+ 'getAllowableActionsResponse' => 'getAllowableActionsResponse',
+ 'getProperties' => 'getProperties',
+ 'getPropertiesResponse' => 'getPropertiesResponse',
+ 'getObject' => 'getObject',
+ 'getObjectResponse' => 'getObjectResponse',
+ 'getObjectByPath' => 'getObjectByPath',
+ 'getObjectByPathResponse' => 'getObjectByPathResponse',
+ 'getContentStream' => 'getContentStream',
+ 'getContentStreamResponse' => 'getContentStreamResponse',
+ 'updateProperties' => 'updateProperties',
+ 'updatePropertiesResponse' => 'updatePropertiesResponse',
+ 'moveObject' => 'moveObject',
+ 'moveObjectResponse' => 'moveObjectResponse',
+ 'deleteObject' => 'deleteObject',
+ 'deleteObjectResponse' => 'deleteObjectResponse',
+ 'deleteTree' => 'deleteTree',
+ 'deleteTreeResponse' => 'deleteTreeResponse',
+ 'failedToDelete' => 'failedToDelete',
+ 'setContentStream' => 'setContentStream',
+ 'setContentStreamResponse' => 'setContentStreamResponse',
+ 'deleteContentStream' => 'deleteContentStream',
+ 'deleteContentStreamResponse' => 'deleteContentStreamResponse',
+ 'addObjectToFolder' => 'addObjectToFolder',
+ 'addObjectToFolderResponse' => 'addObjectToFolderResponse',
+ 'removeObjectFromFolder' => 'removeObjectFromFolder',
+ 'removeObjectFromFolderResponse' => 'removeObjectFromFolderResponse',
+ 'query' => 'query',
+ 'queryResponse' => 'queryResponse',
+ 'getContentChanges' => 'getContentChanges',
+ 'getContentChangesResponse' => 'getContentChangesResponse',
+ 'checkOut' => 'checkOut',
+ 'checkOutResponse' => 'checkOutResponse',
+ 'cancelCheckOut' => 'cancelCheckOut',
+ 'cancelCheckOutResponse' => 'cancelCheckOutResponse',
+ 'checkIn' => 'checkIn',
+ 'checkInResponse' => 'checkInResponse',
+ 'getPropertiesOfLatestVersion' => 'getPropertiesOfLatestVersion',
+ 'getPropertiesOfLatestVersionResponse' => 'getPropertiesOfLatestVersionResponse',
+ 'getObjectOfLatestVersion' => 'getObjectOfLatestVersion',
+ 'getObjectOfLatestVersionResponse' => 'getObjectOfLatestVersionResponse',
+ 'getAllVersions' => 'getAllVersions',
+ 'getAllVersionsResponse' => 'getAllVersionsResponse',
+ 'getObjectRelationships' => 'getObjectRelationships',
+ 'getObjectRelationshipsResponse' => 'getObjectRelationshipsResponse',
+ 'applyPolicy' => 'applyPolicy',
+ 'applyPolicyResponse' => 'applyPolicyResponse',
+ 'removePolicy' => 'removePolicy',
+ 'removePolicyResponse' => 'removePolicyResponse',
+ 'getAppliedPolicies' => 'getAppliedPolicies',
+ 'getAppliedPoliciesResponse' => 'getAppliedPoliciesResponse',
+ 'getACL' => 'getACL',
+ 'getACLResponse' => 'getACLResponse',
+ 'applyACL' => 'applyACL',
+ 'applyACLResponse' => 'applyACLResponse',
+ 'anyURI' => 'anyURI',
+ );
+
+ /**
+ * This class implements the CMIS 1.0 Web Services binding for PHP,
+ * as published by OASIS (http://www.oasis-open.org/committees/cmis/)
+ *
+ * @param string url - URL to CMIS Service Endpoint
+ * @param string options - array with SOAP options
+ */
+
+ public function CMISWebService ($url = "http://democrm/demo/cmiswsdl/test/", $options = array(), $errorFunction = NULL) {
+
+ // set default options if not defined in options parameter
+ if (!array_key_exists('trace', $options)) $options['trace'] = true;
+ if (!array_key_exists('exceptions', $options)) $options['exceptions'] = true;
+ if (!array_key_exists('features', $options)) $options['features'] = SOAP_SINGLE_ELEMENT_ARRAYS + SOAP_USE_XSI_ARRAY_TYPE;
+ if (!array_key_exists('soap_version', $options)) $options['soap_version'] = SOAP_1_1;
+ //if (!array_key_exists('cache_wsdl', $options)) $options['cache_wsdl'] = WSDL_CACHE_NONE; // for debugging
+
+ // set url and error function
+ $this->url = $url;
+ $this->errorFunction = $errorFunction;
+
+ // initialize classmap (merge)
+ foreach(self::$classmap as $key => $value) {
+ if(!isset($options['classmap'][$key])) {
+ $options['classmap'][$key] = $value;
+ }
+ }
+
+ // create individual soap service objects
+ $soapClient = (array_key_exists('CMISSoapClient', $options)) ? $options['CMISSoapClient'] : 'CMISSoapClient';
+ $cmisServices = (array_key_exists('CMISServices', $options)) ? $options['CMISServices'] : array(
+ 'DiscoveryService' => 'DiscoveryService?wsdl',
+ 'MultiFilingService' => 'MultiFilingService?wsdl',
+ 'NavigationService' => 'NavigationService?wsdl',
+ 'ObjectService' => 'ObjectService?wsdl',
+ 'PolicyService' => 'PolicyService?wsdl',
+ 'RelationshipService' => 'RelationshipService?wsdl',
+ 'RepositoryService' => 'RepositoryService?wsdl',
+ 'VersioningService' => 'VersioningService?wsdl',
+ 'ACLService' => 'ACLService?wsdl',
+
+ );
+
+ foreach ($cmisServices as $serviceName => $serviceEndpoint) {
+ $this->$serviceName = new $soapClient($url . $serviceEndpoint, $options);
+ }
+
+ // set credentials if provided through options
+ if (array_key_exists('user_name', $options) && array_key_exists('password', $options)) {
+ $this->setCredentials($options['user_name'], $options['password']);
+ }
+ }
+
+ /**
+ *
+ * setCredentials - sets username and password if not provided in constructor
+ *
+ * @param string username
+ * @param string password
+ */
+ public function setCredentials($username, $password) {
+ $this->RepositoryService->setCredentials($this->url, $username, $password);
+ }
+
+ /**
+ *
+ * clearCredentials - clears credential information of current session
+ *
+ */
+ public function clearCredentials() {
+ $this->RepositoryService->clearCredentials();
+ }
+
+ /**
+ *
+ * query
+ *
+ * @param string repositoryId
+ * @param string statement
+ * @param boolean searchAllVersions
+ * @param boolean includeAllowableActions
+ * @param enumIncludeRelationships includeRelationships
+ * @param string renditionFilter
+ * @param integer maxItems
+ * @param integer skipCount
+ * @param cmisExtensionType extension
+ * @return cmisObjectListType objects
+ */
+ public function query($repositoryId, $statement, $searchAllVersions = NULL, $includeAllowableActions = NULL, $includeRelationships = NULL, $renditionFilter = NULL, $maxItems = NULL, $skipCount = NULL, $extension = NULL) {
+ $parameter = new query();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($statement)) $parameter->statement = (string)$statement;
+ if (isset($searchAllVersions)) $parameter->searchAllVersions = $searchAllVersions;
+ if (isset($includeAllowableActions)) $parameter->includeAllowableActions = $includeAllowableActions;
+ if (isset($includeRelationships)) $parameter->includeRelationships = $includeRelationships;
+ if (isset($renditionFilter)) $parameter->renditionFilter = (string)$renditionFilter;
+ if (isset($maxItems)) $parameter->maxItems = $maxItems;
+ if (isset($skipCount)) $parameter->skipCount = $skipCount;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->DiscoveryService->__soapCall('query', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ $this->decodeObjectProperties ($response->objects->objects);
+ return $response->objects;
+ }
+
+ /**
+ *
+ * getContentChanges
+ *
+ * @param string repositoryId
+ * @param string changeLogToken
+ * @param boolean includeProperties
+ * @param string filter
+ * @param boolean includePolicyIds
+ * @param boolean includeACL
+ * @param integer maxItems
+ * @param cmisExtensionType extension
+ * @return getContentChangesResponse parameters
+ */
+ public function getContentChanges($repositoryId, $changeLogToken = NULL, $includeProperties = NULL, $filter = NULL, $includePolicyIds = NULL, $includeACL = NULL, $maxItems = NULL, $extension = NULL) {
+ $parameter = new getContentChanges();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($changeLogToken)) $parameter->changeLogToken = (string)$changeLogToken;
+ if (isset($includeProperties)) $parameter->includeProperties = $includeProperties;
+ if (isset($filter)) $parameter->filter = (string)$filter;
+ if (isset($includePolicyIds)) $parameter->includePolicyIds = $includePolicyIds;
+ if (isset($includeACL)) $parameter->includeACL = $includeACL;
+ if (isset($maxItems)) $parameter->maxItems = $maxItems;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->DiscoveryService->__soapCall('getContentChanges', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ $this->decodeObjectProperties ($response->parameters->objects->objects);
+ return $response;
+ }
+
+ /**
+ *
+ * addObjectToFolder
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param string folderId
+ * @param boolean allVersions
+ * @param cmisExtensionType extension
+ * @return cmisExtensionType extension
+ */
+ public function addObjectToFolder($repositoryId, $objectId, $folderId, $allVersions = NULL, $extension = NULL) {
+ $parameter = new addObjectToFolder();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($folderId)) $parameter->folderId = (string)$folderId;
+ if (isset($allVersions)) $parameter->allVersions = $allVersions;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->MultiFilingService->__soapCall('addObjectToFolder', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response->extension;
+ }
+
+ /**
+ *
+ * removeObjectFromFolder
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param string folderId
+ * @param cmisExtensionType extension
+ * @return cmisExtensionType extension
+ */
+ public function removeObjectFromFolder($repositoryId, $objectId, $folderId = NULL, $extension = NULL) {
+ $parameter = new removeObjectFromFolder();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($folderId)) $parameter->folderId = (string)$folderId;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->MultiFilingService->__soapCall('removeObjectFromFolder', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response->extension;
+ }
+
+ /**
+ *
+ * getDescendants
+ *
+ * @param string repositoryId
+ * @param string folderId
+ * @param integer depth
+ * @param string filter
+ * @param boolean includeAllowableActions
+ * @param enumIncludeRelationships includeRelationships
+ * @param string renditionFilter
+ * @param boolean includePathSegment
+ * @param cmisExtensionType extension
+ * @return cmisObjectInFolderContainerType objects
+ */
+ public function getDescendants($repositoryId, $folderId, $depth = NULL, $filter = NULL, $includeAllowableActions = NULL, $includeRelationships = NULL, $renditionFilter = NULL, $includePathSegment = NULL, $extension = NULL) {
+ $parameter = new getDescendants();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($folderId)) $parameter->folderId = (string)$folderId;
+ if (isset($depth)) $parameter->depth = $depth;
+ if (isset($filter)) $parameter->filter = (string)$filter;
+ if (isset($includeAllowableActions)) $parameter->includeAllowableActions = $includeAllowableActions;
+ if (isset($includeRelationships)) $parameter->includeRelationships = $includeRelationships;
+ if (isset($renditionFilter)) $parameter->renditionFilter = (string)$renditionFilter;
+ if (isset($includePathSegment)) $parameter->includePathSegment = $includePathSegment;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->NavigationService->__soapCall('getDescendants', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ $this->decodeObjectInFolderContainerProperties ($response->objects);
+ return $response->objects;
+ }
+
+ /**
+ *
+ * getChildren
+ *
+ * @param string repositoryId
+ * @param string folderId
+ * @param string filter
+ * @param string orderBy
+ * @param boolean includeAllowableActions
+ * @param enumIncludeRelationships includeRelationships
+ * @param string renditionFilter
+ * @param boolean includePathSegment
+ * @param integer maxItems
+ * @param integer skipCount
+ * @param cmisExtensionType extension
+ * @return cmisObjectInFolderListType objects
+ */
+ public function getChildren($repositoryId, $folderId, $filter = NULL, $orderBy = NULL, $includeAllowableActions = NULL, $includeRelationships = NULL, $renditionFilter = NULL, $includePathSegment = NULL, $maxItems = NULL, $skipCount = NULL, $extension = NULL) {
+ $parameter = new getChildren();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($folderId)) $parameter->folderId = (string)$folderId;
+ if (isset($filter)) $parameter->filter = (string)$filter;
+ if (isset($orderBy)) $parameter->orderBy = (string)$orderBy;
+ if (isset($includeAllowableActions)) $parameter->includeAllowableActions = $includeAllowableActions;
+ if (isset($includeRelationships)) $parameter->includeRelationships = $includeRelationships;
+ if (isset($renditionFilter)) $parameter->renditionFilter = (string)$renditionFilter;
+ if (isset($includePathSegment)) $parameter->includePathSegment = $includePathSegment;
+ if (isset($maxItems)) $parameter->maxItems = $maxItems;
+ if (isset($skipCount)) $parameter->skipCount = $skipCount;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->NavigationService->__soapCall('getChildren', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ $this->decodeObjectInFolderProperties ($response->objects->objects);
+ return $response->objects;
+ }
+
+ /**
+ *
+ * getFolderParent
+ *
+ * @param string repositoryId
+ * @param string folderId
+ * @param string filter
+ * @param cmisExtensionType extension
+ * @return cmisObjectType object
+ */
+ public function getFolderParent($repositoryId, $folderId, $filter = NULL, $extension = NULL) {
+ $parameter = new getFolderParent();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($folderId)) $parameter->folderId = (string)$folderId;
+ if (isset($filter)) $parameter->filter = (string)$filter;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->NavigationService->__soapCall('getFolderParent', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ $this->decodeObjectProperties ($response->object);
+ return $response->object;
+ }
+
+ /**
+ *
+ * getFolderTree
+ *
+ * @param string repositoryId
+ * @param string folderId
+ * @param integer depth
+ * @param string filter
+ * @param boolean includeAllowableActions
+ * @param enumIncludeRelationships includeRelationships
+ * @param string renditionFilter
+ * @param boolean includePathSegment
+ * @param cmisExtensionType extension
+ * @return cmisObjectInFolderContainerType objects
+ */
+ public function getFolderTree($repositoryId, $folderId, $depth = NULL, $filter = NULL, $includeAllowableActions = NULL, $includeRelationships = NULL, $renditionFilter = NULL, $includePathSegment = NULL, $extension = NULL) {
+ $parameter = new getFolderTree();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($folderId)) $parameter->folderId = (string)$folderId;
+ if (isset($depth)) $parameter->depth = $depth;
+ if (isset($filter)) $parameter->filter = (string)$filter;
+ if (isset($includeAllowableActions)) $parameter->includeAllowableActions = $includeAllowableActions;
+ if (isset($includeRelationships)) $parameter->includeRelationships = $includeRelationships;
+ if (isset($renditionFilter)) $parameter->renditionFilter = (string)$renditionFilter;
+ if (isset($includePathSegment)) $parameter->includePathSegment = $includePathSegment;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->NavigationService->__soapCall('getFolderTree', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ $this->decodeObjectInFolderContainerProperties ($response->objects);
+ return $response->objects;
+ }
+
+ /**
+ *
+ * getObjectParents
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param string filter
+ * @param boolean includeAllowableActions
+ * @param enumIncludeRelationships includeRelationships
+ * @param string renditionFilter
+ * @param boolean includeRelativePathSegment
+ * @param cmisExtensionType extension
+ * @return cmisObjectParentsType parents
+ */
+ public function getObjectParents($repositoryId, $objectId, $filter = NULL, $includeAllowableActions = NULL, $includeRelationships = NULL, $renditionFilter = NULL, $includeRelativePathSegment = NULL, $extension = NULL) {
+ $parameter = new getObjectParents();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($filter)) $parameter->filter = (string)$filter;
+ if (isset($includeAllowableActions)) $parameter->includeAllowableActions = $includeAllowableActions;
+ if (isset($includeRelationships)) $parameter->includeRelationships = $includeRelationships;
+ if (isset($renditionFilter)) $parameter->renditionFilter = (string)$renditionFilter;
+ if (isset($includeRelativePathSegment)) $parameter->includeRelativePathSegment = $includeRelativePathSegment;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->NavigationService->__soapCall('getObjectParents', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ $this->decodeObjectProperties ($response->parents->object);
+ return $response->parents;
+ }
+
+ /**
+ *
+ * getCheckedOutDocs
+ *
+ * @param string repositoryId
+ * @param string folderId
+ * @param string filter
+ * @param string orderBy
+ * @param boolean includeAllowableActions
+ * @param enumIncludeRelationships includeRelationships
+ * @param string renditionFilter
+ * @param integer maxItems
+ * @param integer skipCount
+ * @param cmisExtensionType extension
+ * @return cmisObjectListType objects
+ */
+ public function getCheckedOutDocs($repositoryId, $folderId = NULL, $filter = NULL, $orderBy = NULL, $includeAllowableActions = NULL, $includeRelationships = NULL, $renditionFilter = NULL, $maxItems = NULL, $skipCount = NULL, $extension = NULL) {
+ $parameter = new getCheckedOutDocs();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($folderId)) $parameter->folderId = (string)$folderId;
+ if (isset($filter)) $parameter->filter = (string)$filter;
+ if (isset($orderBy)) $parameter->orderBy = (string)$orderBy;
+ if (isset($includeAllowableActions)) $parameter->includeAllowableActions = $includeAllowableActions;
+ if (isset($includeRelationships)) $parameter->includeRelationships = $includeRelationships;
+ if (isset($renditionFilter)) $parameter->renditionFilter = (string)$renditionFilter;
+ if (isset($maxItems)) $parameter->maxItems = $maxItems;
+ if (isset($skipCount)) $parameter->skipCount = $skipCount;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->NavigationService->__soapCall('getCheckedOutDocs', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ $this->decodeObjectProperties ($response->objects->objects);
+ return $response->objects;
+ }
+
+ /**
+ *
+ * createDocument
+ *
+ * @param string repositoryId
+ * @param cmisPropertiesType properties
+ * @param string folderId
+ * @param cmisContentStreamType contentStream
+ * @param enumVersioningState versioningState
+ * @param string policies[]
+ * @param cmisAccessControlListType addACEs
+ * @param cmisAccessControlListType removeACEs
+ * @param cmisExtensionType extension
+ * @return createDocumentResponse parameters
+ */
+ public function createDocument($repositoryId, $properties, $folderId = NULL, cmisContentStreamType $contentStream = NULL, $versioningState = NULL, $policies = NULL, cmisAccessControlListType $addACEs = NULL, cmisAccessControlListType $removeACEs = NULL, $extension = NULL) {
+ $parameter = new createDocument();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($properties)) $parameter->properties = $this->encodeProperties($properties);
+ if (isset($folderId)) $parameter->folderId = (string)$folderId;
+ if (isset($contentStream)) $parameter->contentStream = $contentStream;
+ if (isset($versioningState)) $parameter->versioningState = $versioningState;
+ if (isset($policies)) $parameter->policies = (string)$policies;
+ else $parameter->policies = array(); // fix issues with array not set
+ if (isset($addACEs)) $parameter->addACEs = $addACEs;
+ if (isset($removeACEs)) $parameter->removeACEs = $removeACEs;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->ObjectService->__soapCall('createDocument', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response;
+ }
+
+ /**
+ *
+ * createDocumentFromSource
+ *
+ * @param string repositoryId
+ * @param string sourceId
+ * @param cmisPropertiesType properties
+ * @param string folderId
+ * @param enumVersioningState versioningState
+ * @param string policies[]
+ * @param cmisAccessControlListType addACEs
+ * @param cmisAccessControlListType removeACEs
+ * @param cmisExtensionType extension
+ * @return createDocumentFromSourceResponse parameters
+ */
+ public function createDocumentFromSource($repositoryId, $sourceId, $properties, $folderId = NULL, $versioningState = NULL, $policies = NULL, cmisAccessControlListType $addACEs = NULL, cmisAccessControlListType $removeACEs = NULL, $extension = NULL) {
+ $parameter = new createDocumentFromSource();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($sourceId)) $parameter->sourceId = (string)$sourceId;
+ if (isset($properties)) $parameter->properties = $this->encodeProperties($properties);
+ if (isset($folderId)) $parameter->folderId = (string)$folderId;
+ if (isset($versioningState)) $parameter->versioningState = $versioningState;
+ if (isset($policies)) $parameter->policies = (string)$policies;
+ else $parameter->policies = array(); // fix issues with array not set
+ if (isset($addACEs)) $parameter->addACEs = $addACEs;
+ if (isset($removeACEs)) $parameter->removeACEs = $removeACEs;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->ObjectService->__soapCall('createDocumentFromSource', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response;
+ }
+
+ /**
+ *
+ * createFolder
+ *
+ * @param string repositoryId
+ * @param cmisPropertiesType properties
+ * @param string folderId
+ * @param string policies[]
+ * @param cmisAccessControlListType addACEs
+ * @param cmisAccessControlListType removeACEs
+ * @param cmisExtensionType extension
+ * @return createFolderResponse parameters
+ */
+ public function createFolder($repositoryId, $properties, $folderId, $policies = NULL, cmisAccessControlListType $addACEs = NULL, cmisAccessControlListType $removeACEs = NULL, $extension = NULL) {
+ $parameter = new createFolder();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($properties)) $parameter->properties = $this->encodeProperties($properties);
+ if (isset($folderId)) $parameter->folderId = (string)$folderId;
+ if (isset($policies)) $parameter->policies = (string)$policies;
+ else $parameter->policies = array(); // fix issues with array not set
+ if (isset($addACEs)) $parameter->addACEs = $addACEs;
+ if (isset($removeACEs)) $parameter->removeACEs = $removeACEs;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->ObjectService->__soapCall('createFolder', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response;
+ }
+
+ /**
+ *
+ * createRelationship
+ *
+ * @param string repositoryId
+ * @param cmisPropertiesType properties
+ * @param string policies[]
+ * @param cmisAccessControlListType addACEs
+ * @param cmisAccessControlListType removeACEs
+ * @param cmisExtensionType extension
+ * @return createRelationshipResponse parameters
+ */
+ public function createRelationship($repositoryId, $properties, $policies = NULL, cmisAccessControlListType $addACEs = NULL, cmisAccessControlListType $removeACEs = NULL, $extension = NULL) {
+ $parameter = new createRelationship();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($properties)) $parameter->properties = $this->encodeProperties($properties);
+ if (isset($policies)) $parameter->policies = (string)$policies;
+ else $parameter->policies = array(); // fix issues with array not set
+ if (isset($addACEs)) $parameter->addACEs = $addACEs;
+ if (isset($removeACEs)) $parameter->removeACEs = $removeACEs;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->ObjectService->__soapCall('createRelationship', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response;
+ }
+
+ /**
+ *
+ * createPolicy
+ *
+ * @param string repositoryId
+ * @param cmisPropertiesType properties
+ * @param string folderId
+ * @param string policies[]
+ * @param cmisAccessControlListType addACEs
+ * @param cmisAccessControlListType removeACEs
+ * @param cmisExtensionType extension
+ * @return createPolicyResponse parameters
+ */
+ public function createPolicy($repositoryId, $properties, $folderId = NULL, $policies = NULL, cmisAccessControlListType $addACEs = NULL, cmisAccessControlListType $removeACEs = NULL, $extension = NULL) {
+ $parameter = new createPolicy();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($properties)) $parameter->properties = $this->encodeProperties($properties);
+ if (isset($folderId)) $parameter->folderId = (string)$folderId;
+ if (isset($policies)) $parameter->policies = (string)$policies;
+ else $parameter->policies = array(); // fix issues with array not set
+ if (isset($addACEs)) $parameter->addACEs = $addACEs;
+ if (isset($removeACEs)) $parameter->removeACEs = $removeACEs;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->ObjectService->__soapCall('createPolicy', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response;
+ }
+
+ /**
+ *
+ * getAllowableActions
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param cmisExtensionType extension
+ * @return cmisAllowableActionsType allowableActions
+ */
+ public function getAllowableActions($repositoryId, $objectId, $extension = NULL) {
+ $parameter = new getAllowableActions();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->ObjectService->__soapCall('getAllowableActions', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response->allowableActions;
+ }
+
+ /**
+ *
+ * getObject
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param string filter
+ * @param boolean includeAllowableActions
+ * @param enumIncludeRelationships includeRelationships
+ * @param string renditionFilter
+ * @param boolean includePolicyIds
+ * @param boolean includeACL
+ * @param cmisExtensionType extension
+ * @return cmisObjectType object
+ */
+ public function getObject($repositoryId, $objectId, $filter = NULL, $includeAllowableActions = NULL, $includeRelationships = NULL, $renditionFilter = NULL, $includePolicyIds = NULL, $includeACL = NULL, $extension = NULL) {
+ $parameter = new getObject();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($filter)) $parameter->filter = (string)$filter;
+ if (isset($includeAllowableActions)) $parameter->includeAllowableActions = $includeAllowableActions;
+ if (isset($includeRelationships)) $parameter->includeRelationships = $includeRelationships;
+ if (isset($renditionFilter)) $parameter->renditionFilter = (string)$renditionFilter;
+ if (isset($includePolicyIds)) $parameter->includePolicyIds = $includePolicyIds;
+ if (isset($includeACL)) $parameter->includeACL = $includeACL;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->ObjectService->__soapCall('getObject', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ $this->decodeObjectProperties ($response->object);
+ return $response->object;
+ }
+
+ /**
+ *
+ * getProperties
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param string filter
+ * @param cmisExtensionType extension
+ * @return cmisPropertiesType properties
+ */
+ public function getProperties($repositoryId, $objectId, $filter = NULL, $extension = NULL) {
+ $parameter = new getProperties();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($filter)) $parameter->filter = (string)$filter;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->ObjectService->__soapCall('getProperties', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ $this->decodeProperties ($response->properties);
+ return $response->properties;
+ }
+
+ /**
+ *
+ * getRenditions
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param string renditionFilter
+ * @param integer maxItems
+ * @param integer skipCount
+ * @param cmisExtensionType extension
+ * @return cmisRenditionType renditions
+ */
+ public function getRenditions($repositoryId, $objectId, $renditionFilter = NULL, $maxItems = NULL, $skipCount = NULL, $extension = NULL) {
+ $parameter = new getRenditions();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($renditionFilter)) $parameter->renditionFilter = (string)$renditionFilter;
+ if (isset($maxItems)) $parameter->maxItems = $maxItems;
+ if (isset($skipCount)) $parameter->skipCount = $skipCount;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->ObjectService->__soapCall('getRenditions', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response->renditions;
+ }
+
+ /**
+ *
+ * getObjectByPath
+ *
+ * @param string repositoryId
+ * @param string path
+ * @param string filter
+ * @param boolean includeAllowableActions
+ * @param enumIncludeRelationships includeRelationships
+ * @param string renditionFilter
+ * @param boolean includePolicyIds
+ * @param boolean includeACL
+ * @param cmisExtensionType extension
+ * @return cmisObjectType object
+ */
+ public function getObjectByPath($repositoryId, $path, $filter = NULL, $includeAllowableActions = NULL, $includeRelationships = NULL, $renditionFilter = NULL, $includePolicyIds = NULL, $includeACL = NULL, $extension = NULL) {
+ $parameter = new getObjectByPath();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($path)) $parameter->path = (string)$path;
+ if (isset($filter)) $parameter->filter = (string)$filter;
+ if (isset($includeAllowableActions)) $parameter->includeAllowableActions = $includeAllowableActions;
+ if (isset($includeRelationships)) $parameter->includeRelationships = $includeRelationships;
+ if (isset($renditionFilter)) $parameter->renditionFilter = (string)$renditionFilter;
+ if (isset($includePolicyIds)) $parameter->includePolicyIds = $includePolicyIds;
+ if (isset($includeACL)) $parameter->includeACL = $includeACL;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->ObjectService->__soapCall('getObjectByPath', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ $this->decodeObjectProperties ($response->object);
+ return $response->object;
+ }
+
+ /**
+ *
+ * getContentStream
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param string streamId
+ * @param integer offset
+ * @param integer length
+ * @param cmisExtensionType extension
+ * @return cmisContentStreamType contentStream
+ */
+ public function getContentStream($repositoryId, $objectId, $streamId = NULL, $offset = NULL, $length = NULL, $extension = NULL) {
+ $parameter = new getContentStream();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($streamId)) $parameter->streamId = (string)$streamId;
+ if (isset($offset)) $parameter->offset = $offset;
+ if (isset($length)) $parameter->length = $length;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->ObjectService->__soapCall('getContentStream', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response->contentStream;
+ }
+
+ /**
+ *
+ * updateProperties
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param string changeToken
+ * @param cmisPropertiesType properties
+ * @param cmisExtensionType extension
+ * @return updatePropertiesResponse parameters
+ */
+ public function updateProperties($repositoryId, $objectId, $changeToken = NULL, $properties, $extension = NULL) {
+ $parameter = new updateProperties();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($changeToken)) $parameter->changeToken = (string)$changeToken;
+ if (isset($properties)) $parameter->properties = $this->encodeProperties($properties);
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->ObjectService->__soapCall('updateProperties', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response;
+ }
+
+ /**
+ *
+ * moveObject
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param string targetFolderId
+ * @param string sourceFolderId
+ * @param cmisExtensionType extension
+ * @return moveObjectResponse parameters
+ */
+ public function moveObject($repositoryId, $objectId, $targetFolderId, $sourceFolderId, $extension = NULL) {
+ $parameter = new moveObject();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($targetFolderId)) $parameter->targetFolderId = (string)$targetFolderId;
+ if (isset($sourceFolderId)) $parameter->sourceFolderId = (string)$sourceFolderId;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->ObjectService->__soapCall('moveObject', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response;
+ }
+
+ /**
+ *
+ * deleteObject
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param boolean allVersions
+ * @param cmisExtensionType extension
+ * @return cmisExtensionType extension
+ */
+ public function deleteObject($repositoryId, $objectId, $allVersions = NULL, $extension = NULL) {
+ $parameter = new deleteObject();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($allVersions)) $parameter->allVersions = $allVersions;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->ObjectService->__soapCall('deleteObject', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response->extension;
+ }
+
+ /**
+ *
+ * deleteTree
+ *
+ * @param string repositoryId
+ * @param string folderId
+ * @param boolean allVersions
+ * @param enumUnfileObject unfileObjects
+ * @param boolean continueOnFailure
+ * @param cmisExtensionType extension
+ * @return failedToDelete failedToDelete
+ */
+ public function deleteTree($repositoryId, $folderId, $allVersions = NULL, $unfileObjects = NULL, $continueOnFailure = NULL, $extension = NULL) {
+ $parameter = new deleteTree();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($folderId)) $parameter->folderId = (string)$folderId;
+ if (isset($allVersions)) $parameter->allVersions = $allVersions;
+ if (isset($unfileObjects)) $parameter->unfileObjects = $unfileObjects;
+ if (isset($continueOnFailure)) $parameter->continueOnFailure = $continueOnFailure;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->ObjectService->__soapCall('deleteTree', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response->failedToDelete;
+ }
+
+ /**
+ *
+ * setContentStream
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param boolean overwriteFlag
+ * @param string changeToken
+ * @param cmisContentStreamType contentStream
+ * @param cmisExtensionType extension
+ * @return setContentStreamResponse parameters
+ */
+ public function setContentStream($repositoryId, $objectId, $overwriteFlag = NULL, $changeToken = NULL, cmisContentStreamType $contentStream, $extension = NULL) {
+ $parameter = new setContentStream();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($overwriteFlag)) $parameter->overwriteFlag = $overwriteFlag;
+ if (isset($changeToken)) $parameter->changeToken = (string)$changeToken;
+ if (isset($contentStream)) $parameter->contentStream = $contentStream;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->ObjectService->__soapCall('setContentStream', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response;
+ }
+
+ /**
+ *
+ * deleteContentStream
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param string changeToken
+ * @param cmisExtensionType extension
+ * @return deleteContentStreamResponse parameters
+ */
+ public function deleteContentStream($repositoryId, $objectId, $changeToken = NULL, $extension = NULL) {
+ $parameter = new deleteContentStream();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($changeToken)) $parameter->changeToken = (string)$changeToken;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->ObjectService->__soapCall('deleteContentStream', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response;
+ }
+
+ /**
+ *
+ * applyPolicy
+ *
+ * @param string repositoryId
+ * @param string policyId
+ * @param string objectId
+ * @param cmisExtensionType extension
+ * @return cmisExtensionType extension
+ */
+ public function applyPolicy($repositoryId, $policyId, $objectId, $extension = NULL) {
+ $parameter = new applyPolicy();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($policyId)) $parameter->policyId = (string)$policyId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->PolicyService->__soapCall('applyPolicy', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response->extension;
+ }
+
+ /**
+ *
+ * removePolicy
+ *
+ * @param string repositoryId
+ * @param string policyId
+ * @param string objectId
+ * @param cmisExtensionType extension
+ * @return cmisExtensionType extension
+ */
+ public function removePolicy($repositoryId, $policyId, $objectId, $extension = NULL) {
+ $parameter = new removePolicy();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($policyId)) $parameter->policyId = (string)$policyId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->PolicyService->__soapCall('removePolicy', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response->extension;
+ }
+
+ /**
+ *
+ * getAppliedPolicies
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param string filter
+ * @param cmisExtensionType extension
+ * @return cmisObjectType objects
+ */
+ public function getAppliedPolicies($repositoryId, $objectId, $filter = NULL, $extension = NULL) {
+ $parameter = new getAppliedPolicies();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($filter)) $parameter->filter = (string)$filter;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->PolicyService->__soapCall('getAppliedPolicies', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ $this->decodeObjectProperties ($response->objects);
+ return $response->objects;
+ }
+
+ /**
+ *
+ * getObjectRelationships
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param boolean includeSubRelationshipTypes
+ * @param enumRelationshipDirection relationshipDirection
+ * @param string typeId
+ * @param string filter
+ * @param boolean includeAllowableActions
+ * @param integer maxItems
+ * @param integer skipCount
+ * @param cmisExtensionType extension
+ * @return cmisObjectListType objects
+ */
+ public function getObjectRelationships($repositoryId, $objectId, $includeSubRelationshipTypes = NULL, $relationshipDirection = NULL, $typeId = NULL, $filter = NULL, $includeAllowableActions = NULL, $maxItems = NULL, $skipCount = NULL, $extension = NULL) {
+ $parameter = new getObjectRelationships();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($includeSubRelationshipTypes)) $parameter->includeSubRelationshipTypes = $includeSubRelationshipTypes;
+ if (isset($relationshipDirection)) $parameter->relationshipDirection = $relationshipDirection;
+ if (isset($typeId)) $parameter->typeId = (string)$typeId;
+ if (isset($filter)) $parameter->filter = (string)$filter;
+ if (isset($includeAllowableActions)) $parameter->includeAllowableActions = $includeAllowableActions;
+ if (isset($maxItems)) $parameter->maxItems = $maxItems;
+ if (isset($skipCount)) $parameter->skipCount = $skipCount;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->RelationshipService->__soapCall('getObjectRelationships', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ $this->decodeObjectProperties ($response->objects->objects);
+ return $response->objects;
+ }
+
+ /**
+ *
+ * getRepositories
+ *
+ * @param cmisExtensionType extension
+ * @return cmisRepositoryEntryType repositories
+ */
+ public function getRepositories($extension = NULL) {
+ $parameter = new getRepositories();
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->RepositoryService->__soapCall('getRepositories', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response->repositories;
+ }
+
+ /**
+ *
+ * getRepositoryInfo
+ *
+ * @param string repositoryId
+ * @param cmisExtensionType extension
+ * @return cmisRepositoryInfoType repositoryInfo
+ */
+ public function getRepositoryInfo($repositoryId, $extension = NULL) {
+ $parameter = new getRepositoryInfo();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->RepositoryService->__soapCall('getRepositoryInfo', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response->repositoryInfo;
+ }
+
+ /**
+ *
+ * getTypeChildren
+ *
+ * @param string repositoryId
+ * @param string typeId
+ * @param boolean includePropertyDefinitions
+ * @param integer maxItems
+ * @param integer skipCount
+ * @param cmisExtensionType extension
+ * @return cmisTypeDefinitionListType types
+ */
+ public function getTypeChildren($repositoryId, $typeId = NULL, $includePropertyDefinitions = NULL, $maxItems = NULL, $skipCount = NULL, $extension = NULL) {
+ $parameter = new getTypeChildren();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($typeId)) $parameter->typeId = (string)$typeId;
+ if (isset($includePropertyDefinitions)) $parameter->includePropertyDefinitions = $includePropertyDefinitions;
+ if (isset($maxItems)) $parameter->maxItems = $maxItems;
+ if (isset($skipCount)) $parameter->skipCount = $skipCount;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->RepositoryService->__soapCall('getTypeChildren', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response->types;
+ }
+
+ /**
+ *
+ * getTypeDescendants
+ *
+ * @param string repositoryId
+ * @param string typeId
+ * @param integer depth
+ * @param boolean includePropertyDefinitions
+ * @param cmisExtensionType extension
+ * @return cmisTypeContainer types
+ */
+ public function getTypeDescendants($repositoryId, $typeId = NULL, $depth = NULL, $includePropertyDefinitions = NULL, $extension = NULL) {
+ $parameter = new getTypeDescendants();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($typeId)) $parameter->typeId = (string)$typeId;
+ if (isset($depth)) $parameter->depth = $depth;
+ if (isset($includePropertyDefinitions)) $parameter->includePropertyDefinitions = $includePropertyDefinitions;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->RepositoryService->__soapCall('getTypeDescendants', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response->types;
+ }
+
+ /**
+ *
+ * getTypeDefinition
+ *
+ * @param string repositoryId
+ * @param string typeId
+ * @param cmisExtensionType extension
+ * @return cmisTypeDefinitionType type
+ */
+ public function getTypeDefinition($repositoryId, $typeId, $extension = NULL) {
+ $parameter = new getTypeDefinition();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($typeId)) $parameter->typeId = (string)$typeId;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->RepositoryService->__soapCall('getTypeDefinition', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response->type;
+ }
+
+ /**
+ *
+ * checkOut
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param cmisExtensionType extension
+ * @return checkOutResponse parameters
+ */
+ public function checkOut($repositoryId, $objectId, $extension = NULL) {
+ $parameter = new checkOut();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->VersioningService->__soapCall('checkOut', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response;
+ }
+
+ /**
+ *
+ * cancelCheckOut
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param cmisExtensionType extension
+ * @return cmisExtensionType extension
+ */
+ public function cancelCheckOut($repositoryId, $objectId, $extension = NULL) {
+ $parameter = new cancelCheckOut();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->VersioningService->__soapCall('cancelCheckOut', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response->extension;
+ }
+
+ /**
+ *
+ * checkIn
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param boolean major
+ * @param cmisPropertiesType properties
+ * @param cmisContentStreamType contentStream
+ * @param string checkinComment
+ * @param string policies[]
+ * @param cmisAccessControlListType addACEs
+ * @param cmisAccessControlListType removeACEs
+ * @param cmisExtensionType extension
+ * @return checkInResponse parameters
+ */
+ public function checkIn($repositoryId, $objectId, $major = NULL, $properties = NULL, cmisContentStreamType $contentStream = NULL, $checkinComment = NULL, $policies = NULL, cmisAccessControlListType $addACEs = NULL, cmisAccessControlListType $removeACEs = NULL, $extension = NULL) {
+ $parameter = new checkIn();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($major)) $parameter->major = $major;
+ if (isset($properties)) $parameter->properties = $this->encodeProperties($properties);
+ if (isset($contentStream)) $parameter->contentStream = $contentStream;
+ if (isset($checkinComment)) $parameter->checkinComment = (string)$checkinComment;
+ if (isset($policies)) $parameter->policies = (string)$policies;
+ else $parameter->policies = array(); // fix issues with array not set
+ if (isset($addACEs)) $parameter->addACEs = $addACEs;
+ if (isset($removeACEs)) $parameter->removeACEs = $removeACEs;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->VersioningService->__soapCall('checkIn', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response;
+ }
+
+ /**
+ *
+ * getObjectOfLatestVersion
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param boolean major
+ * @param string filter
+ * @param boolean includeAllowableActions
+ * @param enumIncludeRelationships includeRelationships
+ * @param string renditionFilter
+ * @param boolean includePolicyIds
+ * @param boolean includeACL
+ * @param cmisExtensionType extension
+ * @return cmisObjectType object
+ */
+ public function getObjectOfLatestVersion($repositoryId, $objectId, $major = NULL, $filter = NULL, $includeAllowableActions = NULL, $includeRelationships = NULL, $renditionFilter = NULL, $includePolicyIds = NULL, $includeACL = NULL, $extension = NULL) {
+ $parameter = new getObjectOfLatestVersion();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($major)) $parameter->major = $major;
+ if (isset($filter)) $parameter->filter = (string)$filter;
+ if (isset($includeAllowableActions)) $parameter->includeAllowableActions = $includeAllowableActions;
+ if (isset($includeRelationships)) $parameter->includeRelationships = $includeRelationships;
+ if (isset($renditionFilter)) $parameter->renditionFilter = (string)$renditionFilter;
+ if (isset($includePolicyIds)) $parameter->includePolicyIds = $includePolicyIds;
+ if (isset($includeACL)) $parameter->includeACL = $includeACL;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->VersioningService->__soapCall('getObjectOfLatestVersion', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ $this->decodeObjectProperties ($response->object);
+ return $response->object;
+ }
+
+ /**
+ *
+ * getPropertiesOfLatestVersion
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param boolean major
+ * @param string filter
+ * @param cmisExtensionType extension
+ * @return cmisPropertiesType properties
+ */
+ public function getPropertiesOfLatestVersion($repositoryId, $objectId, $major = NULL, $filter = NULL, $extension = NULL) {
+ $parameter = new getPropertiesOfLatestVersion();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($major)) $parameter->major = $major;
+ if (isset($filter)) $parameter->filter = (string)$filter;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->VersioningService->__soapCall('getPropertiesOfLatestVersion', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ $this->decodeProperties ($response->properties);
+ return $response->properties;
+ }
+
+ /**
+ *
+ * getAllVersions
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param string filter
+ * @param boolean includeAllowableActions
+ * @param cmisExtensionType extension
+ * @return cmisObjectType objects
+ */
+ public function getAllVersions($repositoryId, $objectId, $filter = NULL, $includeAllowableActions = NULL, $extension = NULL) {
+ $parameter = new getAllVersions();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($filter)) $parameter->filter = (string)$filter;
+ if (isset($includeAllowableActions)) $parameter->includeAllowableActions = $includeAllowableActions;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->VersioningService->__soapCall('getAllVersions', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ $this->decodeObjectProperties ($response->objects);
+ return $response->objects;
+ }
+
+ /**
+ *
+ * getACL
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param boolean onlyBasicPermissions
+ * @param cmisExtensionType extension
+ * @return cmisACLType ACL
+ */
+ public function getACL($repositoryId, $objectId, $onlyBasicPermissions = NULL, $extension = NULL) {
+ $parameter = new getACL();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($onlyBasicPermissions)) $parameter->onlyBasicPermissions = $onlyBasicPermissions;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->ACLService->__soapCall('getACL', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response->ACL;
+ }
+
+ /**
+ *
+ * applyACL
+ *
+ * @param string repositoryId
+ * @param string objectId
+ * @param cmisAccessControlListType addACEs
+ * @param cmisAccessControlListType removeACEs
+ * @param enumACLPropagation ACLPropagation
+ * @param cmisExtensionType extension
+ * @return cmisACLType ACL
+ */
+ public function applyACL($repositoryId, $objectId, cmisAccessControlListType $addACEs = NULL, cmisAccessControlListType $removeACEs = NULL, $ACLPropagation = NULL, $extension = NULL) {
+ $parameter = new applyACL();
+ if (isset($repositoryId)) $parameter->repositoryId = (string)$repositoryId;
+ if (isset($objectId)) $parameter->objectId = (string)$objectId;
+ if (isset($addACEs)) $parameter->addACEs = $addACEs;
+ if (isset($removeACEs)) $parameter->removeACEs = $removeACEs;
+ if (isset($ACLPropagation)) $parameter->ACLPropagation = $ACLPropagation;
+ if (isset($extension)) $parameter->extension = $extension;
+
+ $parameter = new SoapVar($parameter, SOAP_ENC_OBJECT);
+
+ try {
+ $response = $this->ACLService->__soapCall('applyACL', array($parameter));
+ }
+ catch (SoapFault $sf) {
+ if (function_exists($this->errorFunction)) {
+ $function = $this->errorFunction;
+ $function($sf);
+ } else {
+ echo "\nSoapFault ERROR: " . $sf->getMessage() . "\n";
+ }
+ }
+ return $response->ACL;
+ }
+
+
+
+ /**
+ * Convert from propertiesArray (one array with named properties)
+ * to cmisPropertiesType (individual arrays per type)
+ *
+ * @param array $propertiesArray
+ * @return \cmisPropertiesType
+ */
+ private function encodeProperties($propertiesArray) {
+ $propertiesObject = new cmisPropertiesType;
+ foreach (get_class_vars('cmisPropertiesType') as $propertyType => $propertyDefault) {
+ $propertiesObject->$propertyType = array(); // initialize empty array to avoid nil values
+ }
+ foreach ($propertiesArray as $propertyName => $propertyValue) { // loop over all properties
+ if (is_object($propertyValue)) { // passed as property object
+ $propertyType = get_class($propertyValue); // find out type,
+ if (substr($propertyType, 0, 12) == 'cmisProperty') { // ensure it's a property type
+ $propertyField = 'property' . substr($propertyType, 12); // get name of array
+ $propertyValue->propertyDefinitionId = $propertyName; // assign property name
+ array_push($propertiesObject->$propertyField, $propertyValue); // and value
+ } else {
+ $propertyValue->value = (string)$propertyValue; // other object, convert to string
+ } // and assign
+ }
+ if (!is_object($propertyValue)) { // take all other properties as string
+ $property = new propertyString($propertyValue); // create and fill string property
+ $property->propertyDefinitionId = $propertyName;
+ array_push($propertiesObject->propertyString, $property); // and assign it
+ }
+ }
+ return $propertiesObject;
+ }
+
+ /**
+ * Convert from cmisPropertiesType (object with individual arrays per type=
+ * to one properties array with named property objects
+ *
+ * @param cmisPropertiesType $propertiesObject
+ * @return array properties
+ */
+ private function decodeProperties(&$propertiesObject) {
+ if (!isset($propertiesObject)) return;
+ $propertiesArray = array();
+ foreach (get_object_vars($propertiesObject) as $propertyType => $propertyValues) { // loop over all types
+ if (!is_array($propertyValues)) continue; // skip empty types
+ if ($propertyType == 'any') continue; // skip any, eg aspects from Alfresco for now
+ foreach ($propertyValues as $propertyValue) { // loop over all properties of this type
+ $propertiesArray[$propertyValue->propertyDefinitionId] = $propertyValue; // fill array with name and value
+ }
+ }
+ $propertiesObject = $propertiesArray;
+ }
+
+ private function decodeObjectProperties(&$objects) {
+ if (!isset($objects)) return;
+ if (is_array($objects)) {
+ foreach ($objects as $object) {
+ $this->decodeProperties($object->properties);
+ if (isset($object->relationships)) {
+ $this->decodeObjectProperties($object->relationships);
+ }
+ }
+ }
+ else {
+ $this->decodeProperties($objects->properties);
+ if (isset($objects->relationships)) {
+ $this->decodeObjectProperties($objects->relationships);
+ }
+ }
+ }
+
+ private function decodeObjectInFolderProperties(&$objects) {
+ if (!isset($objects)) return;
+ if (is_array($objects)) {
+ foreach ($objects as $object) {
+ $this->decodeProperties($object->object->properties);
+ }
+ }
+ else {
+ $this->decodeProperties($objects->object->properties);
+ }
+ }
+
+ private function decodeObjectInFolderContainerProperties($objects) {
+ if (!isset($objects)) return;
+ if (is_array($objects)) {
+ foreach ($objects as $object) {
+ $this->decodeProperties($object->objectInFolder->object->properties);
+ if (isset($object->children)) {
+ $this->decodeObjectInFolderContainerProperties($object->children);
+ }
+ }
+ }
+ else {
+ $this->decodeProperties($objects->objectInFolder->object->properties);
+ if (isset($objects->children)) {
+ $this->decodeObjectInFolderContainerProperties($objects->children);
+ }
+ }
+ }
+}
+
+
+?>
diff --git a/soap/include/cmisTypeDefinitions.php b/soap/include/cmisTypeDefinitions.php
new file mode 100644
index 0000000..bf873b2
--- /dev/null
+++ b/soap/include/cmisTypeDefinitions.php
@@ -0,0 +1,1282 @@
+<?php
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+ /**
+ * CMIS Type Definitions
+ *
+ * Type definitions for the CMIS object model, to support the Web Services binding for PHP,
+ * as published by OASIS (http://www.oasis-open.org/committees/cmis/)
+ *
+ * @author Karsten Eberding
+ * @package CMISWebService
+ * @version 0.5
+ */
+
+class enumDecimalPrecision {
+ const value_32 = '32';
+ const value_64 = '64';
+}
+
+class enumContentStreamAllowed {
+ const notallowed = 'notallowed';
+ const allowed = 'allowed';
+ const required = 'required';
+}
+
+class enumCardinality {
+ const single = 'single';
+ const multi = 'multi';
+}
+
+class enumUpdatability {
+ const readonly = 'readonly';
+ const readwrite = 'readwrite';
+ const whencheckedout = 'whencheckedout';
+ const oncreate = 'oncreate';
+}
+
+class enumDateTimeResolution {
+ const year = 'year';
+ const date = 'date';
+ const time = 'time';
+}
+
+class enumPropertyType {
+ const boolean = 'boolean';
+ const id = 'id';
+ const integer = 'integer';
+ const datetime = 'datetime';
+ const decimal = 'decimal';
+ const html = 'html';
+ const string = 'string';
+ const uri = 'uri';
+}
+
+class enumBaseObjectTypeIds {
+ const cmis_document = 'cmis:document';
+ const cmis_folder = 'cmis:folder';
+ const cmis_relationship = 'cmis:relationship';
+ const cmis_policy = 'cmis:policy';
+}
+
+class enumCapabilityQuery {
+ const none = 'none';
+ const metadataonly = 'metadataonly';
+ const fulltextonly = 'fulltextonly';
+ const bothseparate = 'bothseparate';
+ const bothcombined = 'bothcombined';
+}
+
+class enumCapabilityJoin {
+ const none = 'none';
+ const inneronly = 'inneronly';
+ const innerandouter = 'innerandouter';
+}
+
+class enumCapabilityContentStreamUpdates {
+ const anytime = 'anytime';
+ const pwconly = 'pwconly';
+ const none = 'none';
+}
+
+class enumVersioningState {
+ const none = 'none';
+ const checkedout = 'checkedout';
+ const minor = 'minor';
+ const major = 'major';
+}
+
+class enumUnfileObject {
+ const unfile = 'unfile';
+ const deletesinglefiled = 'deletesinglefiled';
+ const delete = 'delete';
+}
+
+class enumRelationshipDirection {
+ const source = 'source';
+ const target = 'target';
+ const either = 'either';
+}
+
+class enumIncludeRelationships {
+ const none = 'none';
+ const source = 'source';
+ const target = 'target';
+ const both = 'both';
+}
+
+class enumPropertiesBase {
+ const cmis_name = 'cmis:name';
+ const cmis_objectId = 'cmis:objectId';
+ const cmis_objectTypeId = 'cmis:objectTypeId';
+ const cmis_baseTypeId = 'cmis:baseTypeId';
+ const cmis_createdBy = 'cmis:createdBy';
+ const cmis_creationDate = 'cmis:creationDate';
+ const cmis_lastModifiedBy = 'cmis:lastModifiedBy';
+ const cmis_lastModificationDate = 'cmis:lastModificationDate';
+ const cmis_changeToken = 'cmis:changeToken';
+}
+
+class enumPropertiesDocument {
+ const cmis_isImmutable = 'cmis:isImmutable';
+ const cmis_isLatestVersion = 'cmis:isLatestVersion';
+ const cmis_isMajorVersion = 'cmis:isMajorVersion';
+ const cmis_isLatestMajorVersion = 'cmis:isLatestMajorVersion';
+ const cmis_versionLabel = 'cmis:versionLabel';
+ const cmis_versionSeriesId = 'cmis:versionSeriesId';
+ const cmis_isVersionSeriesCheckedOut = 'cmis:isVersionSeriesCheckedOut';
+ const cmis_versionSeriesCheckedOutBy = 'cmis:versionSeriesCheckedOutBy';
+ const cmis_versionSeriesCheckedOutId = 'cmis:versionSeriesCheckedOutId';
+ const cmis_checkinComment = 'cmis:checkinComment';
+ const cmis_contentStreamLength = 'cmis:contentStreamLength';
+ const cmis_contentStreamMimeType = 'cmis:contentStreamMimeType';
+ const cmis_contentStreamFileName = 'cmis:contentStreamFileName';
+ const cmis_contentStreamId = 'cmis:contentStreamId';
+}
+
+class enumPropertiesFolder {
+ const cmis_parentId = 'cmis:parentId';
+ const cmis_allowedChildObjectTypeIds = 'cmis:allowedChildObjectTypeIds';
+ const cmis_path = 'cmis:path';
+}
+
+class enumPropertiesRelationship {
+ const cmis_sourceId = 'cmis:sourceId';
+ const cmis_targetId = 'cmis:targetId';
+}
+
+class enumPropertiesPolicy {
+ const cmis_policyText = 'cmis:policyText';
+}
+
+class cmisObjectType {
+ public $properties; // cmisPropertiesType
+ public $allowableActions; // cmisAllowableActionsType
+ public $relationship; // cmisObjectType
+ public $changeEventInfo; // cmisChangeEventType
+ public $acl; // cmisAccessControlListType
+ public $exactACL; // boolean
+ public $policyIds; // cmisListOfIdsType
+ public $rendition; // cmisRenditionType
+}
+
+class cmisPropertiesType {
+ public $propertyBoolean; // cmisPropertyBoolean
+ public $propertyId; // cmisPropertyId
+ public $propertyInteger; // cmisPropertyInteger
+ public $propertyDateTime; // cmisPropertyDateTime
+ public $propertyDecimal; // cmisPropertyDecimal
+ public $propertyHtml; // cmisPropertyHtml
+ public $propertyString; // cmisPropertyString
+ public $propertyUri; // cmisPropertyUri
+}
+
+class cmisProperty {
+
+ public $value;
+
+ public function __construct($v) {
+ if (is_array($v)) $this->value = $v;
+ else $this->value = array($v);
+ }
+
+ public function __toString() {
+ if (isset($this->value[0])) return $this->value[0];
+ else return (NULL);
+ }
+
+ public function single() {
+ if (isset($this->value[0])) return $this->value[0];
+ else return (NULL);
+ }
+
+ public function multi() {
+ if (isset($this->value)) return $this->value;
+ else return (NULL);
+ }
+}
+
+class cmisPropertyBoolean extends cmisProperty {
+}
+
+class cmisPropertyId extends cmisProperty {
+}
+
+class cmisPropertyInteger extends cmisProperty {
+}
+
+class cmisPropertyDateTime extends cmisProperty {
+}
+
+class cmisPropertyDecimal extends cmisProperty {
+}
+
+class cmisPropertyHtml extends cmisProperty {
+}
+
+class cmisPropertyString extends cmisProperty {
+}
+
+class cmisPropertyUri extends cmisProperty {
+}
+
+class cmisChoice {
+}
+
+class cmisChoiceBoolean extends cmisChoice {
+ public $value; // boolean
+ public $choice; // cmisChoiceBoolean
+}
+
+class cmisChoiceId extends cmisChoice {
+ public $value; // string
+ public $choice; // cmisChoiceId
+}
+
+class cmisChoiceInteger extends cmisChoice {
+ public $value; // integer
+ public $choice; // cmisChoiceInteger
+}
+
+class cmisChoiceDateTime extends cmisChoice {
+ public $value; // dateTime
+ public $choice; // cmisChoiceDateTime
+}
+
+class cmisChoiceDecimal extends cmisChoice {
+ public $value; // decimal
+ public $choice; // cmisChoiceDecimal
+}
+
+class cmisChoiceHtml extends cmisChoice {
+ public $value; // string
+ public $choice; // cmisChoiceHtml
+}
+
+class cmisChoiceString extends cmisChoice {
+ public $value; // string
+ public $choice; // cmisChoiceString
+}
+
+class cmisChoiceUri extends cmisChoice {
+ public $value; // anyURI
+ public $choice; // cmisChoiceUri
+}
+
+class cmisAllowableActionsType {
+ public $canDeleteObject; // boolean
+ public $canUpdateProperties; // boolean
+ public $canGetFolderTree; // boolean
+ public $canGetProperties; // boolean
+ public $canGetObjectRelationships; // boolean
+ public $canGetObjectParents; // boolean
+ public $canGetFolderParent; // boolean
+ public $canGetDescendants; // boolean
+ public $canMoveObject; // boolean
+ public $canDeleteContentStream; // boolean
+ public $canCheckOut; // boolean
+ public $canCancelCheckOut; // boolean
+ public $canCheckIn; // boolean
+ public $canSetContentStream; // boolean
+ public $canGetAllVersions; // boolean
+ public $canAddObjectToFolder; // boolean
+ public $canRemoveObjectFromFolder; // boolean
+ public $canGetContentStream; // boolean
+ public $canApplyPolicy; // boolean
+ public $canGetAppliedPolicies; // boolean
+ public $canRemovePolicy; // boolean
+ public $canGetChildren; // boolean
+ public $canCreateDocument; // boolean
+ public $canCreateFolder; // boolean
+ public $canCreateRelationship; // boolean
+ public $canDeleteTree; // boolean
+ public $canGetRenditions; // boolean
+ public $canGetACL; // boolean
+ public $canApplyACL; // boolean
+}
+
+class cmisListOfIdsType {
+ public $id; // string
+}
+
+class cmisPropertyDefinitionType {
+ public $id; // string
+ public $localName; // string
+ public $localNamespace; // anyURI
+ public $displayName; // string
+ public $queryName; // string
+ public $description; // string
+ public $propertyType; // enumPropertyType
+ public $cardinality; // enumCardinality
+ public $updatability; // enumUpdatability
+ public $inherited; // boolean
+ public $required; // boolean
+ public $queryable; // boolean
+ public $orderable; // boolean
+ public $openChoice; // boolean
+}
+
+class cmisPropertyBooleanDefinitionType extends cmisPropertyDefinitionType {
+ public $defaultValue; // cmisPropertyBoolean
+ public $choice; // cmisChoiceBoolean
+}
+
+class cmisPropertyIdDefinitionType extends cmisPropertyDefinitionType {
+ public $defaultValue; // cmisPropertyId
+ public $choice; // cmisChoiceId
+}
+
+class cmisPropertyIntegerDefinitionType extends cmisPropertyDefinitionType {
+ public $defaultValue; // cmisPropertyInteger
+ public $maxValue; // integer
+ public $minValue; // integer
+ public $choice; // cmisChoiceInteger
+}
+
+class cmisPropertyDateTimeDefinitionType extends cmisPropertyDefinitionType {
+ public $defaultValue; // cmisPropertyDateTime
+ public $resolution; // enumDateTimeResolution
+ public $choice; // cmisChoiceDateTime
+}
+
+class cmisPropertyDecimalDefinitionType extends cmisPropertyDefinitionType {
+ public $defaultValue; // cmisPropertyDecimal
+ public $maxValue; // decimal
+ public $minValue; // decimal
+ public $precision; // enumDecimalPrecision
+ public $choice; // cmisChoiceDecimal
+}
+
+class cmisPropertyHtmlDefinitionType extends cmisPropertyDefinitionType {
+ public $defaultValue; // cmisPropertyHtml
+ public $choice; // cmisChoiceHtml
+}
+
+class cmisPropertyStringDefinitionType extends cmisPropertyDefinitionType {
+ public $defaultValue; // cmisPropertyString
+ public $maxLength; // integer
+ public $choice; // cmisChoiceString
+}
+
+class cmisPropertyUriDefinitionType extends cmisPropertyDefinitionType {
+ public $defaultValue; // cmisPropertyUri
+ public $choice; // cmisChoiceUri
+}
+
+class cmisTypeDefinitionType {
+ public $id; // string
+ public $localName; // string
+ public $localNamespace; // anyURI
+ public $displayName; // string
+ public $queryName; // string
+ public $description; // string
+ public $baseId; // enumBaseObjectTypeIds
+ public $parentId; // string
+ public $creatable; // boolean
+ public $fileable; // boolean
+ public $queryable; // boolean
+ public $fulltextIndexed; // boolean
+ public $includedInSupertypeQuery; // boolean
+ public $controllablePolicy; // boolean
+ public $controllableACL; // boolean
+ public $propertyBooleanDefinition; // cmisPropertyBooleanDefinitionType
+ public $propertyDateTimeDefinition; // cmisPropertyDateTimeDefinitionType
+ public $propertyDecimalDefinition; // cmisPropertyDecimalDefinitionType
+ public $propertyIdDefinition; // cmisPropertyIdDefinitionType
+ public $propertyIntegerDefinition; // cmisPropertyIntegerDefinitionType
+ public $propertyHtmlDefinition; // cmisPropertyHtmlDefinitionType
+ public $propertyStringDefinition; // cmisPropertyStringDefinitionType
+ public $propertyUriDefinition; // cmisPropertyUriDefinitionType
+}
+
+class cmisTypeDocumentDefinitionType extends cmisTypeDefinitionType {
+ public $versionable; // boolean
+ public $contentStreamAllowed; // enumContentStreamAllowed
+}
+
+class cmisTypeFolderDefinitionType extends cmisTypeDefinitionType {
+}
+
+class cmisTypeRelationshipDefinitionType extends cmisTypeDefinitionType {
+ public $allowedSourceTypes; // string
+ public $allowedTargetTypes; // string
+}
+
+class cmisTypePolicyDefinitionType extends cmisTypeDefinitionType {
+}
+
+class cmisQueryType {
+ public $statement; // string
+ public $searchAllVersions; // boolean
+ public $includeAllowableActions; // boolean
+ public $includeRelationships; // enumIncludeRelationships
+ public $renditionFilter; // string
+ public $maxItems; // integer
+ public $skipCount; // integer
+}
+
+class cmisRepositoryInfoType {
+ public $repositoryId; // string
+ public $repositoryName; // string
+ public $repositoryDescription; // string
+ public $vendorName; // string
+ public $productName; // string
+ public $productVersion; // string
+ public $rootFolderId; // string
+ public $latestChangeLogToken; // string
+ public $capabilities; // cmisRepositoryCapabilitiesType
+ public $aclCapability; // cmisACLCapabilityType
+ public $cmisVersionSupported; // string
+ public $thinClientURI; // anyURI
+ public $changesIncomplete; // boolean
+ public $changesOnType; // enumBaseObjectTypeIds
+ public $principalAnonymous; // string
+ public $principalAnyone; // string
+}
+
+class cmisRepositoryCapabilitiesType {
+ public $capabilityACL; // enumCapabilityACL
+ public $capabilityAllVersionsSearchable; // boolean
+ public $capabilityChanges; // enumCapabilityChanges
+ public $capabilityContentStreamUpdatability; // enumCapabilityContentStreamUpdates
+ public $capabilityGetDescendants; // boolean
+ public $capabilityGetFolderTree; // boolean
+ public $capabilityMultifiling; // boolean
+ public $capabilityPWCSearchable; // boolean
+ public $capabilityPWCUpdatable; // boolean
+ public $capabilityQuery; // enumCapabilityQuery
+ public $capabilityRenditions; // enumCapabilityRendition
+ public $capabilityUnfiling; // boolean
+ public $capabilityVersionSpecificFiling; // boolean
+ public $capabilityJoin; // enumCapabilityJoin
+}
+
+class enumTypeOfChanges {
+ const created = 'created';
+ const updated = 'updated';
+ const deleted = 'deleted';
+ const security = 'security';
+}
+
+class enumCapabilityChanges {
+ const none = 'none';
+ const objectidsonly = 'objectidsonly';
+ const properties = 'properties';
+ const all = 'all';
+}
+
+class cmisChangeEventType {
+ public $changeType; // enumTypeOfChanges
+ public $changeTime; // dateTime
+}
+
+class enumACLPropagation {
+ const repositorydetermined = 'repositorydetermined';
+ const objectonly = 'objectonly';
+ const propagate = 'propagate';
+}
+
+class enumCapabilityACL {
+ const none = 'none';
+ const discover = 'discover';
+ const manage = 'manage';
+}
+
+class enumBasicPermissions {
+ const cmis_read = 'cmis:read';
+ const cmis_write = 'cmis:write';
+ const cmis_all = 'cmis:all';
+}
+
+class cmisPermissionDefinition {
+ public $permission; // string
+ public $description; // string
+}
+
+class cmisPermissionMapping {
+ public $key; // enumAllowableActionsKey
+ public $permission; // string
+}
+
+class enumAllowableActionsKey {
+ const canGetDescendents_Folder = 'canGetDescendents.Folder';
+ const canGetChildren_Folder = 'canGetChildren.Folder';
+ const canGetParents_Folder = 'canGetParents.Folder';
+ const canGetFolderParent_Object = 'canGetFolderParent.Object';
+ const canCreateDocument_Folder = 'canCreateDocument.Folder';
+ const canCreateFolder_Folder = 'canCreateFolder.Folder';
+ const canCreateRelationship_Source = 'canCreateRelationship.Source';
+ const canCreateRelationship_Target = 'canCreateRelationship.Target';
+ const canGetProperties_Object = 'canGetProperties.Object';
+ const canViewContent_Object = 'canViewContent.Object';
+ const canUpdateProperties_Object = 'canUpdateProperties.Object';
+ const canMove_Object = 'canMove.Object';
+ const canMove_Target = 'canMove.Target';
+ const canMove_Source = 'canMove.Source';
+ const canDelete_Object = 'canDelete.Object';
+ const canDeleteTree_Folder = 'canDeleteTree.Folder';
+ const canSetContent_Document = 'canSetContent.Document';
+ const canDeleteContent_Document = 'canDeleteContent.Document';
+ const canAddToFolder_Object = 'canAddToFolder.Object';
+ const canAddToFolder_Folder = 'canAddToFolder.Folder';
+ const canRemoveFromFolder_Object = 'canRemoveFromFolder.Object';
+ const canRemoveFromFolder_Folder = 'canRemoveFromFolder.Folder';
+ const canCheckout_Document = 'canCheckout.Document';
+ const canCancelCheckout_Document = 'canCancelCheckout.Document';
+ const canCheckin_Document = 'canCheckin.Document';
+ const canGetAllVersions_VersionSeries = 'canGetAllVersions.VersionSeries';
+ const canGetObjectRelationships_Object = 'canGetObjectRelationships.Object';
+ const canAddPolicy_Object = 'canAddPolicy.Object';
+ const canAddPolicy_Policy = 'canAddPolicy.Policy';
+ const canRemovePolicy_Object = 'canRemovePolicy.Object';
+ const canRemovePolicy_Policy = 'canRemovePolicy.Policy';
+ const canGetAppliedPolicies_Object = 'canGetAppliedPolicies.Object';
+ const canGetACL_Object = 'canGetACL.Object';
+ const canApplyACL_Object = 'canApplyACL.Object';
+}
+
+class enumUsers {
+ const cmis_user = 'cmis:user';
+}
+
+class cmisAccessControlPrincipalType {
+ public $principalId; // string
+}
+
+class cmisAccessControlEntryType {
+ public $principal; // cmisAccessControlPrincipalType
+ public $permission; // string
+ public $direct; // boolean
+}
+
+class cmisAccessControlListType {
+ public $permission; // cmisAccessControlEntryType
+}
+
+class cmisACLCapabilityType {
+ public $supportedPermissions; // enumSupportedPermissions
+ public $propagation; // enumACLPropagation
+ public $permissions; // cmisPermissionDefinition
+ public $mapping; // cmisPermissionMapping
+}
+
+class enumSupportedPermissions {
+ const basic = 'basic';
+ const repository = 'repository';
+ const both = 'both';
+}
+
+class enumCapabilityRendition {
+ const none = 'none';
+ const read = 'read';
+}
+
+class enumRenditionKind {
+ const cmis_thumbnail = 'cmis:thumbnail';
+}
+
+class cmisRenditionType {
+ public $streamId; // string
+ public $mimetype; // string
+ public $length; // integer
+ public $kind; // string
+ public $title; // string
+ public $height; // integer
+ public $width; // integer
+ public $renditionDocumentId; // string
+}
+
+class cmisFaultType {
+ public $type; // enumServiceException
+ public $code; // integer
+ public $message; // string
+}
+
+class enumServiceException {
+ const constraint = 'constraint';
+ const nameConstraintViolation = 'nameConstraintViolation';
+ const contentAlreadyExists = 'contentAlreadyExists';
+ const filterNotValid = 'filterNotValid';
+ const invalidArgument = 'invalidArgument';
+ const notSupported = 'notSupported';
+ const objectNotFound = 'objectNotFound';
+ const permissionDenied = 'permissionDenied';
+ const runtime = 'runtime';
+ const storage = 'storage';
+ const streamNotSupported = 'streamNotSupported';
+ const updateConflict = 'updateConflict';
+ const versioning = 'versioning';
+}
+
+class cmisExtensionType {
+}
+
+class cmisTypeContainer {
+ public $type; // cmisTypeDefinitionType
+ public $children; // cmisTypeContainer
+}
+
+class cmisTypeDefinitionListType {
+ public $types; // cmisTypeDefinitionType
+ public $hasMoreItems; // boolean
+ public $numItems; // integer
+}
+
+class cmisObjectInFolderContainerType {
+ public $objectInFolder; // cmisObjectInFolderType
+ public $children; // cmisObjectInFolderContainerType
+}
+
+class cmisObjectListType {
+ public $objects; // cmisObjectType
+ public $hasMoreItems; // boolean
+ public $numItems; // integer
+}
+
+class cmisObjectInFolderType {
+ public $object; // cmisObjectType
+ public $pathSegment; // string
+}
+
+class cmisObjectParentsType {
+ public $object; // cmisObjectType
+ public $relativePathSegment; // string
+}
+
+class cmisObjectInFolderListType {
+ public $objects; // cmisObjectInFolderType
+ public $hasMoreItems; // boolean
+ public $numItems; // integer
+}
+
+class cmisRepositoryEntryType {
+ public $repositoryId; // string
+ public $repositoryName; // string
+}
+
+class cmisContentStreamType {
+ public $length; // integer
+ public $mimeType; // string
+ public $filename; // string
+ public $stream; // base64Binary
+}
+
+class cmisACLType {
+ public $ACL; // cmisAccessControlListType
+ public $exact; // boolean
+}
+
+class getRepositories {
+ public $extension; // cmisExtensionType
+}
+
+class getRepositoriesResponse {
+ public $repositories; // cmisRepositoryEntryType
+}
+
+class getRepositoryInfo {
+ public $repositoryId; // string
+ public $extension; // cmisExtensionType
+}
+
+class getRepositoryInfoResponse {
+ public $repositoryInfo; // cmisRepositoryInfoType
+}
+
+class getTypeChildren {
+ public $repositoryId; // string
+ public $typeId; // string
+ public $includePropertyDefinitions; // boolean
+ public $maxItems; // integer
+ public $skipCount; // integer
+ public $extension; // cmisExtensionType
+}
+
+class getTypeChildrenResponse {
+ public $types; // cmisTypeDefinitionListType
+}
+
+class getTypeDescendants {
+ public $repositoryId; // string
+ public $typeId; // string
+ public $depth; // integer
+ public $includePropertyDefinitions; // boolean
+ public $extension; // cmisExtensionType
+}
+
+class getTypeDescendantsResponse {
+ public $types; // cmisTypeContainer
+}
+
+class getTypeDefinition {
+ public $repositoryId; // string
+ public $typeId; // string
+ public $extension; // cmisExtensionType
+}
+
+class getTypeDefinitionResponse {
+ public $type; // cmisTypeDefinitionType
+}
+
+class getDescendants {
+ public $repositoryId; // string
+ public $folderId; // string
+ public $depth; // integer
+ public $filter; // string
+ public $includeAllowableActions; // boolean
+ public $includeRelationships; // enumIncludeRelationships
+ public $renditionFilter; // string
+ public $includePathSegment; // boolean
+ public $extension; // cmisExtensionType
+}
+
+class getDescendantsResponse {
+ public $objects; // cmisObjectInFolderContainerType
+}
+
+class getFolderTree {
+ public $repositoryId; // string
+ public $folderId; // string
+ public $depth; // integer
+ public $filter; // string
+ public $includeAllowableActions; // boolean
+ public $includeRelationships; // enumIncludeRelationships
+ public $renditionFilter; // string
+ public $includePathSegment; // boolean
+ public $extension; // cmisExtensionType
+}
+
+class getFolderTreeResponse {
+ public $objects; // cmisObjectInFolderContainerType
+}
+
+class getChildren {
+ public $repositoryId; // string
+ public $folderId; // string
+ public $filter; // string
+ public $orderBy; // string
+ public $includeAllowableActions; // boolean
+ public $includeRelationships; // enumIncludeRelationships
+ public $renditionFilter; // string
+ public $includePathSegment; // boolean
+ public $maxItems; // integer
+ public $skipCount; // integer
+ public $extension; // cmisExtensionType
+}
+
+class getChildrenResponse {
+ public $objects; // cmisObjectInFolderListType
+}
+
+class getFolderParent {
+ public $repositoryId; // string
+ public $folderId; // string
+ public $filter; // string
+ public $extension; // cmisExtensionType
+}
+
+class getFolderParentResponse {
+ public $object; // cmisObjectType
+}
+
+class getObjectParents {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $filter; // string
+ public $includeAllowableActions; // boolean
+ public $includeRelationships; // enumIncludeRelationships
+ public $renditionFilter; // string
+ public $includeRelativePathSegment; // boolean
+ public $extension; // cmisExtensionType
+}
+
+class getObjectParentsResponse {
+ public $parents; // cmisObjectParentsType
+}
+
+class getRenditions {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $renditionFilter; // string
+ public $maxItems; // integer
+ public $skipCount; // integer
+ public $extension; // cmisExtensionType
+}
+
+class getRenditionsResponse {
+ public $renditions; // cmisRenditionType
+}
+
+class getCheckedOutDocs {
+ public $repositoryId; // string
+ public $folderId; // string
+ public $filter; // string
+ public $orderBy; // string
+ public $includeAllowableActions; // boolean
+ public $includeRelationships; // enumIncludeRelationships
+ public $renditionFilter; // string
+ public $maxItems; // integer
+ public $skipCount; // integer
+ public $extension; // cmisExtensionType
+}
+
+class getCheckedOutDocsResponse {
+ public $objects; // cmisObjectListType
+}
+
+class createDocument {
+ public $repositoryId; // string
+ public $properties; // cmisPropertiesType
+ public $folderId; // string
+ public $contentStream; // cmisContentStreamType
+ public $versioningState; // enumVersioningState
+ public $policies; // string
+ public $addACEs; // cmisAccessControlListType
+ public $removeACEs; // cmisAccessControlListType
+ public $extension; // cmisExtensionType
+}
+
+class createDocumentResponse {
+ public $objectId; // string
+ public $extension; // cmisExtensionType
+}
+
+class createDocumentFromSource {
+ public $repositoryId; // string
+ public $sourceId; // string
+ public $properties; // cmisPropertiesType
+ public $folderId; // string
+ public $versioningState; // enumVersioningState
+ public $policies; // string
+ public $addACEs; // cmisAccessControlListType
+ public $removeACEs; // cmisAccessControlListType
+ public $extension; // cmisExtensionType
+}
+
+class createDocumentFromSourceResponse {
+ public $objectId; // string
+ public $extension; // cmisExtensionType
+}
+
+class createFolder {
+ public $repositoryId; // string
+ public $properties; // cmisPropertiesType
+ public $folderId; // string
+ public $policies; // string
+ public $addACEs; // cmisAccessControlListType
+ public $removeACEs; // cmisAccessControlListType
+ public $extension; // cmisExtensionType
+}
+
+class createFolderResponse {
+ public $objectId; // string
+ public $extension; // cmisExtensionType
+}
+
+class createRelationship {
+ public $repositoryId; // string
+ public $properties; // cmisPropertiesType
+ public $policies; // string
+ public $addACEs; // cmisAccessControlListType
+ public $removeACEs; // cmisAccessControlListType
+ public $extension; // cmisExtensionType
+}
+
+class createRelationshipResponse {
+ public $objectId; // string
+ public $extension; // cmisExtensionType
+}
+
+class createPolicy {
+ public $repositoryId; // string
+ public $properties; // cmisPropertiesType
+ public $folderId; // string
+ public $policies; // string
+ public $addACEs; // cmisAccessControlListType
+ public $removeACEs; // cmisAccessControlListType
+ public $extension; // cmisExtensionType
+}
+
+class createPolicyResponse {
+ public $objectId; // string
+ public $extension; // cmisExtensionType
+}
+
+class getAllowableActions {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $extension; // cmisExtensionType
+}
+
+class getAllowableActionsResponse {
+ public $allowableActions; // cmisAllowableActionsType
+}
+
+class getProperties {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $filter; // string
+ public $extension; // cmisExtensionType
+}
+
+class getPropertiesResponse {
+ public $properties; // cmisPropertiesType
+}
+
+class getObject {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $filter; // string
+ public $includeAllowableActions; // boolean
+ public $includeRelationships; // enumIncludeRelationships
+ public $renditionFilter; // string
+ public $includePolicyIds; // boolean
+ public $includeACL; // boolean
+ public $extension; // cmisExtensionType
+}
+
+class getObjectResponse {
+ public $object; // cmisObjectType
+}
+
+class getObjectByPath {
+ public $repositoryId; // string
+ public $path; // string
+ public $filter; // string
+ public $includeAllowableActions; // boolean
+ public $includeRelationships; // enumIncludeRelationships
+ public $renditionFilter; // string
+ public $includePolicyIds; // boolean
+ public $includeACL; // boolean
+ public $extension; // cmisExtensionType
+}
+
+class getObjectByPathResponse {
+ public $object; // cmisObjectType
+}
+
+class getContentStream {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $streamId; // string
+ public $offset; // integer
+ public $length; // integer
+ public $extension; // cmisExtensionType
+}
+
+class getContentStreamResponse {
+ public $contentStream; // cmisContentStreamType
+}
+
+class updateProperties {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $changeToken; // string
+ public $properties; // cmisPropertiesType
+ public $extension; // cmisExtensionType
+}
+
+class updatePropertiesResponse {
+ public $objectId; // string
+ public $changeToken; // string
+ public $extension; // cmisExtensionType
+}
+
+class moveObject {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $targetFolderId; // string
+ public $sourceFolderId; // string
+ public $extension; // cmisExtensionType
+}
+
+class moveObjectResponse {
+ public $objectId; // string
+ public $extension; // cmisExtensionType
+}
+
+class deleteObject {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $allVersions; // boolean
+ public $extension; // cmisExtensionType
+}
+
+class deleteObjectResponse {
+ public $extension; // cmisExtensionType
+}
+
+class deleteTree {
+ public $repositoryId; // string
+ public $folderId; // string
+ public $allVersions; // boolean
+ public $unfileObjects; // enumUnfileObject
+ public $continueOnFailure; // boolean
+ public $extension; // cmisExtensionType
+}
+
+class deleteTreeResponse {
+ public $failedToDelete; // failedToDelete
+}
+
+class failedToDelete {
+ public $objectIds; // string
+}
+
+class setContentStream {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $overwriteFlag; // boolean
+ public $changeToken; // string
+ public $contentStream; // cmisContentStreamType
+ public $extension; // cmisExtensionType
+}
+
+class setContentStreamResponse {
+ public $objectId; // string
+ public $changeToken; // string
+ public $extension; // cmisExtensionType
+}
+
+class deleteContentStream {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $changeToken; // string
+ public $extension; // cmisExtensionType
+}
+
+class deleteContentStreamResponse {
+ public $objectId; // string
+ public $changeToken; // string
+ public $extension; // cmisExtensionType
+}
+
+class addObjectToFolder {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $folderId; // string
+ public $allVersions; // boolean
+ public $extension; // cmisExtensionType
+}
+
+class addObjectToFolderResponse {
+ public $extension; // cmisExtensionType
+}
+
+class removeObjectFromFolder {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $folderId; // string
+ public $extension; // cmisExtensionType
+}
+
+class removeObjectFromFolderResponse {
+ public $extension; // cmisExtensionType
+}
+
+class query {
+ public $repositoryId; // string
+ public $statement; // string
+ public $searchAllVersions; // boolean
+ public $includeAllowableActions; // boolean
+ public $includeRelationships; // enumIncludeRelationships
+ public $renditionFilter; // string
+ public $maxItems; // integer
+ public $skipCount; // integer
+ public $extension; // cmisExtensionType
+}
+
+class queryResponse {
+ public $objects; // cmisObjectListType
+}
+
+class getContentChanges {
+ public $repositoryId; // string
+ public $changeLogToken; // string
+ public $includeProperties; // boolean
+ public $filter; // string
+ public $includePolicyIds; // boolean
+ public $includeACL; // boolean
+ public $maxItems; // integer
+ public $extension; // cmisExtensionType
+}
+
+class getContentChangesResponse {
+ public $objects; // cmisObjectListType
+ public $changeLogToken; // string
+}
+
+class checkOut {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $extension; // cmisExtensionType
+}
+
+class checkOutResponse {
+ public $objectId; // string
+ public $contentCopied; // boolean
+ public $extension; // cmisExtensionType
+}
+
+class cancelCheckOut {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $extension; // cmisExtensionType
+}
+
+class cancelCheckOutResponse {
+ public $extension; // cmisExtensionType
+}
+
+class checkIn {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $major; // boolean
+ public $properties; // cmisPropertiesType
+ public $contentStream; // cmisContentStreamType
+ public $checkinComment; // string
+ public $policies; // string
+ public $addACEs; // cmisAccessControlListType
+ public $removeACEs; // cmisAccessControlListType
+ public $extension; // cmisExtensionType
+}
+
+class checkInResponse {
+ public $objectId; // string
+ public $extension; // cmisExtensionType
+}
+
+class getPropertiesOfLatestVersion {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $major; // boolean
+ public $filter; // string
+ public $extension; // cmisExtensionType
+}
+
+class getPropertiesOfLatestVersionResponse {
+ public $properties; // cmisPropertiesType
+}
+
+class getObjectOfLatestVersion {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $major; // boolean
+ public $filter; // string
+ public $includeAllowableActions; // boolean
+ public $includeRelationships; // enumIncludeRelationships
+ public $renditionFilter; // string
+ public $includePolicyIds; // boolean
+ public $includeACL; // boolean
+ public $extension; // cmisExtensionType
+}
+
+class getObjectOfLatestVersionResponse {
+ public $object; // cmisObjectType
+}
+
+class getAllVersions {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $filter; // string
+ public $includeAllowableActions; // boolean
+ public $extension; // cmisExtensionType
+}
+
+class getAllVersionsResponse {
+ public $objects; // cmisObjectType
+}
+
+class getObjectRelationships {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $includeSubRelationshipTypes; // boolean
+ public $relationshipDirection; // enumRelationshipDirection
+ public $typeId; // string
+ public $filter; // string
+ public $includeAllowableActions; // boolean
+ public $maxItems; // integer
+ public $skipCount; // integer
+ public $extension; // cmisExtensionType
+}
+
+class getObjectRelationshipsResponse {
+ public $objects; // cmisObjectListType
+}
+
+class applyPolicy {
+ public $repositoryId; // string
+ public $policyId; // string
+ public $objectId; // string
+ public $extension; // cmisExtensionType
+}
+
+class applyPolicyResponse {
+ public $extension; // cmisExtensionType
+}
+
+class removePolicy {
+ public $repositoryId; // string
+ public $policyId; // string
+ public $objectId; // string
+ public $extension; // cmisExtensionType
+}
+
+class removePolicyResponse {
+ public $extension; // cmisExtensionType
+}
+
+class getAppliedPolicies {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $filter; // string
+ public $extension; // cmisExtensionType
+}
+
+class getAppliedPoliciesResponse {
+ public $objects; // cmisObjectType
+}
+
+class getACL {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $onlyBasicPermissions; // boolean
+ public $extension; // cmisExtensionType
+}
+
+class getACLResponse {
+ public $ACL; // cmisACLType
+}
+
+class applyACL {
+ public $repositoryId; // string
+ public $objectId; // string
+ public $addACEs; // cmisAccessControlListType
+ public $removeACEs; // cmisAccessControlListType
+ public $ACLPropagation; // enumACLPropagation
+ public $extension; // cmisExtensionType
+}
+
+class applyACLResponse {
+ public $ACL; // cmisACLType
+}
+
+class anyURI {
+}
+
+?>
diff --git a/soap/include/dialog.js b/soap/include/dialog.js
new file mode 100644
index 0000000..7b0224f
--- /dev/null
+++ b/soap/include/dialog.js
@@ -0,0 +1,54 @@
+function showModal(divId, notice, objectId) {
+ window.onscroll = function () {
+ document.getElementById(divId).style.top = document.body.scrollTop;
+ };
+
+ var elements, element;
+ var i;
+ var dialogNode = document.getElementById(divId);
+
+ // Set the notice text into the dialognotice DIV element
+ if (notice != null) {
+ elements = dialogNode.getElementsByTagName('div');
+ for (i=0; i<elements.length; i++) {
+ element = elements[i];
+ if (element.className == 'dialognotice') {
+ if (element.hasChildNodes()) {
+ while (element.childNodes.length >= 1) {
+ element.removeChild(element.firstChild);
+ }
+ }
+ element.appendChild(document.createTextNode(notice));
+ }
+ }
+ }
+
+ // Add objectid as hidden input parameter into form
+ if (objectId != null) {
+ var formElements = dialogNode.getElementsByTagName('form');
+ var formElement = formElements[0]; // assumes single form in dialog
+ var inputElements = formElement.getElementsByTagName('input');
+ for (i=0; i<inputElements.length; i++) {
+ var inputElement = inputElements[i];
+ if (inputElement.getAttribute('name') == 'objectid') {
+ element.parentNode.removeChild(inputElement);
+ }
+ }
+
+ var objectParam = document.createElement('input');
+ objectParam.setAttribute('type', 'hidden');
+ objectParam.setAttribute('name', 'objectid');
+ objectParam.setAttribute('value', objectId);
+ formElement.appendChild(objectParam);
+ }
+
+ // show dialog
+ document.getElementById(divId).style.display = "block";
+ document.getElementById(divId).style.top = document.body.scrollTop;
+}
+
+function hideModal(divID) {
+
+ // hide dialog
+ document.getElementById(divID).style.display = "none";
+}
diff --git a/soap/include/pcc.css b/soap/include/pcc.css
new file mode 100644
index 0000000..469f473
--- /dev/null
+++ b/soap/include/pcc.css
@@ -0,0 +1,168 @@
+/*
+ Document : gendoc
+ Created on : 03.08.2012, 19:32:13
+ Author : Karsten Eberding
+ Description:
+ Purpose of the stylesheet follows.
+*/
+
+body {
+ margin: auto;
+ display: block;
+ font-family: Arial, Verdana, sans-serif;
+}
+
+h1, h2 {
+ margin: 0px;
+ font-weight: bold;
+}
+
+.clear {
+ clear: both;
+ visibility: hidden;
+}
+
+.header {
+ background-color: #ddddff;
+ padding: 10px;
+}
+
+.titleContainer {
+ width: 100%;
+ height: 36px;
+}
+.errorMessage {
+ background-color: #cc0000;
+ padding: 12px;
+ color: #ffffff;
+}
+.folderList {
+ width: 25%;
+ float: left;
+ background-color: #eeeeee;
+ padding: 6px;
+ display: table;
+}
+
+.documentList {
+ width: 70%;
+ float: left;
+ display: inline-block;
+ padding: 6px;
+}
+
+.headerText {
+ font-size: 100%;
+}
+.moduleTitle {
+ font-size: 150%;
+ height: 28px;
+ width: 70%;
+ margin: 0px;
+ float: left;
+}
+
+.moduleSubTitle {
+ font-size: 100%;
+ text-align: right;
+ width: 30%;
+ margin: 0px;
+ float: left;
+}
+
+.logoutTitle {
+ float: left;
+ width: 30%;
+ height: 36px;
+ font-size: 100%;
+ text-align: right;
+}
+.dialoghead {
+ font-size: 120%;
+ height: 36px;
+ margin: 0px;
+ padding: 10px;
+ background-color: #ddddff;
+}
+.dialogbody {
+ padding: 10px;
+}
+.dialognotice {
+ color: brown;
+}
+.dialogLabel {
+ width: 30%;
+}
+.dialogField {
+ width: 70%;
+}
+
+.mainentry {
+ font-size: 120%;
+ font-weight: bold;
+ color: blue;
+}
+
+.actionlist {
+ font-size: 80%;
+ font-weight: normal;
+ margin: 0;
+ padding: 0;
+}
+
+.actionlist {
+ visibility: hidden;
+ display: block;
+ margin: 0 10px 0 0;
+ padding: 0 0 3px 0;
+}
+
+.actionlist span {
+ margin: 0 15px 0 0;
+}
+
+tr:hover .actionlist {
+ visibility: visible;
+}
+
+.modalContainer {
+ display: none;
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ top: 0px;
+ left: 0px;
+}
+
+.modalBackground {
+ filter: Alpha(Opacity=40);
+ -moz-opacity: 0.4;
+ opacity: 0.4;
+ width: 100%;
+ height: 100%;
+ background-color: #999999;
+ position: absolute;
+ z-index: 500;
+ top: 0px;
+ left: 0px;
+}
+
+.modalWindow {
+ position: absolute;
+ width: 400px;
+ left: 50%;
+ top: 50%;
+ z-index: 750;
+}
+
+.modalDialog {
+ background-color: white;
+ border: solid 6px black;
+ position: relative;
+ top: -200px;
+ left: -200px;
+ z-index: 1000;
+ width: 400px;
+ height: 300px;
+ padding: 0px;
+}
\ No newline at end of file
diff --git a/soap/index.php b/soap/index.php
new file mode 100644
index 0000000..faef097
--- /dev/null
+++ b/soap/index.php
@@ -0,0 +1,495 @@
+<?php
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+/* pcc - PHP CMIS Client
+ *
+ * @author Karsten Eberding
+ *
+ * URL parameters:
+ * action upload, download, checkin, checkout, cancelco,
+ * default to show list view
+ * objectid object to perform action on, no objectid shows list view
+ * folderid current Folder ID, defaults to root folder
+ * page page number for document list view, defaults to 1
+ */
+
+// TODO: logout button
+// TODO: delete object and folder
+// TODO: detail page for object and folder
+// TODO: improved error handling
+
+/*
+ * Part 1: Initialize variables and sessions
+ */
+require_once 'PccHTML.php';
+require_once 'include/CMISWebService.php';
+require_once 'include/CMISAlfrescoSoapClient.php';
+
+// Globals
+global $errorMessage; // holds error message from error handler
+
+// General configuration settings
+//$soapClient = 'CMISSoapClient'; // class name for CMIS Soap Client
+$soapClient = 'CMISAlfrescoSoapClient'; // class name for CMIS Soap Client
+$url = 'http://demoalf:8080/alfresco/cmisws/'; // URL for repository
+//$url = 'http://cmis.alfresco.com/cmisws/'; // URL for repository
+$cmisServices = array( // service endpoints for CMIS services, appended to $url
+ 'RepositoryService' => 'RepositoryService?wsdl',
+ 'DiscoveryService' => 'DiscoveryService?wsdl',
+ 'MultiFilingService' => 'MultiFilingService?wsdl',
+ 'NavigationService' => 'NavigationService?wsdl',
+ 'ObjectService' => 'ObjectService?wsdl',
+ 'PolicyService' => 'PolicyService?wsdl',
+ 'RelationshipService' => 'RelationshipService?wsdl',
+ 'VersioningService' => 'VersioningService?wsdl',
+ 'ACLService' => 'ACLService?wsdl',
+);
+$maxItems = 15; // max number of documents on a page
+$useQuery = true; // get document list with query, or with getChildren
+
+// Initialize variables and session
+$html = new PccHTML();
+$errorMesssage = '';
+session_start();
+
+// Get session parameters for current folder and page, if set
+$currentFolderId = (isset($_SESSION['cmisSession']['currentFolder'])) ? $_SESSION['cmisSession']['currentFolder'] : '';
+$currentPage = (isset($_SESSION['cmisSession']['currentPage'])) ? (int)$_SESSION['cmisSession']['currentPage'] : 1;
+
+// Get URL parameters, handle login
+if ($_SERVER['REQUEST_METHOD'] == 'GET') {
+ if (isset($_GET['folderid']) && ($_GET['folderid'] != '')) {
+ $newFolderId = urldecode($_GET['folderid']);
+ if ($newFolderId != $currentFolderId) { // reset page if folder changed
+ $currentPage = 1;
+ }
+ $currentFolderId = $newFolderId;
+ }
+ if (isset($_GET['page']) && ($_GET['page'] != '')) {
+ $currentPage = (int)$_GET['page'];
+ }
+ $currentDocId = (isset($_GET['objectid'])) ? urldecode($_GET['objectid']) : '';
+ $action = (isset($_GET['action'])) ? $_GET['action'] : '';
+ if ($action == 'login') { // display login form
+ echo $html->applyTemplate('loginForm');
+ exit;
+ }
+}
+if ($_SERVER['REQUEST_METHOD'] == 'POST') {
+ if (isset($_POST['folderid']) && ($_POST['folderid'] != '')) {
+ $newFolderId = urldecode($_POST['folderid']);
+ if ($newFolderId != $currentFolderId) { // reset page if folder changed
+ $currentPage = 1;
+ }
+ $currentFolderId = $newFolderId;
+ }
+ if (isset($_POST['page']) && ($_POST['page'] != '')) {
+ $currentPage = (int)$_POST['page'];
+ }
+ $currentDocId = (isset($_POST['objectid'])) ? urldecode($_POST['objectid']) : '';
+ $action = (isset($_POST['action'])) ? $_POST['action'] : '';
+ if ($action == 'login') { // process login information
+ $_SESSION['cmisSession']['username'] = $_POST['username'];
+ $_SESSION['cmisSession']['password'] = $_POST['password'];
+ }
+}
+
+// Forward to login page if credentials are not set
+if (!isset($_SESSION['cmisSession']['username']) || !isset($_SESSION['cmisSession']['password'])) {
+ $path = 'index.php?action=login';
+ header("Location: $path");
+ exit;
+}
+
+// Open a SOAP session to the CMIS repository
+$cmisSessionOptions = array(
+ 'CMISSoapClient' => $soapClient, // class name for custom SoapClient
+ 'CMISServices' => $cmisServices, // service endpoints
+ 'user_name' => $_SESSION['cmisSession']['username'],
+ 'password' => $_SESSION['cmisSession']['password']
+ );
+try {
+ $ecmClient = new CMISWebService($url, $cmisSessionOptions, 'errorMessage');
+} catch (Exception $e) {
+ error_message($e);
+}
+
+// credentials can be set after SOAP initialization, if not provided through options array
+// $ecmClient->setCredentials($ecmSession['username'], $ecmSession['password']);
+
+// Get basic information about repository
+$repositories = $ecmClient->getRepositories();
+$repositoryName = $repositories[0]->repositoryName; // Using first repository only
+$repositoryId = $repositories[0]->repositoryId;
+$repositoryInfo = $ecmClient->getRepositoryInfo($repositoryId);
+$rootFolderId = $repositoryInfo->rootFolderId;
+if ($currentFolderId == '') {
+ $currentFolderId = $rootFolderId;
+}
+$currentFolderName = (string) $currentFolderObject->properties['cmis:name'];
+$downloadFrame = '';
+
+// Save current folder and page in session for subsequent page requests
+$_SESSION['cmisSession']['currentFolder'] = $currentFolderId;
+$_SESSION['cmisSession']['currentPage'] = $currentPage;
+
+/*
+ * Part 2: handle different actions
+ */
+$pccLeft = '';
+$pccRight = '';
+switch ($action) {
+ case 'logout':
+ $ecmClient->clearCredentials();
+ unset($_SESSION['cmisSession']['username']);
+ unset($_SESSION['cmisSession']['password']);
+ $path = 'index.php?action=login';
+ header("Location: $path");
+ return;
+ break;
+ case 'createdocument':
+ createDocumentAction($ecmClient, $repositoryId, $_FILES['filename'], $_POST['createfilename'], $currentFolderId);
+ break;
+ case 'createfolder':
+ createFolderAction($ecmClient, $repositoryId, $_GET['createfoldername'], $currentFolderId);
+ break;
+ case 'checkin':
+ checkinAction($ecmClient, $repositoryId, $_FILES['filename'], $currentDocId);
+ break;
+ case 'upload':
+ uploadAction($ecmClient, $repositoryId, $_FILES['filename'], $currentDocId);
+ break;
+ case 'download':
+ downloadAction($ecmClient, $repositoryId, $currentDocId);
+ return; // do not continue to display new page
+ break;
+ case 'checkout':
+ $pwcId = urlencode(checkoutAction($ecmClient, $repositoryId, $currentDocId));
+ $downloadFrame = $html->applyTemplate('downloadFrame', $pwcId); // start download after page refresh
+ break;
+ case 'cancelco':
+ cancelcoAction($ecmClient, $repositoryId, $currentDocId);
+ break;
+ case 'delete':
+ deleteAction($ecmClient, $repositoryId, $currentDocId);
+ break;
+ case 'details':
+ $pccRight = documentDetails();
+ break;
+ default:
+ break;
+}
+
+// Generate output, if not done under action yet
+if ($pccLeft == '') {
+ $pccLeft = folderList($html, $ecmClient, $repositoryId, $currentFolderId, $rootFolderId, $useQuery);
+}
+if ($pccRight == '') {
+ $pccRight = documentList($html, $ecmClient, $repositoryId, $currentFolderId, $currentPage, $maxItems, $useQuery);
+}
+
+/*
+ * Part 3: Display page with folder list and document list or details
+ */
+
+/* Build page to display */
+echo $html->applyTemplate('htmlHeader');
+// all dialogs are included into the main page, to avoid page reloads for dialogs
+createModalDialog($html, 'checkin', 'Checkin');
+createModalDialog($html, 'checkout', 'Checkout');
+createModalDialog($html, 'cancelCO', 'Cancel Checkout');
+createModalDialog($html, 'uploadFile', 'Upload File');
+createModalDialog($html, 'delete', 'Confirm Delete');
+createModalDialog($html, 'createFolder', 'Create Folder');
+createModalDialog($html, 'createDocument', 'Create Document');
+echo $downloadFrame; // frame used for file download
+
+// Display header with path and buttons
+$pccPath = pccPath($html, $ecmClient, $repositoryId, $currentFolderId, $rootFolderId);
+$pccButtons = $html->applyTemplate('createFolderBtn', $currentFolderName)
+ . $html->applyTemplate('createDocumentBtn', $currentFolderName);
+echo $html->applyTemplate('pageHeader', $errorMessage, $pccPath, $pccButtons);
+
+// Display main page left and right
+echo $pccLeft;
+echo $pccRight;
+
+return;
+
+/*
+ * End of main program
+ */
+
+function pccPath($html, $ecmClient, $repositoryId, $currentFolderId, $rootFolderId) {
+
+ // Get current folder object and name
+ $currentFolderObject = $ecmClient->getObject($repositoryId, $currentFolderId, 'cmis:name');
+
+ // Build navigation path
+ $path = '';
+ $folderId = $currentFolderId;
+ while (true) { // loop upwards until root is reached
+ $folderObject = $ecmClient->getObject($repositoryId, $folderId, 'cmis:objectId, cmis:name, cmis:parentId');
+ $folderUrl = urlencode($folderObject->properties['cmis:objectId']);
+ $path = $html->applyTemplate('folderUrl', $folderUrl, $folderObject->properties['cmis:name']) . $path;
+ if ($folderId == $rootFolderId) {
+ break;
+ }
+ $path = ' > ' . $path;
+ $folderId = (string) $folderObject->properties['cmis:parentId'];
+ if (! $folderId) break; // avoid endless loop in case of error
+ }
+ return $path;
+}
+
+function folderList($html, $ecmClient, $repositoryId, $currentFolderId, $rootFolderId, $useQuery) {
+ // Get parent of current folder, set 'UP' for folder list
+ $folderList = "\n";
+ if ($currentFolderId !== $rootFolderId) {
+ $parentFolder = $ecmClient->getFolderParent($repositoryId, $currentFolderId);
+ $folderList .= $html->applyTemplate('folderListEntry', urlencode($parentFolder->properties['cmis:objectId']), '../' . $parentFolder->properties['cmis:name']);
+ }
+
+ // This code implements two versions to select all folder in the current folder
+ // 1) Using a query call. This may not work well with asynchronous search engines like Alfresco solr
+ // 2) Using getFolderTree.
+ if ($useQuery) {
+ $folderObjects = $ecmClient->query($repositoryId, "select * from cmis:folder where cmis:parentId = '$currentFolderId' order by cmis:name");
+ // Display all folder objects in folder list
+ if (count($folderObjects->objects) > 0) {
+ foreach ($folderObjects->objects as $object) {
+ // display each folder entry
+ $folderList .= $html->applyTemplate('folderListEntry', urlencode($object->properties['cmis:objectId']), $object->properties['cmis:name']);
+ }
+ }
+ } else {
+ $folders = $ecmClient->getFolderTree($repositoryId, $currentFolderId, 1, '*');
+ $numFolders = count($folders);
+ if ($numFolders > 0) {
+ $myFolders = array();
+ foreach ($folders as $folderContainer) {
+ // put into array for sorting
+ $object = $folderContainer->objectInFolder->object;
+ $myFolders[(string)$object->properties['cmis:name']] = $object;
+ }
+ ksort($myFolders); // sort array, getFolderTree does not support sorting
+ foreach ($myFolders as $name => $object) {
+ // display each folder entry
+ $folderList .= $html->applyTemplate('folderListEntry', urlencode($object->properties['cmis:objectId']), $name);
+ }
+ }
+ }
+ return $html->applyTemplate('folderList', $folderList);
+}
+
+function documentList($html, $ecmClient, $repositoryId, $currentFolderId, $currentPage, $maxItems, $useQuery) {
+ // This code implements two versions to select all documents in the current folder
+ // 1) Using a query call. This may not work well with asynchronous search engines like Alfresco solr
+ // 2) Using getChildren.
+ if ($useQuery) {
+ $documentObjects = $ecmClient->query($repositoryId,
+ "select * from cmis:document where in_folder('$currentFolderId') order by cmis:name",
+ FALSE, TRUE, enumIncludeRelationships::none, 'cmis:none', $maxItems, ($currentPage - 1) * $maxItems);
+ } else {
+ $children = $ecmClient->getChildren($repositoryId, $currentFolderId, '*', 'cmis:baseTypeId, cmis:name',
+ true, enumIncludeRelationships::none);
+ // create $documentObjects result as it would be returned by query
+ $documentObjects = new cmisObjectListType(); // Transform getChildren response into the query return type
+ $documentObjects->hasMoreItems = FALSE;
+ foreach ($children->objects as $child) {
+ if ((string) $child->object->properties['cmis:baseTypeId'] == 'cmis:document') {
+ $documentObjects->objects[] = $child->object;
+ }
+ }
+ }
+ // Display document list or empty message
+ if (count($documentObjects->objects) == 0) {
+ $documentHead = $html->applyTemplate('docListEmpty');
+ }
+ else {
+ $documentHead = $html->applyTemplate('docListHead');
+ $documentList = "\n";
+ // Loop over all documents
+ foreach ($documentObjects->objects as $object) {
+ // build list of actions with links for each object
+ $actionList = ''; // actions with links
+ $objectId = $object->properties['cmis:objectId']->single();
+ $objectUrl = urlencode($objectId);
+ $objectName = $object->properties['cmis:name']->single();
+ if ($object->properties['cmis:isVersionSeriesCheckedOut']->single()) { // object is checked out
+ if ($object->allowableActions->canCheckIn) { // allowed to upload and check in
+ $actionList .= $html->applyTemplate('uploadAction', $objectName, $objectUrl);
+ $actionList .= $html->applyTemplate('checkinAction', $objectName, $objectUrl);
+ }
+ if ($object->allowableActions->canCancelCheckOut) {
+ $actionList .= $html->applyTemplate('cancelCOAction', $objectName, $objectUrl);
+ }
+ }
+ else { // object is not checked out
+ if ($object->allowableActions->canCheckOut) {
+ $actionList .= $html->applyTemplate('checkoutAction', $objectName, $objectUrl);
+ }
+ }
+ if ($object->allowableActions->canDeleteObject) {
+ $actionList .= $html->applyTemplate('deleteAction', $objectName, $objectUrl);
+ }
+ $actionList .= $html->applyTemplate('detailsAction', $objectUrl);
+ // Display row with name, date and action links for object
+ $documentList .= $html->applyTemplate('docListEntry', $objectUrl, $objectName,
+ dateString($object->properties['cmis:lastModificationDate']), $actionList) . "\n";
+ }
+ }
+ // Display paging links if more than one page
+ $paging = '';
+ if ($documentObjects->hasMoreItems || $currentPage > 1) { // display page information
+ // if numItems ist set, maxPage can be calculated, otherwise use current or next page
+ $maxPage = (isset($documentObjects->numItems)) ? ceil($documentObjects->numItems / $maxItems) :
+ ($documentObjects->hasMoreItems ? $currentPage + 1 : $currentPage);
+ // display page numbers
+ for ($i = 1; $i <= $maxPage; $i++) {
+ if (($currentPage) == $i) {
+ $paging .= $html->applyTemplate('pageCurrent', $i);
+ } else {
+ $paging .= $html->applyTemplate('pageLink', urlencode($currentFolderId), $i);
+ }
+ }
+ $paging = $html->applyTemplate('pageList', $paging);
+ }
+ return $html->applyTemplate('documentList', $documentHead, $documentList, $paging);
+}
+
+function documentDetails() {
+ // TODO: display detail page for individual object
+ $documentList = "<div class=\"documentDetail\">Document Details not yet implemented.</div>\n";
+ return $documentList;
+}
+
+function dateString($d) {
+ $d = date_create($d);
+ $d = date_format($d, "d. M Y H:i");
+ return $d;
+}
+
+// Various actions
+function checkoutAction($ecmClient, $repositoryId, $objectId) {
+ $response = $ecmClient->checkOut($repositoryId, $objectId);
+ return $response->objectId;
+}
+
+function cancelcoAction($ecmClient, $repositoryId, $objectId) {
+ $object = $ecmClient->getObject($repositoryId, $objectId, '*');
+ if (isset($object->properties['cmis:versionSeriesCheckedOutId'])) {
+ $response = $ecmClient->cancelCheckOut($repositoryId, $object->properties['cmis:versionSeriesCheckedOutId']);
+ }
+}
+
+function deleteAction($ecmClient, $repositoryId, $objectId) {
+ $ecmClient->deleteObject($repositoryId, $objectId, TRUE);
+}
+
+function downloadAction($ecmClient, $repositoryId, $objectId) {
+
+ $object = $ecmClient->getObject($repositoryId, $objectId, '*');
+ $streamLength = $object->properties['cmis:contentStreamLength']->single();
+ $bufferLength = 0; // define buffer size, or 0 to disable buffering
+
+ if ($bufferLength == 0) { // don't use buffering, not implemented in OpenCMIS < 0.8 !
+ $stream = $ecmClient->getContentStream($repositoryId, $objectId, '');
+ header('Content-Type: ' . $stream->mimeType);
+ header('Content-Disposition: attachment; filename=' . $stream->filename);
+ header('Content-Length; ' . $streamLength);
+ echo $stream->stream;
+ flush();
+ } else {
+ // Send first content chunk, up to bufferLength
+ $stream = $ecmClient->getContentStream($repositoryId, $objectId, '', 0, $bufferLength);
+ header('Content-Type: ' . $stream->mimeType);
+ header('Content-Disposition: attachment; filename=' . $stream->filename);
+ header('Content-Length; ' . $streamLength);
+ echo $stream->stream;
+ flush();
+
+ // Send additional chunks if required
+ $offset = $bufferLength;
+ while ($offset < $streamLength) {
+ $stream = $ecmClient->getContentStream($repositoryId, $objectId, NULL, $offset, $bufferLength);
+ echo $stream->stream;
+ flush();
+ $offset += $bufferLength;
+ }
+ }
+}
+
+function checkinAction($ecmClient, $repositoryId, $file, $objectId) {
+ $stream = NULL;
+ $major = false;
+ $comment = NULL;
+ if (is_array($file) && $file['error'] == 0) {
+ $stream = new cmisContentStreamType();
+ $stream->length = $file['size'];
+ $stream->mimeType = $file['type'];
+ $stream->filename = $file['name'];
+ $stream->stream = file_get_contents($file['tmp_name']);
+ }
+ $object = $ecmClient->getObject($repositoryId, $objectId, '*');
+ if (isset($object->properties['cmis:versionSeriesCheckedOutId'])) {
+ $response = $ecmClient->checkIn($repositoryId, $object->properties['cmis:versionSeriesCheckedOutId'], $major, NULL, $stream, $comment);
+ }
+}
+
+function uploadAction($ecmClient, $repositoryId, $file, $objectId) {
+ $stream = new cmisContentStreamType();
+ $stream->length = $file['size'];
+ $stream->mimeType = $file['type'];
+ $stream->filename = $file['name'];
+ $stream->stream = file_get_contents($file['tmp_name']);
+
+ $ecmClient->setContentStream($repositoryId, $objectId, NULL, NULL, $stream);
+}
+
+function createFolderAction($ecmClient, $repositoryId, $createName, $folderId) {
+ $properties['cmis:name'] = new cmisPropertyString($createName);
+ $properties['cmis:objectTypeId'] = new cmisPropertyId('cmis:folder');
+ $response = $ecmClient->createFolder($repositoryId, $properties, $folderId);
+}
+
+function createDocumentAction($ecmClient, $repositoryId, $file, $createName, $folderId) {
+ $properties['cmis:name'] = new cmisPropertyString($createName);
+ $properties['cmis:objectTypeId'] = new cmisPropertyId('cmis:document');
+ $stream = new cmisContentStreamType();
+ if (is_array($file) && $file['error'] == 0) {
+ $stream->length = $file['size'];
+ $stream->mimeType = $file['type'];
+ $stream->filename = $file['name'];
+ $stream->stream = file_get_contents($file['tmp_name']);
+ }
+ $response = $ecmClient->createDocument($repositoryId, $properties, $folderId, $stream);
+}
+
+// Modal dialog
+function createModalDialog($html, $name, $title) {
+ echo $html->applyTemplate('modalDialog', $name, $title,
+ $html->applyTemplate($name . 'Dialog', $name));
+}
+
+function errorMessage($sf) {
+ global $errorMessage;
+ // Display Soap Fault error message on page, if any
+ $errorMessage .= "<div class=\"errorMessage\"><div class=\"ErrorTitle\">SOAP Error:</div>\n" . $sf->getMessage() . "</div>\n";
+}
+?>
\ No newline at end of file