Exemplo n.º 1
0
/**
 * Returns information about received iomadcertificate.
 * Used for user activity reports.
 *
 * @param stdClass $course
 * @param stdClass $user
 * @param stdClass $mod
 * @param stdClass $page
 * @return string the user complete information
 */
function iomadcertificate_user_complete($course, $user, $mod, $iomadcertificate)
{
    global $DB, $OUTPUT;
    if ($issue = $DB->get_record('iomadcertificate_issues', array('iomadcertificateid' => $iomadcertificate->id, 'userid' => $user->id))) {
        echo $OUTPUT->box_start();
        echo get_string('issued', 'iomadcertificate') . ": ";
        echo userdate($issue->timecreated);
        iomadcertificate_print_user_files($iomadcertificate->id, $user->id);
        echo '<br />';
        echo $OUTPUT->box_end();
    } else {
        print_string('notissuedyet', 'iomadcertificate');
    }
}
Exemplo n.º 2
0
            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';
$btndownloadods = $OUTPUT->single_button(new moodle_url("report.php", array('id' => $cm->id, 'download' => 'ods')), get_string("downloadods"));
$btndownloadxls = $OUTPUT->single_button(new moodle_url("report.php", array('id' => $cm->id, 'download' => 'xls')), get_string("downloadexcel"));
$btndownloadtxt = $OUTPUT->single_button(new moodle_url("report.php", array('id' => $cm->id, 'download' => 'txt')), get_string("downloadtext"));
$tablebutton->data[] = array($btndownloadods, $btndownloadxls, $btndownloadtxt);
echo $OUTPUT->header();
groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/iomadcertificate/report.php?id=' . $id);
echo $OUTPUT->heading(get_string('modulenameplural', 'iomadcertificate'));
echo $OUTPUT->paging_bar($usercount, $page, $perpage, $url);
echo '<br />';