Current status

This commit is contained in:
Kumi 2022-09-07 13:59:29 +00:00
parent df7499249e
commit d406c4ae16
Signed by: kumi
GPG key ID: ECBCC9082395383F
4 changed files with 166 additions and 161 deletions

View file

@ -18,7 +18,7 @@
* The report that displays the certificates the user has throughout the site.
*
* @package mod_htmlcert
* @copyright 2016 Mark Nelson <markn@moodle.com>, 2021 Klaus-Uwe Mitterer <kumitterer@kumi.systems>
* @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
*/
@ -34,7 +34,7 @@ require_once($CFG->libdir . '/tablelib.php');
* Class for the report that displays the certificates the user has throughout the site.
*
* @package mod_htmlcert
* @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
*/
class my_certificates_table extends \table_sql {
@ -148,7 +148,7 @@ class my_certificates_table extends \table_sql {
'certificateid' => $certificate->id,
'downloadcert' => '1'));
return $OUTPUT->action_link($link, '', null, null, $icon);
return $OUTPUT->action_link($link, '', new \popup_action('click', $link), null, $icon);
}
/**

View file

@ -18,7 +18,7 @@
* A scheduled task for emailing certificates.
*
* @package mod_htmlcert
* @copyright 2017 Mark Nelson <markn@moodle.com>, 2021 Klaus-Uwe Mitterer <kumitterer@kumi.systems>
* @copyright 2017 Mark Nelson <markn@moodle.com>, 2021 Kumi Systems e.U. <office@kumi.systems>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_htmlcert\task;
@ -71,6 +71,8 @@ class email_certificate_task extends \core\task\scheduled_task {
$htmlrenderer = $PAGE->get_renderer('mod_htmlcert', 'email', 'htmlemail');
$textrenderer = $PAGE->get_renderer('mod_htmlcert', 'email', 'textemail');
foreach ($customcerts as $customcert) {
// Get the context.
$context = \context::instance_by_id($htmlcert->contextid);
@ -158,7 +160,7 @@ class email_certificate_task extends \core\task\scheduled_task {
// If there are no users to email we can return early.
if (!$issuedusers) {
return;
continue;
}
// Create a directory to store the PDF we will be sending.
@ -243,4 +245,6 @@ class email_certificate_task extends \core\task\scheduled_task {
$DB->set_field('htmlcert_issues', 'emailed', 1, array('id' => $user->issueid));
}
}
}
}

View file

@ -18,7 +18,7 @@
* Class represents a htmlcert template.
*
* @package mod_htmlcert
* @copyright 2016 Mark Nelson <markn@moodle.com>, 2021 Klaus-Uwe Mitterer <kumitterer@kumi.systems>
* @copyright 2016 Mark Nelson <markn@moodle.com>, 2021-2022 Kumi Systems e.U. <office@kumi.systems>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -35,7 +35,7 @@ defined('MOODLE_INTERNAL') || die();
* Class represents a htmlcert template.
*
* @package mod_htmlcert
* @copyright 2016 Mark Nelson <markn@moodle.com>, 2021 Klaus-Uwe Mitterer <kumitterer@kumi.systems>
* @copyright 2016 Mark Nelson <markn@moodle.com>, 2021-2022 Kumi Systems e.U. <office@kumi.systems>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class template {
@ -165,7 +165,7 @@ class template {
$html = str_replace("__CERTNUM__", $code, $html);
$courseid = $htmlcert->course || $SITE->id;
$courseid = $htmlcert->course ?: $SITE->id;
$course = get_course($courseid);
$coursename = $course->fullname;
@ -176,7 +176,7 @@ class template {
$html = str_replace("__DATE__", userdate($date, '%B %d, %Y'), $html);
$html = str_replace("__PIN__", $user->profile_field_pin, $html);
$html = str_replace("__PIN__", $user->username, $html);
$pdf->addPage($html);
$pdf->send();

View file

@ -18,7 +18,7 @@
* Handles viewing a htmlcert.
*
* @package mod_htmlcert
* @copyright 2013 Mark Nelson <markn@moodle.com>, 2021 Klaus-Uwe Mitterer <kumitterer@kumi.systems>
* @copyright 2013 Mark Nelson <markn@moodle.com>, 2021-2022 Kumi Systems e.U. <office@kumi.systems>
* @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/htmlcert/view.php', array('id' => $cm->id, 'downloadown' => true));
$downloadbutton = new single_button($link, $linkname, 'get', true);
$downloadbutton->class .= ' m-b-1'; // Seems a bit hackish, ahem.
$downloadbutton->add_action(new \popup_action('click', $link));
$downloadbutton = $OUTPUT->render($downloadbutton);
}