Current status
This commit is contained in:
parent
bd2a78b94b
commit
6ac6ba53c1
3 changed files with 8 additions and 3 deletions
|
@ -18,7 +18,7 @@
|
||||||
* Class represents a customcert template.
|
* Class represents a customcert template.
|
||||||
*
|
*
|
||||||
* @package mod_customcert
|
* @package mod_customcert
|
||||||
* @copyright 2016 Mark Nelson <markn@moodle.com>
|
* @copyright 2016 Mark Nelson <markn@moodle.com>, 2022 Kumi Systems e.U. <office@kumi.systems>
|
||||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ namespace mod_customcert;
|
||||||
|
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
require_once(__DIR__ . "/../vendor/autoload.php");
|
require_once(__DIR__ . "/../vendor/autoload.php");
|
||||||
|
require_once($CFG->dirroot.'/user/profile/lib.php');
|
||||||
|
|
||||||
use mikehaertl\wkhtmlto\Pdf;
|
use mikehaertl\wkhtmlto\Pdf;
|
||||||
|
|
||||||
|
@ -272,6 +273,8 @@ class template {
|
||||||
|
|
||||||
require_once($CFG->libdir . '/pdflib.php');
|
require_once($CFG->libdir . '/pdflib.php');
|
||||||
|
|
||||||
|
profile_load_data($user);
|
||||||
|
|
||||||
// Get the pages for the template, there should always be at least one page for each template.
|
// Get the pages for the template, there should always be at least one page for each template.
|
||||||
if ($pages = $DB->get_records('customcert_pages', array('templateid' => $this->id), 'sequence ASC')) {
|
if ($pages = $DB->get_records('customcert_pages', array('templateid' => $this->id), 'sequence ASC')) {
|
||||||
// Create the pdf object.
|
// Create the pdf object.
|
||||||
|
@ -376,7 +379,7 @@ class template {
|
||||||
|
|
||||||
$html = str_replace("__DATE__", userdate($date, '%B %d, %Y'), $html);
|
$html = str_replace("__DATE__", userdate($date, '%B %d, %Y'), $html);
|
||||||
|
|
||||||
$html = str_replace("__PIN__", $user->profile["pin"], $html);
|
$html = str_replace("__PIN__", $user->username, $html);
|
||||||
|
|
||||||
$pdf->addPage($html);
|
$pdf->addPage($html);
|
||||||
$pdf->send();
|
$pdf->send();
|
||||||
|
|
|
@ -54,3 +54,4 @@ if ($elements = $DB->get_records_sql($sql, array('templateid' => $template->get_
|
||||||
$DB->delete_records('customcert_pages', array('templateid' => $template->get_id()));
|
$DB->delete_records('customcert_pages', array('templateid' => $template->get_id()));
|
||||||
|
|
||||||
$loadtemplate->copy_to_template($template->get_id());
|
$loadtemplate->copy_to_template($template->get_id());
|
||||||
|
|
||||||
|
|
3
view.php
3
view.php
|
@ -18,7 +18,7 @@
|
||||||
* Handles viewing a customcert.
|
* Handles viewing a customcert.
|
||||||
*
|
*
|
||||||
* @package mod_customcert
|
* @package mod_customcert
|
||||||
* @copyright 2013 Mark Nelson <markn@moodle.com>
|
* @copyright 2013 Mark Nelson <markn@moodle.com>, 2022 Kumi Systems e.U. <office@kumi.systems>
|
||||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -142,6 +142,7 @@ if (!$downloadown && !$downloadissue) {
|
||||||
$link = new moodle_url('/mod/customcert/view.php', array('id' => $cm->id, 'downloadown' => true));
|
$link = new moodle_url('/mod/customcert/view.php', array('id' => $cm->id, 'downloadown' => true));
|
||||||
$downloadbutton = new single_button($link, $linkname, 'get', true);
|
$downloadbutton = new single_button($link, $linkname, 'get', true);
|
||||||
$downloadbutton->class .= ' m-b-1'; // Seems a bit hackish, ahem.
|
$downloadbutton->class .= ' m-b-1'; // Seems a bit hackish, ahem.
|
||||||
|
$downloadbutton->add_action(new \popup_action('click', $link));
|
||||||
$downloadbutton = $OUTPUT->render($downloadbutton);
|
$downloadbutton = $OUTPUT->render($downloadbutton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue