Minor changes
This commit is contained in:
parent
e441b7051b
commit
3a63a6e00a
5 changed files with 18 additions and 21 deletions
|
@ -48,7 +48,7 @@ class customcert_element_categoryname extends customcert_element_base {
|
|||
* drag and drop interface to position it.
|
||||
*/
|
||||
public function render_html() {
|
||||
global $DB, $COURSE;
|
||||
global $DB, $COURSE;
|
||||
|
||||
$categoryname = $DB->get_field('course_categories', 'name', array('id' => $COURSE->category), MUST_EXIST);
|
||||
|
||||
|
|
|
@ -327,17 +327,17 @@ abstract class customcert_element_base {
|
|||
public function render_form_element_position($mform) {
|
||||
$mform->addElement('text', 'posx', get_string('posx', 'customcert'), array('size' => 10));
|
||||
$mform->setType('posx', PARAM_INT);
|
||||
$mform->setDefault('posx', '0');
|
||||
$mform->setDefault('posx', 0);
|
||||
$mform->addHelpButton('posx', 'posx', 'customcert');
|
||||
|
||||
$mform->addElement('text', 'posy', get_string('posy', 'customcert'), array('size' => 10));
|
||||
$mform->setType('posy', PARAM_INT);
|
||||
$mform->setDefault('posy', '0');
|
||||
$mform->setDefault('posy', 0);
|
||||
$mform->addHelpButton('posy', 'posy', 'customcert');
|
||||
|
||||
$mform->addElement('text', 'width', get_string('elementwidth', 'customcert'), array('size' => 10));
|
||||
$mform->setType('width', PARAM_INT);
|
||||
$mform->setDefault('width', '');
|
||||
$mform->setDefault('width', 0);
|
||||
$mform->addHelpButton('width', 'elementwidth', 'customcert');
|
||||
|
||||
$refpointoptions = array();
|
||||
|
@ -347,7 +347,7 @@ abstract class customcert_element_base {
|
|||
|
||||
$mform->addElement('select', 'refpoint', get_string('refpoint', 'customcert'), $refpointoptions);
|
||||
$mform->setType('refpoint', PARAM_INT);
|
||||
$mform->setDefault('refpoint', '');
|
||||
$mform->setDefault('refpoint', CUSTOMCERT_REF_POINT_TOPCENTER);
|
||||
$mform->addHelpButton('refpoint', 'refpoint', 'customcert');
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
$string['addcertpage'] = 'Add another certificate page';
|
||||
$string['addelement'] = 'Add element';
|
||||
$string['applypositions'] = 'Save positions & continue';
|
||||
$string['awardedto'] = 'Awarded to';
|
||||
$string['code'] = 'Code';
|
||||
$string['copy'] = 'Copy';
|
||||
|
@ -47,8 +46,8 @@ $string['elementname_help'] = 'This will be the name used to identify this eleme
|
|||
page and will want to distinguish between them quickly when editing the certificate. Note: this will not displayed on the PDF.';
|
||||
$string['elements'] = 'Elements';
|
||||
$string['elements_help'] = 'These are the list of elements that will be displayed on this PDF page.';
|
||||
$string['elementwidth'] = 'Max width';
|
||||
$string['elementwidth_help'] = 'Specify the maximum width of the element. 0 means no limit.';
|
||||
$string['elementwidth'] = 'Width';
|
||||
$string['elementwidth_help'] = 'Specify the width of the element - \'0\' means that there is no width constraint.';
|
||||
$string['errorloadingelement'] = 'Error loading the element "{$a}"';
|
||||
$string['errorsavingelement'] = 'Error saving the element "{$a}"';
|
||||
$string['font'] = 'Font';
|
||||
|
@ -65,7 +64,7 @@ $string['invalidcolour'] = 'Invalid colour chosen, please enter a valid HTML col
|
|||
$string['invalidelementwidth'] = 'Please enter a positive number.';
|
||||
$string['invalidposition'] = 'Please select a positive number for position {$a}.';
|
||||
$string['invalidheight'] = 'The height has to be a valid number greater than 0.';
|
||||
$string['invalidmargin'] = 'The margin cannot be a negative number.';
|
||||
$string['invalidmargin'] = 'The margin has to be a valid number greater than 0.';
|
||||
$string['invalidwidth'] = 'The width has to be a valid number greater than 0.';
|
||||
$string['issued'] = 'Issued';
|
||||
$string['landscape'] = 'Landscape';
|
||||
|
@ -99,8 +98,9 @@ $string['refpoint_help'] = 'This specifies which location of the element to be l
|
|||
$string['replacetemplate'] = 'Replace';
|
||||
$string['report'] = 'Report';
|
||||
$string['save'] = 'Save';
|
||||
$string['saveandclose'] = 'Save and close';
|
||||
$string['saveandcontinue'] = 'Save and continue';
|
||||
$string['savechangespreview'] = 'Save changes and preview';
|
||||
$string['savepositions'] = 'Save positions';
|
||||
$string['savetemplate'] = 'Save template';
|
||||
$string['setprotection'] = 'Set protection';
|
||||
$string['setprotection_help'] = 'Choose the actions you wish to prevent users from performing on this certificate.';
|
||||
|
|
|
@ -55,9 +55,9 @@ $PAGE->requires->js_init_call('M.mod_customcert.rearrange.init', array($cm->id,
|
|||
// Create the buttons to save the position of the elements.
|
||||
$html = html_writer::start_tag('div', array('class' => 'buttons'));
|
||||
$html .= $OUTPUT->single_button(new moodle_url('/mod/customcert/edit.php', array('cmid' => $cm->id)),
|
||||
get_string('savepositions', 'customcert'), 'get', array('class' => 'savepositionsbtn'));
|
||||
get_string('saveandclose', 'customcert'), 'get', array('class' => 'savepositionsbtn'));
|
||||
$html .= $OUTPUT->single_button(new moodle_url('/mod/customcert/rearrange.php', array('id' => $pid)),
|
||||
get_string('applypositions', 'customcert'), 'get', array('class' => 'applypositionsbtn'));
|
||||
get_string('saveandcontinue', 'customcert'), 'get', array('class' => 'applypositionsbtn'));
|
||||
$html .= $OUTPUT->single_button(new moodle_url('/mod/customcert/edit.php', array('cmid' => $cm->id)),
|
||||
get_string('cancel'), 'get', array('class' => 'cancelbtn'));
|
||||
$html .= html_writer::end_tag('div');
|
||||
|
|
15
rest.php
15
rest.php
|
@ -43,14 +43,11 @@ $elements = $DB->get_records_sql('SELECT * FROM {customcert_elements} e
|
|||
require_login($course, false, $cm);
|
||||
require_capability('mod/customcert:manage', $context);
|
||||
|
||||
// Loop through the data
|
||||
// Loop through the data.
|
||||
foreach ($values as $value) {
|
||||
// if (array_key_exists($value->id, $elements)) {
|
||||
// Perform the update.
|
||||
$element = new stdClass();
|
||||
$element->id = $value->id;
|
||||
$element->posx = $value->posx;
|
||||
$element->posy = $value->posy;
|
||||
$DB->update_record('customcert_elements', $element);
|
||||
// }
|
||||
$element = new stdClass();
|
||||
$element->id = $value->id;
|
||||
$element->posx = $value->posx;
|
||||
$element->posy = $value->posy;
|
||||
$DB->update_record('customcert_elements', $element);
|
||||
}
|
Loading…
Reference in a new issue