本文整理汇总了PHP中flexible_table::column_suppress方法的典型用法代码示例。如果您正苦于以下问题:PHP flexible_table::column_suppress方法的具体用法?PHP flexible_table::column_suppress怎么用?PHP flexible_table::column_suppress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flexible_table
的用法示例。
在下文中一共展示了flexible_table::column_suppress方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: display
//.........这里部分代码省略.........
$questionlist = game_questions_in_game($game->questions);
$questionids = explode(',', $questionlist);
$sql = "SELECT q.*, i.score AS maxgrade, i.id AS instance" . " FROM {question} q," . " {game_queries} i" . " WHERE i.gameid = '{$game->id}' AND q.id = i.questionid" . " AND q.id IN ({$questionlist})";
if (!($questions = get_records_sql($sql))) {
print_error('No questions found');
}
$number = 1;
foreach ($questionids as $key => $id) {
if ($questions[$id]->length) {
// Only print questions of non-zero length.
$tablecolumns[] = '$' . $id;
$tableheaders[] = '#' . $number;
$questions[$id]->number = $number;
$number += $questions[$id]->length;
} else {
// Get rid of zero length questions.
unset($questions[$id]);
unset($questionids[$key]);
}
}
}
if ($hasfeedback) {
$tablecolumns[] = 'feedbacktext';
$tableheaders[] = get_string('feedback', 'game');
}
if (!$download) {
// Set up the table.
$table = new flexible_table('mod-game-report-overview-report');
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($CFG->wwwroot . '/mod/game/report.php?mode=overview&id=' . $cm->id . '&noattempts=' . $noattempts . '&detailedmarks=' . $detailedmarks . '&pagesize=' . $pagesize);
$table->sortable(true);
$table->collapsible(true);
$table->column_suppress('picture');
$table->column_suppress('fullname');
$table->column_class('picture', 'picture');
$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('reportoverview', 'game');
$myxls =& $workbook->add_worksheet($sheettitle);
// Format types.
$format =& $workbook->add_format();
$format->set_bold(0);
$formatbc =& $workbook->add_format();
$formatbc->set_bold(1);
$formatbc->set_align('center');
$formatb =& $workbook->add_format();
$formatb->set_bold(1);
$formaty =& $workbook->add_format();
$formaty->set_bg_color('yellow');
$formatc =& $workbook->add_format();
$formatc->set_align('center');
$formatr =& $workbook->add_format();
$formatr->set_bold(1);
示例3: display
//.........这里部分代码省略.........
// Get number of main columns used.
$objectives = get_scorm_objectives($scorm->id);
$nosort = array();
foreach ($objectives as $scoid => $sco) {
foreach ($sco as $id => $objectivename) {
$colid = $scoid . 'objectivestatus' . $id;
$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.
示例4: count
/**
* Prints a table with users and their attempts
*
* @return void
* @todo Add current grade to the table
* Finnish documenting
**/
function view_question($quiz, $question, $totalattempts, $ungraded)
{
global $CFG;
$usercount = count($this->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($this->viewurl->out());
$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();
list($select, $from, $where) = $this->attempts_sql($quiz->id, true, $question->id);
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
$table->pagesize(QUIZ_REPORT_DEFAULT_PAGE_SIZE, $totalattempts);
// get the attempts and process them
if ($attempts = get_records_sql($select . $from . $where . $sort, $table->get_page_start(), $table->get_page_size())) {
// grade all link
$links = "<strong><a href=\"report.php?mode=grading&gradeall=1&q={$quiz->id}&questionid={$question->id}\">" . get_string('gradeall', 'quiz_grading', $totalattempts) . '</a></strong>';
if ($ungraded > 0) {
$links .= "<br /><strong><a href=\"report.php?mode=grading&gradeungraded=1&q={$quiz->id}&questionid={$question->id}\">" . get_string('gradeungraded', 'quiz_grading', $ungraded) . '</a></strong>';
if ($ungraded > QUIZ_REPORT_DEFAULT_GRADING_PAGE_SIZE) {
$links .= "<br /><strong><a href=\"report.php?mode=grading&gradenextungraded=1&q={$quiz->id}&questionid={$question->id}\">" . get_string('gradenextungraded', 'quiz_grading', QUIZ_REPORT_DEFAULT_GRADING_PAGE_SIZE) . '</a></strong>';
}
}
$table->add_data_keyed(array('grade' => $links));
$table->add_separator();
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>';
$gradedclass = question_state_is_graded($attempt) ? ' class="highlightgraded" ' : '';
$gradedstring = question_state_is_graded($attempt) ? ' ' . get_string('graded', 'quiz_grading') : '';
// link for the attempt
$attemptlink = "<a {$gradedclass}href=\"report.php?mode=grading&q={$quiz->id}&questionid={$question->id}&attemptid={$attempt->attemptid}\">" . userdate($attempt->timefinish, get_string('strftimedatetime')) . $gradedstring . '</a>';
// grade all attempts for this user
$gradelink = "<a href=\"report.php?mode=grading&q={$quiz->id}&questionid={$question->id}&userid={$attempt->userid}\">" . get_string('grade') . '</a>';
$table->add_data(array($picture, $userlink, $attemptlink, $gradelink));
}
$table->add_separator();
$table->add_data_keyed(array('grade' => $links));
// print everything here
echo '<div id="tablecontainer">';
$table->print_html();
echo '</div>';
} else {
notify(get_string('noattemptstoshow', 'quiz'));
}
}
示例5: array
$wherefromstr = get_string('department', 'scheduler');
$whatstr = get_string('what', 'scheduler');
$whatresultedstr = get_string('whatresulted', 'scheduler');
$whathappenedstr = get_string('whathappened', 'scheduler');
$tablecolumns = array('courseshort', 'schedulerid', 'starttime', 'appointmentlocation', 'studentfullname', 'studentdepartment', 'notes', 'grade', 'appointmentnote');
$tableheaders = array($coursestr, $schedulerstr, $whenstr, $wherestr, $whostr, $wherefromstr, $whatstr, $whatresultedstr, $whathappenedstr);
$table = new flexible_table('mod-scheduler-datelist');
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($taburl);
$table->sortable(true, 'when');
// Sorted by date by default.
$table->collapsible(true);
// Allow column hiding.
$table->initialbars(true);
$table->column_suppress('courseshort');
$table->column_suppress('schedulerid');
$table->column_suppress('starttime');
$table->column_suppress('studentfullname');
$table->column_suppress('notes');
$table->set_attribute('id', 'dates');
$table->set_attribute('class', 'datelist');
$table->column_class('course', 'datelist_course');
$table->column_class('scheduler', 'datelist_scheduler');
$table->setup();
// Get extra query parameters from flexible_table behaviour.
$where = $table->get_sql_where();
$sort = $table->get_sql_sort();
$table->pagesize($limit, $numrecords);
if (!empty($sort)) {
$sql .= " ORDER BY {$sort}";
示例6: array
/**
* Display all the submissions ready for grading
*/
function display_submissions()
{
global $CFG, $db, $USER;
/* 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('webquestscorm_perpage', $perpage);
set_user_preference('webquestscorm_quickgrade', optional_param('quickgrade', 0, PARAM_BOOL));
}
/* next we get perpage and quickgrade (allow quick grade) params
* from database
*/
$perpage = get_user_preferences('webquestscorm_perpage', 10);
$quickgrade = get_user_preferences('webquestscorm_quickgrade', 0);
$teacherattempts = true;
/// Temporary measure
$page = optional_param('page', 0, PARAM_INT);
$strsaveallfeedback = get_string('saveallfeedback', 'webquestscorm');
/// Some shortcuts to make the code read better
$tabindex = 1;
//tabindex for quick grading tabbing; Not working for dropdowns yet
add_to_log($this->course->id, 'webquestscorm', 'view submission', 'editsubmissions.php?cmid=' . $this->cm->id . '&element=uploadedTasks&subelement=all', $this->wqid, $this->cm->id);
$strwebquestscorms = get_string('modulenameplural', 'webquestscorm');
$strwebquestscorm = get_string('modulename', 'webquestscorm');
///Position swapped
if ($groupmode = groupmode($this->course, $this->cm)) {
// Groups are being used
$currentgroup = setup_and_print_groups($this->course, $groupmode, 'editsubmissions.php?cmid=' . $this->cm->id . '&element=uploadedTasks&subelement=all');
} else {
$currentgroup = false;
}
/// Get all teachers and students
if ($currentgroup) {
$users = get_group_users($currentgroup);
} else {
//$users = get_users_by_capability($this->context, 'mod/webquestscorm:submit'); // everyone with this capability set to non-prohibit
$users = get_course_students($this->course->id);
}
$tablecolumns = array('picture', 'fullname', 'grade', 'submissioncomment', 'timemodified', 'timemarked', 'status');
$tableheaders = array('', get_string('fullname'), get_string('grade'), get_string('comment', 'webquestscorm'), get_string('lastmodified') . ' (' . $this->course->student . ')', get_string('lastmodified') . ' (' . $this->course->teacher . ')', get_string('status'));
require_once $CFG->libdir . '/tablelib.php';
$table = new flexible_table('mod-webquestscorm-submissions');
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($CFG->wwwroot . '/mod/webquestscorm/editsubmissions.php?cmid=' . $this->cm->id . '&element=uploadedTasks&subelement=all&currentgroup=' . $currentgroup);
$table->define_baseurl($CFG->wwwroot . '/mod/webquestscorm/editsubmissions.php?cmid=' . $this->cm->id . '&currentgroup=' . $currentgroup . '&element=uploadedTasks&subelement=all');
$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->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'attempts');
$table->set_attribute('class', 'submissions');
$table->set_attribute('width', '90%');
$table->set_attribute('align', 'center');
// Start working -- this is necessary as soon as the niceties are over
$table->setup();
/// Check to see if groups are being used in this webquestscorm
if (!$teacherattempts) {
$teachers = get_course_teachers($this->course->id);
if (!empty($teachers)) {
$keys = array_keys($teachers);
}
foreach ($keys as $key) {
unset($users[$key]);
}
}
if (empty($users)) {
print_heading(get_string('noattempts', 'webquestscorm'));
print_footer($this->course);
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,
s.id AS submissionid, s.grade, s.submissioncomment,
s.timemodified, s.timemarked ';
$sql = 'FROM ' . $CFG->prefix . 'user u ' . 'LEFT JOIN ' . $CFG->prefix . 'webquestscorm_submissions s ON u.id = s.userid
AND s.webquestscorm = ' . $this->wqid . ' ' . 'WHERE ' . $where . 'u.id IN (' . implode(',', array_keys($users)) . ') ';
$table->pagesize($perpage, count($users));
//.........这里部分代码省略.........
示例7: array
//.........这里部分代码省略.........
if ($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').' ('.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'));
echo '</div>';
return true;
}
if ($this->assignment->assignmenttype=='upload' || $this->assignment->assignmenttype=='online' || $this->assignment->assignmenttype=='uploadsingle') { //TODO: this is an ugly hack, where is the plugin spirit? (skodak)
示例8: navmenu
/**
* Display all the submissions ready for grading
*
* @global object
* @global object
* @global object
* @global object
* @param string $message
* @return bool|void
*/
function display_submissions($message = '')
{
global $CFG, $DB, $USER, $DB, $OUTPUT;
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;
}
$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->cm->id, $this->assignment->id, $this->cm->id);
$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));
$course_context = get_context_instance(CONTEXT_COURSE, $course->id);
if (has_capability('gradereport/grader:view', $course_context) && has_capability('moodle/grade:viewall', $course_context)) {
echo '<div class="allcoursegrades"><a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '">' . get_string('seeallcoursegrades', 'grades') . '</a></div>';
}
if (!empty($message)) {
echo $message;
// display messages here if any
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
/// 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, 'submissions.php?id=' . $this->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)) {
$users = array_keys($users);
}
// 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));
}
}
$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') . ' (' . 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');
}
//.........这里部分代码省略.........
示例9: notify
// Check server exists and works
if (!($serverinfo = remote_server_info($server->url))) {
notify(get_string('renderingserverconnectfailed', 'quiz', $server->url));
} else {
// print the info
print_heading(get_string('serverinfo', 'quiz'));
question_rqp_print_serverinfo($serverinfo);
}
}
/// Set up the table
$table = new flexible_table('mod-quiz-questiontypes-rqp-types');
$table->define_columns(array('name', 'url', 'action'));
$table->define_headers(array(get_string('name'), get_string('serverurl', 'quiz'), get_string('action')));
$table->define_baseurl($CFG->wwwroot . '/question/type/rqp/types.php');
//$table->sortable(true);
$table->column_suppress('name');
$table->set_attribute('cellspacing', '15');
$table->set_attribute('id', 'types');
$table->set_attribute('class', 'generaltable generalbox');
// Start working -- this is necessary as soon as the niceties are over
$table->setup();
/// Create table rows
// Get list of types
$types = get_records('question_rqp_types', '', '', 'name ASC');
$strinfo = get_string('info');
$strdelete = get_string('delete');
$stradd = get_string('add');
if ($types) {
foreach ($types as $type) {
if (!($servers = get_records('question_rqp_servers', 'typeid', $type->id, 'id ASC'))) {
delete_records('question_rqp_types', 'id', $type->id);
示例10: 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;
//.........这里部分代码省略.........
示例11: 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;
}
示例12: array
}
$rolenames[$role->id] = strip_tags(format_string($role->name));
// Used in menus etc later on
}
}
$tablecolumns = array('picture', 'fullname', 'settarget');
$tableheaders = array('', get_string('fullname'), '');
require_once $CFG->libdir . '/tablelib.php';
$table = new flexible_table('mod-targets');
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($baseurl);
$table->sortable(true, 'lastname');
$table->collapsible(false);
$table->initialbars(true);
$table->column_suppress('picture');
$table->column_class('picture', 'picture');
$table->column_class('fullname', 'fullname');
$table->column_class('targets', 'targets');
$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');
// Start working -- this is necessary as soon as the niceties are over
$table->setup();
// 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 {
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
示例13: array
$wherefromstr = get_string('department', 'scheduler');
$whatstr = get_string('what', 'scheduler');
$whatresultedstr = get_string('whatresulted', 'scheduler');
$whathappenedstr = get_string('whathappened', 'scheduler');
$tablecolumns = array('courseshort', 'schedulerid', 'starttime', 'appointmentlocation', 'CONCAT(studentlastname,studentfirstname)', 'department', 'notes', 'grade', 'appointmentnote');
$tableheaders = array("<b>{$coursestr}</b>", "<b>{$schedulerstr}</b>", "<b>{$whenstr}</b>", "<b>{$wherestr}</b>", "<b>{$whostr}</b>", "<b>{$wherefromstr}</b>", "<b>{$whatstr}</b>", "<b>{$whatresultedstr}</b>", "<b>{$whathappenedstr}</b>");
$table = new flexible_table('mod-scheduler-datelist');
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($CFG->wwwroot . '/mod/scheduler/view.php?what=datelist&id=' . $cm->id);
$table->sortable(true, 'when');
//sorted by date by default
$table->collapsible(true);
$table->initialbars(true);
// allow column hiding
$table->column_suppress('course');
$table->column_suppress('starttime');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'dates');
$table->set_attribute('class', 'datelist');
$table->set_attribute('width', '100%');
$table->column_class('course', 'datelist_course');
$table->column_class('scheduler', 'datelist_scheduler');
$table->column_class('starttime', 'timelabel');
$table->setup();
/// get extra query parameters from flexible_table behaviour
$where = $table->get_sql_where();
$sort = $table->get_sql_sort();
$table->pagesize($limit, count($numrecords));
if (!empty($sort)) {
$sql .= " ORDER BY {$sort}";
示例14: display
//.........这里部分代码省略.........
$countsql = 'SELECT COUNT(DISTINCT('.$DB->sql_concat('u.id', '\'#\'', 'COALESCE(st.attempt, 0)').')) AS nbresults, ';
$countsql .= 'COUNT(DISTINCT('.$DB->sql_concat('u.id', '\'#\'', 'st.attempt').')) AS nbattempts, ';
$countsql .= 'COUNT(DISTINCT(u.id)) AS nbusers ';
$countsql .= $from.$where;
$attempts = $DB->get_records_sql($select.$from.$where, $params);
$questioncount = get_scorm_question_count($scorm->id);
for($id = 0; $id < $questioncount; $id++) {
if ($displayoptions['qtext']) {
$columns[] = 'question' . $id;
$headers[] = get_string('questionx', 'scormreport_interactions', $id);
}
if ($displayoptions['resp']) {
$columns[] = 'response' . $id;
$headers[] = get_string('responsex', 'scormreport_interactions', $id);
}
if ($displayoptions['right']) {
$columns[] = 'right' . $id;
$headers[] = get_string('rightanswerx', 'scormreport_interactions', $id);
}
}
if (!$download) {
$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);
}
$table->no_sorting('start');
$table->no_sorting('finish');
$table->no_sorting('score');
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
示例15: 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);
//.........这里部分代码省略.........