diff --git a/block_get_certificate.php b/block_get_certificate.php
new file mode 100644
index 0000000..96dd1a7
--- /dev/null
+++ b/block_get_certificate.php
@@ -0,0 +1,33 @@
+title = get_string('title', 'block_get_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 = '
'.get_string('getcertificate', 'block_get_certificate').'
';
+ $url = new moodle_url('/blocks/get_certificate/index.php');
+ $this->content->text .= '';
+ $this->content->text .= '';
+ $this->content->footer = '';
+
+ return $this->content;
+ }
+
+ function instance_allow_config() {
+ return false;
+ }
+}
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..3e01fe1
--- /dev/null
+++ b/index.php
@@ -0,0 +1,58 @@
+set_pagelayout('standard');
+$PAGE->set_url('/blocks/get_certificate/index.php');
+$PAGE->set_context($context);
+
+// Check if user is logged and not guest
+require_login();
+if (isguestuser()) {
+ die();
+}
+
+// Get data
+$strtitle = get_string('title', 'block_get_certificate');
+$user = $USER;
+$icon = $OUTPUT->pix_icon('print', get_string('print', 'block_get_certificate'), 'block_get_certificate');
+
+$issues = $DB->get_records('certificate_issues', array('userid' => $user->id));
+$data = array();
+
+foreach ($issues as $issue) {
+ $certificate = $DB->get_record('certificate', array('id' => $issue->certificateid));
+ $course = $DB->get_record('course', array('id' => $certificate->course));
+ $cm = get_coursemodule_from_instance('certificate', $certificate->id);
+// $link = html_writer::link(new moodle_url('/mod/certificate/review.php', array('id'=>$cm->id, 'action'=>'get')), $icon);
+ $url = new moodle_url('/mod/certificate/review.php', array('id'=>$cm->id, 'action'=>'get'));
+ $action = new popup_action('click', $url, 'view'.$cm->id, array('height' => 600, 'width' => 800));
+ $link = new action_link($url, $icon, $action);
+ $line = array($issue->code, userdate($issue->timecreated), $course->fullname, $OUTPUT->render($link));
+ $data[] = $line;
+}
+
+// Print the header
+$PAGE->navbar->add($strtitle);
+$PAGE->set_title($strtitle);
+$PAGE->set_heading($strtitle);
+$PAGE->requires->css('/blocks/get_certificate/printstyle.css');
+echo $OUTPUT->header();
+
+// Print concluded courses
+echo $OUTPUT->box_start('generalbox boxaligncenter');
+echo $OUTPUT->heading(get_string('couselistannounce', 'block_get_certificate'));
+
+$table = new html_table();
+$table->align = array('left', 'left', 'left', 'center');
+$table->width = '100%';
+$table->head = array(get_string('code', 'certificate'), get_string('timecreated', 'block_get_certificate'), get_string('course'), get_string('print', 'block_get_certificate'));
+
+$table->data = $data;
+echo html_writer::table($table);
+
+echo $OUTPUT->box_end();
+echo $OUTPUT->footer();
diff --git a/lang/en/block_get_certificate.php b/lang/en/block_get_certificate.php
new file mode 100644
index 0000000..9d522bd
--- /dev/null
+++ b/lang/en/block_get_certificate.php
@@ -0,0 +1,9 @@
+.
+
+$plugin->version = 2009072901;
+
diff --git a/view.php b/view.php
new file mode 100644
index 0000000..5923a32
--- /dev/null
+++ b/view.php
@@ -0,0 +1,37 @@
+set_pagelayout('standard');
+$PAGE->set_url('/blocks/get_certificate/index.php');
+$PAGE->set_context($context);
+
+// Check if user is logged and not guest
+require_login();
+if (isguestuser()) {
+ die();
+}
+
+// Get data
+$user = $USER;
+$issueid = required_param('id', PARAM_INT);
+$issue = $DB->get_record('certificate_issues', array('id'=>$issueid));
+
+// Check if user is the owner of the requested certificate
+
+if ($issue->userid !== $user->id) {
+ print_error(get_string('usernotowner', 'block_get_certificate'));
+ die;
+}
+
+$strtitle = 'coisa';
+// Print the header
+$PAGE->navbar->add($strtitle);
+$PAGE->set_title($strtitle);
+$PAGE->set_heading($strtitle);
+$PAGE->requires->css('/blocks/get_certificate/printstyle.css');
+echo $OUTPUT->header();
+echo $OUTPUT->footer();