Set the default values for each page to the dimensions of an A4 piece of paper

This commit is contained in:
Mark Nelson 2013-05-06 17:44:34 +08:00
parent d7174ce3c8
commit 2b92220c73
2 changed files with 4 additions and 0 deletions

View file

@ -212,11 +212,13 @@ class mod_customcert_edit_form extends moodleform {
$mform->addElement('text', 'width_' . $pageid, get_string('width', 'customcert'));
$mform->setType('width_' . $pageid, PARAM_INT);
$mform->setDefault('width_' . $pageid, '210');
$mform->addRule('width_' . $pageid, null, 'required', null, 'client');
$mform->addHelpButton('width_' . $pageid, 'width', 'customcert');
$mform->addElement('text', 'height_' . $pageid, get_string('height', 'customcert'));
$mform->setType('height_' . $pageid, PARAM_INT);
$mform->setDefault('height_' . $pageid, '297');
$mform->addRule('height_' . $pageid, null, 'required', null, 'client');
$mform->addHelpButton('height_' . $pageid, 'height', 'customcert');

View file

@ -558,6 +558,8 @@ function customcert_add_page($data) {
$page = new stdClass();
$page->customcertid = $data->id;
$page->orientation = 'P';
$page->width = '210';
$page->height = '297';
$page->pagenumber = $pagenum;
$page->timecreated = $time;
$page->timemodified = $time;