本文整理汇总了PHP中flexible_table::sortable方法的典型用法代码示例。如果您正苦于以下问题:PHP flexible_table::sortable方法的具体用法?PHP flexible_table::sortable怎么用?PHP flexible_table::sortable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flexible_table
的用法示例。
在下文中一共展示了flexible_table::sortable方法的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: list_transactions
public function list_transactions($transactions)
{
global $CFG;
$table = new flexible_table('local-magentoconnector-transaction-list');
$table->define_columns(array('user', 'course', 'transactionid', 'timestamp'));
$table->define_headers(array(get_string('user'), get_string('course'), get_string('transactionid', 'local_magentoconnector'), get_string('timestamp', 'local_magentoconnector')));
$table->define_baseurl(new moodle_url('/local/magentoconnector/viewtransactions.php'));
$table->sortable(false);
$table->collapsible(false);
$table->column_class('user', 'user');
$table->column_class('course', 'course');
$table->column_class('transactionid', 'transactionid');
$table->column_class('timestamp', 'timestamp');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'local-magentoconnector-transaction-list');
$table->set_attribute('class', 'local-magentoconnector-transaction-list generaltable');
$table->set_attribute('width', '100%');
$table->setup();
if ($transactions) {
$user = new stdClass();
foreach ($transactions as $transaction) {
$user->id = $transaction->userid;
$user->firstname = $transaction->firstname;
$user->lastname = $transaction->lastname;
$user->firstnamephonetic = $transaction->firstnamephonetic;
$user->lastnamephonetic = $transaction->lastnamephonetic;
$user->middlename = $transaction->middlename;
$user->alternatename = $transaction->alternatename;
$row = array();
$userurl = new moodle_url($CFG->wwwroot . '/user/profile.php', array('id' => $user->id));
$row[] = html_writer::link($userurl, fullname($user), array('title' => get_string('viewprofile')));
$courseurl = new moodle_url($CFG->wwwroot . '/course/view.php', array('id' => $transaction->courseid));
$row[] = html_writer::link($courseurl, $transaction->course, array('title' => $transaction->course));
$row[] = $transaction->ordernum;
$row[] = userdate($transaction->timestamp, get_string('strftimedatetime'));
$table->add_data($row);
}
}
$table->print_html();
}
示例4: display
//.........这里部分代码省略.........
// now calculate statistics and set the values in the $questions array
$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") {
示例5: 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();
//.........这里部分代码省略.........
示例6: list
// from here assume we have at least the module we're using.
$cm = $modinfo->cms[$instanceid];
// Group security checks.
if (!groups_group_visible($currentgroup, $course, $cm)) {
echo $OUTPUT->heading(get_string("notingroup"));
echo $OUTPUT->footer();
exit;
}
$table = new flexible_table('course-participation-' . $course->id . '-' . $cm->id . '-' . $roleid);
$table->course = $course;
$table->define_columns(array('fullname', 'count', 'select'));
$table->define_headers(array(get_string('user'), !empty($action) ? get_string($action) : get_string('allactions'), get_string('select')));
$table->define_baseurl($baseurl);
$table->set_attribute('cellpadding', '5');
$table->set_attribute('class', 'generaltable generalbox reporttable');
$table->sortable(true, 'lastname', 'ASC');
$table->no_sorting('select');
$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 want to query both the current context and parent contexts.
list($relatedctxsql, $params) = $DB->get_in_or_equal($context->get_parent_context_ids(true), SQL_PARAMS_NAMED, 'relatedctx');
$params['roleid'] = $roleid;
$params['instanceid'] = $instanceid;
$params['timefrom'] = $timefrom;
$groupsql = "";
if (!empty($currentgroup)) {
$groupsql = "JOIN {groups_members} gm ON (gm.userid = u.id AND gm.groupid = :groupid)";
$params['groupid'] = $currentgroup;
}
$countsql = "SELECT COUNT(DISTINCT(ra.userid))\n FROM {role_assignments} ra\n JOIN {user} u ON u.id = ra.userid\n {$groupsql}\n WHERE ra.contextid {$relatedctxsql} AND ra.roleid = :roleid";
$totalcount = $DB->count_records_sql($countsql, $params);
示例7: array
if (!empty($CFG->enablegroupings)) {
$tablecolumns[] = 'groupings';
$tableheaders[] = get_string('groupings', 'group');
}
}
}
if ($bulkoperations) {
$tablecolumns[] = 'select';
$tableheaders[] = get_string('select');
}
$table = new flexible_table('user-index-participants-' . $course->id);
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($baseurl);
if (!isset($hiddenfields['lastaccess'])) {
$table->sortable(true, 'lastaccess', SORT_DESC);
}
$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();
$params = array();
// we are looking for all users with this role assigned in this context or higher
if ($usercontexts = get_parent_contexts($context)) {
$listofcontexts = '(' . implode(',', $usercontexts) . ')';
} else {
示例8: implode
}
}
$levels = implode(",", $levels);
// Calculates the number of criteria assigned to current user
$criteriafilter = "\n\tSELECT u.*,\n\t\tCASE WHEN S.comments = 0 AND S.status < 20 THEN 5\n\t\t\tWHEN S.comments = 0 AND S.status >= 20 THEN 20\n\t\t\tWHEN S.comments > 0 THEN 30 END AS status,\n\t\tS.submission\n\tFROM (SELECT\n\ts.id as submission,\n\ts.student,\n\tCOUNT(DISTINCT ec.id) AS comments,\n\ts.sort,\n\ts.status\n\tFROM {emarking_submission} AS s\n\tINNER JOIN {emarking_draft} as d ON (d.submissionid = s.id AND d.qualitycontrol = 0)\n\tINNER JOIN {emarking_page} AS p ON (s.emarking = {$emarking->id} AND p.submission = s.id)\n\tLEFT JOIN {emarking_comment} AS ec ON (ec.page = p.id AND ec.levelid IN ({$levels}))\n\tGROUP BY s.id) AS S\n\tINNER JOIN {user} AS u ON (S.student = u.id)";
// Check if activity is configured with separate groups to filter users
if ($cm->groupmode == SEPARATEGROUPS && $usercangrade && !is_siteadmin($USER) && !$useristeacher) {
$userfilter .= "\nAND u.id in (SELECT userid\n\t\tFROM {groups_members}\nWHERE groupid in (SELECT groupid\nFROM {groups_members} as gm\nINNER JOIN {groups} as g on (gm.groupid = g.id)\nWHERE gm.userid = {$USER->id} AND g.courseid = e.courseid))";
}
// Define flexible table (can be sorted in different ways)
$showpages = new flexible_table('emarking-kanban-' . $cmid);
$showpages->define_headers(array(get_string('notcorrected', 'mod_emarking'), get_string('marking', 'mod_emarking'), get_string('corrected', 'mod_emarking')));
$showpages->define_columns(array('notcorrected', 'marking', 'corrected'));
$showpages->define_baseurl($urlemarking);
$defaulttsort = $emarking->anonymous ? null : 'status';
$showpages->sortable(false);
$showpages->pageable(false);
$showpages->setup();
// Decide on sorting depending on URL parameters and flexible table configuration
$orderby = $emarking->anonymous ? 'ORDER BY sort ASC' : 'ORDER BY u.lastname ASC';
// Get submissions with extra info to show
$sql = $criterionid == 0 ? "\nSELECT u.*, \n\t\tIFNULL(s.id,0) as submission,\n\t\tIFNULL(s.status,0) as status,\n\t\ts.sort\nFROM {emarking_submission} AS s\n\tINNER JOIN {user} AS u ON (s.emarking = ? AND s.student = u.id)\n{$userfilter}\n{$orderby}" : $criteriafilter . $userfilter . $orderby;
// Run the query on the database
$emarkingpages = $DB->get_records_sql($sql, array($emarking->id));
$notcorrected = "";
$marking = "";
$corrected = "";
// Prepare data for the table
foreach ($emarkingpages as $pageinfo) {
// Student info
$userinfo = $emarking->anonymous ? get_string('anonymousstudent', 'mod_emarking') : $pageinfo->firstname . ' ' . $pageinfo->lastname . '</a>';
示例9: array
$groupselect = groups_print_activity_menu($cm, $url->out(), true);
$mygroupid = groups_get_activity_group($cm);
// preparing the table for output
$baseurl = new moodle_url('/mod/feedback/show_entries.php');
$baseurl->params(array('id' => $id, 'do_show' => $do_show, 'showall' => $showall));
$tablecolumns = array('userpic', 'fullname', 'c.timemodified');
$tableheaders = array(get_string('userpic'), get_string('fullnameuser'), get_string('date'));
if (has_capability('mod/feedback:deletesubmissions', $context)) {
$tablecolumns[] = 'deleteentry';
$tableheaders[] = '';
}
$table = new flexible_table('feedback-showentry-list-' . $course->id);
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($baseurl);
$table->sortable(true, 'lastname', SORT_DESC);
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'showentrytable');
$table->set_attribute('class', 'generaltable generalbox');
$table->set_control_variables(array(TABLE_VAR_SORT => 'ssort', TABLE_VAR_IFIRST => 'sifirst', TABLE_VAR_ILAST => 'silast', TABLE_VAR_PAGE => 'spage'));
$table->setup();
if ($table->get_sql_sort()) {
$sort = $table->get_sql_sort();
} else {
$sort = '';
}
list($where, $params) = $table->get_sql_where();
if ($where) {
$where .= ' AND';
}
//get students in conjunction with groupmode
示例10: implode
/**
* Prints a table with users and their attempts
*
* @return void
* @todo Add current grade to the table
* Finnish documenting
**/
function view_question($quiz, $question)
{
global $CFG, $db;
$users = get_course_students($quiz->course);
$userids = implode(',', array_keys($users));
$usercount = count($users);
// set up table
$tablecolumns = array('picture', 'fullname', 'timefinish', 'grade');
$tableheaders = array('', get_string('name'), get_string("completedon", "quiz"), '');
$table = new flexible_table('mod-quiz-report-grading');
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($CFG->wwwroot . '/mod/quiz/report.php?mode=grading&q=' . $quiz->id . '&action=viewquestion&questionid=' . $question->id);
$table->sortable(true);
$table->initialbars($usercount > 20);
// will show initialbars if there are more than 20 users
$table->pageable(true);
$table->collapsible(true);
$table->column_suppress('fullname');
$table->column_suppress('picture');
$table->column_suppress('grade');
$table->column_class('picture', 'picture');
// attributes in the table tag
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'attempts');
$table->set_attribute('class', 'generaltable generalbox');
$table->set_attribute('align', 'center');
//$table->set_attribute('width', '50%');
// get it ready!
$table->setup();
// this sql is a join of the attempts table and the user table. I do this so I can sort by user name and attempt number (not id)
$select = 'SELECT ' . sql_concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')) . ' AS userattemptid, qa.id AS attemptid, qa.uniqueid, qa.attempt, qa.timefinish, u.id AS userid, u.firstname, u.lastname, u.picture ';
$from = 'FROM ' . $CFG->prefix . 'user u LEFT JOIN ' . $CFG->prefix . 'quiz_attempts qa ON (u.id = qa.userid AND qa.quiz = ' . $quiz->id . ') ';
$where = 'WHERE u.id IN (' . $userids . ') ';
$where .= 'AND ' . $db->IfNull('qa.attempt', '0') . ' != 0 ';
$where .= 'AND ' . $db->IfNull('qa.timefinish', '0') . ' != 0 ';
$where .= 'AND preview = 0 ';
// ignore previews
if ($table->get_sql_where()) {
// forgot what this does
$where .= 'AND ' . $table->get_sql_where();
}
// sorting of the table
if ($sort = $table->get_sql_sort()) {
$sort = 'ORDER BY ' . $sort;
// seems like I would need to have u. or qa. infront of the ORDER BY attribues... but seems to work..
} else {
// my default sort rule
$sort = 'ORDER BY u.firstname, u.lastname, qa.timefinish ASC';
}
// set up the pagesize
$total = count_records_sql('SELECT COUNT(DISTINCT(' . sql_concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')) . ')) ' . $from . $where);
$table->pagesize(10, $total);
// get the attempts and process them
if ($attempts = get_records_sql($select . $from . $where . $sort, $table->get_page_start(), $table->get_page_size())) {
foreach ($attempts as $attempt) {
$picture = print_user_picture($attempt->userid, $quiz->course, $attempt->picture, false, true);
// link to student profile
$userlink = "<a href=\"{$CFG->wwwroot}/user/view.php?id={$attempt->userid}&course={$quiz->course}\">" . fullname($attempt, true) . '</a>';
if (!$this->is_graded($question, $attempt)) {
$style = 'class="manual-ungraded"';
} else {
$style = 'class="manual-graded"';
}
// link for the attempt
$attemptlink = "<a {$style} href=\"report.php?mode=grading&action=grade&q={$quiz->id}&questionid={$question->id}&attemptid={$attempt->attemptid}\">" . userdate($attempt->timefinish, get_string('strftimedatetime')) . '</a>';
// grade all attempts for this user
$gradelink = "<a href=\"report.php?mode=grading&action=grade&q={$quiz->id}&questionid={$question->id}&userid={$attempt->userid}\">" . get_string('grade') . '</a>';
$table->add_data(array($picture, $userlink, $attemptlink, $gradelink));
}
}
// grade all and "back" links
$links = "<div class=\"boxaligncenter\"><a href=\"report.php?mode=grading&action=grade&q={$quiz->id}&questionid={$question->id}&gradeall=1\">" . get_string('gradeall', 'quiz') . '</a> | ' . "<a href=\"report.php?mode=grading&q={$quiz->id}&action=viewquestions\">" . get_string('backtoquestionlist', 'quiz') . '</a></div>' . print_heading($question->name);
echo $links;
echo '<div id="tablecontainer">';
$table->print_html();
echo '</div>';
echo $links;
}
示例11: array
}
} else {
if (!empty($tracker->parent)) {
$transferstr = get_string('transfer', 'tracker');
$tablecolumns = array('resolutionpriority', 'id', 'summary', 'datereported', 'reportedby', 'assignedto', 'status', 'watches', 'transfered', 'action');
$tableheaders = array("<b>{$prioritystr}</b>", "<b>{$issuenumberstr}</b>", "<b>{$summarystr}</b>", "<b>{$datereportedstr}</b>", "<b>{$reportedbystr}</b>", "<b>{$assignedtostr}</b>", "<b>{$statusstr}</b>", "<b>{$watchesstr}</b>", "<b>{$transferstr}</b>", "<b>{$actionstr}</b>");
} else {
$tablecolumns = array('resolutionpriority', 'id', 'summary', 'datereported', 'reportedby', 'assignedto', 'status', 'watches', 'action');
$tableheaders = array("<b>{$prioritystr}</b>", "<b>{$issuenumberstr}</b>", "<b>{$summarystr}</b>", "<b>{$datereportedstr}</b>", "<b>{$reportedbystr}</b>", "<b>{$assignedtostr}</b>", "<b>{$statusstr}</b>", "<b>{$watchesstr}</b>", "<b>{$actionstr}</b>");
}
}
$table = new flexible_table('mod-tracker-issuelist');
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($CFG->wwwroot . '/mod/tracker/view.php?id=' . $cm->id . '&view=' . $view . '&screen=' . $screen);
$table->sortable(true, 'resolutionpriority', SORT_ASC);
//sorted by priority by default
$table->collapsible(true);
$table->initialbars(true);
// allow column hiding
// $table->column_suppress('reportedby');
// $table->column_suppress('watches');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'issues');
$table->set_attribute('class', 'issuelist');
$table->set_attribute('width', '100%');
$table->column_class('resolutionpriority', 'list_priority');
$table->column_class('id', 'list_issuenumber');
$table->column_class('summary', 'list_summary');
$table->column_class('datereported', 'timelabel');
$table->column_class('reportedby', 'list_reportedby');
示例12: authorize_print_orders
/**
* authorize_print_orders
*
*/
function authorize_print_orders($courseid, $userid)
{
global $CFG, $USER, $SITE;
global $strs, $authstrs;
require_once $CFG->libdir . '/tablelib.php';
$perpage = 10;
$status = optional_param('status', AN_STATUS_NONE, PARAM_INT);
$searchtype = optional_param('searchtype', 'id', PARAM_ALPHA);
$idortransid = optional_param('idortransid', '0', PARAM_INT);
$showonlymy = optional_param('showonlymy', 0, PARAM_BOOL);
$canmanagepayments = has_capability('enrol/authorize:managepayments', get_context_instance(CONTEXT_COURSE, $courseid));
if ($showonlymy || !$canmanagepayments) {
$userid = $USER->id;
}
$baseurl = $CFG->wwwroot . "/enrol/authorize/index.php?user={$userid}";
$statusmenu = array(AN_STATUS_NONE => $strs->all, AN_STATUS_AUTH | AN_STATUS_UNDERREVIEW | AN_STATUS_APPROVEDREVIEW => $authstrs->allpendingorders, AN_STATUS_AUTH => $authstrs->authorizedpendingcapture, AN_STATUS_AUTHCAPTURE => $authstrs->authcaptured, AN_STATUS_CREDIT => $authstrs->refunded, AN_STATUS_VOID => $authstrs->cancelled, AN_STATUS_EXPIRE => $authstrs->expired, AN_STATUS_UNDERREVIEW => $authstrs->underreview, AN_STATUS_APPROVEDREVIEW => $authstrs->approvedreview, AN_STATUS_REVIEWFAILED => $authstrs->reviewfailed, AN_STATUS_TEST => $authstrs->tested);
$sql = "SELECT c.id, c.fullname FROM {$CFG->prefix}course c INNER JOIN {$CFG->prefix}enrol_authorize e ON c.id = e.courseid ";
if ($userid > 0) {
$sql .= "WHERE (e.userid='{$userid}') ";
}
$sql .= "ORDER BY c.sortorder, c.fullname";
if ($popupcrs = get_records_sql_menu($sql)) {
$popupcrs = array($SITE->id => $SITE->fullname) + $popupcrs;
echo "<table border='0' width='100%' cellspacing='0' cellpadding='3' class='generaltable generalbox'>";
echo "<tr>";
echo "<td width='5%' valign='top'>{$strs->status}: </td><td width='10%'>";
popup_form($baseurl . '&course=' . $courseid . '&status=', $statusmenu, 'statusmenu', $status, '', '', '', false);
if ($canmanagepayments) {
echo "<br />\n";
print_checkbox('showonlymy', '1', $userid == $USER->id, get_string('mypaymentsonly', 'enrol_authorize'), '', "var locationtogo = '{$CFG->wwwroot}/enrol/authorize/index.php?status={$status}&course={$courseid}';\n locationtogo += '&user=' + (this.checked ? '{$USER->id}' : '0');\n top.location.href=locationtogo;");
}
echo "</td>\n";
echo "<td width='5%' valign='top'>{$strs->course}: </td><td width='10%' valign='top'>";
popup_form($baseurl . '&status=' . $status . '&course=', $popupcrs, 'coursesmenu', $courseid, '', '', '', false);
echo "</td>\n";
if (has_capability('enrol/authorize:uploadcsv', get_context_instance(CONTEXT_USER, $USER->id))) {
echo "<form method='get' action='uploadcsv.php'>";
echo "<td rowspan='2' align='right' valign='middle' width='50%'><div><input type='submit' value='" . get_string('uploadcsv', 'enrol_authorize') . "' /></div></td>";
echo "</form>";
} else {
echo "<td rowspan=2 width='100%'> </td>";
}
echo "</tr>\n";
echo "<tr><td>{$strs->search}: </td>";
$searchmenu = array('id' => $authstrs->orderid, 'transid' => $authstrs->transid);
echo "<form method='POST' action='index.php' autocomplete='off'>";
echo "<td colspan='3'>";
choose_from_menu($searchmenu, 'searchtype', $searchtype, '');
echo " = <fieldset class=\"invisiblefieldset\"><input type='text' size='14' name='idortransid' value='' /> ";
echo "<input type='submit' value='{$strs->search}' /></fieldset></td>";
echo "</form>";
echo "</tr>";
echo "</table>";
}
$table = new flexible_table('enrol-authorize');
$table->set_attribute('width', '100%');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('cellpadding', '3');
$table->set_attribute('id', 'orders');
$table->set_attribute('class', 'generaltable generalbox');
$table->define_columns(array('id', 'timecreated', 'userid', 'status', ''));
$table->define_headers(array($authstrs->orderid, $strs->time, $authstrs->nameoncard, $strs->status, $strs->action));
$table->define_baseurl($baseurl . "&status={$status}&course={$courseid}");
$table->sortable(true, 'id', SORT_DESC);
$table->pageable(true);
$table->setup();
$select = "SELECT e.id, e.paymentmethod, e.transid, e.courseid, e.userid, e.status, e.ccname, e.timecreated, e.settletime ";
$from = "FROM {$CFG->prefix}enrol_authorize e ";
$where = "WHERE (1=1) ";
if ($status > AN_STATUS_NONE) {
switch ($status) {
case AN_STATUS_AUTH | AN_STATUS_UNDERREVIEW | AN_STATUS_APPROVEDREVIEW:
$where .= 'AND (e.status IN(' . AN_STATUS_AUTH . ',' . AN_STATUS_UNDERREVIEW . ',' . AN_STATUS_APPROVEDREVIEW . ')) ';
break;
case AN_STATUS_CREDIT:
$from .= "INNER JOIN {$CFG->prefix}enrol_authorize_refunds r ON e.id = r.orderid ";
$where .= "AND (e.status = '" . AN_STATUS_AUTHCAPTURE . "') ";
break;
case AN_STATUS_TEST:
$newordertime = time() - 120;
// -2 minutes. Order may be still in process.
$where .= "AND (e.status = '" . AN_STATUS_NONE . "') AND (e.transid = '0') AND (e.timecreated < {$newordertime}) ";
break;
default:
$where .= "AND (e.status = '{$status}') ";
break;
}
} else {
if (empty($CFG->an_test)) {
$where .= "AND (e.status != '" . AN_STATUS_NONE . "') ";
}
}
if ($courseid != SITEID) {
$where .= "AND (e.courseid = '" . $courseid . "') ";
}
if (!empty($idortransid)) {
//.........这里部分代码省略.........
示例13: authorize_print_orders
/**
* authorize_print_orders
*
*/
function authorize_print_orders($courseid, $userid)
{
global $course;
global $CFG, $USER, $SITE, $DB, $OUTPUT, $PAGE;
global $strs, $authstrs;
$plugin = enrol_get_plugin('authorize');
require_once $CFG->libdir . '/tablelib.php';
$perpage = optional_param('perpage', 10, PARAM_INT);
$showonlymy = optional_param('showonlymy', 0, PARAM_BOOL);
$searchquery = optional_param('searchquery', '0', PARAM_INT);
$searchtype = optional_param('searchtype', 'orderid', PARAM_ALPHA);
$status = optional_param('status', AN_STATUS_NONE, PARAM_INT);
$coursecontext = context_course::instance($courseid);
$searchmenu = array('orderid' => $authstrs->orderid, 'transid' => $authstrs->transid, 'cclastfour' => $authstrs->cclastfour);
$buttons = "<form method='post' action='index.php' autocomplete='off'><div>";
$buttons .= html_writer::label(get_string('orderdetails', 'enrol_authorize'), 'menusearchtype', false, array('class' => 'accesshide'));
$buttons .= html_writer::select($searchmenu, 'searchtype', $searchtype, false);
$buttons .= html_writer::label(get_string('search'), 'searchquery', false, array('class' => 'accesshide'));
$buttons .= "<input id='searchquery' type='text' size='16' name='searchquery' value='' />";
$buttons .= "<input type='submit' value='{$strs->search}' />";
$buttons .= "</div></form>";
if (has_capability('enrol/authorize:uploadcsv', context_user::instance($USER->id))) {
$buttons .= "<form method='get' action='uploadcsv.php'><div><input type='submit' value='" . get_string('uploadcsv', 'enrol_authorize') . "' /></div></form>";
}
$canmanagepayments = has_capability('enrol/authorize:managepayments', $coursecontext);
if ($showonlymy || !$canmanagepayments) {
$userid = $USER->id;
}
$baseurl = $CFG->wwwroot . '/enrol/authorize/index.php?user=' . $userid;
$params = array('userid' => $userid);
$sql = "SELECT c.id, c.fullname FROM {course} c JOIN {enrol_authorize} e ON c.id = e.courseid ";
$sql .= $userid > 0 ? "WHERE (e.userid=:userid) " : '';
$sql .= "ORDER BY c.sortorder, c.fullname";
if ($popupcrs = $DB->get_records_sql_menu($sql, $params)) {
$popupcrs = array($SITE->id => $SITE->fullname) + $popupcrs;
}
$popupmenu = empty($popupcrs) ? '' : $OUTPUT->single_select(new moodle_url($baseurl . '&status=' . $status), 'course', $popupcrs, $courseid, null, 'coursesmenu');
$popupmenu .= '<br />';
$statusmenu = array(AN_STATUS_NONE => $strs->all, AN_STATUS_AUTH | AN_STATUS_UNDERREVIEW | AN_STATUS_APPROVEDREVIEW => $authstrs->allpendingorders, AN_STATUS_AUTH => $authstrs->authorizedpendingcapture, AN_STATUS_AUTHCAPTURE => $authstrs->authcaptured, AN_STATUS_CREDIT => $authstrs->refunded, AN_STATUS_VOID => $authstrs->cancelled, AN_STATUS_EXPIRE => $authstrs->expired, AN_STATUS_UNDERREVIEW => $authstrs->underreview, AN_STATUS_APPROVEDREVIEW => $authstrs->approvedreview, AN_STATUS_REVIEWFAILED => $authstrs->reviewfailed, AN_STATUS_TEST => $authstrs->tested);
$popupmenu .= $OUTPUT->single_select(new moodle_url($baseurl . '&course=' . $courseid), 'status', $statusmenu, $status, null, 'statusmenu');
if ($canmanagepayments) {
$popupmenu .= '<br />';
$PAGE->requires->js('/enrol/authorize/authorize.js');
$aid = $OUTPUT->add_action_handler(new component_action('click', 'authorize_jump_to_mypayments', array('userid' => $USER->id, 'status' => $status)));
$popupmenu .= html_writer::checkbox('enrol_authorize', 1, $userid == $USER->id, get_string('mypaymentsonly', 'enrol_authorize'), array('id' => $aid));
}
if (SITEID != $courseid) {
$shortname = format_string($course->shortname, true, array('context' => $coursecontext));
$PAGE->navbar->add($shortname, new moodle_url('/course/view.php', array('id' => $course->id)));
}
$PAGE->navbar->add($authstrs->paymentmanagement, 'index.php');
$PAGE->set_title("{$course->shortname}: {$authstrs->paymentmanagement}");
$PAGE->set_heading($authstrs->paymentmanagement);
$PAGE->set_headingmenu($popupmenu);
$PAGE->set_button($buttons);
echo $OUTPUT->header();
$table = new flexible_table('enrol-authorize');
$table->set_attribute('width', '100%');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('cellpadding', '3');
$table->set_attribute('id', 'orders');
$table->set_attribute('class', 'generaltable generalbox');
if ($perpage > 100) {
$perpage = 100;
}
$perpagemenus = array(5 => 5, 10 => 10, 20 => 20, 50 => 50, 100 => 100);
$perpagemenu = $OUTPUT->single_select(new moodle_url($baseurl . '&status=' . $status . '&course=' . $courseid), 'perpage', $perpagemenus, $perpage, array('' => 'choosedots'), 'perpagemenu');
$table->define_columns(array('id', 'userid', 'timecreated', 'status', 'action'));
$table->define_headers(array($authstrs->orderid, $authstrs->shopper, $strs->time, $strs->status, $perpagemenu));
$table->define_baseurl($baseurl . "&status={$status}&course={$courseid}&perpage={$perpage}");
$table->no_sorting('action');
$table->sortable(true, 'id', SORT_DESC);
$table->pageable(true);
$table->setup();
$select = "SELECT e.id, e.paymentmethod, e.refundinfo, e.transid, e.courseid, e.userid, e.status, e.ccname, e.timecreated, e.settletime ";
$from = "FROM {enrol_authorize} e ";
$where = "WHERE (1=1) ";
$params = array();
if (!empty($searchquery)) {
switch ($searchtype) {
case 'orderid':
$where = "WHERE (e.id = :searchquery) ";
$params['searchquery'] = $searchquery;
break;
case 'transid':
$where = "WHERE (e.transid = :searchquery) ";
$params['searchquery'] = $searchquery;
break;
case 'cclastfour':
$searchquery = sprintf("%04d", $searchquery);
$where = "WHERE (e.refundinfo = :searchquery) AND (e.paymentmethod=:method) ";
$params['searchquery'] = $searchquery;
$params['method'] = AN_METHOD_CC;
break;
}
} else {
//.........这里部分代码省略.........
示例14: navmenu
function display_submissions($message = '')
{
global $CFG, $db, $USER;
require_once $CFG->libdir . '/gradelib.php';
// Update preferences
if (isset($_POST['updatepref'])) {
$perpage = optional_param('perpage', 20, PARAM_INT);
$perpage = $perpage <= 0 ? 20 : $perpage;
set_user_preference('assignment_perpage', $perpage);
$moderationtarget = optional_param('moderationtarget', 0, PARAM_INT);
$moderationtarget = $moderationtarget <= 0 ? 0 : $moderationtarget;
set_user_preference('assignment_moderationtarget', $moderationtarget);
}
// Get preferences
$perpage = get_user_preferences('assignment_perpage', 10);
$moderationtarget = get_user_preferences('assignment_moderationtarget', 0);
// Some shortcuts to make the code read better
$grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id);
$course = $this->course;
$assignment = $this->assignment;
$cm = $this->cm;
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$page = optional_param('page', 0, PARAM_INT);
// Log this view
add_to_log($course->id, 'assignment', 'view submission', 'submissions.php?id=' . $this->assignment->id, $this->assignment->id, $this->cm->id);
// Print header and navigation breadcrumbs
$navigation = build_navigation($this->strsubmissions, $this->cm);
print_header_simple(format_string($this->assignment->name, true), "", $navigation, '', '', true, update_module_button($cm->id, $course->id, $this->strassignment), navmenu($course, $cm));
// Print tabs at top of page
$tabs = array();
$row = array();
$inactive = array();
$activated = array();
$row[] = new tabobject('criteria', "type/peerreview/" . self::CRITERIA_FILE . "?id=" . $this->cm->id . "&a=" . $this->assignment->id, get_string('criteria', 'assignment_peerreview'));
$row[] = new tabobject('submissions', '', get_string('submissions', 'assignment_peerreview'));
$tabs[] = $row;
$currenttab = 'submissions';
$inactive[] = 'submissions';
$activated[] = 'submissions';
print_tabs($tabs, $currenttab, $inactive, $activated);
// Print optional message
if (!empty($message)) {
echo $message;
// display messages here if any
}
// Check to see if groups are being used in this assignment
// find out current groups mode
// $groupmode = groups_get_activity_groupmode($cm);
// $currentgroup = groups_get_activity_group($cm, true);
// groups_print_activity_menu($cm, $CFG->wwwroot.'/mod/assignment/submissions.php?id=' . $cm->id);
// Get all ppl that are allowed to submit assignments
// if ($users = get_users_by_capability($context, 'mod/assignment:submit', 'u.id', '', '', '', $currentgroup, '', false)) {
if ($users = get_users_by_capability($context, 'mod/assignment:submit', 'u.id')) {
$users = array_keys($users);
}
// Filter out teachers
if ($users && ($teachers = get_users_by_capability($context, 'mod/assignment:grade', 'u.id'))) {
$users = array_diff($users, array_keys($teachers));
}
// Warn if class is too small
if (count($users) < 5) {
notify(get_string('numberofstudentswarning', 'assignment_peerreview'));
}
// if groupmembersonly used, remove users who are not in any group
// if ($users and !empty($CFG->enablegroupings) and $cm->groupmembersonly) {
// if ($groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id')) {
// $users = array_intersect($users, array_keys($groupingusers));
// }
// }
// Create the table to be shown
require_once $CFG->libdir . '/tablelib.php';
$table = new flexible_table('mod-assignment-submissions');
$tablecolumns = array('picture', 'fullname', 'submitted', 'reviews', 'moderations', 'status', 'seedoreviews', 'suggestedmark', 'finalgrade');
$table->define_columns($tablecolumns);
$tableheaders = array('', get_string('fullname'), get_string('submission', 'assignment_peerreview'), get_string('reviewsbystudent', 'assignment_peerreview') . helpbutton('reviewsbystudent', get_string('reviewsbystudent', 'assignment_peerreview'), 'assignment/type/peerreview/', true, false, '', true), get_string('moderationstitle', 'assignment_peerreview') . helpbutton('moderationtarget', get_string('moderationtarget', 'assignment_peerreview'), 'assignment/type/peerreview/', true, false, '', true), get_string('status') . helpbutton('status', get_string('status', 'assignment_peerreview'), 'assignment/type/peerreview/', true, false, '', true), get_string('seedoreviews', 'assignment_peerreview') . helpbutton('seedoreviews', get_string('seedoreviews', 'assignment_peerreview'), 'assignment/type/peerreview/', true, false, '', true), get_string('suggestedgrade', 'assignment_peerreview') . helpbutton('suggestedgrade', get_string('suggestedgrade', 'assignment_peerreview'), 'assignment/type/peerreview/', true, false, '', true), get_string('finalgrade', 'assignment_peerreview') . helpbutton('finalgrade', get_string('finalgrade', 'assignment_peerreview'), 'assignment/type/peerreview/', true, false, '', true));
$table->define_headers($tableheaders);
// $table->define_baseurl($CFG->wwwroot.'/mod/assignment/submissions.php?id='.$this->cm->id.'&currentgroup='.$currentgroup);
$table->define_baseurl($CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $this->cm->id);
// $table->sortable(true, 'submitted');
$table->sortable(false);
$table->collapsible(true);
// $table->initialbars(true);
$table->initialbars(false);
$table->column_suppress('picture');
$table->column_suppress('fullname');
$table->column_class('picture', 'picture');
$table->column_class('fullname', 'fullname');
$table->column_class('submitted', 'submitted');
$table->column_class('reviews', 'reviews');
$table->column_class('moderations', 'moderations');
$table->column_class('status', 'status');
$table->column_class('seedoreviews', 'seedoreviews');
$table->column_class('suggestedmark', 'suggestedmark');
$table->column_class('finalgrade', 'finalgrade');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'attempts');
$table->set_attribute('class', 'submissions');
$table->set_attribute('width', '99%');
$table->set_attribute('align', 'center');
$table->column_style('submitted', 'text-align', $alignment);
//.........这里部分代码省略.........
示例15: array
} else {
$extrafields = array();
}
$tablecolumns = array_merge(array('picture', 'fullname'), $extrafields, array('starttime', 'attempts', 'solveddone', 'totaltime', 'grade'));
$extrafieldnames = array();
foreach ($extrafields as $field) {
$extrafieldnames[] = get_user_field_name($field);
}
$strstarttime = $mode == 'details' ? get_string('starttime', 'jclic') : get_string('lastaccess', 'jclic');
$tableheaders = array_merge(array('', get_string('fullnameuser')), $extrafieldnames, array($strstarttime, get_string('attempts', 'jclic'), get_string('solveddone', 'jclic'), get_string('totaltime', 'jclic'), get_string('grade')));
require_once $CFG->libdir . '/tablelib.php';
$table = new flexible_table('mod-jclic-results');
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($CFG->wwwroot . '/mod/jclic/report.php?id=' . $cm->id . '¤tgroup=' . $currentgroup . '&mode=' . $mode);
$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('starttime');