本文整理汇总了PHP中flexible_table::no_sorting方法的典型用法代码示例。如果您正苦于以下问题:PHP flexible_table::no_sorting方法的具体用法?PHP flexible_table::no_sorting怎么用?PHP flexible_table::no_sorting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flexible_table
的用法示例。
在下文中一共展示了flexible_table::no_sorting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: course_report
/**
* course_report
*
* @param mixed $indicators
* @param mixed $data
* @access public
* @return void
*/
public function course_report($indicators, $data)
{
global $DB, $COURSE;
if (empty($data)) {
return '';
}
$table = new flexible_table('engagement-course-report');
$table->define_baseurl(new moodle_url('/report/engagement/index.php', array('id' => $COURSE->id)));
$headers = array();
$columns = array();
$headers[] = get_string('username');
$columns[] = 'username';
foreach ($indicators as $indicator) {
$headers[] = get_string('pluginname', "engagementindicator_{$indicator}");
$columns[] = "indicator_{$indicator}";
}
$headers[] = get_string('total');
$columns[] = 'total';
$table->define_headers($headers);
$table->define_columns($columns);
$table->sortable(true, 'total', SORT_DESC);
$table->no_sorting('username');
$table->column_class('username', 'student');
foreach ($indicators as $indicator) {
$table->column_class("indicator_{$indicator}", 'indicator');
}
$table->column_class('total', 'total');
$table->set_attribute('id', 'engagement-course-report');
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
$table->setup();
foreach ($data as $user => $ind_data) {
$row = array();
$displayname = fullname($DB->get_record('user', array('id' => $user)));
$url = new moodle_url('/course/report/engagement/index.php', array('id' => $COURSE->id, 'userid' => $user));
$row[] = html_writer::link($url, $displayname);
$total = 0;
$total_raw = 0;
foreach ($indicators as $indicator) {
if (isset($ind_data["indicator_{$indicator}"]['raw'])) {
$ind_value = $ind_data["indicator_{$indicator}"]['raw'];
$weight = $ind_data["indicator_{$indicator}"]['weight'];
} else {
$ind_value = 0;
$weight = 0;
}
$weighted_value = sprintf("%.0f%%", $ind_value * $weight * 100);
$raw_value = sprintf("%.0f%%", 100 * $ind_value);
$row[] = $weighted_value . " ({$raw_value})";
$total += $ind_value * $weight;
$total_raw += $ind_value;
}
$row[] = sprintf("%.0f%%", $total * 100);
$table->add_data($row);
}
$html = $this->output->notification(get_string('reportdescription', 'coursereport_engagement'));
ob_start();
$table->finish_output();
$html .= ob_get_clean();
return $html;
}
示例2: run_table_test
protected function run_table_test($columns, $headers, $sortable, $collapsible, $suppress, $nosorting, $data, $pagesize)
{
$table = new flexible_table('tablelib_test');
$table->define_columns($columns);
$table->define_headers($headers);
$table->define_baseurl('/invalid.php');
$table->sortable($sortable);
$table->collapsible($collapsible);
foreach ($suppress as $column) {
$table->column_suppress($column);
}
foreach ($nosorting as $column) {
$table->no_sorting($column);
}
$table->setup();
$table->pagesize($pagesize, count($data));
foreach ($data as $row) {
$table->add_data_keyed($row);
}
$table->finish_output();
}
示例3: display
//.........这里部分代码省略.........
$top = max($attemptscores);
$bottom = min($attemptscores);
$gap = ($top - $bottom) / 3;
$top -= $gap;
$bottom += $gap;
foreach ($questions as $qid => $q) {
$questions[$qid] = $this->report_question_stats($q, $attemptscores, $statstable, $top, $bottom);
}
unset($attemptscores);
unset($statstable);
/// Now check if asked download of data
if ($download = optional_param('download', NULL)) {
$filename = clean_filename("{$course->shortname} " . format_string($quiz->name, true));
switch ($download) {
case "Excel":
$this->Export_Excel($questions, $filename);
break;
case "ODS":
$this->Export_ODS($questions, $filename);
break;
case "CSV":
$this->Export_CSV($questions, $filename);
break;
}
}
/// Construct the table for this particular report
$tablecolumns = array('id', 'qname', 'responses', 'credits', 'rcounts', 'rpercent', 'facility', 'qsd', 'disc_index', 'disc_coeff');
$tableheaders = array(get_string('qidtitle', 'quiz_analysis'), get_string('qtexttitle', 'quiz_analysis'), get_string('responsestitle', 'quiz_analysis'), get_string('rfractiontitle', 'quiz_analysis'), get_string('rcounttitle', 'quiz_analysis'), get_string('rpercenttitle', 'quiz_analysis'), get_string('facilitytitle', 'quiz_analysis'), get_string('stddevtitle', 'quiz_analysis'), get_string('dicsindextitle', 'quiz_analysis'), get_string('disccoefftitle', 'quiz_analysis'));
$table = new flexible_table('mod-quiz-report-itemanalysis');
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($CFG->wwwroot . '/mod/quiz/report.php?q=' . $quiz->id . '&mode=analysis');
$table->sortable(true);
$table->no_sorting('rpercent');
$table->collapsible(true);
$table->initialbars(false);
$table->column_class('id', 'numcol');
$table->column_class('credits', 'numcol');
$table->column_class('rcounts', 'numcol');
$table->column_class('rpercent', 'numcol');
$table->column_class('facility', 'numcol');
$table->column_class('qsd', 'numcol');
$table->column_class('disc_index', 'numcol');
$table->column_class('disc_coeff', 'numcol');
$table->column_suppress('id');
$table->column_suppress('qname');
$table->column_suppress('facility');
$table->column_suppress('qsd');
$table->column_suppress('disc_index');
$table->column_suppress('disc_coeff');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'itemanalysis');
$table->set_attribute('class', 'generaltable generalbox');
// Start working -- this is necessary as soon as the niceties are over
$table->setup();
$tablesort = $table->get_sql_sort();
$sorts = explode(",", trim($tablesort));
if ($tablesort and is_array($sorts)) {
$sortindex = array();
$sortorder = array();
foreach ($sorts as $sort) {
$data = explode(" ", trim($sort));
$sortindex[] = trim($data[0]);
$s = trim($data[1]);
if ($s == "ASC") {
$sortorder[] = SORT_ASC;
示例4: array
/**
* Display all the submissions ready for grading
*/
function display_submissions($message = '')
{
global $CFG, $db, $USER;
require_once $CFG->libdir . '/gradelib.php';
/* first we check to see if the form has just been submitted
* to request user_preference updates
*/
if (isset($_POST['updatepref'])) {
$perpage = optional_param('perpage', 10, PARAM_INT);
$perpage = $perpage <= 0 ? 10 : $perpage;
set_user_preference('assignment_perpage', $perpage);
set_user_preference('assignment_quickgrade', optional_param('quickgrade', 0, PARAM_BOOL));
}
/* next we get perpage and quickgrade (allow quick grade) params
* from database
*/
$perpage = get_user_preferences('assignment_perpage', 10);
$quickgrade = get_user_preferences('assignment_quickgrade', 0);
$grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id);
if (!empty($CFG->enableoutcomes) and !empty($grading_info->outcomes)) {
$uses_outcomes = true;
} else {
$uses_outcomes = false;
}
$teacherattempts = true;
/// Temporary measure
$page = optional_param('page', 0, PARAM_INT);
$strsaveallfeedback = get_string('saveallfeedback', 'assignment');
/// Some shortcuts to make the code read better
$course = $this->course;
$assignment = $this->assignment;
$cm = $this->cm;
$tabindex = 1;
//tabindex for quick grading tabbing; Not working for dropdowns yet
add_to_log($course->id, 'assignment', 'view submission', 'submissions.php?id=' . $this->assignment->id, $this->assignment->id, $this->cm->id);
$navlinks = array();
$navlinks[] = array('name' => $this->strassignments, 'link' => "index.php?id={$course->id}", 'type' => 'activity');
$navlinks[] = array('name' => format_string($this->assignment->name, true), 'link' => "view.php?a={$this->assignment->id}", 'type' => 'activityinstance');
$navlinks[] = array('name' => $this->strsubmissions, 'link' => '', 'type' => 'title');
$navigation = build_navigation($navlinks);
print_header_simple(format_string($this->assignment->name, true), "", $navigation, '', '', true, update_module_button($cm->id, $course->id, $this->strassignment), navmenu($course, $cm));
if (!empty($message)) {
echo $message;
// display messages here if any
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
/// find out current groups mode
$groupmode = groups_get_activity_groupmode($cm);
$currentgroup = groups_get_activity_group($cm, true);
groups_print_activity_menu($cm, 'submissions.php?id=' . $this->cm->id);
/// Get all ppl that are allowed to submit assignments
$users = get_users_by_capability($context, 'mod/assignment:submit', '', '', '', '', $currentgroup, '', false);
$users = array_keys($users);
if (!empty($CFG->enablegroupings) && !empty($cm->groupingid)) {
$groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id');
$users = array_intersect($users, array_keys($groupingusers));
}
$tablecolumns = array('picture', 'fullname', 'grade', 'submissioncomment', 'timemodified', 'timemarked', 'status', 'finalgrade');
if ($uses_outcomes) {
$tablecolumns[] = 'outcome';
// no sorting based on outcomes column
}
$tableheaders = array('', get_string('fullname'), get_string('grade'), get_string('comment', 'assignment'), get_string('lastmodified') . ' (' . $course->student . ')', get_string('lastmodified') . ' (' . $course->teacher . ')', get_string('status'), get_string('finalgrade', 'grades'));
if ($uses_outcomes) {
$tableheaders[] = get_string('outcome', 'grades');
}
require_once $CFG->libdir . '/tablelib.php';
$table = new flexible_table('mod-assignment-submissions');
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $this->cm->id . '&currentgroup=' . $currentgroup);
$table->sortable(true, 'lastname');
//sorted by lastname by default
$table->collapsible(true);
$table->initialbars(true);
$table->column_suppress('picture');
$table->column_suppress('fullname');
$table->column_class('picture', 'picture');
$table->column_class('fullname', 'fullname');
$table->column_class('grade', 'grade');
$table->column_class('submissioncomment', 'comment');
$table->column_class('timemodified', 'timemodified');
$table->column_class('timemarked', 'timemarked');
$table->column_class('status', 'status');
$table->column_class('finalgrade', 'finalgrade');
if ($uses_outcomes) {
$table->column_class('outcome', 'outcome');
}
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'attempts');
$table->set_attribute('class', 'submissions');
$table->set_attribute('width', '90%');
//$table->set_attribute('align', 'center');
$table->no_sorting('finalgrade');
$table->no_sorting('outcome');
// Start working -- this is necessary as soon as the niceties are over
$table->setup();
//.........这里部分代码省略.........
示例5: navmenu
//.........这里部分代码省略.........
// no sorting based on outcomes column
}
$tableheaders = array('', get_string('fullname'), get_string('grade'), get_string('comment', 'assignment'), get_string('lastmodified') . ' (' . get_string('submission', 'assignment') . ')', get_string('lastmodified') . ' (' . get_string('grade') . ')', get_string('status'), get_string('finalgrade', 'grades'));
if ($uses_outcomes) {
$tableheaders[] = get_string('outcome', 'grades');
}
require_once $CFG->libdir . '/tablelib.php';
$table = new flexible_table('mod-assignment-submissions');
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $this->cm->id . '&currentgroup=' . $currentgroup);
$table->sortable(true, 'lastname');
//sorted by lastname by default
$table->collapsible(true);
$table->initialbars(true);
$table->column_suppress('picture');
$table->column_suppress('fullname');
$table->column_class('picture', 'picture');
$table->column_class('fullname', 'fullname');
$table->column_class('grade', 'grade');
$table->column_class('submissioncomment', 'comment');
$table->column_class('timemodified', 'timemodified');
$table->column_class('timemarked', 'timemarked');
$table->column_class('status', 'status');
$table->column_class('finalgrade', 'finalgrade');
if ($uses_outcomes) {
$table->column_class('outcome', 'outcome');
}
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'attempts');
$table->set_attribute('class', 'submissions');
$table->set_attribute('width', '100%');
//$table->set_attribute('align', 'center');
$table->no_sorting('finalgrade');
$table->no_sorting('outcome');
// Start working -- this is necessary as soon as the niceties are over
$table->setup();
if (empty($users)) {
echo $OUTPUT->heading(get_string('nosubmitusers', 'assignment'));
return true;
}
/// Construct the SQL
if ($where = $table->get_sql_where()) {
$where .= ' AND ';
}
if ($sort = $table->get_sql_sort()) {
$sort = ' ORDER BY ' . $sort;
}
$select = 'SELECT u.id, u.firstname, u.lastname, u.picture, u.imagealt,
s.id AS submissionid, s.grade, s.submissioncomment,
s.timemodified, s.timemarked,
COALESCE(SIGN(SIGN(s.timemarked) + SIGN(s.timemarked - s.timemodified)), 0) AS status ';
$sql = 'FROM {user} u ' . 'LEFT JOIN {assignment_submissions} s ON u.id = s.userid
AND s.assignment = ' . $this->assignment->id . ' ' . 'WHERE ' . $where . 'u.id IN (' . implode(',', $users) . ') ';
$table->pagesize($perpage, count($users));
///offset used to calculate index of student in that particular query, needed for the pop up to know who's next
$offset = $page * $perpage;
$strupdate = get_string('update');
$strgrade = get_string('grade');
$grademenu = make_grades_menu($this->assignment->grade);
if (($ausers = $DB->get_records_sql($select . $sql . $sort, null, $table->get_page_start(), $table->get_page_size())) !== false) {
$grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id, array_keys($ausers));
foreach ($ausers as $auser) {
$final_grade = $grading_info->items[0]->grades[$auser->id];
$grademax = $grading_info->items[0]->grademax;
$final_grade->formatted_grade = round($final_grade->grade, 2) . ' / ' . round($grademax, 2);
示例6: fullname
$orderby = " ORDER BY t.id";
}
}
}
}
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 = "<a href='" . $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> | ';
示例7:
$columns[] = 'select';
// Define flexible table (can be sorted in different ways).
$showpages = new flexible_table('emarking-view-' . $cm->id);
$showpages->set_attribute('id', 'emarking-main');
$showpages->define_headers($headers);
$showpages->define_columns($columns);
$showpages->define_baseurl($urlemarking);
$showpages->column_class('actions', 'actions');
$showpages->column_class('lastname', 'lastname');
if ($emarking->type == EMARKING_TYPE_MARKER_TRAINING || $emarking->type == EMARKING_TYPE_PEER_REVIEW && $issupervisor) {
$showpages->column_class('marker', 'lastname');
}
$defaulttsort = $emarking->anonymous < 2 ? null : 'lastname';
$showpages->sortable(true, $defaulttsort, SORT_ASC);
if ($emarking->anonymous < 2) {
$showpages->no_sorting('lastname');
}
$showpages->no_sorting('comment');
$showpages->no_sorting('actions');
$showpages->no_sorting('select');
$showpages->pageable(true);
$showpages->pagesize($perpage, $totalstudents);
$showpages->setup();
// Decide on sorting depending on URL parameters and flexible table configuration.
$orderby = $emarking->anonymous < 2 ? 'ORDER BY sort ASC' : 'ORDER BY u.lastname ASC';
if ($showpages->get_sql_sort()) {
$orderby = 'ORDER BY ' . $showpages->get_sql_sort();
$tsort = $showpages->get_sql_sort();
}
// Get submissions with extra info to show.
$sqldrafts .= $orderby;
示例8: display
//.........这里部分代码省略.........
$columns[] = $colid;
$nosort[] = $colid;
if (!$displayoptions['objectivescore']) {
// Display the objective name only.
$headers[] = $objectivename;
} else {
// Display the objective status header with a "status" suffix to avoid confusion.
$headers[] = $objectivename . ' ' . get_string('status', 'scormreport_objectives');
// Now print objective score headers.
$colid = $scoid . 'objectivescore' . $id;
$columns[] = $colid;
$nosort[] = $colid;
$headers[] = $objectivename . ' ' . get_string('score', 'scormreport_objectives');
}
}
}
$emptycell = '';
// Used when an empty cell is being printed - in html we add a space.
if (!$download) {
$emptycell = ' ';
$table = new \flexible_table('mod-scorm-report');
$table->define_columns($columns);
$table->define_headers($headers);
$table->define_baseurl($PAGE->url);
$table->sortable(true);
$table->collapsible(true);
// This is done to prevent redundant data, when a user has multiple attempts.
$table->column_suppress('picture');
$table->column_suppress('fullname');
foreach ($extrafields as $field) {
$table->column_suppress($field);
}
foreach ($nosort as $field) {
$table->no_sorting($field);
}
$table->no_sorting('start');
$table->no_sorting('finish');
$table->no_sorting('score');
$table->no_sorting('checkbox');
$table->no_sorting('picture');
foreach ($scoes as $sco) {
if ($sco->launch != '') {
$table->no_sorting('scograde' . $sco->id);
}
}
$table->column_class('picture', 'picture');
$table->column_class('fullname', 'bold');
$table->column_class('score', 'bold');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'attempts');
$table->set_attribute('class', 'generaltable generalbox');
// Start working -- this is necessary as soon as the niceties are over.
$table->setup();
} else {
if ($download == 'ODS') {
require_once "{$CFG->libdir}/odslib.class.php";
$filename .= ".ods";
// Creating a workbook.
$workbook = new \MoodleODSWorkbook("-");
// Sending HTTP headers.
$workbook->send($filename);
// Creating the first worksheet.
$sheettitle = get_string('report', 'scorm');
$myxls = $workbook->add_worksheet($sheettitle);
// Format types.
$format = $workbook->add_format();
示例9: list
$bcoursename = $result->bcoursename;
} else {
list($bid, $boublogid, $bcontextid, $boublogname, $bcoursename) = oublog_import_getbloginfo($bid);
}
echo html_writer::start_tag('p', array('class' => 'oublog_import_step1_from'));
echo get_string('import_step1_from', 'oublog') . '<br />' . html_writer::tag('span', $boublogname);
echo html_writer::end_tag('p');
// Setup table early so sort can be determined (needs setup to be called first).
$table = new flexible_table($cm->id * $bid);
$url = new moodle_url('/mod/oublog/import.php', $params + $stepinfo);
$table->define_baseurl($url);
$table->define_columns(array('title', 'timeposted', 'tags', 'include'));
$table->column_style('include', 'text-align', 'center');
$table->sortable(true, 'timeposted', SORT_DESC);
$table->maxsortkeys = 1;
$table->no_sorting('tags');
$table->no_sorting('include');
$table->setup();
$sort = flexible_table::get_sort_for_table($cm->id * $bid);
if (empty($sort)) {
$sort = 'timeposted DESC';
}
if ($tags = optional_param('tags', null, PARAM_SEQUENCE)) {
// Filter by joining tag instances.
$stepinfo['tags'] = $tags;
}
$perpage = 100;
// Must match value in oublog_import_getallposts.
$page = optional_param('page', 0, PARAM_INT);
$stepinfo['page'] = $page;
$preselected = optional_param('preselected', '', PARAM_SEQUENCE);
示例10: display_allfilesform
//.........这里部分代码省略.........
}
$tableheaders[] = get_string('lastmodified');
$tablecolumns[] = 'timemodified';
if (has_capability('mod/publication:approve', $context)) {
// Not necessary in upload mode without studentapproval.
if ($this->get_instance()->mode == PUBLICATION_MODE_IMPORT && $this->get_instance()->obtainstudentapproval) {
$tablecolumns[] = 'studentapproval';
$tableheaders[] = get_string('studentapproval', 'publication') . ' ' . $OUTPUT->help_icon('studentapproval', 'publication');
}
$tablecolumns[] = 'teacherapproval';
if ($this->get_instance()->mode == PUBLICATION_MODE_IMPORT && $this->get_instance()->obtainstudentapproval) {
$tableheaders[] = get_string('obtainstudentapproval', 'publication');
} else {
$tableheaders[] = get_string('teacherapproval', 'publication');
}
$tablecolumns[] = 'visibleforstudents';
$tableheaders[] = get_string('visibleforstudents', 'publication');
}
require_once $CFG->libdir . '/tablelib.php';
$table = new flexible_table('mod-publication-allfiles');
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($CFG->wwwroot . '/mod/publication/view.php?id=' . $cm->id . '&currentgroup=' . $currentgroup);
$table->sortable(true, 'lastname');
// Sorted by lastname by default.
$table->collapsible(false);
$table->initialbars(true);
$table->column_class('fullname', 'fullname');
$table->column_class('timemodified', 'timemodified');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'attempts');
$table->set_attribute('class', 'publications');
$table->set_attribute('width', '100%');
$table->no_sorting('studentapproval');
$table->no_sorting('selection');
$table->no_sorting('teacherapproval');
$table->no_sorting('visibleforstudents');
// Start working -- this is necessary as soon as the niceties are over.
$table->setup();
// Construct the SQL.
list($where, $params) = $table->get_sql_where();
if ($where) {
$where .= ' AND ';
}
if ($sort = $table->get_sql_sort()) {
$sort = ' ORDER BY ' . $sort;
}
$ufields = user_picture::fields('u');
$useridentityfields = $CFG->showuseridentity != '' ? 'u.' . str_replace(', ', ', u.', $CFG->showuseridentity) . ', ' : '';
$totalfiles = 0;
if (!empty($users)) {
$select = 'SELECT ' . $ufields . ', ' . $useridentityfields . ' username,
COUNT(*) filecount,
SUM(files.studentapproval) as status,
MAX(files.timecreated) timemodified ';
$sql = 'FROM {user} u ' . 'LEFT JOIN {publication_file} files ON u.id = files.userid
AND files.publication = ' . $this->get_instance()->id . ' ' . 'WHERE ' . $where . 'u.id IN (' . implode(', ', $users) . ') ' . 'GROUP BY ' . $ufields . ', ' . $useridentityfields . ' username ';
$ausers = $DB->get_records_sql($select . $sql . $sort, $params, $table->get_page_start(), $table->get_page_size());
$table->pagesize($perpage, count($users));
// Offset used to calculate index of student in that particular query, needed for the pop up to know who's next.
$offset = $page * $perpage;
$strupdate = get_string('update');
if ($ausers !== false) {
$endposition = $offset + $perpage;
$currentposition = 0;
$valid = $OUTPUT->pix_icon('i/valid', get_string('student_approved', 'publication'));
示例11: implode
}
//if($mode === MODE_PICTURES) {
//$tablecolumns = array('userpic');
//$tableheaders = array('User');
//unset($hiddenfields['lastaccess']);
//}
$table = new flexible_table('user-index-participants-' . $course->id);
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($baseurl->out());
if (!isset($hiddenfields['lastaccess'])) {
$table->sortable(true, 'lastaccess', SORT_DESC);
} else {
$table->sortable(true, 'firstname', SORT_ASC);
}
$table->no_sorting('roles');
//$table->no_sorting('groups');
//$table->no_sorting('groupings');
$table->no_sorting('select');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'participants');
$table->set_attribute('class', 'generaltable generalbox');
$table->set_control_variables(array(TABLE_VAR_SORT => 'ssort', TABLE_VAR_HIDE => 'shide', TABLE_VAR_SHOW => 'sshow', TABLE_VAR_IFIRST => 'sifirst', TABLE_VAR_ILAST => 'silast', TABLE_VAR_PAGE => 'spage'));
$table->setup();
// we are looking for all users with this role assigned in this context or higher
$parents = $context->get_parent_context_ids(true);
$contextlist = implode(',', $parents);
//list($esql, $params) = get_enrolled_sql($context, NULL, $currentgroup, true);
list($esql, $params) = get_enrolled_sql($context, NULL, NULL, true);
$joins = array("FROM {user} u");
$wheres = array();
示例12: array
}
/// Get perpage param from database
$perpage = get_user_preferences('stampcoll_perpage', STAMPCOLL_USERS_PER_PAGE);
$showupdateforms = get_user_preferences('stampcoll_showupdateforms', 1);
$tablecolumns = array('picture', 'fullname', 'count', 'comment');
$tableheaders = array('', get_string('fullname'), get_string('numberofstamps', 'stampcoll'), '');
require_once $CFG->libdir . '/tablelib.php';
$table = new flexible_table('mod-stampcoll-editstamps');
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($CFG->wwwroot . '/mod/stampcoll/editstamps.php?id=' . $cm->id . '&currentgroup=' . $currentgroup);
$table->sortable(true, 'lastname');
// default sort - do not use "count" here!
if (!$cap_viewotherstamps) {
// prevent sorting by stamps count and so guessing the number of them
$table->no_sorting('count');
}
$table->collapsible(false);
$table->initialbars(true);
$table->column_suppress('picture');
$table->column_suppress('fullname');
$table->column_class('picture', 'picture');
$table->column_class('fullname', 'fullname');
$table->column_class('count', 'count');
$table->column_class('comment', 'comment');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'stamps');
$table->set_attribute('class', 'stamps');
$table->set_attribute('width', '90%');
$table->set_attribute('align', 'center');
$table->setup();
示例13:
array_push($tableheaders, get_string('inboxtableheaderphone', 'block_moodletxt'));
array_push($tableheaders, get_string('inboxtableheadername', 'block_moodletxt'));
}
array_push($tablecolumns, 'timereceived');
array_push($tableheaders, get_string('inboxtableheadertime', 'block_moodletxt'));
array_push($tablecolumns, 'tags');
array_push($tableheaders, get_string('inboxtableheadertags', 'block_moodletxt'));
if (!$table->is_downloading()) {
array_push($tablecolumns, 'options');
array_push($tableheaders, get_string('inboxtableheaderoptions', 'block_moodletxt'));
}
// Finish off table options
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->sortable(true, 'timereceived', SORT_DESC);
$table->no_sorting('checkbox');
$table->no_sorting('messagetext');
$table->no_sorting('options');
$table->no_sorting('tags');
$table->column_class('tags', 'tagDrop');
$table->show_download_buttons_at(array(TABLE_P_BOTTOM));
$table->setup();
// Output errors if necessary
if (!$table->is_downloading()) {
// Drop in page header
echo $output->header();
$addTagListItems = '';
$tagCloud = new moodletxt_message_tag_cloud(get_string('headertags', 'block_moodletxt'));
$tagCloud->set_attribute('class', 'mdltxt_right');
$tagCloud->set_attribute('style', 'text-align:right;');
$maxCount = 1;
示例14: geogebra_view_results
function geogebra_view_results($geogebra, $context, $cm, $course, $action)
{
global $CFG, $DB, $OUTPUT, $PAGE, $USER;
if ($action == 'submitgrade') {
// Upgrade submitted grade
$grade = optional_param('grade', '', PARAM_INT);
$gradecomment = optional_param_array('comment_editor', '', PARAM_RAW);
$attemptid = optional_param('attemptid', '', PARAM_INT);
$attempt = geogebra_get_attempt($attemptid);
parse_str($attempt->vars, $parsedvars);
$parsedvars['grade'] = $grade;
$attempt->vars = http_build_query($parsedvars, '', '&');
geogebra_update_attempt($attemptid, $attempt->vars, GEOGEBRA_UPDATE_TEACHER, $gradecomment['text']);
}
// Show students list with their results
require_once $CFG->libdir . '/gradelib.php';
$perpage = optional_param('perpage', 10, PARAM_INT);
$perpage = $perpage <= 0 ? 10 : $perpage;
$page = optional_param('page', 0, PARAM_INT);
// Find out current groups mode
$groupmode = groups_get_activity_groupmode($cm);
$currentgroup = groups_get_activity_group($cm, true);
// Get all ppl that are allowed to submit geogebra
list($esql, $params) = get_enrolled_sql($context, 'mod/geogebra:submit', $currentgroup);
$sql = "SELECT u.id FROM {user} u " . "LEFT JOIN ({$esql}) eu ON eu.id=u.id " . "WHERE u.deleted = 0 AND eu.id=u.id ";
$users = $DB->get_records_sql($sql, $params);
if (!empty($users)) {
$users = array_keys($users);
}
// If groupmembersonly used, remove users who are not in any group
if ($users and !empty($CFG->enablegroupmembersonly) and $cm->groupmembersonly) {
if ($groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id')) {
$users = array_intersect($users, array_keys($groupingusers));
}
}
// TODO: Review to show all users information
if (!empty($users)) {
// Create results table
$extrafields = get_extra_user_fields($context);
$tablecolumns = array_merge(array('picture', 'fullname'), $extrafields, array('attempts', 'duration', 'grade', 'comment', 'datestudent', 'dateteacher', 'status'));
$extrafieldnames = array();
foreach ($extrafields as $field) {
$extrafieldnames[] = get_user_field_name($field);
}
$tableheaders = array_merge(array('', get_string('fullnameuser')), $extrafieldnames, array(get_string('attempts', 'geogebra'), get_string('duration', 'geogebra'), get_string('grade'), get_string('comment', 'geogebra'), get_string('lastmodifiedsubmission', 'geogebra'), get_string('lastmodifiedgrade', 'geogebra'), get_string('status', 'geogebra')));
require_once $CFG->libdir . '/tablelib.php';
$table = new flexible_table('mod-geogebra-results');
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($CFG->wwwroot . '/mod/geogebra/report.php?id=' . $cm->id . '&currentgroup=' . $currentgroup);
$table->sortable(true, 'lastname');
// Sorted by lastname by default
$table->collapsible(true);
$table->initialbars(true);
$table->column_suppress('picture');
$table->column_suppress('fullname');
$table->column_class('picture', 'picture');
$table->column_class('fullname', 'fullname');
foreach ($extrafields as $field) {
$table->column_class($field, $field);
}
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'attempts');
$table->set_attribute('class', 'results generaltable generalbox');
$table->set_attribute('width', '100%');
$table->no_sorting('attempts');
$table->no_sorting('duration');
$table->no_sorting('grade');
$table->no_sorting('comment');
$table->no_sorting('datestudent');
$table->no_sorting('dateteacher');
$table->no_sorting('status');
// Start working -- this is necessary as soon as the niceties are over
$table->setup();
// Construct the SQL
list($where, $params) = $table->get_sql_where();
if ($where) {
$where .= ' AND ';
}
if ($sort = $table->get_sql_sort()) {
$sort = ' ORDER BY ' . $sort;
}
$ufields = user_picture::fields('u', $extrafields);
$select = "SELECT {$ufields} ";
$sql = 'FROM {user} u WHERE ' . $where . 'u.id IN (' . implode(',', $users) . ') ';
$ausers = $DB->get_records_sql($select . $sql . $sort, $params, $table->get_page_start(), $table->get_page_size());
$table->pagesize($perpage, count($users));
$offset = $page * $perpage;
// Offset used to calculate index of student in that particular query, needed for the pop up to know who's next
if ($ausers !== false) {
// $grading_info = grade_get_grades($course->id, 'mod', 'geogebra', $geogebra->id, array_keys($ausers));
foreach ($ausers as $auser) {
$picture = $OUTPUT->user_picture($auser);
$userlink = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $auser->id . '&course=' . $course->id . '">' . fullname($auser, has_capability('moodle/site:viewfullnames', $context)) . '</a>';
$row = array($picture, $userlink);
$extradata = array();
foreach ($extrafields as $field) {
$extradata[] = $auser->{$field};
}
$row += $extradata;
//.........这里部分代码省略.........
示例15: create_and_setup_table
/**
* Create a table with properties as passed in params.
*
* @param string[] $columns
* @param string[] $headers
* @param bool $sortable
* @param bool $collapsible
* @param string[] $suppress
* @param string[] $nosorting
* @return flexible_table
*/
protected function create_and_setup_table($columns, $headers, $sortable, $collapsible, $suppress, $nosorting)
{
$table = new flexible_table('tablelib_test');
$table->define_columns($columns);
$table->define_headers($headers);
$table->define_baseurl('/invalid.php');
$table->sortable($sortable);
$table->collapsible($collapsible);
foreach ($suppress as $column) {
$table->column_suppress($column);
}
foreach ($nosorting as $column) {
$table->no_sorting($column);
}
$table->setup();
return $table;
}