本文整理汇总了PHP中update_module_button函数的典型用法代码示例。如果您正苦于以下问题:PHP update_module_button函数的具体用法?PHP update_module_button怎么用?PHP update_module_button使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了update_module_button函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_header
function print_header($title, $morenavlinks = NULL, $bodytags = '', $meta = '', $extrabuttons = '')
{
global $USER, $CFG;
$this->init_full();
$replacements = array('%fullname%' => format_string($this->activityrecord->name));
foreach ($replacements as $search => $replace) {
$title = str_replace($search, $replace, $title);
}
if (empty($morenavlinks) && $this->user_allowed_editing()) {
// mmmm, tables
$buttons = '<table><tr>';
$buttons .= '<td>' . $extrabuttons . '</td>';
$buttons .= '<td>' . update_module_button(optional_param('clone', $this->modulerecord->id, PARAM_INT), $this->courserecord->id, get_string('modulename', $this->activityname)) . '</td>';
if (!empty($CFG->showblocksonmodpages)) {
$clonething = optional_param('clone', 0, PARAM_INT);
$clonething = $clonething ? '<input type="hidden" name="clone" value="' . $clonething . '" />' : '';
$buttons .= '<td><form ' . $CFG->frametarget . ' method="get" action="view.php"><div>' . '<input type="hidden" name="id" value="' . $this->modulerecord->id . '" />' . $clonething . '<input type="hidden" name="edit" value="' . ($this->user_is_editing() ? 'off' : 'on') . '" />' . '<input type="submit" value="' . get_string($this->user_is_editing() ? 'blockseditoff' : 'blocksediton') . '" /></div></form></td>';
}
$buttons .= '</tr></table>';
} else {
$buttons = $extrabuttons ? $extrabuttons : ' ';
}
if (empty($morenavlinks)) {
$morenavlinks = array();
}
$navigation = build_navigation($morenavlinks, $this->modulerecord);
print_header($title, $this->courserecord->fullname, $navigation, '', $meta, true, $buttons, navmenu($this->courserecord, $this->modulerecord), false, $bodytags);
}
示例2: print_header
public function print_header($title, $morebreadcrumbs = null, $navigation = '')
{
global $USER, $CFG;
$this->init_full();
$replacements = array('%fullname%' => format_string($this->activityrecord->name));
foreach ($replacements as $search => $replace) {
$title = str_replace($search, $replace, $title);
}
if ($this->courserecord->id == SITEID) {
$breadcrumbs = array();
} else {
$breadcrumbs = array($this->courserecord->shortname => $CFG->wwwroot . '/course/view.php?id=' . $this->courserecord->id);
}
$breadcrumbs[get_string('modulenameplural', 'game')] = $CFG->wwwroot . '/mod/game/index.php?id=' . $this->courserecord->id;
$breadcrumbs[format_string($this->activityrecord->name)] = $CFG->wwwroot . '/mod/game/view.php?id=' . $this->modulerecord->id;
if (!empty($morebreadcrumbs)) {
$breadcrumbs = array_merge($breadcrumbs, $morebreadcrumbs);
}
if (empty($morebreadcrumbs) && $this->user_allowed_editing()) {
$buttons = '<table><tr><td>' . update_module_button($this->modulerecord->id, $this->courserecord->id, get_string('modulename', 'game')) . '</td>';
if (!empty($CFG->showblocksonmodpages)) {
$buttons .= '<td><form ' . $CFG->frametarget . ' method="get" action="view.php">' . '<div>' . '<input type="hidden" name="id" value="' . $this->modulerecord->id . '" />' . '<input type="hidden" name="edit" value="' . ($this->user_is_editing() ? 'off' : 'on') . '" />' . '<input type="submit" value="' . get_string($this->user_is_editing() ? 'blockseditoff' : 'blocksediton') . '" />' . '</div></form></td>';
}
$buttons .= '</tr></table>';
} else {
$buttons = ' ';
}
print_header($title, $this->courserecord->fullname, $navigation);
}
示例3: url_print_header
/**
* Print url header.
* @param object $url
* @param object $cm
* @param object $course
* @return void
*/
function url_print_header($url, $cm, $course)
{
global $PAGE, $OUTPUT;
$PAGE->set_title($course->shortname . ': ' . $url->name);
$PAGE->set_heading($course->fullname);
$PAGE->set_activity_record($url);
$PAGE->set_button(update_module_button($cm->id, '', get_string('modulename', 'url')));
echo $OUTPUT->header(build_navigation('', $cm), navmenu($course, $cm));
}
示例4: display_course_blocks_start
/**
* Display the resource with the course blocks.
*/
function display_course_blocks_start()
{
global $CFG;
global $USER;
global $THEME;
require_once $CFG->libdir . '/blocklib.php';
require_once $CFG->libdir . '/pagelib.php';
require_once $CFG->dirroot . '/course/lib.php';
//required by some blocks
$PAGE = page_create_object(PAGE_COURSE_VIEW, $this->course->id);
$this->PAGE = $PAGE;
$pageblocks = blocks_setup($PAGE);
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
/// Print the page header
$edit = optional_param('edit', -1, PARAM_BOOL);
if ($edit != -1 and $PAGE->user_allowed_editing()) {
$USER->editing = $edit;
}
$morenavlinks = array($this->strresources => 'index.php?id=' . $this->course->id, $this->resource->name => '');
$PAGE->print_header($this->course->shortname . ': %fullname%', $morenavlinks, "", "", update_module_button($this->cm->id, $this->course->id, $this->strresource));
echo '<table id="layout-table"><tr>';
$lt = empty($THEME->layouttable) ? array('left', 'middle', 'right') : $THEME->layouttable;
foreach ($lt as $column) {
$lt1[] = $column;
if ($column == 'middle') {
break;
}
}
foreach ($lt1 as $column) {
switch ($column) {
case 'left':
if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing()) {
echo '<td style="width: ' . $blocks_preferred_width . 'px;" id="left-column">';
print_container_start();
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
print_container_end();
echo '</td>';
}
break;
case 'middle':
echo '<td id="middle-column">';
print_container_start(false, 'middle-column-wrap');
echo '<div id="resource">';
break;
case 'right':
if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing()) {
echo '<td style="width: ' . $blocks_preferred_width . 'px;" id="right-column">';
print_container_start();
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
print_container_end();
echo '</td>';
}
break;
}
}
}
示例5: display
function display()
{
global $CFG;
$formatoptions = new object();
$formatoptions->noclean = true;
/// Are we displaying the course blocks?
if ($this->resource->options == 'showblocks') {
parent::display_course_blocks_start();
$entry = get_record('kaltura_entries', 'context', "R_" . "{$this->resource}->id");
if (trim(strip_tags($this->resource->alltext))) {
echo $entry->title;
$context = get_context_instance(CONTEXT_COURSE, $this->course->id);
$formatoptions = new object();
$formatoptions->noclean = true;
print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id), "center");
if (has_capability('moodle/course:manageactivities', $context)) {
echo embed_kaltura($resource->alltext, get_width($entry), get_height($entry), $entry->entry_type, $entry->design, true);
} else {
echo embed_kaltura($resource->alltext, get_width($entry), get_height($entry), KalturaEntryType::MEDIA_CLIP, $entry->design, true);
}
}
parent::display_course_blocks_end();
} else {
/// Set up generic stuff first, including checking for access
parent::display();
/// Set up some shorthand variables
$cm = $this->cm;
$course = $this->course;
$resource = $this->resource;
$entry = get_record('kaltura_entries', 'context', "R_" . "{$resource->id}");
$pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name));
$inpopup = optional_param('inpopup', '', PARAM_BOOL);
add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
$navigation = build_navigation($this->navlinks, $cm);
print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
if (trim(strip_tags($this->resource->alltext))) {
echo $entry->title;
$context = get_context_instance(CONTEXT_COURSE, $this->course->id);
$formatoptions = new object();
$formatoptions->noclean = true;
print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id), "center");
if (has_capability('moodle/course:manageactivities', $context)) {
echo embed_kaltura($resource->alltext, get_width($entry), get_height($entry), $entry->entry_type, $entry->design, true);
} else {
echo embed_kaltura($resource->alltext, get_width($entry), get_height($entry), KalturaEntryType::MEDIA_CLIP, $entry->design, true);
}
}
/* print_simple_box(format_text($resource->alltext, $resource->reference, $formatoptions, $course->id),
"center", "", "", "20");
*/
$strlastmodified = get_string("lastmodified");
echo "<div class=\"modified\">{$strlastmodified}: " . userdate($resource->timemodified) . "</div>";
print_footer($course);
}
}
示例6: print_header_and_tabs
function print_header_and_tabs($cm, $course, $quiz, $reportmode = "overview", $meta = "")
{
global $CFG;
/// Define some strings
$strquizzes = get_string("modulenameplural", "quiz");
$strquiz = get_string("modulename", "quiz");
/// Print the page header
print_header_simple(format_string($quiz->name), "", "<a href=\"index.php?id={$course->id}\">{$strquizzes}</a>\n -> " . format_string($quiz->name), '', $meta, true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm));
/// Print the tabs
$currenttab = 'reports';
$mode = $reportmode;
require $CFG->dirroot . '/mod/quiz/tabs.php';
}
示例7: print_header_and_tabs
function print_header_and_tabs($cm, $course, $quiz, $reportmode = "overview", $meta = "")
{
global $CFG;
/// Define some strings
$strquizzes = get_string("modulenameplural", "quiz");
$strquiz = get_string("modulename", "quiz");
/// Print the page header
$navlinks = array();
$navlinks[] = array('name' => $strquizzes, 'link' => "index.php?id={$course->id}", 'type' => 'activity');
$navlinks[] = array('name' => format_string($quiz->name), 'link' => '', 'type' => 'activityinstance');
$navigation = build_navigation($navlinks);
print_header_simple(format_string($quiz->name), "", $navigation, '', $meta, true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm));
/// Print the tabs
$currenttab = 'reports';
$mode = $reportmode;
require $CFG->dirroot . '/mod/quiz/tabs.php';
}
示例8: webquestscorm_print_header
function webquestscorm_print_header($name, $currenttab = '', $course = NULL, $cm = NULL, $cmid = 0)
{
global $CFG;
if ($cmid) {
if (!isset($cm)) {
if (!($cm = get_coursemodule_from_id('webquestscorm', $cmid))) {
error('Course Module ID was incorrect');
}
}
if (!isset($course)) {
if (!($course = get_record('course', 'id', $this->cm->course))) {
error('Course is misconfigured');
}
}
if (!isset($name)) {
if (!($webquestscorm = get_record('webquestscorm', 'id', $this->cm->instance))) {
error('webquestscorm ID was incorrect');
}
$name = $webquestscorm->name;
}
} else {
if (!isset($cm)) {
error('Course Module ID was incorrect');
}
if (!isset($course)) {
error('Course is misconfigured');
}
if (!isset($name)) {
error('webquestscorm name was incorrect');
}
}
$strwebquestscorms = get_string('modulenameplural', 'webquestscorm');
$strwebquestscorm = get_string('modulename', 'webquestscorm');
$strname = format_string($name);
$button = update_module_button($cm->id, $course->id, $strwebquestscorm);
$meta = '';
if ($CFG->version < 2007101500) {
print_header_simple(format_string($strname), "", "<a href=\"index.php?id={$course->id}\">{$strwebquestscorms}</a> -> " . format_string($name), "", "", true, update_module_button($cm->id, $course->id, $strwebquestscorm), navmenu($course, $cm));
} else {
$navigation = build_navigation('', $cm);
print_header($course->shortname . ':' . $strname, $course->fullname, $navigation, '', $meta, true, $button, navmenu($course, $cm));
}
print_heading(format_string($name, true));
require_once "tabs.php";
}
示例9: print_header_and_tabs
function print_header_and_tabs($cm, $course, $game, $reportmode = "overview", $meta = "")
{
global $CFG;
/// Define some strings
$strgames = get_string("modulenameplural", "game");
$strgame = get_string("modulename", "game");
/// Print the page header
if (function_exists('build_navigation')) {
$navigation = build_navigation('', $cm);
print_header($course->shortname, $course->shortname, $navigation);
} else {
print_header_simple(format_string($game->name), "", "<a href=\"index.php?id={$course->id}\">{$strgames}</a>\n -> " . format_string($game->name), '', $meta, true, update_module_button($cm->id, $course->id, $strgame), navmenu($course, $cm));
}
/// Print the tabs
$currenttab = 'reports';
$mode = $reportmode;
include 'tabs.php';
}
示例10: print_header_and_tabs
function print_header_and_tabs($cm, $course, $quiz, $reportmode = "overview")
{
global $CFG;
/// Define some strings
$strquizzes = get_string("modulenameplural", "quiz");
$strquiz = get_string("modulename", "quiz");
/// Print the page header
$navigation = build_navigation('', $cm);
print_header_simple(format_string($quiz->name), "", $navigation, '', '', true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm));
/// Print the tabs
$currenttab = 'reports';
$mode = $reportmode;
require $CFG->dirroot . '/mod/quiz/tabs.php';
$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>';
}
}
示例11: print_header
function print_header($title, $morebreadcrumbs = NULL)
{
global $USER, $CFG;
$this->init_full();
$replacements = array('%fullname%' => format_string($this->activityrecord->name));
foreach ($replacements as $search => $replace) {
$title = str_replace($search, $replace, $title);
}
if ($this->courserecord->id == SITEID) {
$breadcrumbs = array();
} else {
$breadcrumbs = array($this->courserecord->shortname => $CFG->wwwroot . '/course/view.php?id=' . $this->courserecord->id);
}
$breadcrumbs[get_string('modulenameplural', "bigbluebutton")] = $CFG->wwwroot . '/mod/bigbluebutton/index.php?id=' . $this->courserecord->id;
$breadcrumbs[format_string($this->activityrecord->name)] = $CFG->wwwroot . '/mod/bigbluebutton/view.php?id=' . $this->modulerecord->id;
if (!empty($morebreadcrumbs)) {
$breadcrumbs = array_merge($breadcrumbs, $morebreadcrumbs);
}
$total = count($breadcrumbs);
$current = 1;
$crumbtext = '';
foreach ($breadcrumbs as $text => $href) {
if ($current++ == $total) {
$crumbtext .= ' ' . $text;
} else {
$crumbtext .= ' <a href="' . $href . '">' . $text . '</a> ->';
}
}
if (empty($morebreadcrumbs) && $this->user_allowed_editing()) {
$buttons = '<table><tr><td>' . update_module_button($this->modulerecord->id, $this->courserecord->id, get_string('modulename', 'bigbluebutton')) . '</td>';
if (!empty($CFG->showblocksonmodpages)) {
$buttons .= '<td><form target="' . $CFG->framename . '" method="get" action="view.php">' . '<input type="hidden" name="id" value="' . $this->modulerecord->id . '" />' . '<input type="hidden" name="edit" value="' . ($this->user_is_editing() ? 'off' : 'on') . '" />' . '<input type="submit" value="' . get_string($this->user_is_editing() ? 'blockseditoff' : 'blocksediton') . '" /></form></td>';
}
$buttons .= '</tr></table>';
} else {
$buttons = ' ';
}
print_header($title, $this->courserecord->fullname, $crumbtext, '', '', true, $buttons, navmenu($this->courserecord, $this->modulerecord));
}
示例12: groups_get_activity_groupmode
/// Check to see if groups are being used here
$groupmode = groups_get_activity_groupmode($cm);
$currentgroup = groups_get_activity_group($cm, true);
if (empty($currentgroup)) {
$currentgroup = 0;
}
if (empty($elluminate->meetingid) && $elluminate->groupmode != 0) {
elluminate_group_instance_check($elluminate, $cm->id);
}
$baseurl = $CFG->wwwroot . '/mod/elluminate/preload.php?id=' . $elluminate->id;
/// Print the page header
$strelluminates = get_string('modulenameplural', 'elluminate');
$strelluminate = get_string('modulename', 'elluminate');
$straddpreload = get_string('addpreload', 'elluminate');
$strdelpreload = get_string('deletewhiteboardpreload', 'elluminate');
$buttontext = update_module_button($cm->id, $course->id, $strelluminate);
$navigation = build_navigation(empty($delete) ? $straddpreload : $strdelpreload, $cm);
print_header_simple(format_string($elluminate->name), '', $navigation, '', '', true, $buttontext, navmenu($course, $cm));
/// Delete a preload file for this meeting.
if (!empty($delete)) {
if (!empty($elluminate->meetingid)) {
if ($preload = elluminate_list_meeting_preloads($elluminate->meetingid)) {
if ($preload->presentationid == $delete) {
/// Delete the preload from the meeting.
if (!elluminate_delete_preload($preload->presentationid, $elluminate->meetingid)) {
error(get_string('preloaddeleteerror', 'elluminate'));
}
redirect($CFG->wwwroot . '/mod/elluminate/view.php?id=' . $cm->id, get_string('preloaddeletesuccess', 'elluminate'), 5);
}
}
}
示例13: require_course_login
if ($course2 = get_record('course', 'id', $courseid)) {
require_course_login($course2);
//this overwrites the object $course :-(
$course = get_record("course", "id", $cm->course);
// the workaround
} else {
error("courseid is not correct");
}
}
if (!$capabilities->complete) {
error(get_string('error'));
}
/// Print the page header
$strfeedbacks = get_string("modulenameplural", "feedback");
$strfeedback = get_string("modulename", "feedback");
$buttontext = update_module_button($cm->id, $course->id, $strfeedback);
$navlinks = array();
$navlinks[] = array('name' => $strfeedbacks, 'link' => "index.php?id={$course->id}", 'type' => 'activity');
$navlinks[] = array('name' => format_string($feedback->name), 'link' => "", 'type' => 'activityinstance');
$navigation = build_navigation($navlinks);
print_header_simple(format_string($feedback->name), "", $navigation, "", "", true, $buttontext, navmenu($course, $cm));
//ishidden check.
//feedback in courses
if (empty($cm->visible) and !$capabilities->viewhiddenactivities and $course->id != SITEID) {
notice(get_string("activityiscurrentlyhidden"));
}
//ishidden check.
//feedback on mainsite
if (empty($cm->visible) and !$capabilities->viewhiddenactivities and $courseid == SITEID) {
notice(get_string("activityiscurrentlyhidden"));
}
示例14: array
$orgstr = '¤torg=' . $currentorg;
$SESSION->scorm_scoid = $sco->id;
$SESSION->scorm_status = 'Not Initialized';
$SESSION->scorm_mode = $mode;
$SESSION->scorm_attempt = $attempt;
//
// Print the page header
//
$bodyscript = '';
if ($scorm->popup == 1) {
$bodyscript = 'onunload="main.close();"';
}
$navlinks[] = array('name' => format_string($scorm->name, true), 'link' => "view.php?id={$cm->id}", 'type' => 'activityinstance');
$navigation = build_navigation($navlinks);
$exitlink = '<a href="' . $CFG->wwwroot . '/course/view.php?id=' . $scorm->course . '" title="' . $strexit . '">' . $strexit . '</a> ';
print_header($pagetitle, $course->fullname, $navigation, '', '', true, $exitlink . update_module_button($cm->id, $course->id, $strscorm), '', false, $bodyscript);
echo $PAGE->requires->data_for_js('scormplayerdata', array('cwidth' => $scorm->width, 'cheight' => $scorm->height))->asap();
echo $PAGE->requires->js('mod/scorm/request.js')->asap();
echo $PAGE->requires->js('mod/scorm/loaddatamodel.php?id=' . $cm->id . $scoidstr . $modestr . $attemptstr)->asap();
echo $PAGE->requires->js('mod/scorm/rd.js')->asap();
$PAGE->requires->js_function_call('attach_resize_event');
if ($sco->previd != 0 && (!isset($sco->previous) || $sco->previous == 0)) {
$scostr = '&scoid=' . $sco->previd;
$PAGE->requires->js_function_call('scorm_set_prev', array($CFG->wwwroot . '/mod/scorm/player.php?id=' . $cm->id . $orgstr . $modepop . $scostr));
} else {
$PAGE->requires->js_function_call('scorm_set_prev', array($CFG->wwwroot . '/mod/scorm/view.php?id=' . $cm->id));
}
if ($sco->nextid != 0 && (!isset($sco->next) || $sco->next == 0)) {
$scostr = '&scoid=' . $sco->nextid;
$PAGE->requires->js_function_call('scorm_set_next', array($CFG->wwwroot . '/mod/scorm/player.php?id=' . $cm->id . $orgstr . $modepop . $scostr));
} else {
示例15: display_submissions
/**
* 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();
//.........这里部分代码省略.........