Nama Source Code : certificate.php
Nama Element pada Custom Cert : code
Tanggal Dibuat : 05 Desember 2022
URL code : https://domain_situs/mod/customcert/classes/certificate.php
Download Plugin : Download
public static function generate_code() {
global $DB;
$getidna = $DB->get_record_sql("SELECT MAX(id) AS id FROM {customcert_issues}");
$kodeCert = $getidna->id;
$urutan = (int) substr($kodeCert, 3, 3);
$urutan++;
$kodeCertificate = sprintf("%08s", $urutan);
$uniquecodefound = false;
//$code = rand(10,100).'/TA/P.IV/'.date('Y');
$code = $getidna->id.'/TA/P.IV/'.date('Y');
while (!$uniquecodefound) {
if (!$DB->record_exists('customcert_issues', array('code' => $code))) {
$uniquecodefound = true;
} else {
$code = random_string(10);
}
}
0 Comments