Blame view

src/Controller/QrCodesController.php 694 Bytes
5d0d680d   Alexandre   Version: 2.2.0
1
2
3
4
5
6
7
8
9
<?php
namespace App\Controller;

use App\Controller\AppController;
use QRcode;

class QrCodesController extends AppController
{
	
1f42188e   Alexandre   Version: 2.4.4.4
10
	public function creer($message = null) {
5d0d680d   Alexandre   Version: 2.2.0
11
12
13
		
			$fileName = $this->request->session()->id().'.png';
			$cakephpPath = str_replace('webroot/index.php', '', $_SERVER['SCRIPT_FILENAME']);
aa205f2e   Alexandre   Version: 2.4.2.21
14
			$qrCodePath = $cakephpPath . 'webroot/img/qrcodes/' . $fileName;
5d0d680d   Alexandre   Version: 2.2.0
15
			
5d0d680d   Alexandre   Version: 2.2.0
16
			$this->request->session()->write('filename', $fileName);
d58b8953   Alexandre   Version: 2.4.4.0
17
			$this->request->session()->write('qrCodePath', $qrCodePath);
1f42188e   Alexandre   Version: 2.4.4.4
18
19
20
21
22
23
24
			
			if($message == null) {
				return QRcode::png($this->request->session()->read('qrUrl'), $qrCodePath);
			} else {
				return QRcode::png($message, $qrCodePath);
			}
			
5d0d680d   Alexandre   Version: 2.2.0
25
26
27
	}
	
}