}
    if (!empty($orderby) && ($dir == 'asc' || $dir == 'desc')) {
        $orderby .= " " . $dir;
    }
}
$count = $DB->count_records_sql($sqlcount);
$unplagfiles = $DB->get_records_sql($sqlallfiles . $orderby, null, $page * $limit, $limit);
$table->define_columns(array('id', 'name', 'module', 'identifier', 'status', 'attempts', 'action'));
$table->define_headers(array(get_string('id', 'plagiarism_unplag'), get_string('user'), get_string('module', 'plagiarism_unplag'), get_string('identifier', 'plagiarism_unplag'), get_string('status', 'plagiarism_unplag'), get_string('attempts', 'plagiarism_unplag'), ''));
$table->define_baseurl('unplag_debug.php');
$table->sortable(true);
$table->no_sorting('file', 'action');
$table->collapsible(true);
$table->set_attribute('cellspacing', '0');
$table->set_attribute('class', 'generaltable generalbox');
$table->show_download_buttons_at(array(TABLE_P_BOTTOM));
$table->setup();
$fs = get_file_storage();
foreach ($unplagfiles as $tf) {
    $modulecontext = context_module::instance($tf->cm);
    $coursemodule = get_coursemodule_from_id($tf->moduletype, $tf->cm);
    $user = "******" . $CFG->wwwroot . "/user/profile.php?id=" . $tf->userid . "'>" . fullname($tf) . "</a>";
    if ($tf->statuscode == UNPLAG_STATUSCODE_ACCEPTED) {
        // Sanity Check.
        $reset = '<a href="unplag_debug.php?reset=2&id=' . $tf->id . '&sesskey=' . sesskey() . '">' . get_string('getscore', 'plagiarism_unplag') . '</a> | ';
    } else {
        $reset = '<a href="unplag_debug.php?reset=1&id=' . $tf->id . '&sesskey=' . sesskey() . '">' . get_string('resubmit', 'plagiarism_unplag') . '</a> | ';
    }
    $reset .= '<a href="unplag_debug.php?delete=1&id=' . $tf->id . '&sesskey=' . sesskey() . '">' . get_string('delete') . '</a>';
    $cmurl = new moodle_url($CFG->wwwroot . '/mod/' . $tf->moduletype . '/view.php', array('id' => $tf->cm));
    $cmlink = html_writer::link($cmurl, shorten_text($coursemodule->name, 40, true), array('title' => $coursemodule->name));
Esempio n. 2
0
$headers[] = 'Usage';
$table->define_headers($headers);
$columns = array();
$columns[] = 'courses';
$columns[] = 'modules';
$columns[] = 'usage';
$table->define_columns($columns);
// Define a base url
$table->define_baseurl($url);
// The sortable and non sortable columns
$table->pageable(true);
// We get the count for the data
$numcursos = count($modulestats);
// Set the page size
$table->pagesize($perpage, $numcursos);
$table->show_download_buttons_at(array(TABLE_P_TOP));
// Setup the table
$table->setup();
$permodulestats = array();
$courses = array();
$modules = array();
foreach ($modulestats as $stat) {
    $courses[$stat->id] = 1;
    $modules[] = intval($stat->modules);
    $permodulestats[$stat->name][] = intval($stat->modules);
}
$coursestats = local_uai_calculate_stats(array_values($courses), 'courses');
$totalmodules = local_uai_calculate_stats($modules, 'modules');
$courseurl = new moodle_url('/course/view.php', array('id' => $stat->id));
$data = array();
$data[] = $coursestats->count;