Skip to content
Snippets Groups Projects
Commit 5845e052 authored by Alexandre Morin's avatar Alexandre Morin
Browse files

Merge branch 'feature/7423-getContents' into 'develop'

Feature/7423 get contents

See merge request !63
parents dd10be7f a2f5f05c
No related branches found
No related tags found
4 merge requests!100Develop,!84Release/2.2,!82Release/2.2,!63Feature/7423 get contents
......@@ -269,7 +269,25 @@ trait archiveCommunicationTrait
throw $e;
}
return $digitalResource;
$binaryDataObject = \laabs::newInstance("recordsManagement/BinaryDataObject");
$binaryDataObject->attachment = new \stdClass();
$binaryDataObject->attachment->data = base64_encode($digitalResource->getContents());
$binaryDataObject->attachment->uri = "";
$binaryDataObject->attachment->filename = $digitalResource->fileName;
if (!empty($digitalResource->fileExtension)) {
$digitalResource->fileName = $digitalResource->fileName . $digitalResource->fileExtension;
}
$binaryDataObject->format = $digitalResource->puid;
$binaryDataObject->mimetype = $digitalResource->mimetype;
$binaryDataObject->size = $digitalResource->size;
$binaryDataObject->messageDigest = new \stdClass();
$binaryDataObject->messageDigest->value = $digitalResource->hash;
$binaryDataObject->messageDigest->algorithm = $digitalResource->hashAlgorithm;
return $binaryDataObject;
}
/**
......
<?php
/*
* Copyright (C) 2015 Maarch
*
* This file is part of bundle recordsManagement.
*
* Bundle recordsManagement is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Bundle recordsManagement 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 bundle recordsManagement. If not, see <http://www.gnu.org/licenses/>.
*/
namespace bundle\recordsManagement\Model;
/**
* Class model that represents a binary data object
*
* @package RecordsManagement
* @author Alexis Ragot(Maarch) <alexis.ragot@maarch.org>
*
*/
class BinaryDataObject
{
/**
*
*
* @var object
*/
public $attachment;
/**
*
*
* @var string
*/
public $format;
/**
*
*
* @var string
*/
public $mimetype;
/**
*
*
* @var object
*/
public $messageDigest;
/**
*
*
* @var numeric
*/
public $size;
/**
*
*
* @var object
*/
public $metadata;
/**
*
*
* @var array
*/
public $relationships;
}
......@@ -44,10 +44,7 @@ class digitalResource
*/
public function retrieve($resource)
{
//$this->view->addHeaders();
//$this->view->useLayout();
$contents = $resource->getContents();
$contents = base64_decode($resource->attachment->data);
if (strlen($contents) > 65536) {
try {
......
......@@ -194,12 +194,12 @@ class archive
return $contents;
}
$contents = $digitalResource->getContents();
$contents = base64_decode($digitalResource->attachment->data);
$mimetype = $digitalResource->mimetype;
\laabs::setResponseType($mimetype);
$response = \laabs::kernel()->response;
$response->setHeader("Content-Disposition", "inline; filename=".$digitalResource->fileName."");
$response->setHeader("Content-Disposition", "inline; filename=".$digitalResource->attachment->filename."");
return $contents;
}
......
......@@ -240,9 +240,12 @@ class welcome
if (isset(\laabs::configuration('presentation.maarchRM')['displayableFormat'])) {
$this->view->setSource("displayableFormat", json_encode(\laabs::configuration('presentation.maarchRM')['displayableFormat']));
$this->view->merge();
} else {
$this->view->setSource("displayableFormat", json_encode(array()));
}
$this->view->merge();
return $this->view->saveHtml();
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment