Matheus Garcia
7 years ago
14 changed files with 608 additions and 211 deletions
@ -1,41 +1,91 @@ |
|||||
<?php //Updated for use with Certificate v3+ Chardelle Busch
|
<?php |
||||
|
// This file is part of Moodle - http://moodle.org/ |
||||
class block_verify_certificate extends block_base { |
// |
||||
|
// Moodle is free software: you can redistribute it and/or modify |
||||
function init() { |
// it under the terms of the GNU General Public License as published by |
||||
$this->title = get_string('title', 'block_verify_certificate'); |
// the Free Software Foundation, either version 3 of the License, or |
||||
} |
// (at your option) any later version. |
||||
|
// |
||||
function applicable_formats() { |
// Moodle is distributed in the hope that it will be useful, |
||||
return array('all' => true); |
// 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. |
||||
function get_content() { |
// |
||||
if ($this->content !== NULL) { |
// You should have received a copy of the GNU General Public License |
||||
return $this->content; |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
||||
} |
|
||||
$fieldid = implode(',', $this->config->fieldid); |
/** |
||||
|
* Version details |
||||
$this->content = new stdClass; |
* |
||||
$this->content->text = '<p>'.get_string('entercode', 'certificate').'</p>'; |
* Verify certificate block |
||||
$url = new moodle_url('/blocks/verify_certificate/index.php'); |
* -------------------------- |
||||
$this->content->text .= '<center><form class="loginform" name="cert" method="post" action="'. $url . '">'; |
* Verify certificate based on the unique codes displayed on issued certificates. |
||||
|
* Full details of the issued certificate is displayed including profile picture. |
||||
$this->content->text .= '<input type="text" name="certnumber" id="certnumber" size="10" value="" />'; |
* Mostly cosmetic changes to the original codes from Jean-Michel Védrine. |
||||
$this->content->text .= "<input type='hidden' name='list' id='list' value='{$fieldid}' />"; |
* Original Autor & Copyright - Jean-Michel Védrine | 2014 |
||||
$this->content->text .= '<input type="submit" value="'.get_string('validate', 'certificate').'"/></form>'; |
* |
||||
$this->content->text .= '<center>'; |
* @copyright 2015 onwards Manieer Chhettri | Marie Curie, UK | <manieer@gmail.com> |
||||
$this->content->footer = ''; |
* @author Manieer Chhettri | Marie Curie, UK | <manieer@gmail.com> | 2015 |
||||
|
* @package block_verify_certificate |
||||
return $this->content; |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
} |
*/ |
||||
|
|
||||
/* function has_config() { |
/** |
||||
return true; |
* Verify certificate block class |
||||
} |
* |
||||
*/ |
* @copyright 2015 onwards Manieer Chhettri | Marie Curie, UK | <manieer@gmail.com> |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
function instance_allow_config() { |
*/ |
||||
return true; |
class block_verify_certificate extends block_base { |
||||
} |
|
||||
} |
/** |
||||
|
* Sets the block title |
||||
|
* |
||||
|
* @return void |
||||
|
*/ |
||||
|
public function init() { |
||||
|
$this->title = get_string('title', 'block_verify_certificate'); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Defines where the block can be added |
||||
|
* |
||||
|
* @return array |
||||
|
*/ |
||||
|
public function applicable_formats() { |
||||
|
return array('all' => true); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Creates the blocks main content |
||||
|
* |
||||
|
* @return string |
||||
|
*/ |
||||
|
public 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 .= '<form name="cert" method="post" action="'. $url . '">'; |
||||
|
|
||||
|
$this->content->text .= '<input type="text" id="certcode" name="certnumber" size="20" value="" />'; |
||||
|
$this->content->text .= '<input type="submit" value="'.get_string('validate', 'certificate').'"/></form>'; |
||||
|
$this->content->footer = ''; |
||||
|
|
||||
|
return $this->content; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Controls whether the block is configurable |
||||
|
* |
||||
|
* @return boolean |
||||
|
*/ |
||||
|
public function instance_allow_config() { |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
@ -0,0 +1,59 @@ |
|||||
|
<?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/>. |
||||
|
|
||||
|
/** |
||||
|
* Version details |
||||
|
* |
||||
|
* Verify certificate block |
||||
|
* -------------------------- |
||||
|
* Verify certificate based on the unique codes displayed on issued certificates. |
||||
|
* Full details of the issued certificate is displayed including profile picture. |
||||
|
* Mostly cosmetic changes to the original codes from Jean-Michel Védrine. |
||||
|
* Original Autor & Copyright - Jean-Michel Védrine | 2014 |
||||
|
* |
||||
|
* @copyright 2015 onwards Manieer Chhettri | Marie Curie, UK | <manieer@gmail.com> |
||||
|
* @author Manieer Chhettri | Marie Curie, UK | <manieer@gmail.com> | 2015 |
||||
|
* @package block_verify_certificate |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
|
||||
|
defined('MOODLE_INTERNAL') || die(); |
||||
|
|
||||
|
$capabilities = array( |
||||
|
|
||||
|
'block/verify_certificate:myaddinstance' => array( |
||||
|
'captype' => 'write', |
||||
|
'contextlevel' => CONTEXT_SYSTEM, |
||||
|
'archetypes' => array( |
||||
|
'user' => CAP_ALLOW |
||||
|
), |
||||
|
|
||||
|
'clonepermissionsfrom' => 'moodle/my:manageblocks' |
||||
|
), |
||||
|
|
||||
|
'block/verify_certificate:addinstance' => array( |
||||
|
'riskbitmask' => RISK_SPAM | RISK_XSS, |
||||
|
|
||||
|
'captype' => 'write', |
||||
|
'contextlevel' => CONTEXT_BLOCK, |
||||
|
'archetypes' => array( |
||||
|
'editingteacher' => CAP_ALLOW, |
||||
|
'manager' => CAP_ALLOW |
||||
|
), |
||||
|
|
||||
|
'clonepermissionsfrom' => 'moodle/site:manageblocks' |
||||
|
), |
||||
|
); |
@ -1,112 +1,248 @@ |
|||||
<?php |
<?php |
||||
require_once("../../config.php"); |
// This file is part of Moodle - http://moodle.org/ |
||||
require_once("$CFG->dirroot/enrol/locallib.php"); |
// |
||||
require_once("$CFG->libdir/blocklib.php"); |
// Moodle is free software: you can redistribute it and/or modify |
||||
require_once("$CFG->dirroot/user/profile/lib.php"); |
// it under the terms of the GNU General Public License as published by |
||||
|
// the Free Software Foundation, either version 3 of the License, or |
||||
global $DB; |
// (at your option) any later version. |
||||
|
// |
||||
$code = required_param('certnumber', PARAM_ALPHANUM); // certificate code to verify |
// Moodle is distributed in the hope that it will be useful, |
||||
$fieldid = required_param('list', PARAM_SEQUENCE); |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
$fieldid = explode(',', $fieldid); |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
$profile_fields = $DB->get_records_list('user_info_field', 'id', $fieldid); |
// GNU General Public License for more details. |
||||
|
// |
||||
$PAGE->set_pagelayout('standard'); |
// You should have received a copy of the GNU General Public License |
||||
$strverify = get_string('verifycertificate', 'block_verify_certificate'); |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
||||
$PAGE->set_url('/blocks/verify_certificate/index.php', array('certnumber' => $code)); |
|
||||
$context = get_context_instance(CONTEXT_SYSTEM); |
/** |
||||
$PAGE->set_context($context); |
* Version details |
||||
|
* |
||||
/// Print the header |
* Verify certificate block |
||||
|
* -------------------------- |
||||
$PAGE->navbar->add($strverify); |
* Verify certificate based on the unique codes displayed on issued certificates. |
||||
$PAGE->set_title($strverify); |
* Full details of the issued certificate is displayed including profile picture. |
||||
$PAGE->set_heading($strverify); |
* Mostly cosmetic changes to the original codes from Jean-Michel Védrine. |
||||
$PAGE->requires->css('/blocks/verify_certificate/printstyle.css'); |
* Original Autor & Copyright - Jean-Michel Védrine | 2014 |
||||
echo $OUTPUT->header(); |
* |
||||
|
* @copyright 2015 onwards Manieer Chhettri | Marie Curie, UK | <manieer@gmail.com> |
||||
// Print results |
* @author Manieer Chhettri | Marie Curie, UK | <manieer@gmail.com> | 2015 |
||||
|
* @package block_verify_certificate |
||||
echo $OUTPUT->box_start('generalbox boxaligncenter'); |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
if (!$issues = $DB->get_records('certificate_issues', array('code' => $code))) { |
|
||||
echo get_string('notfound', 'block_verify_certificate'); |
require_once("../../config.php"); |
||||
} else { |
require_once($CFG->dirroot . '/mod/certificate/lib.php'); |
||||
echo '<a title="' . get_string('printerfriendly', 'certificate') . '" href="#" onclick="window.print()">'; |
require_once($CFG->dirroot.'/mod/certificate/locallib.php'); |
||||
echo '<div class="printicon">'; |
require_once("$CFG->dirroot/completion/completion_completion.php"); |
||||
echo '<img src="print.gif" height="16" width="16" border="0"/></a></div>'; |
require_once("$CFG->dirroot/enrol/locallib.php"); |
||||
/// Print Section |
|
||||
foreach ($issues as $issue) { |
$id = required_param('certnumber', PARAM_ALPHANUM); // Certificate code to verify. |
||||
if (!$certificate = $DB->get_record('certificate', array('id'=> $issue->certificateid))) { |
|
||||
print_error('course module is incorrect'); |
$PAGE->set_pagelayout('standard'); |
||||
} |
$strverify = get_string('verifycertificate', 'block_verify_certificate'); |
||||
if (!$course = $DB->get_record('course', array('id'=> $certificate->course))) { |
$PAGE->set_url('/blocks/verify_certificate/index.php', array('certnumber' => $id)); |
||||
print_error('course is misconfigured'); |
$context = context_system::instance(); |
||||
} |
$PAGE->set_context($context); |
||||
if (!$user = $DB->get_record('user', array('id'=> $issue->userid))) { |
|
||||
print_error('user is unreachable'); |
// Print the header. |
||||
} |
$PAGE->navbar->add($strverify); |
||||
|
$PAGE->set_title($strverify); |
||||
profile_load_data($user); |
$PAGE->set_heading($strverify); |
||||
|
$PAGE->requires->css('/blocks/verify_certificate/printstyle.css'); |
||||
$enrol_manager = new course_enrolment_manager($PAGE, $course); |
$PAGE->requires->css('/blocks/verify_certificate/styles.css'); |
||||
$user_enrols = $enrol_manager->get_user_enrolments($user->id); |
echo $OUTPUT->header(); |
||||
$start_date = 0; |
|
||||
$end_date = 0; |
$ufields = user_picture::fields('u'); |
||||
foreach ($user_enrols as $enrol) { |
|
||||
if ($enrol->timestart > 0) { |
$sql = "SELECT ci.timecreated AS citimecreated, |
||||
$start_date = $enrol->timestart; |
ci.code, ci.certificateid, ci.userid, $ufields, c.*, u.id AS id, u.* |
||||
} |
FROM {certificate_issues} ci |
||||
if ($enrol->timeend > 0) { |
INNER JOIN {user} u |
||||
$end_date = $enrol->timeend; |
ON u.id = ci.userid |
||||
} |
INNER JOIN {certificate} c |
||||
} |
ON c.id = ci.certificateid |
||||
if (($start_date > 0 and $end_date > 0)) { |
WHERE ci.code = ?"; |
||||
$fmt = '%d/%m/%Y'; // Default format |
$certificates = $DB->get_records_sql($sql, array($id)); |
||||
if ($certificate->datefmt == 1) { |
|
||||
$fmt = '%B %d, %Y'; |
function getFormattedCPFFromUsername($userid) { |
||||
$certificatedate = userdate($ts, '%B %d, %Y') . " a " . userdate($te, '%B %d, %Y'); |
global $DB; |
||||
} else if ($certificate->datefmt == 2) { |
$user = $DB->get_record("user", array("id" => $userid)); |
||||
$suffix = certificate_get_ordinal_number_suffix(userdate($ts, '%d')); |
return mask($user->username, '###.###.###-##'); |
||||
$fmt = '%B %d' . $suffix . ', %Y'; |
} |
||||
$certificatedate = userdate($ts, '%B %d' . $suffix . ', %Y') . " a " . userdate($te, '%B %d' . $suffix . ', %Y'); |
|
||||
} else if ($certificate->datefmt == 3) { |
function mask($val, $mask) |
||||
$fmt = '%d %B %Y'; |
{ |
||||
$certificatedate = userdate($ts, '%d %B %Y') . " a " . userdate($te, '%d %B %Y'); |
if(validatecpf($val)) { |
||||
} else if ($certificate->datefmt == 4) { |
$maskared = ''; |
||||
$fmt = '%B %Y'; |
$k = 0; |
||||
$certificatedate = userdate($ts, '%B %Y') . " a " . userdate($te, '%B %Y'); |
for($i = 0; $i<=strlen($mask)-1; $i++){ |
||||
} else if ($certificate->datefmt == 5) { |
|
||||
$fmt = get_string('strftimedate', 'langconfig'); |
if($mask[$i] == '#'){ |
||||
$certificatedate = userdate($ts, get_string('strftimedate', 'langconfig')) . " a " . userdate($te, get_string('strftimedate', 'langconfig')); |
if(isset($val[$k])) |
||||
} |
$maskared .= $val[$k++]; |
||||
$start_date = userdate($start_date, $fmt); |
} |
||||
$end_date = userdate($end_date, $fmt); |
else |
||||
} else { |
{ |
||||
$start_date = ''; |
if(isset($mask[$i])) |
||||
$end_date = ''; |
$maskared .= $mask[$i]; |
||||
} |
} |
||||
|
} |
||||
$certificatedate = userdate($issue->timecreated); |
return $maskared; |
||||
echo '<p>' . get_string('certificate', 'block_verify_certificate') . " <strong>{$issue->code}</strong></p>"; |
} else { |
||||
echo '<p><strong>' . get_string('to', 'block_verify_certificate') . ': </strong>' . fullname($user) . '</p>'; |
return ""; |
||||
foreach ($profile_fields as $field) { |
} |
||||
$fieldname = "profile_field_{$field->shortname}"; |
} |
||||
$fieldvalue = $user->$fieldname; |
|
||||
echo "<p><strong>{$field->name}: <strong>{$fieldvalue}"; |
|
||||
} |
function validatecpf($cpf) { |
||||
echo '<p><strong>' . get_string('course', 'block_verify_certificate') . ": </strong>{$course->fullname}</p>"; |
// Verifica se um numero foi informado. |
||||
echo '<p><strong>' . get_string('date', 'block_verify_certificate') . ": </strong>$certificatedate</p>"; |
if (is_null($cpf)) { |
||||
echo '<p><strong>' . get_string('enrol_period', 'block_verify_certificate') . ": </strong>$start_date - $end_date</p>"; |
return false; |
||||
if ($certificate->printhours) { |
} |
||||
echo '<p><strong>' . get_string('printhours', 'block_verify_certificate') . ": </strong>{$certificate->printhours}</p>"; |
if (!is_numeric($cpf)) { |
||||
} |
return false; |
||||
if ($certificate->customtext !== '') { |
} |
||||
echo '<p><strong>' . get_string('customtext', 'block_verify_certificate') . ':</strong></p>'; |
//$cpf = str_pad($cpf, 11, '0', STR_PAD_LEFT); |
||||
echo $certificate->customtext; |
|
||||
} |
// Verifica se o numero de digitos informados eh igual a 11. |
||||
} |
if (strlen($cpf) != 11) { |
||||
} |
return false; |
||||
|
} else if ($cpf == '00000000000' || $cpf == '11111111111' || $cpf == '22222222222' || |
||||
echo $OUTPUT->box_end(); |
$cpf == '33333333333' || $cpf == '44444444444' || $cpf == '55555555555' || |
||||
echo $OUTPUT->footer(); |
$cpf == '66666666666' || $cpf == '77777777777' || $cpf == '88888888888' || |
||||
|
$cpf == '99999999999') { |
||||
|
return false; |
||||
|
} else { |
||||
|
// Calcula os digitos verificadores para verificar se o CPF eh valido. |
||||
|
|
||||
|
$cpf = preg_replace('/[^0-9]/', '', (string) $cpf); |
||||
|
// Valida tamanho |
||||
|
if (strlen($cpf) != 11) |
||||
|
return false; |
||||
|
// Calcula e confere primeiro dígito verificador |
||||
|
for ($i = 0, $j = 10, $soma = 0; $i < 9; $i++, $j--) |
||||
|
$soma += $cpf{$i} * $j; |
||||
|
$resto = $soma % 11; |
||||
|
if ($cpf{9} != ($resto < 2 ? 0 : 11 - $resto)) |
||||
|
return false; |
||||
|
// Calcula e confere segundo dígito verificador |
||||
|
for ($i = 0, $j = 11, $soma = 0; $i < 10; $i++, $j--) |
||||
|
$soma += $cpf{$i} * $j; |
||||
|
$resto = $soma % 11; |
||||
|
|
||||
|
$resultado = $cpf{10} == ($resto < 2 ? 0 : 11 - $resto); |
||||
|
return $resultado; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
if (! $certificates) { |
||||
|
echo $OUTPUT->box_start('generalbox boxaligncenter'); |
||||
|
echo '<div id="block_verify_certificate"><br>'; |
||||
|
echo '<p class="notVerified">' . get_string('certificate', 'block_verify_certificate') |
||||
|
. ' "' . $id . '" ' . '</p>'; |
||||
|
echo '<div class="wrapper-box"><br>'; |
||||
|
echo '<div class="left"><br>' .get_string('notfound', 'block_verify_certificate').'</div>'; |
||||
|
echo '<div class="right"><img src="pix/certnotverified.png" border="0" align="center"></div>'; |
||||
|
echo '</div></div>'; |
||||
|
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=\"pix/printicon.png\" height=\"40\" width=\"40\" border=\"0\" align=\"right\"></img></a></div>"; |
||||
|
|
||||
|
// Print Section. |
||||
|
foreach ($certificates as $certdata) { |
||||
|
echo '<p class = "verified">' . get_string('certificate', 'block_verify_certificate') |
||||
|
. ' "' . $certdata->code . '" ' . '</font></b></p>'; |
||||
|
echo '<table width ="100%" cellpadding="5px"><tr><td>'; |
||||
|
echo '<div class="userprofilebox clearfix"><div class="profilepicture">'; |
||||
|
echo $OUTPUT->user_picture($certdata, array('size' => 150)); |
||||
|
echo '</div>'; |
||||
|
echo '</td><td>'; |
||||
|
echo '<p><b>' . get_string('to', 'block_verify_certificate') . ': </b>' . fullname($certdata) . '<br />'; |
||||
|
// Date format. |
||||
|
$dateformat = get_string('strftimedate', 'langconfig'); |
||||
|
|
||||
|
|
||||
|
$certdata->printdate = 1; |
||||
|
$certrecord = new stdClass(); |
||||
|
$certrecord->timecreated = $certdata->citimecreated; |
||||
|
$certrecord->code = $certdata->code; |
||||
|
$certrecord->userid = $certdata->userid; |
||||
|
$certrecord->id = $certdata->id; |
||||
|
$userid = $certrecord->userid; |
||||
|
|
||||
|
// Exibe CPF, se username for CPF |
||||
|
#require_once("$CFG->dirroot/user/profile/lib.php"); |
||||
|
#require_once("$CFG->dirroot/user/profile/field/cpf/field.class.php"); |
||||
|
#$formfield = new profile_field_cpf('8', $certdata->userid); |
||||
|
#$cpf = $formfield->display_data(); |
||||
|
$cpf = getFormattedCPFFromUsername($userid); |
||||
|
if ($cpf) { |
||||
|
echo '<p><b>' . "CPF" . ': </b>' . $cpf . '<br /></p>'; |
||||
|
} |
||||
|
|
||||
|
// Exibe curso |
||||
|
$course = $DB->get_record('course', array('id' => $certdata->course)); |
||||
|
if ($course) { |
||||
|
echo '<p><b>' . get_string('course', 'block_verify_certificate') . ': </b>' . $course->fullname . '<br />'; |
||||
|
} |
||||
|
|
||||
|
// Curso sem tutoria: início é matrícula, final é timeend de course_completions |
||||
|
// Curso com tutoria com turma: início e fim vem da matrícula da turma |
||||
|
// Curso com tutoria sem turma: início e fim vem da configuração do curso |
||||
|
// Demais cursos: início e fim vem da configuração do curso |
||||
|
|
||||
|
$enrol_manager = new course_enrolment_manager($PAGE, $course); |
||||
|
$user_enrol = end($enrol_manager->get_user_enrolments($userid)); |
||||
|
$enrol = $DB->get_record('enrol', array('id' => $user_enrol->enrolid)); |
||||
|
if(substr( $course->idnumber, 0, 3 ) == 'ST-' ) { |
||||
|
$cc = new completion_completion(array('userid'=>$certrecord->userid, 'course'=>$certdata->course)); |
||||
|
$start_date = $user_enrol->timestart; |
||||
|
$end_date = $cc->timecompleted; |
||||
|
$type = 'ST'; |
||||
|
} elseif(substr( $course->idnumber, 0, 3 ) == 'CT-') { |
||||
|
/*$group = $DB->get_record('groups', array('courseid' => $course->id)); |
||||
|
if( $group ) { |
||||
|
$start_date = $enrol->enrolstartdate; |
||||
|
$end_date = $enrol->enrolenddate; |
||||
|
} else { |
||||
|
$start_date = $course->startdate; |
||||
|
$end_date = $course->enddate; |
||||
|
}*/ |
||||
|
$type = 'CT'; |
||||
|
$start_date = $course->startdate; |
||||
|
$end_date = $course->enddate; |
||||
|
} else { |
||||
|
$type = ''; |
||||
|
$start_date = $course->startdate; |
||||
|
$end_date = $course->enddate; |
||||
|
} |
||||
|
|
||||
|
// Retrieving grade and date for each certificate. |
||||
|
$grade = certificate_get_grade($certdata, $course, $userid, $valueonly = true); |
||||
|
//$date = $start_date; //$certrecord->timecreated = $certdata->citimecreated; |
||||
|
|
||||
|
if (($type = 'ST' || $type = 'CT') && $start_date && $end_date) { |
||||
|
echo "<p><b>PERÍODO: </b>" . userdate($start_date, $dateformat) . " a " . userdate($end_date, $dateformat) . '<br /></p>'; |
||||
|
} else { |
||||
|
echo "<p><b>DATA: </b>" . userdate($certdata->timecreated, $dateformat) . '<br /></p>'; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
if ($course && $certdata->printgrade > 0) { |
||||
|
echo '<p><b>' . get_string('grade', 'block_verify_certificate') . ': </b>' . $grade . '<br /></p>'; |
||||
|
} |
||||
|
if ($course->summary) { |
||||
|
echo "<br /><p>$course->summary</p>"; |
||||
|
} |
||||
|
echo '</td><td>'; |
||||
|
echo "<img src=\"pix/certverified.png\" border=\"0\" align=\"center\"></img>"; |
||||
|
echo '</td></tr></table></br>'; |
||||
|
echo '<p><b>' . get_string('check', 'block_verify_certificate') . '</b></p>'; |
||||
|
} |
||||
|
echo $OUTPUT->box_end(); |
||||
|
} |
||||
|
echo $OUTPUT->footer(); |
||||
|
@ -1,15 +1,43 @@ |
|||||
<?php |
<?php |
||||
$string['title'] = 'Verify Certificates'; |
// This file is part of Moodle - http://moodle.org/ |
||||
$string['pluginname'] = 'Verify Certificates'; |
// |
||||
$string['certificate'] = 'Verification for certificate code:'; |
// Moodle is free software: you can redistribute it and/or modify |
||||
$string['verifycertificate'] = 'Verify Certificate'; |
// it under the terms of the GNU General Public License as published by |
||||
$string['notfound'] = 'The certificate number could not be validated.'; |
// the Free Software Foundation, either version 3 of the License, or |
||||
$string['to'] = 'Awarded to'; |
// (at your option) any later version. |
||||
$string['course'] = 'Course'; |
// |
||||
$string['date'] = 'On'; |
// Moodle is distributed in the hope that it will be useful, |
||||
$string['grade'] = 'Grade'; |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
$string['customtext'] = 'Course details'; |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
$string['enrol_period'] = 'Enroll period'; |
// GNU General Public License for more details. |
||||
$string['printhours'] = 'Hours'; |
// |
||||
$string['chooseprofilefields'] = 'Choose profilefields to display'; |
// You should have received a copy of the GNU General Public License |
||||
$string['nofields'] = 'No profilefields defined'; |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
||||
|
|
||||
|
/** |
||||
|
* Version details |
||||
|
* |
||||
|
* Verify certificate block |
||||
|
* -------------------------- |
||||
|
* Verify certificate based on the unique codes displayed on issued certificates. |
||||
|
* Full details of the issued certificate is displayed including profile picture. |
||||
|
* Mostly cosmetic changes to the original codes from Jean-Michel Védrine. |
||||
|
* Original Autor & Copyright - Jean-Michel Védrine | 2014 |
||||
|
* |
||||
|
* @copyright 2015 onwards Manieer Chhettri | Marie Curie, UK | <manieer@gmail.com> |
||||
|
* @author Manieer Chhettri | Marie Curie, UK | <manieer@gmail.com> | 2015 |
||||
|
* @package block_verify_certificate |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
|
||||
|
$string['title'] = 'Verify certificate'; |
||||
|
$string['pluginname'] = 'Verify certificate'; |
||||
|
$string['certificate'] = 'VERIFICATION FOR CERTIFICATE CODE ::'; |
||||
|
$string['verifycertificate'] = 'Verify certificate'; |
||||
|
$string['verify_certificate:addinstance'] = 'Add a new Verify certificate block'; |
||||
|
$string['notfound'] = 'The certificate code you provided could not be validated.<br><br> Please make sure you have typed the code correctly as its case sensetive.'; |
||||
|
$string['to'] = 'AWARDED TO'; |
||||
|
$string['course'] = 'COURSE'; |
||||
|
$string['date'] = 'ON'; |
||||
|
$string['grade'] = 'GRADE'; |
||||
|
$string['check'] = 'Please make sure all the details on the certificate match the displayed results.'; |
||||
|
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 6.3 KiB |
@ -1,21 +1,20 @@ |
|||||
@media print { |
@media print { |
||||
body { |
body { |
||||
background:#FFFFFF; |
background:#FFFFFF; |
||||
} |
} |
||||
#header, #header-home { |
#header, #header-home { |
||||
display: none; |
display: none; |
||||
} |
} |
||||
|
|
||||
#footer { |
#footer { |
||||
display: none; |
display: none; |
||||
} |
} |
||||
|
|
||||
.navbar { |
.navbar { |
||||
display:none; |
display:none; |
||||
} |
} |
||||
|
|
||||
.printicon { |
.printicon { |
||||
display:none; |
display:none; |
||||
} |
} |
||||
|
} |
||||
} |
|
||||
|
@ -0,0 +1,65 @@ |
|||||
|
/** 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/>. |
||||
|
* |
||||
|
* Version details |
||||
|
* |
||||
|
* Verify certificate block |
||||
|
* -------------------------- |
||||
|
* Verify certificate based on the unique codes displayed on issued certificates. |
||||
|
* Full details of the issued certificate is displayed including profile picture. |
||||
|
* Mostly cosmetic changes to the original codes from Jean-Michel Védrine. |
||||
|
* Original Autor & Copyright - Jean-Michel Védrine | 2014 |
||||
|
* |
||||
|
* @copyright 2015 onwards Manieer Chhettri | Marie Curie, UK | <manieer@gmail.com> |
||||
|
* @author Manieer Chhettri | Marie Curie, UK | <manieer@gmail.com> | 2015 |
||||
|
* @package block_verify_certificate |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
|
||||
|
#block_verify_certificate p.notVerified { |
||||
|
color: #F00; |
||||
|
font-size:large; |
||||
|
font-weight:bold; |
||||
|
} |
||||
|
|
||||
|
#block_verify_certificate p.verified { |
||||
|
color: #393; |
||||
|
font-size:large; |
||||
|
font-weight:bold; |
||||
|
} |
||||
|
|
||||
|
#block_verify_certificate .left { |
||||
|
float: left; |
||||
|
width: 75%; |
||||
|
margin-top: 10px; |
||||
|
} |
||||
|
|
||||
|
#block_verify_certificate .right { |
||||
|
float: right; |
||||
|
width: 25%; |
||||
|
margin-top: 10px; |
||||
|
} |
||||
|
|
||||
|
#block_verify_certificate .wrapper-box:after { |
||||
|
content:""; |
||||
|
display: table; |
||||
|
clear: both; |
||||
|
} |
||||
|
|
||||
|
@media screen and (max-width: 480px) { |
||||
|
#block_verify_certificate .left, .right { |
||||
|
float: none; |
||||
|
width: auto; |
||||
|
} |
||||
|
} |
@ -1,19 +1,43 @@ |
|||||
<?php |
<?php |
||||
|
// This file is part of Moodle - http://moodle.org/ |
||||
// This file is part of Moodle - http://moodle.org/ |
// |
||||
// |
// Moodle is free software: you can redistribute it and/or modify |
||||
// Moodle is free software: you can redistribute it and/or modify |
// it under the terms of the GNU General Public License as published by |
||||
// it under the terms of the GNU General Public License as published by |
// the Free Software Foundation, either version 3 of the License, or |
||||
// the Free Software Foundation, either version 3 of the License, or |
// (at your option) any later version. |
||||
// (at your option) any later version. |
// |
||||
// |
// Moodle is distributed in the hope that it will be useful, |
||||
// Moodle is distributed in the hope that it will be useful, |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// GNU General Public License for more details. |
||||
// GNU General Public License for more details. |
// |
||||
// |
// You should have received a copy of the GNU General Public License |
||||
// You should have received a copy of the GNU General Public License |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|
||||
|
/** |
||||
$plugin->version = 2009072901; |
* Version details |
||||
|
* |
||||
|
* Verify certificate block |
||||
|
* -------------------------- |
||||
|
* Verify certificate based on the unique codes displayed on issued certificates. |
||||
|
* Full details of the issued certificate is displayed including profile picture. |
||||
|
* Mostly cosmetic changes to the original codes from Jean-Michel Védrine. |
||||
|
* Original Autor & Copyright - Jean-Michel Védrine | 2014 |
||||
|
* |
||||
|
* @copyright 2015 onwards Manieer Chhettri | Marie Curie, UK | <manieer@gmail.com> |
||||
|
* @author Manieer Chhettri | Marie Curie, UK | <manieer@gmail.com> | 2015 |
||||
|
* @package block_verify_certificate |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
|
||||
|
defined('MOODLE_INTERNAL') || die(); |
||||
|
|
||||
|
$plugin->version = 2016051200; // The current plugin version (Date: YYYYMMDDXX) |
||||
|
$plugin->requires = 2014051203; // Requires this Moodle version 2.7. |
||||
|
$plugin->cron = 0; // Period for cron to check this module (secs). |
||||
|
$plugin->component = 'block_verify_certificate'; // To check on upgrade, that module sits in correct place. |
||||
|
$plugin->maturity = MATURITY_STABLE; |
||||
|
$plugin->release = 'v3.0'; |
||||
|
$plugin->dependencies = array( |
||||
|
'mod_certificate' => 2014041801 |
||||
|
); |
||||
|
Loading…
Reference in new issue