Ejemplo n.º 1
0
 /**
  * balise : QRCODE
  * mode : OUVERTURE
  * 
  * @param	array	paramètres de l'élément de parsing
  * @return	null
  */
 protected function o_QRCODE($param)
 {
     if ($this->DEBUG_actif) {
         $this->DEBUG_add('QRCODE', true);
     }
     if (!isset($param['value'])) {
         $param['value'] = '';
     }
     if (!isset($param['ec'])) {
         $param['ec'] = 'H';
     }
     if (!isset($param['size'])) {
         $param['size'] = '0.6mm';
     }
     if (!isset($param['style']['color'])) {
         $param['style']['color'] = '#000000';
     }
     if (!isset($param['style']['background-color'])) {
         $param['style']['background-color'] = '#FFFFFF';
     }
     if ($param['value'] === '') {
         return true;
     }
     $noborder = isset($param['noborder']);
     $this->style->save();
     $this->style->analyse('qrcode', $param);
     $this->style->setPosition();
     $this->style->FontSet();
     $x = $this->pdf->getX();
     $y = $this->pdf->getY();
     $s = $this->style->ConvertToMM($param['size']);
     $ec = $param['ec'];
     if (!in_array($ec, array('L', 'M', 'Q', 'H'))) {
         $ec = 'H';
     }
     require_once dirname(__FILE__) . '/qrcode/qrcode.class.php';
     $qrcode = new QRcode($param['value'], $ec);
     if ($noborder) {
         $qrcode->disableBorder();
     }
     if (!$this->sub_part && !$this->isSubPart) {
         $qrcode->displayTCPDF($this->pdf, $x, $y, $s, $this->style->value['background']['color'], $this->style->value['color']);
     }
     $size = $s * $qrcode->getQrSize();
     unset($qrcode);
     // position maximale globale
     $this->maxX = max($this->maxX, $x + $size);
     $this->maxY = max($this->maxY, $y + $size);
     $this->maxH = max($this->maxH, $size);
     $this->pdf->setX($x + $size);
     $this->style->load();
     $this->style->FontSet();
     return true;
 }