Browse Source

Bloco de verificação de certificados para Moodle 2.1 ou superior

MOODLE_34_STABLE
Sesostris Vieira 11 years ago
parent
commit
bf9df1f019
  1. 4
      README.md
  2. 35
      block_verify_certificate.php
  3. 46
      index.php
  4. 11
      lang/de/block_verify_certificate.php
  5. 11
      lang/en/block_verify_certificate.php
  6. 11
      lang/pt_br/block_verify_certificate.php
  7. BIN
      print.gif
  8. 21
      printstyle.css
  9. 19
      version.php

4
README.md

@ -1,2 +1,4 @@
moodle_block_verify_certificate
Moodle block Verify certificate
===============================
This module was written by Jean-Michel Védrine and my only contribution was to add the Brazilian Portuguese localization file.

35
block_verify_certificate.php

@ -0,0 +1,35 @@
<?php //Updated for use with Certificate v3+ Chardelle Busch
class block_verify_certificate extends block_base {
function init() {
$this->title = get_string('title', 'block_verify_certificate');
}
function applicable_formats() {
return array('all' => true);
}
function get_content() {
if ($this->content !== NULL) {
return $this->content;
}
$this->content = new stdClass;
$this->content->text = '<p>'.get_string('entercode', 'certificate').'</p>';
$url = new moodle_url('/blocks/verify_certificate/index.php');
$this->content->text .= '<center><form class="loginform" name="cert" method="post" action="'. $url . '">';
$this->content->text .= '<input type="text" name="certnumber" id=name="certnumber" size="10" value="" />';
$this->content->text .= '<input type="submit" value="'.get_string('validate', 'certificate').'"/></form>';
$this->content->text .= '<center>';
$this->content->footer = '';
return $this->content;
}
function instance_allow_config() {
return false;
}
}
?>

46
index.php

@ -0,0 +1,46 @@
<?php
require_once("../../config.php");
global $DB;
$id = required_param('certnumber', PARAM_ALPHANUM); // certificate code to verify
$PAGE->set_pagelayout('standard');
$strverify = get_string('verifycertificate', 'block_verify_certificate');
$PAGE->set_url('/blocks/verify_certificate/index.php', array('certnumber' => $id));
$context = get_context_instance(CONTEXT_SYSTEM);
$PAGE->set_context($context);
/// Print the header
$PAGE->navbar->add($strverify);
$PAGE->set_title($strverify);
$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) {
echo $OUTPUT->box_start('generalbox boxaligncenter');
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 />';
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>';
}
}
echo $OUTPUT->box_end();
}
echo $OUTPUT->footer();

11
lang/de/block_verify_certificate.php

@ -0,0 +1,11 @@
<?php
$string['title'] = 'Zertifikate verifizieren';
$string['certificate'] = 'Abgleichung des Zertifikat-Codes:';
$string['verifycertificate'] = 'Zertifikate verifizieren';
$string['notfound'] = 'Die Zertifikatsnummer konnte nicht bestätigt werden.';
$string['to'] = 'Zuerkannt';
$string['course'] = 'Kurs';
$string['date'] = 'Am';
$string['grade'] = 'Bewertung';

11
lang/en/block_verify_certificate.php

@ -0,0 +1,11 @@
<?php
$string['title'] = 'Verify Certificates';
$string['pluginname'] = 'Verify Certificates';
$string['certificate'] = 'Verification for certificate code:';
$string['verifycertificate'] = 'Verify Certificate';
$string['notfound'] = 'The certificate number could not be validated.';
$string['to'] = 'Awarded to';
$string['course'] = 'Course';
$string['date'] = 'On';
$string['grade'] = 'Grade';

11
lang/pt_br/block_verify_certificate.php

@ -0,0 +1,11 @@
<?php
$string['title'] = 'Verificar Certificados';
$string['pluginname'] = 'Verificar Certificados';
$string['certificate'] = 'Verificação do código de certificado:';
$string['verifycertificate'] = 'Verificar Certificado';
$string['notfound'] = 'O número do certificado não pode ser validadado.';
$string['to'] = 'Emitido para';
$string['course'] = 'Curso';
$string['date'] = 'Data';
$string['grade'] = 'Nota';

BIN
print.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

21
printstyle.css

@ -0,0 +1,21 @@
@media print {
body {
background:#FFFFFF;
}
#header, #header-home {
display: none;
}
#footer {
display: none;
}
.navbar {
display:none;
}
.printicon {
display:none;
}
}

19
version.php

@ -0,0 +1,19 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
$plugin->version = 2009072901;
Loading…
Cancel
Save