Ejemplo n.º 1
0
 /**
  * Gets the url which can be used to download the document.
  *
  * @param int $version Not implemented. The content version of the document
  */
 function get_download_url($version = null)
 {
     $session = $this->ktapi->get_session();
     // Create the url that can be used to download the document
     $download_manager = new KTDownloadManager();
     $download_manager->set_session($session->session);
     $download_manager->cleanup();
     $url = $download_manager->allow_download($this);
     // Log the transaction
     $this->download();
     return $url;
 }
Ejemplo n.º 2
0
 * Free Software Foundation.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, 
 * California 94120-7775, or email info@knowledgetree.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * KnowledgeTree" logo and retain the original copyright notice. If the display of the 
 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
 * must display the words "Powered by KnowledgeTree" and retain the original 
 * copyright notice.
 * Contributor( s): ______________________________________
 *
 */
require_once '../config/dmsDefaults.php';
require_once 'KTUploadManager.inc.php';
$download_manager = new KTDownloadManager();
$download_manager->cleanup();
Ejemplo n.º 3
0
 /**
  * Returns a reference to a file to be downloaded.
  *
  * @param string $session_id
  * @param int $document_id
  * @return kt_response. status_code can be KTWS_ERR_INVALID_SESSION, KTWS_ERR_INVALID_DOCUMENT or KTWS_SUCCESS
  */
 function download_document($session_id, $document_id, $version = null)
 {
     $this->debug("download_document('{$session_id}',{$document_id})");
     $kt =& $this->get_ktapi($session_id);
     if (is_array($kt)) {
         return new SOAP_Value('return', "{urn:{$this->namespace}}kt_response", $kt);
     }
     $response = KTWebService::_status(KTWS_ERR_INVALID_DOCUMENT);
     $document =& $kt->get_document_by_id($document_id);
     if (PEAR::isError($document)) {
         $response['message'] = $document->getMessage();
         $this->debug("download_document - cannot get {$document_id} - " . $document->getMessage(), $session_id);
         return new SOAP_Value('return', "{urn:{$this->namespace}}kt_response", $response);
     }
     $result = $document->download();
     if (PEAR::isError($result)) {
         $response['message'] = $result->getMessage();
         $this->debug("download_document - cannot download - " . $result->getMessage(), $session_id);
         return new SOAP_Value('return', "{urn:{$this->namespace}}kt_response", $response);
     }
     $session =& $kt->get_session();
     $download_manager = new KTDownloadManager();
     $download_manager->set_session($session->session);
     $download_manager->cleanup();
     $url = $download_manager->allow_download($document);
     $response['status_code'] = KTWS_SUCCESS;
     $response['message'] = $url;
     return new SOAP_Value('return', "{urn:{$this->namespace}}kt_response", $response);
 }
Ejemplo n.º 4
0
 /**
  * Checkout a Document
  * params contains:
  * 		document_id			the id of the document
  * 		reason				the checkout reason
  *
  * @param array $params
  *
  */
 function checkout_document($params)
 {
     $responseType = 'kt_response';
     $kt =& $this->KT;
     $document =& $kt->get_document_by_id($params['document_id']);
     if (PEAR::isError($document)) {
         $this->addError("checkout_document - cannot get documentid {$params['document_id']} - " . $document->getMessage());
         $this->setResponse(array('status_code' => 1, 'message' => $document->getMessage()));
         return;
     }
     $result = $document->checkout($params['reason']);
     if (PEAR::isError($result)) {
         $this->addError($result->getMessage());
         $this->setResponse(array('status_code' => 1, 'message' => $result->getMessage()));
         return;
     }
     $url = '';
     if ($params['download']) {
         $download_manager = new KTDownloadManager();
         $download_manager->set_session($params['session_id']);
         $download_manager->cleanup();
         $url = $download_manager->allow_download($document);
     }
     $this->setResponse(array('status_code' => 0, 'message' => $url));
 }
Ejemplo n.º 5
0
 /**
  * Returns a reference to a file to be downloaded.
  *
  * @author KnowledgeTree Team
  * @access public
  * @param int $document_id
  * @return kt_response.
  */
 public function download_document($document_id, $version = null)
 {
     $document =& $this->get_document_by_id($document_id);
     if (PEAR::isError($document)) {
         $response['status_code'] = 1;
         $response['message'] = $document->getMessage();
         return $response;
     }
     $result = $document->download();
     if (PEAR::isError($result)) {
         $response['status_code'] = 1;
         $response['message'] = $result->getMessage();
         return $response;
     }
     $session =& $this->get_session();
     $download_manager = new KTDownloadManager();
     $download_manager->set_session($session->session);
     $download_manager->cleanup();
     $url = $download_manager->allow_download($document);
     $response['status_code'] = 0;
     $response['results'] = urlencode($url);
     return $response;
 }