From d21b05a5c25367b060826509d1aad33239334818 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Mon, 10 Sep 2012 08:12:36 +0000 Subject: [PATCH] --- inc/commons/class.common.core.php | 3 + inc/ws/Controlleur/class.ws.services.php | 113 ++++++++++++++++++++- inc/ws/Metier/class.ws.book.parametres.php | 3 +- 3 files changed, 116 insertions(+), 3 deletions(-) diff --git a/inc/commons/class.common.core.php b/inc/commons/class.common.core.php index 6c77fa13c..2efe43ba7 100644 --- a/inc/commons/class.common.core.php +++ b/inc/commons/class.common.core.php @@ -458,6 +458,9 @@ class commonCore extends cubeCore { $db->sessions->primary('pk_sessions', 'session_id'); $db->sessions->index('idx_sessions_time', 'BTREE', 'time'); + // Table Grdf + $db->grdf->datas('text', 0, false); + try { $dbi = new CubeDbStruct($this->con); diff --git a/inc/ws/Controlleur/class.ws.services.php b/inc/ws/Controlleur/class.ws.services.php index 0f4c2376a..78717f5ec 100644 --- a/inc/ws/Controlleur/class.ws.services.php +++ b/inc/ws/Controlleur/class.ws.services.php @@ -250,7 +250,7 @@ class wsServices extends cubeFlashGateway { if (!file_exists($destDir)) { mkdir($destDir, 0777, true); } - $fname = md5(implode(',%ù', $range)) . '.pdf'; + $fname = md5(implode(',%ù', $range)) . '.pdf'; $destFile = $destDir . '/' . $fname; $destURL = '/fluidbook/cache/exportpdf/' . $book->book_id . '/' . $fname; // If result exists, don't make the pdf again @@ -280,6 +280,59 @@ class wsServices extends cubeFlashGateway { exit; } + public function grdfValidForm() { + $notempty = array('civilite', 'prenom', 'nom', 'email', 'adresse', 'codepostal', 'ville', 'telephone', 'optin', 'connu', 'echeance'); + $error = false; + $errors = array(); + foreach ($notempty as $f) { + if (!isset($this->args[$f]) || is_null($this->args[$f]) || $this->args[$f] == 'null' || trim($this->args[$f]) == '') { + $error = true; + $errors[] = $f; + } + } + + if (!cubeMail::isEmail($this->args['email'])) { + $error = true; + $errors[] = 'email_valid'; + } + + $this->xml->addChild('ok', $error ? '0' : '1'); + $this->xml->addChild('errors', implode(',', $errors)); + } + + public function grdfSendForm() { + global $core; + + $fields = array('Civilité' => 'civilite', 'Prénom' => 'prenom', 'Nom' => 'nom', + 'E-mail' => 'email', 'Adresse' => 'adresse', 'Code postal' => 'codepostal', 'Ville' => 'ville', + 'Téléphone' => 'telephone', 'Connu par' => 'connu', 'Echéance' => 'echeance', + 'Optin' => 'optin', 'Coupons sélectionnés' => 'reflist'); + + $mail = new cubeMail(); + $mail->charset = 'UTF-8'; + $mail->subject = '[Chéquier avantages] Validation de coupon'; + $mail->from = 'noreply@chequieravantages.fr'; + $mail->replyTo = 'noreply@chequiavantages.fr'; + $mail->cc = 'gerald@sensoa.fr'; + $mail->to = 'chequieravantages@gmail.com'; + $body = ''; + + + + foreach ($fields as $k => $f) { + $body.=$k . ' : ' . $this->args[$f] . "\r\n"; + $datas[$f] = $this->args[$f]; + } + $datas['date'] = TIME; + + $c = $core->con->openCursor('grdf'); + $c->datas = json_encode($datas); + $c->insert(); + + $mail->body = $body; + $mail->send(); + } + public function grdfCoupon() { $this->outputXML = false; $couponsRoot = WS_BOOKS . '/working/10828/commerce/'; @@ -307,7 +360,7 @@ class wsServices extends cubeFlashGateway { $pdf->SetXY(15, 10); $pdf->SetFont('Helvetica', '', 12); $pdf->SetTextColor(0, 0, 0); - $pdf->Cell(180, 10, trim($_GET['civilite'] . ' ' . $_GET['prenom'] . ' ' . $_GET['nom']) . ','); + $pdf->Cell(180, 10, utf8_decode(trim($_GET['civilite'] . ' ' . $_GET['prenom'] . ' ' . $_GET['nom']) . ',')); $pdf->SetXY(143, 203); $pdf->SetFont('Helvetica', 'B', 18); $pdf->Cell(33, 15, $code); @@ -315,6 +368,62 @@ class wsServices extends cubeFlashGateway { $pdf->Output('coupon.pdf', 'I'); } + public function grdfExcel12568() { + global $core; + $this->outputXML = false; + + + $couponsRoot = WS_BOOKS . '/working/10828/commerce/'; + + $xml = simplexml_load_file($couponsRoot . 'references.xml'); + + $cols = array('Date' => 'date', 'Civilité' => 'civilite', 'Prénom' => 'prenom', 'Nom' => 'nom', + 'E-mail' => 'email', 'Adresse' => 'adresse', 'Code postal' => 'codepostal', 'Ville' => 'ville', + 'Téléphone' => 'telephone', 'Connu par' => 'connu', 'Echéance' => 'echeance', + 'Optin' => 'optin'); + $refs = array(); + foreach ($xml->xpath('//item') as $i) { + $refs[(string) $i['reference']] = $i['name']; + } + + // + $h = ''; + $h.=''; + foreach ($cols as $l => $k) { + $h.=''; + } + foreach ($refs as $k => $l) { + $h.=''; + } + $h.=''; + + $r = $core->con->select('SELECT * FROM grdf'); + while ($r->fetch()) { + $d = json_decode($r->datas); + $rl = explode(',', $d->reflist); + $h.=''; + foreach ($cols as $l => $k) { + $v = $d->$k; + if ($k == 'date') { + $v = date('Y-m-d H:i', $v); + } + $h.=''; + } + foreach ($refs as $k => $l) { + $v = in_array($k, $rl) ? '1' : '0'; + $h.=''; + } + $h.=''; + } + + $h.='
' . utf8_decode($l) . '' . utf8_decode($l) . '
' . utf8_decode($v) . '' . utf8_decode($v) . '
'; + + ob_end_clean(); + cubeHTTP::forceDownload('chequieravantages.xls'); + echo $h; + return; + } + public function proxy() { ob_end_clean(); fb(netHttp::quickGet($_GET['u'], 'php://output')); diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index a9ce0c5e6..69c2cee70 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -189,9 +189,10 @@ class wsBookParametres extends wsParametres { $this->fields['linkTracker'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Tracking des liens'), 'grade' => 5); $this->fields['linkTrackerRegexp'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Tracking des liens applicables aux liens du domaine'), 'grade' => 5); $this->fields['linkMultimediaPerformanceMode'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Mode perfomance pour les liens multimédia'), 'grade' => 5); + $this->fields['linkMultimediaQuality'] = array('type' => 'float', 'default' => 1.0, 'editable' => true, 'label' => __('Qualité de rendu des animations'), 'grade' => 5); $this->fields['linkCornerSize'] = array('type' => 'integer', 'default' => '10', 'editable' => true, 'label' => __('Taille des liens de coins de page'), 'hint' => __("Pourcentage de la largeur de la page")); $this->forms['multimedia'] = array('label' => __('Liens et multimédia'), - 'fieldsnames' => array('permanentLinks', 'linkBlinkTime', 'customLinkClass', 'linkTooltipManager', 'linkCornerSize', '|', 'linkTracker', 'linkTrackerRegexp', '|', 'linkMultimediaPerformanceMode')); + 'fieldsnames' => array('permanentLinks', 'linkBlinkTime', 'customLinkClass', 'linkTooltipManager', 'linkCornerSize', '|', 'linkTracker', 'linkTrackerRegexp', '|', 'linkMultimediaPerformanceMode','linkMultimediaQuality')); //. $this->fields['externalArchives'] = array('type' => 'freefile', 'default' => '', 'editable' => true, 'label' => __('Archives'), 'grade' => 3, 'fileFilter' => $swfFilter); -- 2.39.5