Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new button to return to course #655

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lang/en/customcert.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@
$string['refpoint_help'] = 'The reference point is the location of an element from which its x and y coordinates are determined. It is indicated by the \'+\' that appears in the centre or corners of the element.';
$string['replacetemplate'] = 'Replace';
$string['requiredtimenotmet'] = 'You must spend at least a minimum of {$a->requiredtime} minutes in the course before you can access this certificate.';
$string['returncourse'] = 'Return to course button';
$string['returncourse_desc'] = 'Display a "return to course" button';
$string['returncourselabel'] = 'Return to course menu';
$string['rightmargin'] = 'Right margin';
$string['rightmargin_help'] = 'This is the right margin of the certificate PDF in mm.';
$string['save'] = 'Save';
Expand Down
5 changes: 5 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
get_string('uploadimage', 'customcert'), get_string('uploadimagedesc', 'customcert'),
get_string('uploadimage', 'customcert'), new moodle_url('/mod/customcert/upload_image.php'), ''));

$settings->add(new admin_setting_configcheckbox('customcert/returncourse',
get_string('returncourse', 'customcert'),
get_string('returncourse_desc', 'customcert'),
0));

if (has_capability('mod/customcert:viewallcertificates', context_system::instance())) {
$settings->add(new \mod_customcert\admin_setting_link('customcert/downloadallsitecerts',
get_string('downloadallsitecertificates', 'customcert'), get_string('downloadallsitecertificatesdesc', 'customcert'),
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');

$plugin->version = 2024042206; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2024112800; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2024042200; // Requires this Moodle version (4.4).
$plugin->cron = 0; // Period for cron to check this module (secs).
$plugin->component = 'mod_customcert';
Expand Down
11 changes: 11 additions & 0 deletions view.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,20 @@

// Create the button to download the customcert.
$downloadbutton = '';
$renderbuttoncourse = '';
$displayreturnbutton = get_config('customcert', 'returncourse');
if ($canreceive) {
$linkname = get_string('getcustomcert', 'customcert');
$link = new moodle_url('/mod/customcert/view.php', ['id' => $cm->id, 'downloadown' => true]);
$downloadbutton = new single_button($link, $linkname, 'get', single_button::BUTTON_PRIMARY);
$downloadbutton->class .= ' m-b-1'; // Seems a bit hackish, ahem.
$downloadbutton = $OUTPUT->render($downloadbutton);
if ($displayreturnbutton) {
$url = new moodle_url('/course/view.php', ['id' => $course->id]);
$buttonreturntocourse = new single_button($url, get_string('returncourselabel', 'customcert'), 'get',
single_button::BUTTON_PRIMARY);
$renderbuttoncourse = $OUTPUT->render($buttonreturntocourse);
}
}

$numissues = \mod_customcert\certificate::get_number_of_issues($customcert->id, $cm, $groupmode);
Expand All @@ -176,6 +184,9 @@
echo $issuehtml;
echo $downloadbutton;
echo $downloadallbutton;
if ($displayreturnbutton) {
echo $renderbuttoncourse;
}
if (isset($reporttable)) {
echo $OUTPUT->heading(get_string('listofissues', 'customcert', $numissues), 3);
groups_print_activity_menu($cm, $pageurl);
Expand Down
Loading