#49 Allow templates to have the same name
This commit is contained in:
parent
583368656e
commit
6fffb1a89a
2 changed files with 0 additions and 10 deletions
|
@ -128,17 +128,8 @@ class edit_form extends \moodleform {
|
||||||
* @return array the errors that were found
|
* @return array the errors that were found
|
||||||
*/
|
*/
|
||||||
public function validation($data, $files) {
|
public function validation($data, $files) {
|
||||||
global $DB;
|
|
||||||
|
|
||||||
$errors = parent::validation($data, $files);
|
$errors = parent::validation($data, $files);
|
||||||
|
|
||||||
// Check that the template name does not already exist for another template.
|
|
||||||
if ($template = $DB->get_record('customcert_templates', array('name' => $data['name']))) {
|
|
||||||
if (empty($data['tid']) || $template->id != $data['tid']) {
|
|
||||||
$errors['name'] = get_string('customcertnameexists', 'customcert');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Go through the data and check any width, height or margin values.
|
// Go through the data and check any width, height or margin values.
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
if (strpos($key, 'pagewidth_') !== false) {
|
if (strpos($key, 'pagewidth_') !== false) {
|
||||||
|
|
|
@ -31,7 +31,6 @@ $string['coursetimereq'] = 'Required minutes in course';
|
||||||
$string['coursetimereq_help'] = 'Enter here the minimum amount of time, in minutes, that a student must be logged into the course before they will be able to receive
|
$string['coursetimereq_help'] = 'Enter here the minimum amount of time, in minutes, that a student must be logged into the course before they will be able to receive
|
||||||
the certificate.';
|
the certificate.';
|
||||||
$string['createtemplate'] = 'Create template';
|
$string['createtemplate'] = 'Create template';
|
||||||
$string['customcertnameexists'] = 'A certificate already exists with this name';
|
|
||||||
$string['customcertreport'] = 'Custom certificate report';
|
$string['customcertreport'] = 'Custom certificate report';
|
||||||
$string['customcert:addinstance'] = 'Add a new custom certificate instance';
|
$string['customcert:addinstance'] = 'Add a new custom certificate instance';
|
||||||
$string['customcert:manage'] = 'Manage a custom certificate';
|
$string['customcert:manage'] = 'Manage a custom certificate';
|
||||||
|
|
Loading…
Reference in a new issue