Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
core_qrcode Class Reference

Class for generating QR codes. More...

Inheritance diagram for core_qrcode:
TCPDF2DBarcode

Public Member Functions

 __construct ($data)
 Overrided constructor to force QR codes.
 
 getBarcodeArray ()
 Return an array representations of barcode.
 
 getBarcodeHTML ($w=10, $h=10, $color='black')
 Return an HTML representation of barcode.
 
 getBarcodePNG ($w=3, $h=3, $color=array(0, 0, 0))
 Send a PNG image representation of barcode (requires GD or Imagick library).
 
 getBarcodePngData ($w=3, $h=3, $color=array(0, 0, 0))
 Return a PNG image representation of barcode (requires GD or Imagick library).
 
 getBarcodeSVG ($w=3, $h=3, $color='black')
 Send barcode as SVG image object to the standard output.
 
 getBarcodeSVGcode ($w=3, $h=3, $color='black')
 Return a SVG string representation of barcode.
 
 setBarcode ($code, $type)
 Set the barcode.
 

Protected Attributes

 $barcode_array = array()
 Array representation of barcode.
 

Detailed Description

Class for generating QR codes.

Wrapper class that extends TCPDF.

Constructor & Destructor Documentation

◆ __construct()

core_qrcode::__construct ( $data)

Overrided constructor to force QR codes.

Parameters
string$datathe data to generate the code

Member Function Documentation

◆ getBarcodeArray()

TCPDF2DBarcode::getBarcodeArray ( )
inherited

Return an array representations of barcode.

Return values
array

◆ getBarcodeHTML()

TCPDF2DBarcode::getBarcodeHTML ( $w = 10,
$h = 10,
$color = 'black' )
inherited

Return an HTML representation of barcode.

Parameters
int$wWidth of a single rectangle element in pixels.
int$hHeight of a single rectangle element in pixels.
string$colorForeground color for bar elements (background is transparent).
Return values
stringHTML code.

◆ getBarcodePNG()

TCPDF2DBarcode::getBarcodePNG ( $w = 3,
$h = 3,
$color = array(0,0,0) )
inherited

Send a PNG image representation of barcode (requires GD or Imagick library).

Parameters
int$wWidth of a single rectangle element in pixels.
int$hHeight of a single rectangle element in pixels.
array$colorRGB (0-255) foreground color for bar elements (background is transparent).

◆ getBarcodePngData()

TCPDF2DBarcode::getBarcodePngData ( $w = 3,
$h = 3,
$color = array(0,0,0) )
inherited

Return a PNG image representation of barcode (requires GD or Imagick library).

Parameters
int$wWidth of a single rectangle element in pixels.
int$hHeight of a single rectangle element in pixels.
array$colorRGB (0-255) foreground color for bar elements (background is transparent).
Return values
string|Imagick|falseimage or false in case of error.

◆ getBarcodeSVG()

TCPDF2DBarcode::getBarcodeSVG ( $w = 3,
$h = 3,
$color = 'black' )
inherited

Send barcode as SVG image object to the standard output.

Parameters
int$wWidth of a single rectangle element in user units.
int$hHeight of a single rectangle element in user units.
string$colorForeground color (in SVG format) for bar elements (background is transparent).

◆ getBarcodeSVGcode()

TCPDF2DBarcode::getBarcodeSVGcode ( $w = 3,
$h = 3,
$color = 'black' )
inherited

Return a SVG string representation of barcode.

Parameters
int$wWidth of a single rectangle element in user units.
int$hHeight of a single rectangle element in user units.
string$colorForeground color (in SVG format) for bar elements (background is transparent).
Return values
stringSVG code.

◆ setBarcode()

TCPDF2DBarcode::setBarcode ( $code,
$type )
inherited

Set the barcode.

Parameters
string$codecode to print
string$typetype of barcode:
  • DATAMATRIX : Datamatrix (ISO/IEC 16022)
  • PDF417 : PDF417 (ISO/IEC 15438:2006)
  • PDF417,a,e,t,s,f,o0,o1,o2,o3,o4,o5,o6 : PDF417 with parameters: a = aspect ratio (width/height); e = error correction level (0-8); t = total number of macro segments; s = macro segment index (0-99998); f = file ID; o0 = File Name (text); o1 = Segment Count (numeric); o2 = Time Stamp (numeric); o3 = Sender (text); o4 = Addressee (text); o5 = File Size (numeric); o6 = Checksum (numeric). NOTES: Parameters t, s and f are required for a Macro Control Block, all other parameters are optional. To use a comma character ',' on text options, replace it with the character 255: "::xff".
  • QRCODE : QRcode Low error correction
  • QRCODE,L : QRcode Low error correction
  • QRCODE,M : QRcode Medium error correction
  • QRCODE,Q : QRcode Better error correction
  • QRCODE,H : QR-CODE Best error correction
  • RAW: raw mode - comma-separad list of array rows
  • RAW2: raw mode - array rows are surrounded by square parenthesis.
  • TEST : Test matrix
Return values
void

The documentation for this class was generated from the following file: