Skip to content

Commit

Permalink
IOMAD: Logic not quite right on cert regeneration.
Browse files Browse the repository at this point in the history
  • Loading branch information
turf212 committed Sep 22, 2023
1 parent 0970d22 commit d5d195c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions local/iomad_track/db/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ function xmldb_local_iomad_track_record_certificates($courseid, $userid, $tracki
// Get context
$context = context_course::instance($courseid);

mtrace ("generating certificate with onlyvisible = $onlyvisible</br>");
die;
// Get user
$user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);

Expand Down
6 changes: 3 additions & 3 deletions local/report_completion/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@
// Re-generate the certificate.
if ($trackrec = $DB->get_record('local_iomad_track', array('id' => $key))) {
local_iomad_track_delete_entry($key);
xmldb_local_iomad_track_record_certificates($trackrec->courseid, $trackrec->userid, $trackrec->id, false, true);
xmldb_local_iomad_track_record_certificates($trackrec->courseid, $trackrec->userid, $trackrec->id, false, false);
}
}
}
Expand Down Expand Up @@ -362,7 +362,7 @@

// Re-generate the certificate.
local_iomad_track_delete_entry($key);
xmldb_local_iomad_track_record_certificates($trackrec->courseid, $trackrec->userid, $trackrec->id, false, true);
xmldb_local_iomad_track_record_certificates($trackrec->courseid, $trackrec->userid, $trackrec->id, false, false);
}
}
}
Expand All @@ -376,7 +376,7 @@
if ($action == 'redocert' && !empty($redocertificate)) {
if ($trackrec = $DB->get_record('local_iomad_track', array('id' => $redocertificate))) {
local_iomad_track_delete_entry($redocertificate);
if (xmldb_local_iomad_track_record_certificates($trackrec->courseid, $trackrec->userid, $trackrec->id, false, true)) {
if (xmldb_local_iomad_track_record_certificates($trackrec->courseid, $trackrec->userid, $trackrec->id, false, false)) {
redirect(new moodle_url('/local/report_completion/index.php', $params),
get_string($action . "_successful", 'local_report_users'),
null,
Expand Down
2 changes: 1 addition & 1 deletion local/report_users/newentry.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
$trackid = $DB->insert_record('local_iomad_track', $newentry);

// Create a certificate, if required.
xmldb_local_iomad_track_record_certificates($newentry->courseid, $newentry->userid, $trackid, false, true);
xmldb_local_iomad_track_record_certificates($newentry->courseid, $newentry->userid, $trackid, false, false);

// Return success.
redirect($returnurl,
Expand Down
6 changes: 3 additions & 3 deletions local/report_users/userdisplay.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
// Re-generate the certificate.
if ($trackrec = $DB->get_record('local_iomad_track', array('id' => $key))) {
local_iomad_track_delete_entry($key);
xmldb_local_iomad_track_record_certificates($trackrec->courseid, $trackrec->userid, $trackrec->id, false, true);
xmldb_local_iomad_track_record_certificates($trackrec->courseid, $trackrec->userid, $trackrec->id, false, false);
}
}
}
Expand Down Expand Up @@ -250,7 +250,7 @@

// Re-generate the certificate.
local_iomad_track_delete_entry($key);
xmldb_local_iomad_track_record_certificates($trackrec->courseid, $trackrec->userid, $trackrec->id, false, true);
xmldb_local_iomad_track_record_certificates($trackrec->courseid, $trackrec->userid, $trackrec->id, false, false);
}
}
}
Expand All @@ -272,7 +272,7 @@
if ($action == 'redocert' && !empty($redocertificate)) {
if ($trackrec = $DB->get_record('local_iomad_track', array('id' => $redocertificate))) {
local_iomad_track_delete_entry($redocertificate);
if (xmldb_local_iomad_track_record_certificates($trackrec->courseid, $trackrec->userid, $trackrec->id, false, true)) {
if (xmldb_local_iomad_track_record_certificates($trackrec->courseid, $trackrec->userid, $trackrec->id, false, false)) {
redirect(new moodle_url('/local/report_users/userdisplay.php', array('userid' => $userid)),
get_string($action . "_successful", 'local_report_users'),
null,
Expand Down

0 comments on commit d5d195c

Please sign in to comment.