Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

(no description)

Author: Nicola Asuni
Version: 1.0.008
File Size: 1176 lines (43 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: Datamatrix  - X-Ref


__construct($code)   X-Ref
This is the class constructor.
Creates a datamatrix object

param: $code (string) Code to represent using Datamatrix.

getBarcodeArray()   X-Ref
Returns a barcode array which is readable by TCPDF

return: array barcode array readable by TCPDF;

getGFProduct($a, $b, $log, $alog, $gf)   X-Ref
Product of two numbers in a Power-of-Two Galois Field

param: $a (int) first number to multiply.
param: $b (int) second number to multiply.
param: $log (array) Log table.
param: $alog (array) Anti-Log table.
param: $gf (array) Number of Factors of the Reed-Solomon polynomial.
return: int product

getErrorCorrection($wd, $nb, $nd, $nc, $gf=256, $pp=301)   X-Ref
Add error correction codewords to data codewords array (ANNEX E).

param: $wd (array) Array of datacodewords.
param: $nb (int) Number of blocks.
param: $nd (int) Number of data codewords per block.
param: $nc (int) Number of correction codewords per block.
param: $gf (int) numner of fields on log/antilog table (power of 2).
param: $pp (int) The value of its prime modulus polynomial (301 for ECC200).
return: array data codewords + error codewords

get253StateCodeword($cwpad, $cwpos)   X-Ref
Return the 253-state codeword

param: $cwpad (int) Pad codeword.
param: $cwpos (int) Number of data codewords from the beginning of encoded data.
return: pad codeword

get255StateCodeword($cwpad, $cwpos)   X-Ref
Return the 255-state codeword

param: $cwpad (int) Pad codeword.
param: $cwpos (int) Number of data codewords from the beginning of encoded data.
return: pad codeword

isCharMode($chr, $mode)   X-Ref
Returns true if the char belongs to the selected mode

param: $chr (int) Character (byte) to check.
param: $mode (int) Current encoding mode.
return: boolean true if the char is of the selected mode.

lookAheadTest($data, $pos, $mode)   X-Ref
The look-ahead test scans the data to be encoded to find the best mode (Annex P - steps from J to S).

param: $data (string) data to encode
param: $pos (int) current position
param: $mode (int) current encoding mode
return: int encoding mode

getSwitchEncodingCodeword($mode)   X-Ref
Get the switching codeword to a new encoding mode (latch codeword)

param: $mode (int) New encoding mode.
return: (int) Switch codeword.

getMaxDataCodewords($numcw)   X-Ref
Choose the minimum matrix size and return the max number of data codewords.

param: $numcw (int) Number of current codewords.
return: number of data codewords in matrix

getHighLevelEncoding($data)   X-Ref
Get high level encoding using the minimum symbol data characters for ECC 200

param: $data (string) data to encode
return: array of codewords

placeModule($marr, $nrow, $ncol, $row, $col, $chr, $bit)   X-Ref
Places "chr+bit" with appropriate wrapping within array[].
(Annex F - ECC 200 symbol character placement)

param: $marr (array) Array of symbols.
param: $nrow (int) Number of rows.
param: $ncol (int) Number of columns.
param: $row (int) Row number.
param: $col (int) Column number.
param: $chr (int) Char byte.
param: $bit (int) Bit.
return: array

placeUtah($marr, $nrow, $ncol, $row, $col, $chr)   X-Ref
Places the 8 bits of a utah-shaped symbol character.
(Annex F - ECC 200 symbol character placement)

param: $marr (array) Array of symbols.
param: $nrow (int) Number of rows.
param: $ncol (int) Number of columns.
param: $row (int) Row number.
param: $col (int) Column number.
param: $chr (int) Char byte.
return: array

placeCornerA($marr, $nrow, $ncol, $chr)   X-Ref
Places the 8 bits of the first special corner case.
(Annex F - ECC 200 symbol character placement)

param: $marr (array) Array of symbols.
param: $nrow (int) Number of rows.
param: $ncol (int) Number of columns.
param: $chr (int) Char byte.
return: array

placeCornerB($marr, $nrow, $ncol, $chr)   X-Ref
Places the 8 bits of the second special corner case.
(Annex F - ECC 200 symbol character placement)

param: $marr (array) Array of symbols.
param: $nrow (int) Number of rows.
param: $ncol (int) Number of columns.
param: $chr (int) Char byte.
return: array

placeCornerC($marr, $nrow, $ncol, $chr)   X-Ref
Places the 8 bits of the third special corner case.
(Annex F - ECC 200 symbol character placement)

param: $marr (array) Array of symbols.
param: $nrow (int) Number of rows.
param: $ncol (int) Number of columns.
param: $chr (int) Char byte.
return: array

placeCornerD($marr, $nrow, $ncol, $chr)   X-Ref
Places the 8 bits of the fourth special corner case.
(Annex F - ECC 200 symbol character placement)

param: $marr (array) Array of symbols.
param: $nrow (int) Number of rows.
param: $ncol (int) Number of columns.
param: $chr (int) Char byte.
return: array

getPlacementMap($nrow, $ncol)   X-Ref
Build a placement map.
(Annex F - ECC 200 symbol character placement)

param: $nrow (int) Number of rows.
param: $ncol (int) Number of columns.
return: array