本文整理汇总了PHP中flexible_table类的典型用法代码示例。如果您正苦于以下问题:PHP flexible_table类的具体用法?PHP flexible_table怎么用?PHP flexible_table使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了flexible_table类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
/**
* Setup the columns and headers and other properties of the table and then
* call flexible_table::setup() method.
*/
function setup($reporturl, $question, $hassubqs)
{
$this->question = $question;
// Define table columns
$columns = array();
$headers = array();
if ($hassubqs) {
$columns[] = 'subq';
$headers[] = '';
}
$columns[] = 'response';
$headers[] = get_string('response', 'quiz_statistics');
$columns[] = 'credit';
$headers[] = get_string('optiongrade', 'quiz_statistics');
$columns[] = 'rcount';
$headers[] = get_string('count', 'quiz_statistics');
$columns[] = 'frequency';
$headers[] = get_string('frequency', 'quiz_statistics');
$this->define_columns($columns);
$this->define_headers($headers);
$this->sortable(false);
$this->column_class('credit', 'numcol');
$this->column_class('rcount', 'numcol');
$this->column_class('frequency', 'numcol');
// Set up the table
$this->define_baseurl($reporturl->out());
$this->collapsible(false);
$this->set_attribute('class', 'generaltable generalbox boxaligncenter');
parent::setup();
}
示例2: setup
/**
* Setup the columns and headers and other properties of the table and then
* call flexible_table::setup() method.
*/
function setup($quiz, $cmid, $reporturl, $s)
{
$this->quiz = $quiz;
$this->cmid = $cmid;
// Define table columns
$columns = array();
$headers = array();
$columns[] = 'number';
$headers[] = get_string('questionnumber', 'quiz_statistics');
if (!$this->is_downloading()) {
$columns[] = 'icon';
$headers[] = '';
$columns[] = 'actions';
$headers[] = '';
} else {
$columns[] = 'qtype';
$headers[] = get_string('questiontype', 'quiz_statistics');
}
$columns[] = 'name';
$headers[] = get_string('questionname', 'quiz');
$columns[] = 's';
$headers[] = get_string('attempts', 'quiz_statistics');
if ($s > 1) {
$columns[] = 'facility';
$headers[] = get_string('facility', 'quiz_statistics');
$columns[] = 'sd';
$headers[] = get_string('standarddeviationq', 'quiz_statistics');
}
$columns[] = 'random_guess_score';
$headers[] = get_string('random_guess_score', 'quiz_statistics');
$columns[] = 'intended_weight';
$headers[] = get_string('intended_weight', 'quiz_statistics');
$columns[] = 'effective_weight';
$headers[] = get_string('effective_weight', 'quiz_statistics');
$columns[] = 'discrimination_index';
$headers[] = get_string('discrimination_index', 'quiz_statistics');
$columns[] = 'discriminative_efficiency';
$headers[] = get_string('discriminative_efficiency', 'quiz_statistics');
$this->define_columns($columns);
$this->define_headers($headers);
$this->sortable(false);
$this->column_class('s', 'numcol');
$this->column_class('random_guess_score', 'numcol');
$this->column_class('intended_weight', 'numcol');
$this->column_class('effective_weight', 'numcol');
$this->column_class('sd', 'numcol');
$this->column_class('facility', 'numcol');
$this->column_class('discrimination_index', 'numcol');
$this->column_class('discriminative_efficiency', 'numcol');
// Set up the table
$this->define_baseurl($reporturl->out());
$this->collapsible(true);
$this->set_attribute('id', 'questionstatistics');
$this->set_attribute('class', 'generaltable generalbox boxaligncenter');
parent::setup();
}
示例3: groups_get_course_groupmode
// Fetch current active group.
$groupmode = groups_get_course_groupmode($course);
$currentgroup = $SESSION->activegroup[$course->id][$groupmode][$course->defaultgroupingid];
if (!empty($instanceid) && !empty($roleid)) {
// Trigger a report viewed event.
$event = \report_participation\event\report_viewed::create(array('context' => $context, 'other' => array('instanceid' => $instanceid, 'groupid' => $currentgroup, 'roleid' => $roleid, 'timefrom' => $timefrom, 'action' => $action)));
$event->trigger();
// 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;
示例4: display_submissions
/**
* 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');
}
//.........这里部分代码省略.........
示例5: sesskey
} else {
$version = "{$block->version} ({$plugin->version})";
}
if (!$blockobject) {
// ignore
$undeletable = '';
} else {
if (in_array($blockname, $undeletableblocktypes)) {
$undeletable = '<a href="blocks.php?unprotect=' . $blockid . '&sesskey=' . sesskey() . '" title="' . $strunprotect . '">' . '<img src="' . $OUTPUT->pix_url('t/unlock') . '" class="icon" alt="' . $strunprotect . '" /></a>';
} else {
$undeletable = '<a href="blocks.php?protect=' . $blockid . '&sesskey=' . sesskey() . '" title="' . $strprotect . '">' . '<img src="' . $OUTPUT->pix_url('t/unlock_gray') . '" class="icon" alt="' . $strprotect . '" /></a>';
}
}
$row = array('<span' . $class . '>' . $strblockname . '</span>', $blocklist, '<span' . $class . '>' . $version . '</span>', $visible, $undeletable, $delete, $settings);
$table->add_data($row);
}
$table->print_html();
if (!empty($incompatible)) {
echo $OUTPUT->heading(get_string('incompatibleblocks', 'blockstable', 'admin'));
$table = new flexible_table('admin-blocks-incompatible');
$table->define_columns(array('block', 'delete'));
$table->define_headers(array($strname, $strdelete));
$table->define_baseurl($CFG->wwwroot . '/' . $CFG->admin . '/blocks.php');
$table->set_attribute('class', 'incompatibleblockstable generaltable');
$table->setup();
foreach ($incompatible as $block) {
$table->add_data(array($block->name, '<a href="blocks.php?delete=' . $block->id . '&sesskey=' . sesskey() . '">' . $strdelete . '</a>'));
}
$table->print_html();
}
echo $OUTPUT->footer();
示例6: get_string
$tablecolumns[] = 'roles';
$tableheaders[] = get_string('roles');
if ($groupmode != 0) {
$tablecolumns[] = 'groups';
$tableheaders[] = get_string('groups');
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();
示例7: get_string
if ($managesharedfeeds) {
$select = '(userid = ' . $USER->id . ' OR shared = 1)';
} else {
$select = 'userid = ' . $USER->id;
}
$feeds = $DB->get_records_select('block_rss_client', $select, null, $DB->sql_order_by_text('title'));
$strmanage = get_string('managefeeds', 'block_rss_client');
$PAGE->set_pagelayout('standard');
$PAGE->set_title($strmanage);
$PAGE->set_heading($strmanage);
$managefeeds = new moodle_url('/blocks/rss_client/managefeeds.php', $urlparams);
$PAGE->navbar->add(get_string('blocks'));
$PAGE->navbar->add(get_string('pluginname', 'block_rss_client'));
$PAGE->navbar->add(get_string('managefeeds', 'block_rss_client'), $managefeeds);
echo $OUTPUT->header();
$table = new flexible_table('rss-display-feeds');
$table->define_columns(array('feed', 'actions'));
$table->define_headers(array(get_string('feed', 'block_rss_client'), get_string('actions', 'moodle')));
$table->define_baseurl($baseurl);
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'rssfeeds');
$table->set_attribute('class', 'generaltable generalbox');
$table->column_class('feed', 'feed');
$table->column_class('actions', 'actions');
$table->setup();
foreach ($feeds as $feed) {
if (!empty($feed->preferredtitle)) {
$feedtitle = s($feed->preferredtitle);
} else {
$feedtitle = s($feed->title);
}
示例8: array
$DB->delete_records('block_links', array('id' => $delete));
}
$rs = $DB->get_records('block_links', null, 'linktext');
if (!is_array($rs)) {
$rs = array();
}
// Check to see if we have any records.
if (count($rs) == 0) {
$add = 1;
}
echo $OUTPUT->header();
echo html_writer::start_tag('div', array('class' => 'content'));
echo html_writer::tag('h2', $strmanagelinks, array('class' => 'main'));
// Generate the table.
echo html_writer::start_tag('form', array('method' => 'post', 'action' => $baseurl));
$table = new flexible_table('links-administration');
$table->define_columns(array('linktext', 'url', 'notes', 'defaultshow', 'category', 'actions'));
$table->define_headers(array(get_string('linktext', 'block_links'), get_string('url', 'block_links'), get_string('notes', 'block_links'), get_string('defaultshow', 'block_links'), get_string('category', 'block_links'), get_string('actions', 'moodle')));
$table->define_baseurl($baseurl);
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'links');
$table->set_attribute('class', 'generaltable generalbox');
$table->column_class('linktext', 'linktext');
$table->column_class('url', 'url');
$table->column_class('notes', 'notes');
$table->column_class('defaultshow', 'defaultshow');
$table->column_class('category', 'category');
$table->column_class('actions', 'actions');
$table->setup();
foreach ($rs as $index => $link) {
if ($link->defaultshow == '1') {
示例9: sesskey
// ignore
$undeletable = '';
} else {
if (in_array($blockname, $undeletableblocktypes)) {
$undeletable = '<a href="blocks.php?unprotect=' . $blockid . '&sesskey=' . sesskey() . '" title="' . $strunprotect . '">' . '<img src="' . $OUTPUT->pix_url('t/unlock') . '" class="iconsmall" alt="' . $strunprotect . '" /></a>';
} else {
$undeletable = '<a href="blocks.php?protect=' . $blockid . '&sesskey=' . sesskey() . '" title="' . $strprotect . '">' . '<img src="' . $OUTPUT->pix_url('t/lock') . '" class="iconsmall" alt="' . $strprotect . '" /></a>';
}
}
$row = array($strblockname, $blocklist, $version, $visible, $undeletable, $settings, $uninstall);
$table->add_data($row, $class);
}
$table->print_html();
if (!empty($incompatible)) {
echo $OUTPUT->heading(get_string('incompatibleblocks', 'blockstable', 'admin'));
$table = new flexible_table('admin-blocks-incompatible');
$table->define_columns(array('block', 'uninstall'));
$table->define_headers(array($strname, $struninstall));
$table->define_baseurl($CFG->wwwroot . '/' . $CFG->admin . '/blocks.php');
$table->set_attribute('class', 'incompatibleblockstable generaltable');
$table->setup();
foreach ($incompatible as $block) {
if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('block_' . $block->name, 'manage')) {
$uninstall = html_writer::link($uninstallurl, $struninstall);
} else {
$uninstall = '';
}
$table->add_data(array($block->name, $uninstall));
}
$table->print_html();
}
示例10: display_submissions
//.........这里部分代码省略.........
$wherefilter;
}
$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));
}
}
$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');
示例11: display
//.........这里部分代码省略.........
// Statistics Data table built
unset($attempts);
unset($quizquestions);
unset($states);
// 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) {
示例12: dialogue_list_conversations
/**
* List conversations of either open or closed type for the current user
*
* Called when a user clicks the "Current Dialogues" or "Closed Dialogues" tabs
* rendering those out directly as HTML inside a print_table() showing who the
* conversation is with, what the subject is, how many entries there are,
* how many are un-read and what the most recent post date is
*
* @param object $dialogue
* @param int $groupid of the group to filter conversations by (default: 0)
* @param string $type 'open' (default) or 'closed'
* @todo remove the embedded style for 'th', make it a class driven thing in the theme
*/
function dialogue_list_conversations($dialogue, $groupid = 0, $type = 'open')
{
global $USER, $CFG;
$condition = $type == 'closed' ? " closed='1' " : " closed='0' ";
$tabid = $type == 'closed' ? 3 : 1;
if (!($course = get_record('course', 'id', $dialogue->course))) {
error('Course is misconfigured');
}
if (!($cm = get_coursemodule_from_instance('dialogue', $dialogue->id, $course->id))) {
error('Course Module ID was incorrect');
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$dialoguemanagers = array_keys(get_users_by_capability($context, 'mod/dialogue:manage'));
echo '<style>th.header { text-align: left; }</style>';
require_once $CFG->libdir . '/tablelib.php';
$tablecolumns = array('picture', 'subject', 'fullname', 'total', 'unread', 'lastentry');
$tableheaders = array('', get_string('subject', 'dialogue'), get_string('fullname', ''), get_string('numberofentries', 'dialogue'), get_string('unread', 'dialogue'), get_string('lastentry', 'dialogue'));
$table = new flexible_table('mod-dialogue-submissions');
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($CFG->wwwroot . '/mod/dialogue/view.php?id=' . $cm->id . '&pane=' . $tabid);
$table->sortable(true, 'subject');
$table->collapsible(false);
//$table->column_suppress('picture'); // supress multiple subsequent row entries
//$table->column_suppress('fullname');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'dialogue');
$table->set_attribute('class', 'conversations');
$table->set_attribute('width', '100%');
$table->setup();
$order = '';
// so we can filter the get_conversations() call later
$namesort = '';
// if we want to sort by other calculated fields, e.g. first/last name
if ($sort = $table->get_sql_sort('mod-dialogue-submissions')) {
$sortparts = explode(',', $sort);
$sqlsort = $sortparts[0];
if (strpos($sqlsort, 'subject') !== false) {
$order = $sqlsort;
}
if (strpos($sqlsort, 'total') !== false) {
$order = $sqlsort;
}
if (strpos($sqlsort, 'lastentry') !== false) {
$order = $sqlsort;
$order = str_replace('lastentry', 'c.timemodified', $order);
}
if (strpos($sqlsort, 'firstname') !== false) {
$namesort = $sqlsort;
}
if (strpos($sqlsort, 'lastname') !== false) {
$namesort = $sqlsort;
}
if (strpos($sqlsort, 'unread') !== false) {
$namesort = $sqlsort;
}
}
// list the conversations requiring a resonse from this user in full
if ($conversations = dialogue_get_conversations($dialogue, $USER, $condition, $order, $groupid)) {
foreach ($conversations as $conversation) {
if (in_array($USER->id, $dialoguemanagers)) {
if (!in_array($conversation->userid, $dialoguemanagers)) {
if (!($with = get_record('user', 'id', $conversation->userid))) {
error("User's record not found");
}
} else {
if (!($with = get_record('user', 'id', $conversation->recipientid))) {
error("User's record not found");
}
}
} else {
if ($USER->id != $conversation->userid) {
if (!($with = get_record('user', 'id', $conversation->userid))) {
error("User's record not found");
}
} else {
if (!($with = get_record('user', 'id', $conversation->recipientid))) {
error("User's record not found");
}
}
}
// save sortable field values for each conversation so can sort by them later
$names[$conversation->id] = fullname($with);
$unread[$conversation->id] = $conversation->total - $conversation->readings;
$names_firstlast[$conversation->id] = $with->firstname . ' ' . $with->lastname;
$names_lastfirst[$conversation->id] = $with->lastname . ' ' . $with->firstname;
$photos[$conversation->id] = print_user_picture($with, $course->id, true, 0, true);
//.........这里部分代码省略.........
示例13: __construct
public function __construct($uniqueid, $params)
{
parent::__construct($uniqueid);
$this->offlinequiz = $params['offlinequiz'];
$this->noresults = $params['noresults'];
$this->psize = $params['pagesize'];
}
示例14: setup
/**
* Setup the table, i.e. table headers
*
*/
public function setup()
{
// Set var for is downloading
$isdownloading = $this->is_downloading();
$this->set_attribute('cellspacing', '0');
if ($this->rtq->group_mode()) {
$columns = array('session' => get_string('sessionname', 'activequiz'), 'group' => get_string('group'), 'timestart' => get_string('startedon', 'activequiz'), 'timefinish' => get_string('timecompleted', 'activequiz'), 'grade' => get_string('grade'));
} else {
$columns = array('session' => get_string('sessionname', 'activequiz'), 'timestart' => get_string('startedon', 'activequiz'), 'timefinish' => get_string('timecompleted', 'activequiz'), 'grade' => get_string('grade'));
}
if (!$isdownloading) {
$columns['attemptview'] = get_string('attemptview', 'activequiz');
}
$this->define_columns(array_keys($columns));
$this->define_headers(array_values($columns));
$this->sortable(false);
$this->collapsible(false);
$this->column_class('session', 'bold');
$this->set_attribute('cellspacing', '0');
$this->set_attribute('cellpadding', '2');
$this->set_attribute('id', 'attempts');
$this->set_attribute('class', 'generaltable generalbox');
$this->set_attribute('align', 'center');
parent::setup();
}
示例15: __construct
/**
* Construct the table for the specified tour ID.
*
* @param int $tourid The id of the tour.
*/
public function __construct($tourid)
{
parent::__construct('steps');
$this->tourid = $tourid;
$baseurl = new \moodle_url('/tool/usertours/configure.php', array('id' => $tourid));
$this->define_baseurl($baseurl);
// Column definition.
$this->define_columns(array('title', 'content', 'target', 'actions'));
$this->define_headers(array(get_string('title', 'tool_usertours'), get_string('content', 'tool_usertours'), get_string('target', 'tool_usertours'), get_string('actions', 'tool_usertours')));
$this->set_attribute('class', 'admintable generaltable steptable');
$this->setup();
}