mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merge branch 'MDL-76495-master' of https://github.com/marinaglancy/moodle
This commit is contained in:
commit
fb27e80566
3 changed files with 34 additions and 2 deletions
|
@ -884,14 +884,14 @@ class QRcode {
|
||||||
protected function getCode() {
|
protected function getCode() {
|
||||||
if ($this->count < $this->dataLength) {
|
if ($this->count < $this->dataLength) {
|
||||||
$row = $this->count % $this->blocks;
|
$row = $this->count % $this->blocks;
|
||||||
$col = $this->count / $this->blocks;
|
$col = (int)($this->count / $this->blocks);
|
||||||
if ($col >= $this->rsblocks[0]['dataLength']) {
|
if ($col >= $this->rsblocks[0]['dataLength']) {
|
||||||
$row += $this->b1;
|
$row += $this->b1;
|
||||||
}
|
}
|
||||||
$ret = $this->rsblocks[$row]['data'][$col];
|
$ret = $this->rsblocks[$row]['data'][$col];
|
||||||
} elseif ($this->count < $this->dataLength + $this->eccLength) {
|
} elseif ($this->count < $this->dataLength + $this->eccLength) {
|
||||||
$row = ($this->count - $this->dataLength) % $this->blocks;
|
$row = ($this->count - $this->dataLength) % $this->blocks;
|
||||||
$col = ($this->count - $this->dataLength) / $this->blocks;
|
$col = (int)(($this->count - $this->dataLength) / $this->blocks);
|
||||||
$ret = $this->rsblocks[$row]['ecc'][$col];
|
$ret = $this->rsblocks[$row]['ecc'][$col];
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -6,6 +6,8 @@ Description of TCPDF library import
|
||||||
* remove all fonts that were not already present
|
* remove all fonts that were not already present
|
||||||
* visit http://127.0.0.1/lib/tests/other/pdflibtestpage.php and view the pdf
|
* visit http://127.0.0.1/lib/tests/other/pdflibtestpage.php and view the pdf
|
||||||
* modify getTCPDFProducer lib/tcpdf/include/tcpdf_static.php to remove the version number
|
* modify getTCPDFProducer lib/tcpdf/include/tcpdf_static.php to remove the version number
|
||||||
|
* Check the status of https://github.com/tecnickcom/TCPDF/pull/548 , apply if it is still
|
||||||
|
not included or delete this entry
|
||||||
|
|
||||||
Important
|
Important
|
||||||
---------
|
---------
|
||||||
|
|
|
@ -36,4 +36,34 @@ class pdflib_test extends \advanced_testcase {
|
||||||
$producer = TCPDF_STATIC::getTCPDFProducer();
|
$producer = TCPDF_STATIC::getTCPDFProducer();
|
||||||
$this->assertEquals('TCPDF (http://www.tcpdf.org)', $producer);
|
$this->assertEquals('TCPDF (http://www.tcpdf.org)', $producer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_qrcode() {
|
||||||
|
global $CFG;
|
||||||
|
require_once($CFG->libdir.'/pdflib.php');
|
||||||
|
|
||||||
|
$this->resetAfterTest();
|
||||||
|
|
||||||
|
$pdf = new \pdf();
|
||||||
|
$pdf->AddPage('P', [500, 500]);
|
||||||
|
$pdf->SetMargins(10, 0, 10);
|
||||||
|
|
||||||
|
$style = [
|
||||||
|
'border' => 0,
|
||||||
|
'vpadding' => 'auto',
|
||||||
|
'hpadding' => 'auto',
|
||||||
|
'fgcolor' => [0, 0, 0],
|
||||||
|
'bgcolor' => [255, 255, 255],
|
||||||
|
'module_width' => 1,
|
||||||
|
'module_height' => 1
|
||||||
|
];
|
||||||
|
|
||||||
|
$pdf->setCellPaddings(0, 0, 0, 0);
|
||||||
|
$pdf->write2DBarcode('https://www.example.com/moodle/admin/search.php',
|
||||||
|
'QRCODE,M', null, null, 35, 35, $style, 'N');
|
||||||
|
$pdf->SetFillColor(255, 255, 255);
|
||||||
|
$res = $pdf->Output('output', 'S');
|
||||||
|
|
||||||
|
$this->assertGreaterThan(100000, strlen($res));
|
||||||
|
$this->assertLessThan(120000, strlen($res));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue