';
$this->content->footer = '';
@@ -29,7 +30,12 @@ class block_verify_certificate extends block_base {
return $this->content;
}
+/* function has_config() {
+ return true;
+ }
+*/
+
function instance_allow_config() {
- return false;
+ return true;
}
}
diff --git a/index.php b/index.php
index 19b6f9c..d1575b0 100644
--- a/index.php
+++ b/index.php
@@ -1,14 +1,19 @@
dirroot/enrol/locallib.php");
+require_once("$CFG->libdir/blocklib.php");
+require_once("$CFG->dirroot/user/profile/lib.php");
global $DB;
$code = required_param('certnumber', PARAM_ALPHANUM); // certificate code to verify
+ $fieldid = required_param('list', PARAM_SEQUENCE);
+ $fieldid = explode(',', $fieldid);
+ $profile_fields = $DB->get_records_list('user_info_field', 'id', $fieldid);
$PAGE->set_pagelayout('standard');
$strverify = get_string('verifycertificate', 'block_verify_certificate');
- $PAGE->set_url('/blocks/verify_certificate/index.php', array('certnumber' => $id));
+ $PAGE->set_url('/blocks/verify_certificate/index.php', array('certnumber' => $code));
$context = get_context_instance(CONTEXT_SYSTEM);
$PAGE->set_context($context);
@@ -42,6 +47,8 @@ global $DB;
print_error('user is unreachable');
}
+ profile_load_data($user);
+
$enrol_manager = new course_enrolment_manager($PAGE, $course);
$user_enrols = $enrol_manager->get_user_enrolments($user->id);
$start_date = 0;
@@ -83,6 +90,11 @@ global $DB;
$certificatedate = userdate($issue->timecreated);
echo '' . get_string('certificate', 'block_verify_certificate') . " {$issue->code}
";
echo '' . get_string('to', 'block_verify_certificate') . ': ' . fullname($user) . '
';
+ foreach ($profile_fields as $field) {
+ $fieldname = "profile_field_{$field->shortname}";
+ $fieldvalue = $user->$fieldname;
+ echo "{$field->name}: {$fieldvalue}";
+ }
echo '' . get_string('course', 'block_verify_certificate') . ": {$course->fullname}
";
echo '' . get_string('date', 'block_verify_certificate') . ": $certificatedate
";
echo '' . get_string('enrol_period', 'block_verify_certificate') . ": $start_date - $end_date
";
diff --git a/lang/de/block_verify_certificate.php b/lang/de/block_verify_certificate.php
index 81dec6c..378b1cd 100644
--- a/lang/de/block_verify_certificate.php
+++ b/lang/de/block_verify_certificate.php
@@ -11,3 +11,5 @@ $string['grade'] = 'Bewertung';
$string['customtext'] = 'Kurs details';
$string['enrol_period'] = 'Einschreiben Zeitraum';
$string['printhours'] = 'Stunden';
+$string['chooseprofilefields'] = 'Wählen Sie Profilfelder angezeigt';
+$string['nofields'] = 'Kein ProfilFeld definiert';
diff --git a/lang/en/block_verify_certificate.php b/lang/en/block_verify_certificate.php
index 1d055b5..9c1c5b7 100644
--- a/lang/en/block_verify_certificate.php
+++ b/lang/en/block_verify_certificate.php
@@ -11,3 +11,5 @@ $string['grade'] = 'Grade';
$string['customtext'] = 'Course details';
$string['enrol_period'] = 'Enroll period';
$string['printhours'] = 'Hours';
+$string['chooseprofilefields'] = 'Choose profilefields to display';
+$string['nofields'] = 'No profilefields defined';
diff --git a/lang/pt_br/block_verify_certificate.php b/lang/pt_br/block_verify_certificate.php
index c3d80ac..bab77d5 100644
--- a/lang/pt_br/block_verify_certificate.php
+++ b/lang/pt_br/block_verify_certificate.php
@@ -11,3 +11,5 @@ $string['grade'] = 'Nota';
$string['customtext'] = 'Programa do curso';
$string['enrol_period'] = 'Período de realização';
$string['printhours'] = 'Carga horária';
+$string['chooseprofilefields'] = 'Escolha os campos de perfil para mostrar';
+$string['nofields'] = 'Nenhum campo de perfil definido';