From bd7bb851cb74375764cddeed7ab9c04ac05783d2 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Wed, 18 Mar 2015 15:19:28 +0000 Subject: [PATCH] Grdf 2015 --- inc/ws/Controlleur/class.ws.services.php | 38 ++++++++++++++++++++++ inc/ws/Metier/class.ws.book.parametres.php | 3 +- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/inc/ws/Controlleur/class.ws.services.php b/inc/ws/Controlleur/class.ws.services.php index 6c0f743ee..9b01f2c39 100644 --- a/inc/ws/Controlleur/class.ws.services.php +++ b/inc/ws/Controlleur/class.ws.services.php @@ -532,9 +532,47 @@ class wsServices extends cubeFlashGateway { $mail->send(); } + public function grdfCoupon2015() { + $id = $this->args['id']; + + $this->outputXML = false; + $couponsRoot = WS_BOOKS . '/working/' . $id . '/commerce/'; + + $xml = simplexml_load_file($couponsRoot . 'references.xml'); + // Check hash + $hash = md5('ae' . $_GET['nom'] . '25' . $_GET['ref']); + if ($hash != $_GET['h']) { + exit; + } + $refs = explode(',', $_GET['ref']); + + $tmp = cubeFiles::tempnam(); + $pdftk = new CubeIT_CommandLine('pdftk'); + $pdftk->setPath(CONVERTER_PATH); + foreach ($refs as $ref) { + $file = $couponsRoot . $ref . '.pdf'; + $pdftk->setArg(null, $file); + } + $pdftk->setArg(null, 'output'); + $pdftk->setArg(null, $tmp); + $pdftk->execute(); + + header('Content-Type: application/pdf'); + header('Content-Disposition: inline; filename="CouponChequier.pdf"'); + + readfile($tmp); + unlink($tmp); + exit; + } + public function grdfCoupon() { + $id = $this->args['id']; + if ($id == 13372) { + return $this->grdfCoupon2015(); + } + $this->outputXML = false; $couponsRoot = WS_BOOKS . '/working/' . $id . '/commerce/'; diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index 59ab227a3..2db5f396e 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -268,6 +268,7 @@ class wsBookParametres extends wsParametres { 'datas' => array(__('Classic') => 'com.fluidbook.player.basket.BasketManager', 'Grdf' => 'com.fluidbook.player.basket.custom.grdf.GrdfBasketManager', 'Grdf 2013' => 'com.fluidbook.player.basket.custom.grdf.grdf2013.GrdfBasketManager2013', + 'Grdf 2015' => 'com.fluidbook.player.basket.custom.grdf.grdf2015.GrdfBasketManager2015', 'Essilor' => 'com.fluidbook.player.basket.custom.essilor.EssilorBasketManager', 'Essilor Recap' => 'com.fluidbook.player.basket.cursor.essilorrecap.EssilorRecapBasketManager'), 'grade' => 5); $this->fields['basketReferences'] = array('type' => 'freefile', 'default' => '', 'editable' => true, @@ -393,5 +394,3 @@ class wsBookParametres extends wsParametres { } } - -?> \ No newline at end of file -- 2.39.5