Browse Source

Correção do certificado para funcionar com certificate no Moodle 2.5

MOODLE_34_STABLE
Sesostris Vieira 11 years ago
parent
commit
6d8f721316
  1. 38
      index.php
  2. 2
      lang/de/block_verify_certificate.php
  3. 2
      lang/en/block_verify_certificate.php
  4. 2
      lang/pt_br/block_verify_certificate.php

38
index.php

@ -3,7 +3,7 @@ require_once("../../config.php");
global $DB;
$id = required_param('certnumber', PARAM_ALPHANUM); // certificate code to verify
$code = required_param('certnumber', PARAM_ALPHANUM); // certificate code to verify
$PAGE->set_pagelayout('standard');
$strverify = get_string('verifycertificate', 'block_verify_certificate');
@ -18,29 +18,37 @@ global $DB;
$PAGE->set_heading($strverify);
$PAGE->requires->css('/blocks/verify_certificate/printstyle.css');
echo $OUTPUT->header();
$certificate = $DB->get_records_sql("SELECT s.*
FROM {certificate_issues} s
WHERE s.code = ?", array($id));
if (! $certificate) {
// Print results
echo $OUTPUT->box_start('generalbox boxaligncenter');
if (!$issues = $DB->get_records('certificate_issues', array('code' => $code))) {
echo get_string('notfound', 'block_verify_certificate');
echo $OUTPUT->box_end();
} else {
echo $OUTPUT->box_start('generalbox boxaligncenter');
echo "<a title=\""; print_string('printerfriendly', 'certificate');
echo "\" href=\"#\" onclick=\"window.print ()\"><div class=\"printicon\">";
echo "<img src=\"print.gif\" height=\"16\" width=\"16\" border=\"0\"></img></a></div>";
/// Print Section
foreach ($certificate as $certrecord) {
$certificatedate = userdate($certrecord->timecreated);
echo '<p>' . get_string('certificate', 'block_verify_certificate') . ' ' . $certrecord->code . '</p>';
echo '<p><b>' . get_string('to', 'block_verify_certificate') . ': </b>' . $certrecord->studentname . '<br />';
echo '<p><b>' . get_string('course', 'block_verify_certificate') . ': </b>' . $certrecord->classname . '<br />';
foreach ($issues as $issue) {
if (!$certificate = $DB->get_record('certificate', array('id'=> $issue->certificateid))) {
print_error('course module is incorrect');
}
if (!$course = $DB->get_record('course', array('id'=> $certificate->course))) {
print_error('course is misconfigured');
}
if (!$user = $DB->get_record('user', array('id'=> $issue->userid))) {
print_error('user is unreachable');
}
$certificatedate = userdate($issue->timecreated);
echo '<p>' . get_string('certificate', 'block_verify_certificate') . ' ' . $issue->code . '</p>';
echo '<p><b>' . get_string('to', 'block_verify_certificate') . ': </b>' . fullname($user) . '<br />';
echo '<p><b>' . get_string('course', 'block_verify_certificate') . ': </b>' . $course->fullname . '<br />';
echo '<p><b>' . get_string('date', 'block_verify_certificate') . ': </b>' . $certificatedate . '<br /></p>';
if ($certrecord->reportgrade != null) {
echo '<p><b>' . get_string('grade', 'block_verify_certificate') . ': </b>' . $certrecord->reportgrade . '<br /></p>';
if ($certificate->customtext !== '') {
echo '<p><b>' . get_string('customtext', 'block_verify_certificate') . ': </b><br/></p>';
echo $certificate->customtext;
}
}
echo $OUTPUT->box_end();
}
echo $OUTPUT->box_end();
echo $OUTPUT->footer();

2
lang/de/block_verify_certificate.php

@ -8,4 +8,4 @@ $string['to'] = 'Zuerkannt';
$string['course'] = 'Kurs';
$string['date'] = 'Am';
$string['grade'] = 'Bewertung';
$string['customtext'] = 'Kurs details';

2
lang/en/block_verify_certificate.php

@ -8,4 +8,4 @@ $string['to'] = 'Awarded to';
$string['course'] = 'Course';
$string['date'] = 'On';
$string['grade'] = 'Grade';
$string['customtext'] = 'Course details';

2
lang/pt_br/block_verify_certificate.php

@ -8,4 +8,4 @@ $string['to'] = 'Emitido para';
$string['course'] = 'Curso';
$string['date'] = 'Data';
$string['grade'] = 'Nota';
$string['customtext'] = 'Programa do curso';

Loading…
Cancel
Save