use App\Models\Resource;
use Cubist\Backpack\Magic\PageData;
+use Cubist\Util\Files\Files;
-class FrontController extends Controller
-{
- public function splash()
- {
+class FrontController extends Controller {
+ public function splash() {
return view('front.splash', $this->_getDataFromCMS());
}
- public function home()
- {
+ public function home() {
return view('front.home', $this->_getDataFromCMS());
}
- public function resources()
- {
+ public function resources() {
return view('front.resources', $this->_getDataFromCMS());
}
- public function medialibrary()
- {
+ public function medialibrary() {
return view('front.media-library', $this->_getDataFromCMS());
}
- protected function _getDataFromCMS()
- {
+ public function fluidbook($args = '') {
+ if (!$args) {
+ $args = [];
+ } else {
+ $args = explode('/', $args);
+ }
+
+ if (count($args) > 0) {
+ $path = implode('/', $args);
+ } else {
+ return redirect(backpack_url('front/coeur/index.html'));
+ }
+
+ $path = storage_path('fluidbook/out') . '/' . $path;
+
+
+ if (file_exists($path)) {
+ return response(null)->header('Content-Type', Files::_getMimeType($path))->header('X-Sendfile', $path);
+ } else {
+ return response(null)->setStatusCode(404);
+ }
+
+ }
+
+ protected function _getDataFromCMS() {
return ['resources' => $this->_getResourcesFromCMS()];
}
- protected function _getResourcesFromCMS()
- {
+ protected function _getResourcesFromCMS() {
/** @var PageData $d */
$d = Resource::find('1')->getPageData();
return $d->getRawData();
$logo = '/storage/102/groupe-84.svg';
$subtitle = "Découvrez le coeur de l'offre sous forme de feuilleteur interactif";
$button = "Découvrir l'offre";
- $button_link = '/tools/fluidbookpreview/';
+ $button_link = '/front/coeur/index.html';
$illustration = '/storage/137/home-magazine.jpg';
$shortcuts = [
[
'title' => 'Ressources',
'content' => "Consultez l'ensemble des documents au format PDF",
'image' => '/storage/104/groupe-209-at-2x.png',
- 'link' => '/ressources',
+ 'link' => '/ressources.html',
],
[
'title' => 'Médiathèque',
'content' => 'Consultez les médias audio et vidéo',
'image' => '/storage/105/groupe-211-at-2x.png',
- 'link' => '/mediatheque',
+ 'link' => '/mediatheque.html',
],
[
'title' => 'Visite guidée',
'content' => 'Laissez-vous guider dans une lecture thématique',
'image' => '/storage/106/groupe-221-at-2x.png',
- 'link' => '/tour',
+ 'link' => '/tour.html',
],
];
@endphp
{{-- RESOURCES --}}
<div class="resources" x-data="{
- viewerURL: '/tools/fluidbookpreview/pdfjs/web/viewer.html?file=', // Base URL for viewer
+ viewerURL: '/front/coeur/pdfjs/web/viewer.html?file=', // Base URL for viewer
shown: false,
init() {
</video>
</div>
- <x-link href="/accueil"
+ <x-link href="/accueil.html"
id="home_link"
class="w-full max-h-[90vh] flex flex-col items-center justify-around">
<img x-show="shown"
<ul class="w-full font-medium text-6xl">
@php
$menu_links = [
- '/accueil' => 'Accueil',
- '/tools/fluidbookpreview/' => 'Cœur de l’offre',
- '/ressources' => 'Ressources',
- '/mediatheque' => 'Médiathèque',
- '/tour' => 'Visite guidée',
+ '/accueil.html' => 'Accueil',
+ '/coeur/index.html' => 'Cœur de l’offre',
+ '/ressources.html' => 'Ressources',
+ '/mediatheque.html' => 'Médiathèque',
+ '/tour.html' => 'Visite guidée',
];
@endphp
// Frontend
Route::group([
'prefix' => 'front',
- 'middleware' => ['web', config('backpack.base.middleware_key', 'admin'),'can:view'],
+ 'middleware' => ['web', config('backpack.base.middleware_key', 'admin'), 'can:view'],
'namespace' => '\App\Http\Controllers',
], function () {
- Route::get('','FrontController@splash');
- Route::get('accueil','FrontController@home');
- Route::get('ressources','FrontController@resources');
- Route::get('mediatheque','FrontController@medialibrary');
-
+ Route::get('index.html', 'FrontController@splash');
+ Route::get('accueil.html', 'FrontController@home');
+ Route::get('ressources.html', 'FrontController@resources');
+ Route::get('mediatheque.html', 'FrontController@medialibrary');
+ Route::get('coeur/{args?}', 'FrontController@fluidbook')->where(['args' => '.*']);
});