Make it clear what element values are just an example (#144)

This commit is contained in:
Mark Nelson 2018-12-31 09:35:31 +08:00
parent d12e752d1a
commit 1b756fbd5b
4 changed files with 11 additions and 2 deletions

View file

@ -190,7 +190,12 @@ class element extends \mod_customcert\element {
// Ensure that a date has been set. // Ensure that a date has been set.
if (!empty($date)) { if (!empty($date)) {
\mod_customcert\element_helper::render_content($pdf, $this, $this->get_date_format_string($date, $dateformat)); $date = $this->get_date_format_string($date, $dateformat);
// If we are previewing, we want to let the user know it's an example date so they don't get confused.
if ($preview) {
$date = get_string('exampledata', 'customcert', 'date') . ' ' . $date;
}
\mod_customcert\element_helper::render_content($pdf, $this, $date);
} }
} }

View file

@ -108,6 +108,7 @@ class element extends \mod_customcert\element {
if ($preview) { if ($preview) {
$courseitem = \grade_item::fetch_course_item($courseid); $courseitem = \grade_item::fetch_course_item($courseid);
$grade = grade_format_gradevalue('100', $courseitem, true, $gradeinfo->gradeformat); $grade = grade_format_gradevalue('100', $courseitem, true, $gradeinfo->gradeformat);
$grade = get_string('exampledata', 'customcert', 'grade') . ' ' . $grade;
} else { } else {
if ($gradeitem == CUSTOMCERT_GRADE_COURSE) { if ($gradeitem == CUSTOMCERT_GRADE_COURSE) {
$grade = \mod_customcert\element_helper::get_course_grade_info( $grade = \mod_customcert\element_helper::get_course_grade_info(

View file

@ -87,6 +87,8 @@ $string['emailteachers'] = 'Email teachers';
$string['emailteachers_help'] = 'If set this will email the teachers a copy of the certificate when it becomes available.'; $string['emailteachers_help'] = 'If set this will email the teachers a copy of the certificate when it becomes available.';
$string['emailothers'] = 'Email others'; $string['emailothers'] = 'Email others';
$string['emailothers_help'] = 'If set this will email the email addresses listed here (separated by a comma) with a copy of the certificate when it becomes available.'; $string['emailothers_help'] = 'If set this will email the email addresses listed here (separated by a comma) with a copy of the certificate when it becomes available.';
$string['exampledata'] = 'Example {$a}:';
$string['exampledatawarning'] = 'Some of these values may just be an example to ensure positioning of the elements is possible.';
$string['font'] = 'Font'; $string['font'] = 'Font';
$string['font_help'] = 'The font used when generating this element.'; $string['font_help'] = 'The font used when generating this element.';
$string['fontcolour'] = 'Colour'; $string['fontcolour'] = 'Colour';

View file

@ -125,7 +125,8 @@ $html .= html_writer::end_tag('div');
echo $OUTPUT->header(); echo $OUTPUT->header();
echo $OUTPUT->heading($heading); echo $OUTPUT->heading($heading);
echo $OUTPUT->heading(get_string('rearrangeelementsheading', 'customcert'), 4); echo $OUTPUT->heading(get_string('rearrangeelementsheading', 'customcert'), 3);
echo $OUTPUT->notification(get_string('exampledatawarning', 'customcert'), \core\output\notification::NOTIFY_WARNING);
echo $html; echo $html;
$PAGE->requires->js_call_amd('mod_customcert/rearrange-area', 'init', array('#pdf')); $PAGE->requires->js_call_amd('mod_customcert/rearrange-area', 'init', array('#pdf'));
echo $OUTPUT->footer(); echo $OUTPUT->footer();