You will need to use the database layer in Moodle to retrieve the data you want to display (have a look at https://docs.moodle.org/dev/Data_manipulation_API). Once you have the value, you won't be echoing it, you will be passing it to the certificate_print_text() function. For an example of its use take a look at mod/certificate/type/A4_embedded/certificate.php.
Re: Adding the date of a face to face course to the certificate
Re: Adding the date of a face to face course to the certificate
I've read the doc and read a few forums with similar question.
My head is hurting, how do I use the database layer.
Do I create a new file or add the code to the certificate.
I'm normally good with SQL and PHP but I'm sure I must be missing something.
Re: Adding the date of a face to face course to the certificate
Re: Adding the date of a face to face course to the certificate
I'm back
I've got it mostly working but can't get the time to convert all the usual unix converters either give a page error or do nothing.
How do I join tables in the Global $db.
It looks like it works at first but my certificate put a different unix date on.
Have a look at to see where I'm going wrong please
$sql = " SELECT *
FROM {facetoface} f
JOIN {facetoface_sessions} fs ON f.id = fs.facetoface
JOIN {facetoface_sessions_dates} fsd ON fs.id = fsd.sessionid
JOIN {facetoface_signups} fsu ON fs.id = fsu.sessionid
JOIN {user} u ON fsu.userid = u.id";
$f2fdate = $DB->get_record_sql('SELECT timefinish FROM {facetoface_sessions_dates}');
certificate_print_text($pdf, $x, $y + 92, 'C', 'freesans', '', 20, $f2fdate->timefinish);
Thanks Jimi