[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 //============================================================+ 3 // File name : 2dbarcodes.php 4 // Begin : 2009-04-07 5 // Last Update : 2009-04-08 6 // Version : 1.0.000 7 // License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html) 8 // ---------------------------------------------------------------------------- 9 // Copyright (C) 2008-2009 Nicola Asuni - Tecnick.com S.r.l. 10 // 11 // This program is free software: you can redistribute it and/or modify 12 // it under the terms of the GNU Lesser General Public License as published by 13 // the Free Software Foundation, either version 2.1 of the License, or 14 // (at your option) any later version. 15 // 16 // This program is distributed in the hope that it will be useful, 17 // but WITHOUT ANY WARRANTY; without even the implied warranty of 18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 // GNU Lesser General Public License for more details. 20 // 21 // You should have received a copy of the GNU Lesser General Public License 22 // along with this program. If not, see <http://www.gnu.org/licenses/>. 23 // 24 // See LICENSE.TXT file for more information. 25 // ---------------------------------------------------------------------------- 26 // 27 // Description : PHP class to creates array representations for 28 // 2D barcodes to be used with TCPDF. 29 // 30 // Author: Nicola Asuni 31 // 32 // (c) Copyright: 33 // Nicola Asuni 34 // Tecnick.com S.r.l. 35 // Via della Pace, 11 36 // 09044 Quartucciu (CA) 37 // ITALY 38 // www.tecnick.com 39 // [email protected] 40 //============================================================+ 41 42 /** 43 * PHP class to creates array representations for 2D barcodes to be used with TCPDF. 44 * @package com.tecnick.tcpdf 45 * @abstract Functions for generating string representation of 2D barcodes. 46 * @author Nicola Asuni 47 * @copyright 2008-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - [email protected] 48 * @link http://www.tcpdf.org 49 * @license http://www.gnu.org/copyleft/lesser.html LGPL 50 * @version 1.0.000 51 */ 52 53 /** 54 * PHP class to creates array representations for 2D barcodes to be used with TCPDF (http://www.tcpdf.org).<br> 55 * @name TCPDFBarcode 56 * @package com.tecnick.tcpdf 57 * @version 1.0.000 58 * @author Nicola Asuni 59 * @link http://www.tcpdf.org 60 * @license http://www.gnu.org/copyleft/lesser.html LGPL 61 */ 62 class TCPDF2DBarcode { 63 64 /** 65 * @var array representation of barcode. 66 * @access protected 67 */ 68 protected $barcode_array; 69 70 /** 71 * This is the class constructor. 72 * Return an array representations for 2D barcodes:<ul> 73 * <li>$arrcode['code'] code to be printed on text label</li> 74 * <li>$arrcode['num_rows'] required number of rows</li> 75 * <li>$arrcode['num_cols'] required number of columns</li> 76 * <li>$arrcode['bcode'][$r][$c] value of the cell is $r row and $c column (0 = transparent, 1 = black)</li></ul> 77 * @param string $code code to print 78 * @param string $type type of barcode: <ul><li>TEST</li><li>...TO BE IMPLEMENTED</li></ul> 79 */ 80 public function __construct($code, $type) { 81 $this->setBarcode($code, $type); 82 } 83 84 /** 85 * Return an array representations of barcode. 86 * @return array 87 */ 88 public function getBarcodeArray() { 89 return $this->barcode_array; 90 } 91 92 /** 93 * Set the barcode. 94 * @param string $code code to print 95 * @param string $type type of barcode: <ul><li>TEST</li><li>...TO BE IMPLEMENTED</li></ul> 96 * @return array 97 */ 98 public function setBarcode($code, $type) { 99 $mode = explode(',', $type); 100 switch (strtoupper($mode[0])) { 101 case 'TEST': { // TEST MODE 102 $this->barcode_array['num_rows'] = 5; 103 $this->barcode_array['num_cols'] = 15; 104 $this->barcode_array['bcode'] = array( 105 array(1,1,1,0,1,1,1,0,1,1,1,0,1,1,1), 106 array(0,1,0,0,1,0,0,0,1,0,0,0,0,1,0), 107 array(0,1,0,0,1,1,0,0,1,1,1,0,0,1,0), 108 array(0,1,0,0,1,0,0,0,0,0,1,0,0,1,0), 109 array(0,1,0,0,1,1,1,0,1,1,1,0,0,1,0) 110 ); 111 break; 112 } 113 114 // ... Add here real 2D barcodes ... 115 116 default: { 117 $this->barcode_array = false; 118 } 119 } 120 } 121 } // end of class 122 123 //============================================================+ 124 // END OF FILE 125 //============================================================+ 126 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |