Compare commits

..

64 commits

Author SHA1 Message Date
6ac6ba53c1
Current status 2022-09-07 13:54:03 +00:00
bd2a78b94b Add CLI script to batch-apply templates 2021-11-09 14:27:32 +00:00
87b79503c8 Implemented PIN replacement 2021-11-09 14:23:04 +00:00
7c33e659b4 Current changes 2021-11-09 13:43:08 +00:00
8cc6693b24 Current changes 2021-11-09 13:42:54 +00:00
6bb72f655f Current changes 2021-11-09 13:42:47 +00:00
b9c5e95f7a Add custom HTML field which takes precedence over template pages 2021-11-05 08:02:24 +00:00
Mark Nelson
311e243ca5 Update CHANGES.md 2021-10-27 16:46:50 +08:00
Mark Nelson
5ba1b2b40f Respect multiple languages in manage template page title (#467) 2021-10-27 16:44:49 +08:00
Mark Nelson
4ca9f05fc1 Updated CHANGES.md 2021-10-27 15:31:53 +08:00
hieuvu
2a9640b5a3 Fix error message when we have custom profile fields (#465) 2021-10-27 15:30:13 +08:00
Mark Nelson
18eab896bd Change JS to please GHA 2021-10-27 13:30:04 +08:00
Mark Nelson
9e38411434 Changes to make GHA happy and added usages of the coalescing operator (#121) 2021-10-27 13:15:32 +08:00
Mark Nelson
8464ba6259 Add issue number to CHANGES.md 2021-10-27 12:23:50 +08:00
Mark Nelson
92a3bcb0c3 Updated CHANGES.md 2021-10-25 16:14:18 +08:00
Jesús Alonso Abad
3b1cd64703 Added alignment to activity backup/cloning (#121) 2021-10-17 20:54:42 +08:00
Jesús Alonso Abad
383054be39 Added elements alignment support (#121) 2021-10-17 20:44:55 +08:00
Mark Nelson
80dc7395c3 Do not encode html entities in emails (#457) 2021-09-28 22:17:53 +08:00
Mark Nelson
b684fee9f4 Update CHANGES.md 2021-08-06 10:56:43 +08:00
Andrew Madden
95274bfad6 Closes #449 The user id should be mapped to the equivalent user id in new sites during activity restore
As the userid in the customcert_issues table were using the userid from the site where the activity was backed up, emails were being sent to those that had already received them. Theoretically there wwere also users who should have received an email who didn't get one.
2021-08-06 10:48:21 +08:00
Mark Nelson
75fe6b4cdd Update CHANGES.md 2021-08-04 11:37:11 +08:00
Mark Nelson
8b8a358790 Minor code changes (#415) 2021-08-04 11:28:03 +08:00
Sameer Ahmed
a1f0e6dec7 Display the course short name (#415)
- Added a new select box to choose from course name or short description to display.
2021-08-03 18:56:25 +08:00
Mark Nelson
f1cf599f31 GHA: ROW_FORMAT=COMPRESSED deprecated in MariaDB 10.6
See MDL-72131.
2021-08-03 17:56:54 +08:00
Mark Nelson
afcea89c82 Add new lines at end of files 2021-08-03 17:39:34 +08:00
Mark Nelson
5e3135324c Remove unnecessary new line 2021-08-03 16:53:24 +08:00
Mark Nelson
c6c4e6f6a7 Minor changes and CHANGES.md note (#433) 2021-08-03 16:30:45 +08:00
Michael Milette
25d398ce22 Fix for multi-language issues (#433).
- Filename of PDF when viewing/previewing PDF.
- Page title tag when viewing/previewing PDF.
- List of available templates.
- Template Load dropdown list.
2021-07-27 10:54:18 +08:00
Mark Nelson
cf11f765b0 Fix GHA failing 2021-07-06 17:18:35 +08:00
Dani Palou
6d966df56c Adapt mobile app code to Ionic 5 (#431) 2021-07-06 17:03:49 +08:00
Mark Nelson
e4458872fa Fix release date 2021-06-13 14:26:57 +08:00
Mark Nelson
26802e9262 Bump version 2021-06-13 14:04:59 +08:00
Mark Nelson
0de67035a3 Use 'cron_setup_user' when sending emails (#414) 2021-06-13 14:04:18 +08:00
Mark Nelson
11225ff1fa Set proper context when sending emails (#402) 2021-06-13 13:36:02 +08:00
hieuvu
bd361d2434 Add actions title to elements table (#425) 2021-06-08 17:41:38 +08:00
Mark Nelson
659e065a2f Fix failing PHPUnit test 2021-05-28 00:50:25 +08:00
Mark Nelson
991ef9b0e3 Fix failing Behat tests 2021-05-28 00:33:52 +08:00
Mark Nelson
a68f1b9487 Remove usage of deprecated user fields 2021-05-27 23:14:10 +08:00
Mark Nelson
8145e020e4 Add type hint and return type 2021-05-27 22:49:57 +08:00
Mark Nelson
e65cf7e9c2 Add new line at end of file 2021-05-27 22:48:30 +08:00
Mark Nelson
345c6e438b Removed usaged of deprecated functions (#423) 2021-05-27 22:46:53 +08:00
Mark Nelson
1343d64310 Fix Moodle Code Checker complaints 2021-05-27 22:13:31 +08:00
Mark Nelson
0208efa585 Removed usaged of deprecated functions (#423) 2021-05-27 21:37:50 +08:00
Mark Nelson
1a6d370d3f Removed .travis.yml file 2021-05-27 19:21:11 +08:00
Mark Nelson
69a3436faa Fix Moodle Code Checker complaints 2021-05-27 18:24:01 +08:00
Mark Nelson
9f320984c6 Update github/workflows/moodle-ci.yml 2021-05-27 14:28:16 +08:00
Mark Nelson
0122cc1138 Update travis.yml 2021-05-27 14:11:54 +08:00
Mark Nelson
4ca04d204d Bump for version 3.11 2021-05-27 14:05:04 +08:00
Mark Nelson
ff16abfd7c Update CHANGES.md 2021-04-16 14:42:31 +08:00
Mikhail Golenkov
1859ffa651 Fix the issue with displaying PDF when debugging is ON (#420) 2021-04-16 14:36:15 +08:00
Mark Nelson
47061f8737 Add type hinting to get_course_time() 2021-04-05 20:11:02 +08:00
Mark Nelson
6e89c1d921 Use instance of moodle_url() in the function notice() 2021-04-05 20:08:25 +08:00
Mark Nelson
22081dffb0 Fix get_course_time() allowing users to view certificate early (#403) 2021-04-05 19:55:27 +08:00
Mark Nelson
2e58b24daa Updated CHANGES.md 2021-04-05 16:51:26 +08:00
Mark Nelson
8446a2e10a Add ability to choose how to deliver the certificate (#401) 2021-04-05 16:49:10 +08:00
Mark Nelson
ae2df6c9ed Updated CHANGES.md 2021-04-03 11:27:32 +08:00
Mark Nelson
2e881e32c9 Add ability to show description on course page (#406) 2021-04-03 10:37:15 +08:00
Marina Glancy
dcbb07e2f3 Add github actions (#407) 2021-04-02 20:48:49 +08:00
Toni Förster
350b18dda6 Allow managers to download certificates (#412)
Currently, it is not possible for editing teachers
and managers to download certificates for users because
we only check for $canreceive.
2021-04-02 20:45:42 +08:00
Mark Nelson
a9f83a2579 Fix PHPDocs for the method get_course_field_value() 2020-11-27 20:13:33 +08:00
Mark Nelson
a81b6e4fd5 Update .travis.yml 2020-11-27 20:13:28 +08:00
Mark Nelson
8515c5bd9e Add missing full-stop to comment 2020-11-27 16:02:07 +08:00
Mark Nelson
b70224c0e4 Make tests compatible with new version of PHPUnit 2020-11-27 16:01:04 +08:00
Mark Nelson
a38678c691 3.10 release 2020-11-27 14:40:56 +08:00
46 changed files with 675 additions and 151 deletions

View file

@ -29,16 +29,16 @@ jobs:
matrix: matrix:
include: include:
- php: '7.4' - php: '7.4'
moodle-branch: 'MOODLE_39_STABLE' moodle-branch: 'MOODLE_311_STABLE'
database: pgsql database: pgsql
- php: '7.4' - php: '7.4'
moodle-branch: 'MOODLE_39_STABLE' moodle-branch: 'MOODLE_311_STABLE'
database: mariadb database: mariadb
- php: '7.2' - php: '7.3'
moodle-branch: 'MOODLE_39_STABLE' moodle-branch: 'MOODLE_311_STABLE'
database: pgsql database: pgsql
- php: '7.2' - php: '7.3'
moodle-branch: 'MOODLE_39_STABLE' moodle-branch: 'MOODLE_311_STABLE'
database: mariadb database: mariadb
steps: steps:
@ -111,9 +111,9 @@ jobs:
run: | run: |
moodle-plugin-ci phpunit moodle-plugin-ci phpunit
cd moodle cd moodle
vendor/bin/phpunit --fail-on-risky --disallow-test-output -v admin/tool/dataprivacy/tests/metadata_registry_test.php vendor/bin/phpunit --fail-on-risky --disallow-test-output --filter tool_dataprivacy_metadata_registry_testcase
vendor/bin/phpunit --fail-on-risky --disallow-test-output -v lib/tests/externallib_test.php vendor/bin/phpunit --fail-on-risky --disallow-test-output --filter core_externallib_testcase
vendor/bin/phpunit --fail-on-risky --disallow-test-output -v privacy/tests/provider_test.php vendor/bin/phpunit --fail-on-risky --disallow-test-output --testsuite core_privacy_testsuite --filter provider_testcase
- name: Behat features - name: Behat features
if: ${{ always() }} if: ${{ always() }}

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
vendor/
*.swp

View file

@ -4,19 +4,25 @@ All notable changes to this project will be documented in this file.
Note - All hash comments refer to the issue number. Eg. #169 refers to https://github.com/mdjnelson/moodle-mod_customcert/issues/169. Note - All hash comments refer to the issue number. Eg. #169 refers to https://github.com/mdjnelson/moodle-mod_customcert/issues/169.
## [3.9.2] - 2021-??-?? ## [3.11.2] - 2021-??-??
### Fixed ### Fixed
- Fix places not using the multi-language filter (#433). - Fix places not using the multi-language filter (#433).
- Fix user IDs in the issue table not being mapped during restore (#449). - Fix user IDs in the issue table not being mapped during restore (#449).
- Fix emails displaying HTML entities encoded (#457). - Fix emails displaying HTML entities encoded (#457).
- Fix error message when we have custom profile fields (#465).
- Respect multiple languages in manage template page title (#467). - Respect multiple languages in manage template page title (#467).
### Added ### Added
- You can now choose the course short or full name to display (#415). - You can now choose the course short or full name to display (#415).
- You can now select the alignment for all text elements (#121). - You can now select the alignment for all text elements (#121).
## [3.9.1] - 2021-06-13 ## [3.11.1] - 2021-06-13
### Fixed
- Usage of deprecated functions (#423)
## [3.10.1] - 2021-06-13
### Added ### Added
- Usage of github actions (#407). - Usage of github actions (#407).

View file

@ -6,6 +6,8 @@ This activity allows the dynamic generation of PDF certificates with complete cu
There are two installation methods that are available. There are two installation methods that are available.
First, make sure that wkhtmltopdf is installed on your server and available on $PATH.
Follow one of these, then log into your Moodle site as an administrator and visit the notifications page to complete the install. Follow one of these, then log into your Moodle site as an administrator and visit the notifications page to complete the install.
### Git ### Git

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -18,7 +18,6 @@
* use the YUI version in AMD code until it is replaced. * use the YUI version in AMD code until it is replaced.
* *
* @module mod_customcert/dialogue * @module mod_customcert/dialogue
* @package mod_customcert
* @copyright 2016 Mark Nelson <markn@moodle.com> * @copyright 2016 Mark Nelson <markn@moodle.com>
* @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
*/ */

View file

@ -17,7 +17,6 @@
* AMD module used when rearranging a custom certificate. * AMD module used when rearranging a custom certificate.
* *
* @module mod_customcert/rearrange-area * @module mod_customcert/rearrange-area
* @package mod_customcert
* @copyright 2016 Mark Nelson <markn@moodle.com> * @copyright 2016 Mark Nelson <markn@moodle.com>
* @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
*/ */

View file

@ -270,12 +270,20 @@ class certificate {
$allparams = $conditionsparams + array('customcertid' => $customcertid); $allparams = $conditionsparams + array('customcertid' => $customcertid);
// Return the issues. // Return the issues.
$extrafields = get_extra_user_fields(\context_module::instance($cm->id)); $context = \context_module::instance($cm->id);
$ufields = \user_picture::fields('u', $extrafields); $extrafields = \core_user\fields::for_identity($context)->get_required_fields();
$sql = "SELECT $ufields, ci.id as issueid, ci.code, ci.timecreated
$ufields = \core_user\fields::for_userpic()->including(...$extrafields);
[
'selects' => $userfieldsselects,
'joins' => $userfieldsjoin,
'params' => $userfieldsparams
] = (array) $ufields->get_sql('u', true);
$allparams = array_merge($allparams, $userfieldsparams);
$sql = "SELECT ci.id as issueid, ci.code, ci.timecreated $userfieldsselects
FROM {user} u FROM {user} u
INNER JOIN {customcert_issues} ci INNER JOIN {customcert_issues} ci ON u.id = ci.userid
ON u.id = ci.userid $userfieldsjoin
WHERE u.deleted = 0 WHERE u.deleted = 0
AND ci.customcertid = :customcertid AND ci.customcertid = :customcertid
$conditionssql"; $conditionssql";

64
classes/helper.php Normal file
View file

@ -0,0 +1,64 @@
<?php
// This file is part of the customcert module for Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides helper functionality.
*
* @package mod_customcert
* @copyright 2021 Mark Nelson <mdjnelson@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_customcert;
use core_user\fields;
defined('MOODLE_INTERNAL') || die();
/**
* Class helper.
*
* Helper functionality for this module.
*
* @package mod_customcert
* @copyright 2021 Mark Nelson <mdjnelson@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class helper {
/**
* A centralised location for the all name fields.
*
* Returns a sql string snippet.
*
* @param string $tableprefix table query prefix to use in front of each field.
* @return string All name fields.
*/
public static function get_all_user_name_fields(string $tableprefix = ''): string {
$alternatenames = [];
foreach (fields::get_name_fields() as $field) {
$alternatenames[$field] = $field;
}
if ($tableprefix) {
foreach ($alternatenames as $key => $altname) {
$alternatenames[$key] = $tableprefix . '.' . $altname;
}
}
return implode(',', $alternatenames);
}
}

View file

@ -66,7 +66,7 @@ class report_table extends \table_sql {
parent::__construct('mod_customcert_report_table'); parent::__construct('mod_customcert_report_table');
$context = \context_module::instance($cm->id); $context = \context_module::instance($cm->id);
$extrafields = get_extra_user_fields($context); $extrafields = \core_user\fields::for_identity($context)->get_required_fields();
$columns = []; $columns = [];
$columns[] = 'fullname'; $columns[] = 'fullname';
@ -79,7 +79,7 @@ class report_table extends \table_sql {
$headers = []; $headers = [];
$headers[] = get_string('fullname'); $headers[] = get_string('fullname');
foreach ($extrafields as $extrafield) { foreach ($extrafields as $extrafield) {
$headers[] = get_user_field_name($extrafield); $headers[] = \core_user\fields::get_display_name($extrafield);
} }
$headers[] = get_string('receiveddate', 'customcert'); $headers[] = get_string('receiveddate', 'customcert');
$headers[] = get_string('code', 'customcert'); $headers[] = get_string('code', 'customcert');

View file

@ -23,6 +23,8 @@
*/ */
namespace mod_customcert\task; namespace mod_customcert\task;
use mod_customcert\helper;
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
/** /**
@ -105,7 +107,7 @@ class email_certificate_task extends \core\task\scheduled_task {
$info->certificatename = $certificatename; $info->certificatename = $certificatename;
// Get a list of all the issues. // Get a list of all the issues.
$userfields = get_all_user_name_fields(true, 'u'); $userfields = helper::get_all_user_name_fields('u');
$sql = "SELECT u.id, u.username, $userfields, u.email, ci.id as issueid, ci.emailed $sql = "SELECT u.id, u.username, $userfields, u.email, ci.id as issueid, ci.emailed
FROM {customcert_issues} ci FROM {customcert_issues} ci
JOIN {user} u JOIN {user} u

View file

@ -18,13 +18,19 @@
* 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
*/ */
namespace mod_customcert; namespace mod_customcert;
defined('MOODLE_INTERNAL') || die(); error_reporting(E_ALL);
require_once(__DIR__ . "/../vendor/autoload.php");
require_once($CFG->dirroot.'/user/profile/lib.php');
use mikehaertl\wkhtmlto\Pdf;
#defined('MOODLE_INTERNAL') || die();
/** /**
* Class represents a customcert template. * Class represents a customcert template.
@ -50,6 +56,8 @@ class template {
*/ */
protected $contextid; protected $contextid;
protected $html;
/** /**
* The constructor. * The constructor.
* *
@ -59,6 +67,7 @@ class template {
$this->id = $template->id; $this->id = $template->id;
$this->name = $template->name; $this->name = $template->name;
$this->contextid = $template->contextid; $this->contextid = $template->contextid;
$this->html = $template->html;
} }
/** /**
@ -254,7 +263,7 @@ class template {
* @return string|void Can return the PDF in string format if specified. * @return string|void Can return the PDF in string format if specified.
*/ */
public function generate_pdf(bool $preview = false, int $userid = null, bool $return = false) { public function generate_pdf(bool $preview = false, int $userid = null, bool $return = false) {
global $CFG, $DB, $USER; global $CFG, $DB, $USER, $SITE;
if (empty($userid)) { if (empty($userid)) {
$user = $USER; $user = $USER;
@ -264,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.
@ -310,24 +321,91 @@ class template {
$orientation = 'P'; $orientation = 'P';
} }
$pdf->AddPage($orientation, array($page->width, $page->height)); $pdf->AddPage($orientation, array($page->width, $page->height));
$pdf->SetMargins($page->leftmargin, 0, $page->rightmargin);
// Get the elements for the page. if ($this->html) {
if ($elements = $DB->get_records('customcert_elements', array('pageid' => $page->id), 'sequence ASC')) { $pdf = new Pdf(array(
// Loop through and display. "disable-smart-shrinking",
foreach ($elements as $element) { "margin-bottom" => "0",
// Get an instance of the element class. "margin-right" => "0",
if ($e = \mod_customcert\element_factory::get_element_instance($element)) { "margin-left" => "0",
$e->render($pdf, $preview, $user); "margin-top" => "0"
} ));
} $html = $this->html;
}
$context = \context_user::instance($user->id);
$fs = get_file_storage();
$files = $fs->get_area_files($context->id, 'user', 'icon', 0);
$file = null;
$content = "";
foreach ($files as $filefound) {
if (!$filefound->is_directory()) {
$file = $filefound;
break;
}
}
if ($file) {
$location = make_request_directory() . '/target';
$content = $file->get_content();
} else if ($preview) {
}
$html = str_replace("__PROFILEPIC__", 'data: ' . mime_content_type($file) . ';base64,' . $content, $html);
$html = str_replace("__NAME__", $user->firstname . " " . $user->lastname, $html);
if ($preview) {
$code = \mod_customcert\certificate::generate_code();
} else {
$issue = $DB->get_record('customcert_issues', array('userid' => $user->id, 'customcertid' => $customcert->id),
'*', IGNORE_MULTIPLE);
$code = $issue->code;
}
$html = str_replace("__CERTNUM__", $code, $html);
if ($preview) {
$courseid = $SITE->id;
} else {
$courseid = $customcert->course;
}
$course = get_course($courseid);
$coursename = $course->fullname;
$html = str_replace("__COURSE__", $coursename, $html);
$date = $issue->timecreated;
$html = str_replace("__DATE__", userdate($date, '%B %d, %Y'), $html);
$html = str_replace("__PIN__", $user->username, $html);
$pdf->addPage($html);
$pdf->send();
die($pdf->getError());
} else {
$pdf->SetMargins($page->leftmargin, 0, $page->rightmargin);
// Get the elements for the page.
if ($elements = $DB->get_records('customcert_elements', array('pageid' => $page->id), 'sequence ASC')) {
// Loop through and display.
foreach ($elements as $element) {
// Get an instance of the element class.
if ($e = \mod_customcert\element_factory::get_element_instance($element)) {
$e->render($pdf, $preview, $user);
}
}
}
}
} }
if ($return) { if ($return && !$this->html) {
return $pdf->Output('', 'S'); return $pdf->Output('', 'S');
} }
$pdf->Output($filename, $deliveryoption); if (!$this->html) {
$pdf->Output($filename, $deliveryoption);
}
} }
} }
@ -339,6 +417,10 @@ class template {
public function copy_to_template($copytotemplateid) { public function copy_to_template($copytotemplateid) {
global $DB; global $DB;
$copytotemplate = $DB->get_record('customcert_templates', array('id' => $copytotemplateid));
$copytotemplate->html = $this->html;
$DB->update_record('customcert_templates', $copytotemplate);
// 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 ($templatepages = $DB->get_records('customcert_pages', array('templateid' => $this->id))) { if ($templatepages = $DB->get_records('customcert_pages', array('templateid' => $this->id))) {
// Loop through the pages. // Loop through the pages.
@ -431,6 +513,10 @@ class template {
return $this->name; return $this->name;
} }
public function get_html() {
return $this->html;
}
/** /**
* Returns the context id. * Returns the context id.
* *

View file

@ -2,7 +2,8 @@
"name": "mdjnelson/moodle-mod_customcert", "name": "mdjnelson/moodle-mod_customcert",
"type": "moodle-mod", "type": "moodle-mod",
"require": { "require": {
"composer/installers": "~1.0" "composer/installers": "~1.0",
"mikehaertl/phpwkhtmltopdf": "^2.5"
}, },
"extra": { "extra": {
"installer-name": "customcert" "installer-name": "customcert"

311
composer.lock generated Normal file
View file

@ -0,0 +1,311 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "749e39445f7c33f767b710400da4e9c6",
"packages": [
{
"name": "composer/installers",
"version": "v1.12.0",
"source": {
"type": "git",
"url": "https://github.com/composer/installers.git",
"reference": "d20a64ed3c94748397ff5973488761b22f6d3f19"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/installers/zipball/d20a64ed3c94748397ff5973488761b22f6d3f19",
"reference": "d20a64ed3c94748397ff5973488761b22f6d3f19",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0 || ^2.0"
},
"replace": {
"roundcube/plugin-installer": "*",
"shama/baton": "*"
},
"require-dev": {
"composer/composer": "1.6.* || ^2.0",
"composer/semver": "^1 || ^3",
"phpstan/phpstan": "^0.12.55",
"phpstan/phpstan-phpunit": "^0.12.16",
"symfony/phpunit-bridge": "^4.2 || ^5",
"symfony/process": "^2.3"
},
"type": "composer-plugin",
"extra": {
"class": "Composer\\Installers\\Plugin",
"branch-alias": {
"dev-main": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Composer\\Installers\\": "src/Composer/Installers"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kyle Robinson Young",
"email": "kyle@dontkry.com",
"homepage": "https://github.com/shama"
}
],
"description": "A multi-framework Composer library installer",
"homepage": "https://composer.github.io/installers/",
"keywords": [
"Craft",
"Dolibarr",
"Eliasis",
"Hurad",
"ImageCMS",
"Kanboard",
"Lan Management System",
"MODX Evo",
"MantisBT",
"Mautic",
"Maya",
"OXID",
"Plentymarkets",
"Porto",
"RadPHP",
"SMF",
"Starbug",
"Thelia",
"Whmcs",
"WolfCMS",
"agl",
"aimeos",
"annotatecms",
"attogram",
"bitrix",
"cakephp",
"chef",
"cockpit",
"codeigniter",
"concrete5",
"croogo",
"dokuwiki",
"drupal",
"eZ Platform",
"elgg",
"expressionengine",
"fuelphp",
"grav",
"installer",
"itop",
"joomla",
"known",
"kohana",
"laravel",
"lavalite",
"lithium",
"magento",
"majima",
"mako",
"mediawiki",
"miaoxing",
"modulework",
"modx",
"moodle",
"osclass",
"pantheon",
"phpbb",
"piwik",
"ppi",
"processwire",
"puppet",
"pxcms",
"reindex",
"roundcube",
"shopware",
"silverstripe",
"sydes",
"sylius",
"symfony",
"tastyigniter",
"typo3",
"wordpress",
"yawik",
"zend",
"zikula"
],
"support": {
"issues": "https://github.com/composer/installers/issues",
"source": "https://github.com/composer/installers/tree/v1.12.0"
},
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://github.com/composer",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2021-09-13T08:19:44+00:00"
},
{
"name": "mikehaertl/php-shellcommand",
"version": "1.6.4",
"source": {
"type": "git",
"url": "https://github.com/mikehaertl/php-shellcommand.git",
"reference": "3488d7803df1e8f1a343d3d0ca452d527ad8d5e5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mikehaertl/php-shellcommand/zipball/3488d7803df1e8f1a343d3d0ca452d527ad8d5e5",
"reference": "3488d7803df1e8f1a343d3d0ca452d527ad8d5e5",
"shasum": ""
},
"require": {
"php": ">= 5.3.0"
},
"require-dev": {
"phpunit/phpunit": ">4.0 <=9.4"
},
"type": "library",
"autoload": {
"psr-4": {
"mikehaertl\\shellcommand\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Härtl",
"email": "haertl.mike@gmail.com"
}
],
"description": "An object oriented interface to shell commands",
"keywords": [
"shell"
],
"support": {
"issues": "https://github.com/mikehaertl/php-shellcommand/issues",
"source": "https://github.com/mikehaertl/php-shellcommand/tree/1.6.4"
},
"time": "2021-03-17T06:54:33+00:00"
},
{
"name": "mikehaertl/php-tmpfile",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/mikehaertl/php-tmpfile.git",
"reference": "70a5b70b17bc0d9666388e6a551ecc93d0b40a10"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mikehaertl/php-tmpfile/zipball/70a5b70b17bc0d9666388e6a551ecc93d0b40a10",
"reference": "70a5b70b17bc0d9666388e6a551ecc93d0b40a10",
"shasum": ""
},
"require-dev": {
"php": ">=5.3.0",
"phpunit/phpunit": ">4.0 <=9.4"
},
"type": "library",
"autoload": {
"psr-4": {
"mikehaertl\\tmp\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Härtl",
"email": "haertl.mike@gmail.com"
}
],
"description": "A convenience class for temporary files",
"keywords": [
"files"
],
"support": {
"issues": "https://github.com/mikehaertl/php-tmpfile/issues",
"source": "https://github.com/mikehaertl/php-tmpfile/tree/1.2.1"
},
"time": "2021-03-01T18:26:25+00:00"
},
{
"name": "mikehaertl/phpwkhtmltopdf",
"version": "2.5.0",
"source": {
"type": "git",
"url": "https://github.com/mikehaertl/phpwkhtmltopdf.git",
"reference": "17ee71341591415d942774eda2c98d8ba7ea9e90"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mikehaertl/phpwkhtmltopdf/zipball/17ee71341591415d942774eda2c98d8ba7ea9e90",
"reference": "17ee71341591415d942774eda2c98d8ba7ea9e90",
"shasum": ""
},
"require": {
"mikehaertl/php-shellcommand": "^1.5.0",
"mikehaertl/php-tmpfile": "^1.2.1",
"php": ">=5.0.0"
},
"require-dev": {
"phpunit/phpunit": ">4.0 <9.4"
},
"type": "library",
"autoload": {
"psr-4": {
"mikehaertl\\wkhtmlto\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Haertl",
"email": "haertl.mike@gmail.com"
}
],
"description": "A slim PHP wrapper around wkhtmltopdf with an easy to use and clean OOP interface",
"homepage": "http://mikehaertl.github.com/phpwkhtmltopdf/",
"keywords": [
"pdf",
"wkhtmltoimage",
"wkhtmltopdf"
],
"support": {
"issues": "https://github.com/mikehaertl/phpwkhtmltopdf/issues",
"source": "https://github.com/mikehaertl/phpwkhtmltopdf/tree/2.5.0"
},
"time": "2021-03-01T19:41:06+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"plugin-api-version": "2.0.0"
}

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/customcert/db" VERSION="20170530" COMMENT="XMLDB file for Moodle mod/customcert" <XMLDB PATH="mod/customcert/db" VERSION="20211105" COMMENT="XMLDB file for Moodle mod/customcert"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd" xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
> >
@ -10,7 +10,7 @@
<FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/> <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="templateid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/> <FIELD NAME="templateid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/> <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="intro" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/> <FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="requiredtime" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/> <FIELD NAME="requiredtime" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="verifyany" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/> <FIELD NAME="verifyany" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
@ -34,6 +34,7 @@
<FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="References contextid."/> <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="References contextid."/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/> <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/> <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="html" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
</FIELDS> </FIELDS>
<KEYS> <KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for customcert_template"/> <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for customcert_template"/>
@ -77,7 +78,7 @@
<FIELD NAME="pageid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/> <FIELD NAME="pageid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/> <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="element" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/> <FIELD NAME="element" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="data" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="data" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="font" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="font" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="fontsize" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="fontsize" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="colour" TYPE="char" LENGTH="50" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="colour" TYPE="char" LENGTH="50" NOTNULL="false" SEQUENCE="false"/>

View file

@ -166,7 +166,7 @@ function xmldb_customcert_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2019111803, 'customcert'); upgrade_mod_savepoint(true, 2019111803, 'customcert');
} }
if ($oldversion < 2020061501) { if ($oldversion < 2020110901) {
$table = new xmldb_table('customcert'); $table = new xmldb_table('customcert');
$field = new xmldb_field('deliveryoption', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'verifyany'); $field = new xmldb_field('deliveryoption', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'verifyany');
@ -175,16 +175,28 @@ function xmldb_customcert_upgrade($oldversion) {
$dbman->add_field($table, $field); $dbman->add_field($table, $field);
} }
upgrade_mod_savepoint(true, 2020061501, 'customcert'); upgrade_mod_savepoint(true, 2020110901, 'customcert');
} }
if ($oldversion < 2020061503) { if ($oldversion < 2021051702) {
$table = new xmldb_table('customcert_elements'); $table = new xmldb_table('customcert_elements');
$field = new xmldb_field('alignment', XMLDB_TYPE_CHAR, '1', null, XMLDB_NOTNULL, null, 'L', 'refpoint'); $field = new xmldb_field('alignment', XMLDB_TYPE_CHAR, '1', null, XMLDB_NOTNULL, null, 'L', 'refpoint');
$dbman->add_field($table, $field); $dbman->add_field($table, $field);
upgrade_mod_savepoint(true, 2020061503, 'customcert'); // Replace with the actual version number. upgrade_mod_savepoint(true, 2021051702, 'customcert');
}
if ($oldversion < 2021110501) {
$table = new xmldb_table('customcert_templates');
$field = new xmldb_field('html', XMLDB_TYPE_TEXT, null, null, null, null, null, 'timemodified');
// Conditionally launch add field html.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_mod_savepoint(true, 2021110501, 'customcert');
} }
return true; return true;

View file

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2021051700; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version (3.9). $plugin->requires = 2021051700; // Requires this Moodle version (3.11).
$plugin->component = 'customcertelement_bgimage'; $plugin->component = 'customcertelement_bgimage';

View file

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2021051700; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version (3.9). $plugin->requires = 2021051700; // Requires this Moodle version (3.11).
$plugin->component = 'customcertelement_border'; $plugin->component = 'customcertelement_border';

View file

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2021051700; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version (3.9). $plugin->requires = 2021051700; // Requires this Moodle version (3.11).
$plugin->component = 'customcertelement_categoryname'; $plugin->component = 'customcertelement_categoryname';

View file

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2021051700; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version (3.9). $plugin->requires = 2021051700; // Requires this Moodle version (3.11).
$plugin->component = 'customcertelement_code'; $plugin->component = 'customcertelement_code';

View file

@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2021051700; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version (3.9). $plugin->requires = 2021051700; // Requires this Moodle version (3.11).
$plugin->component = 'customcertelement_coursefield'; $plugin->component = 'customcertelement_coursefield';

View file

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2021051700; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version (3.9). $plugin->requires = 2021051700; // Requires this Moodle version (3.11).
$plugin->component = 'customcertelement_coursename'; $plugin->component = 'customcertelement_coursename';

View file

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2021051700; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version (3.9). $plugin->requires = 2021051700; // Requires this Moodle version (3.11).
$plugin->component = 'customcertelement_date'; $plugin->component = 'customcertelement_date';

View file

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2021051700; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version (3.9). $plugin->requires = 2021051700; // Requires this Moodle version (3.11).
$plugin->component = 'customcertelement_daterange'; $plugin->component = 'customcertelement_daterange';

View file

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2021051700; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version (3.9). $plugin->requires = 2021051700; // Requires this Moodle version (3.11).
$plugin->component = 'customcertelement_digitalsignature'; $plugin->component = 'customcertelement_digitalsignature';

View file

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2021051700; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version (3.9). $plugin->requires = 2021051700; // Requires this Moodle version (3.11).
$plugin->component = 'customcertelement_grade'; $plugin->component = 'customcertelement_grade';

View file

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2021051700; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version (3.9). $plugin->requires = 2021051700; // Requires this Moodle version (3.11).
$plugin->component = 'customcertelement_gradeitemname'; $plugin->component = 'customcertelement_gradeitemname';

View file

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2021051700; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version (3.9). $plugin->requires = 2021051700; // Requires this Moodle version (3.11).
$plugin->component = 'customcertelement_image'; $plugin->component = 'customcertelement_image';

View file

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2021051700; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version (3.9). $plugin->requires = 2021051700; // Requires this Moodle version (3.11).
$plugin->component = 'customcertelement_qrcode'; $plugin->component = 'customcertelement_qrcode';

View file

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2021051700; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version (3.9). $plugin->requires = 2021051700; // Requires this Moodle version (3.11).
$plugin->component = 'customcertelement_studentname'; $plugin->component = 'customcertelement_studentname';

View file

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2021051700; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version (3.9). $plugin->requires = 2021051700; // Requires this Moodle version (3.11).
$plugin->component = 'customcertelement_teachername'; $plugin->component = 'customcertelement_teachername';

View file

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2021051700; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version (3.9). $plugin->requires = 2021051700; // Requires this Moodle version (3.11).
$plugin->component = 'customcertelement_text'; $plugin->component = 'customcertelement_text';

View file

@ -24,6 +24,8 @@
namespace customcertelement_userfield; namespace customcertelement_userfield;
use core_user\fields;
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
/** /**
@ -43,24 +45,20 @@ class element extends \mod_customcert\element {
public function render_form_elements($mform) { public function render_form_elements($mform) {
// Get the user profile fields. // Get the user profile fields.
$userfields = array( $userfields = array(
'firstname' => get_user_field_name('firstname'), 'firstname' => fields::get_display_name('firstname'),
'lastname' => get_user_field_name('lastname'), 'lastname' => fields::get_display_name('lastname'),
'username' => get_user_field_name('username'), 'username' => fields::get_display_name('username'),
'email' => get_user_field_name('email'), 'email' => fields::get_display_name('email'),
'city' => get_user_field_name('city'), 'city' => fields::get_display_name('city'),
'country' => get_user_field_name('country'), 'country' => fields::get_display_name('country'),
'url' => get_user_field_name('url'), 'url' => fields::get_display_name('url'),
'icq' => get_user_field_name('icq'), 'skype' => fields::get_display_name('skype'),
'skype' => get_user_field_name('skype'), 'idnumber' => fields::get_display_name('idnumber'),
'aim' => get_user_field_name('aim'), 'institution' => fields::get_display_name('institution'),
'yahoo' => get_user_field_name('yahoo'), 'department' => fields::get_display_name('department'),
'msn' => get_user_field_name('msn'), 'phone1' => fields::get_display_name('phone1'),
'idnumber' => get_user_field_name('idnumber'), 'phone2' => fields::get_display_name('phone2'),
'institution' => get_user_field_name('institution'), 'address' => fields::get_display_name('address')
'department' => get_user_field_name('department'),
'phone1' => get_user_field_name('phone1'),
'phone2' => get_user_field_name('phone2'),
'address' => get_user_field_name('address')
); );
// Get the user custom fields. // Get the user custom fields.
$arrcustomfields = \availability_profile\condition::get_custom_profile_fields(); $arrcustomfields = \availability_profile\condition::get_custom_profile_fields();

View file

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2021051700; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version (3.9). $plugin->requires = 2021051700; // Requires this Moodle version (3.11).
$plugin->component = 'customcertelement_userfield'; $plugin->component = 'customcertelement_userfield';

View file

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2021051700; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version (3.9). $plugin->requires = 2021051700; // Requires this Moodle version (3.11).
$plugin->component = 'customcertelement_userpicture'; $plugin->component = 'customcertelement_userpicture';

57
load_template_cli.php Normal file
View file

@ -0,0 +1,57 @@
<?php
// This file is part of the customcert module for Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
define('CLI_SCRIPT', true);
require_once('../../config.php');
$tid = $argv[1];
$ltid = $argv[2];
$template = $DB->get_record('customcert_templates', array('id' => $tid), '*', MUST_EXIST);
$template = new \mod_customcert\template($template);
$loadtemplate = $DB->get_record('customcert_templates', array('id' => $ltid), '*', MUST_EXIST);
$loadtemplate = new \mod_customcert\template($loadtemplate);
$cm = $template->get_cm();
if ($template->get_context()->contextlevel == CONTEXT_MODULE) {
$customcert = $DB->get_record('customcert', ['id' => $cm->instance], '*', MUST_EXIST);
$title = $customcert->name;
$heading = format_string($title);
} else {
$title = $SITE->fullname;
$heading = $title;
}
$sql = "SELECT e.*
FROM {customcert_elements} e
INNER JOIN {customcert_pages} p
ON e.pageid = p.id
WHERE p.templateid = :templateid";
if ($elements = $DB->get_records_sql($sql, array('templateid' => $template->get_id()))) {
foreach ($elements as $element) {
if ($e = \mod_customcert\element_factory::get_element_instance($element)) {
$e->delete();
}
}
}
$DB->delete_records('customcert_pages', array('templateid' => $template->get_id()));
$loadtemplate->copy_to_template($template->get_id());

View file

@ -8,11 +8,9 @@ Feature: Being able to correctly display options on the certificate activity edi
And the following "users" exist: And the following "users" exist:
| username | firstname | lastname | email | | username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com | | teacher1 | Teacher | 1 | teacher1@example.com |
| manager1 | Manager | 1 | Manager1@example.com |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher1 | C1 | editingteacher |
| manager1 | C1 | manager |
And the following "activities" exist: And the following "activities" exist:
| activity | name | intro | course | idnumber | | activity | name | intro | course | idnumber |
| customcert | Custom certificate 1 | Custom certificate 1 intro | C1 | customcert1 | | customcert | Custom certificate 1 | Custom certificate 1 intro | C1 | customcert1 |
@ -29,40 +27,7 @@ Feature: Being able to correctly display options on the certificate activity edi
And I should see "Required minutes in course" And I should see "Required minutes in course"
And I should see "Set protection" And I should see "Set protection"
Scenario: Create an activity as an Editing Teacher I can see all custom certificate options @javascript
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Custom certificate" to section "1"
And I should see "Email students"
And I should see "Email teachers"
And I should see "Email others"
And I should see "Allow anyone to verify a certificate"
And I should see "Required minutes in course"
And I should see "Set protection"
Scenario: Add an activity as a Manager I can see all custom certificate options
And I log in as "manager1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Custom certificate" to section "1"
And I should see "Email students"
And I should see "Email teachers"
And I should see "Email others"
And I should see "Allow anyone to verify a certificate"
And I should see "Required minutes in course"
And I should see "Set protection"
Scenario: Edit an activity as a Manager Teacher I can see all custom certificate options
And I log in as "manager1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Custom certificate 1"
And I navigate to "Edit settings" in current page administration
And I should see "Email students"
And I should see "Email teachers"
And I should see "Email others"
And I should see "Allow anyone to verify a certificate"
And I should see "Required minutes in course"
And I should see "Set protection"
Scenario: Create an activity as an Editing Teacher without required capabilities I can't see all custom certificate options Scenario: Create an activity as an Editing Teacher without required capabilities I can't see all custom certificate options
And I log in as "admin" And I log in as "admin"
And I set the following system permissions of "Teacher" role: And I set the following system permissions of "Teacher" role:
@ -106,8 +71,9 @@ Feature: Being able to correctly display options on the certificate activity edi
And I should not see "Required minutes in course" And I should not see "Required minutes in course"
And I should not see "Set protection" And I should not see "Set protection"
@javascript
Scenario: Add an activity using default custom certificate options Scenario: Add an activity using default custom certificate options
And I log in as "manager1" And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on And I am on "Course 1" course homepage with editing mode on
And I add a "Custom certificate" to section "0" And I add a "Custom certificate" to section "0"
And the field "emailstudents" matches value "0" And the field "emailstudents" matches value "0"
@ -119,6 +85,7 @@ Feature: Being able to correctly display options on the certificate activity edi
And the field "protection_modify" matches value "0" And the field "protection_modify" matches value "0"
And the field "protection_copy" matches value "0" And the field "protection_copy" matches value "0"
@javascript
Scenario: Add an activity using configured custom certificate options Scenario: Add an activity using configured custom certificate options
And the following config values are set as admin: And the following config values are set as admin:
| emailstudents | 1 | customcert | | emailstudents | 1 | customcert |
@ -129,7 +96,7 @@ Feature: Being able to correctly display options on the certificate activity edi
| protection_print | 1 | customcert | | protection_print | 1 | customcert |
| protection_modify | 1 | customcert | | protection_modify | 1 | customcert |
| protection_copy | 1 | customcert | | protection_copy | 1 | customcert |
And I log in as "manager1" And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on And I am on "Course 1" course homepage with editing mode on
And I add a "Custom certificate" to section "1" And I add a "Custom certificate" to section "1"
And the field "emailstudents" matches value "1" And the field "emailstudents" matches value "1"

View file

@ -21,6 +21,8 @@ Feature: Being able to view the certificates that have been issued
And the following "activities" exist: And the following "activities" exist:
| activity | name | intro | course | idnumber | | activity | name | intro | course | idnumber |
| customcert | Custom certificate 1 | Custom certificate 1 intro | C1 | customcert1 | | customcert | Custom certificate 1 | Custom certificate 1 intro | C1 | customcert1 |
And the following config values are set as admin:
| showuseridentity | username,email |
Scenario: View the issued certificates Scenario: View the issued certificates
And I log in as "student1" And I log in as "student1"
@ -38,6 +40,12 @@ Feature: Being able to view the certificates that have been issued
And I follow "Custom certificate 1" And I follow "Custom certificate 1"
And I should see "Student 1" And I should see "Student 1"
And I should see "Student 2" And I should see "Student 2"
And I should see "Email address"
And I should see "Username"
And "Student 1" row "Email address" column of "generaltable" table should contain "student1@example.com"
And "Student 1" row "Username" column of "generaltable" table should contain "student1"
And "Student 2" row "Email address" column of "generaltable" table should contain "student2@example.com"
And "Student 2" row "Username" column of "generaltable" table should contain "student2"
Scenario: Delete an issued certificate Scenario: Delete an issued certificate
And I log in as "student1" And I log in as "student1"

View file

@ -40,7 +40,7 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
/** /**
* Test set up. * Test set up.
*/ */
public function setUp() { public function setUp(): void {
$this->resetAfterTest(); $this->resetAfterTest();
} }

View file

@ -38,7 +38,7 @@ class mod_customcert_task_email_certificate_task_testcase extends advanced_testc
/** /**
* Test set up. * Test set up.
*/ */
public function setUp() { public function setUp(): void {
$this->resetAfterTest(); $this->resetAfterTest();
} }

View file

@ -40,7 +40,7 @@ class mod_customcert_external_test_testcase extends advanced_testcase {
/** /**
* Test set up. * Test set up.
*/ */
public function setUp() { public function setUp(): void {
$this->resetAfterTest(); $this->resetAfterTest();
} }

View file

@ -98,9 +98,9 @@ class mod_customcert_privacy_provider_testcase extends \core_privacy\tests\provi
// Check this time there are 2 users. // Check this time there are 2 users.
$this->assertCount(2, $userlist->get_userids()); $this->assertCount(2, $userlist->get_userids());
$this->assertContains($user1->id, $userlist->get_userids()); $this->assertContains((int) $user1->id, $userlist->get_userids());
$this->assertContains($user2->id, $userlist->get_userids()); $this->assertContains((int) $user2->id, $userlist->get_userids());
$this->assertNotContains($user3->id, $userlist->get_userids()); $this->assertNotContains((int) $user3->id, $userlist->get_userids());
} }
/** /**

View file

@ -93,7 +93,7 @@ if ($code) {
$result->issues = array(); $result->issues = array();
// Ok, now check if the code is valid. // Ok, now check if the code is valid.
$userfields = get_all_user_name_fields(true, 'u'); $userfields = \mod_customcert\helper::get_all_user_name_fields('u');
$sql = "SELECT ci.id, u.id as userid, $userfields, co.id as courseid, $sql = "SELECT ci.id, u.id as userid, $userfields, co.id as courseid,
co.fullname as coursefullname, c.id as certificateid, co.fullname as coursefullname, c.id as certificateid,
c.name as certificatename, c.verifyany c.name as certificatename, c.verifyany

View file

@ -24,10 +24,10 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2020061503; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2021110501; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version (3.9). $plugin->requires = 2021051700; // Requires this Moodle version (3.11).
$plugin->cron = 0; // Period for cron to check this module (secs). $plugin->cron = 0; // Period for cron to check this module (secs).
$plugin->component = 'mod_customcert'; $plugin->component = 'mod_customcert';
$plugin->maturity = MATURITY_STABLE; $plugin->maturity = MATURITY_STABLE;
$plugin->release = "3.9.1"; // User-friendly version number. $plugin->release = "3.11.1-seachefs"; // User-friendly version number.

View file

@ -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);
} }