コード例 #1
0
 function getCheckedOutDocs($repositoryId, $folderId = null, $filter = '', $includeAllowableActions, $includeRelationships, $maxItems = 0, $skipCount = 0)
 {
     $checkedout = array();
     $results = $this->ktapi->get_checkedout_docs(false);
     foreach ($results as $document) {
         $CMISDocument = new CMISDocumentObject($document->getId(), $this->ktapi);
         // set version label property - possibly belongs in document class
         $CMISDocument->setProperty('VersionLabel', $CMISDocument->getProperty('VersionSeriesCheckedOutId'));
         $checkedout[] = $CMISDocument->getProperties();
     }
     return $checkedout;
 }
コード例 #2
0
 public function checkOut($repositoryId, &$documentId, $changeToken = '')
 {
     $contentCopied = false;
     $documentId = CMISUtil::decodeObjectId($documentId, $typeId);
     // NOTE We are not planning on persisting the PWC beyond the current session, it will be re-created on access of the checked out document
     // TODO consider persisting in the database?  How will this relate to JSR if we are switching to that?
     // NOTE within the current system it is assumed if a new document metadata version is created that this is the latest version of the document
     // TODO see if there is an easy way to modify this, else we may not have an easy way to persist PWC objects
     // throw updateConflictException if the operation is attempting to update an object that is no longer current (as determined by the repository).
     try {
         $pwc = new CMISDocumentObject($documentId, $this->ktapi);
     } catch (exception $e) {
         throw new UpdateConflictException($e->getMessage());
     }
     // throw exception if the object is not versionable
     if (!$pwc->getAttribute('versionable')) {
         throw new ConstraintViolationException('This document is not versionable and may not be checked out');
     }
     // NOTE KTAPI as currently implemented does not give a direct response which indicates if the document is already checked out,
     //      as long as the same use is calling the checkout again, so should we add a check here specifically?
     // run checkout process - set $download = false (third function argument) as we want to return the document content via the contentStream
     $response = $this->ktapi->checkout_document($documentId, 'CMIS Checkout Action', false, $sig_username, $sig_password);
     // if there was an error, throw an exception
     if ($response['status_code'] == 1) {
         throw new StorageException($response['message']);
     }
     // if successful, set $contentCopied = true; unless contentStream is not set
     if ($pwc->getProperty('ContentStreamFilename') != '') {
         $contentCopied = true;
     }
     $documentId = CMISUtil::encodeObjectId('Document', $documentId);
     // mark document object as checked out
     $pwc->setProperty('IsVersionSeriesCheckedOut', true);
     $userName = '';
     $user = $this->ktapi->get_user();
     if (!PEAR::isError($user)) {
         $userName = $user->getName();
     }
     $pwc->setProperty('VersionSeriesCheckedOutBy', $userName);
     $pwc->setProperty('VersionSeriesCheckedOutId', $documentId);
     return $contentCopied;
 }