ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
2dbarcodes.php
Go to the documentation of this file.
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 // info@tecnick.com
40 //============================================================+
41 
63 
68  protected $barcode_array;
69 
80  public function __construct($code, $type) {
81  $this->setBarcode($code, $type);
82  }
83 
88  public function getBarcodeArray() {
89  return $this->barcode_array;
90  }
91 
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 ?>