Exemplo n.º 1
0
// Get previous cert record
if (!($certrecord = $DB->get_record('iomadcertificate_issues', array('userid' => $USER->id, 'iomadcertificateid' => $iomadcertificate->id)))) {
    notice(get_string('noiomadcertificatesissued', 'iomadcertificate'), "{$CFG->wwwroot}/course/view.php?id={$course->id}");
    die;
}
// Load the specific iomadcertificatetype
require "{$CFG->dirroot}/mod/iomadcertificate/type/{$iomadcertificate->iomadcertificatetype}/iomadcertificate.php";
if ($action) {
    // Remove full-stop at the end if it exists, to avoid "..pdf" being created and being filtered by clean_filename
    $certname = rtrim($iomadcertificate->name, '.');
    $filename = clean_filename("{$certname}.pdf");
    $pdf->Output($filename, 'I');
    // open in browser
    exit;
}
echo $OUTPUT->header();
if (has_capability('mod/iomadcertificate:manage', $context)) {
    $numusers = count(iomadcertificate_get_issues($iomadcertificate->id, 'ci.timecreated ASC', '', $cm));
    $url = html_writer::tag('a', get_string('viewiomadcertificateviews', 'iomadcertificate', $numusers), array('href' => $CFG->wwwroot . '/mod/iomadcertificate/report.php?id=' . $cm->id));
    echo html_writer::tag('div', $url, array('class' => 'reportlink'));
}
if (!empty($iomadcertificate->intro)) {
    echo $OUTPUT->box(format_module_intro('iomadcertificate', $iomadcertificate, $cm->id), 'generalbox', 'intro');
}
echo html_writer::tag('p', get_string('viewed', 'iomadcertificate') . '<br />' . userdate($certrecord->timecreated), array('style' => 'text-align:center'));
$link = new moodle_url('/mod/iomadcertificate/review.php?id=' . $cm->id . '&action=get');
$linkname = get_string('reviewiomadcertificate', 'iomadcertificate');
$button = new single_button($link, $linkname);
$button->add_action(new popup_action('click', $link, array('height' => 600, 'width' => 800)));
echo html_writer::tag('div', $OUTPUT->render($button), array('style' => 'text-align:center'));
echo $OUTPUT->footer($course);
Exemplo n.º 2
0
            $ug2 = '';
            if ($usergrps = groups_get_all_groups($course->id, $user->id)) {
                foreach ($usergrps as $ug) {
                    $ug2 = $ug2 . $ug->name;
                }
            }
            echo $ug2 . "\t";
            echo userdate($user->timecreated) . "\t";
            echo iomadcertificate_get_grade($iomadcertificate, $course, $user->id) . "\t";
            echo $user->code . "\n";
            $row++;
        }
    }
    exit;
}
$usercount = count(iomadcertificate_get_issues($iomadcertificate->id, $DB->sql_fullname(), $groupmode, $cm));
// Create the table for the users
$table = new html_table();
$table->width = "95%";
$table->tablealign = "center";
$table->head = array($strto, $strdate, $strgrade, $strcode);
$table->align = array("left", "left", "center", "center");
foreach ($users as $user) {
    $name = $OUTPUT->user_picture($user) . fullname($user);
    $date = userdate($user->timecreated) . iomadcertificate_print_user_files($iomadcertificate, $user->id, $context->id);
    $code = $user->code;
    $table->data[] = array($name, $date, iomadcertificate_get_grade($iomadcertificate, $course, $user->id), $code);
}
// Create table to store buttons
$tablebutton = new html_table();
$tablebutton->attributes['class'] = 'downloadreport';