本文整理汇总了PHP中assign::submissions_open方法的典型用法代码示例。如果您正苦于以下问题:PHP assign::submissions_open方法的具体用法?PHP assign::submissions_open怎么用?PHP assign::submissions_open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assign
的用法示例。
在下文中一共展示了assign::submissions_open方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(\mod_mediagallery\collection $collection, array $galleries)
{
global $CFG, $DB;
$this->collection = $collection;
$this->galleries = $galleries;
if ($collection->user_can_add_children()) {
$this->maxreached = false;
}
if ($this->isassessable = $collection->is_assessable()) {
$this->hassubmitted = $collection->has_submitted();
if ($this->linkedassigncmid = $collection->get_linked_assignid()) {
require_once $CFG->dirroot . '/mod/assign/locallib.php';
$context = \context_module::instance($this->linkedassigncmid);
$cm = get_coursemodule_from_id('assign', $this->linkedassigncmid, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$assign = new \assign($context, $cm, $course);
$this->submissionsopen = $assign->submissions_open();
}
}
$this->readonly = $collection->is_read_only();
$this->tags = $collection->get_tags();
$mygalleries = $collection->get_my_galleries();
$this->userorgrouphasgallery = !empty($mygalleries);
foreach (array('id', 'mode', 'thumbnailsperrow', 'thumbnailsperpage') as $opt) {
if (isset($collection->{$opt})) {
$this->{$opt} = $collection->{$opt};
}
}
}
示例2: col_userid
/**
* Format a column of data for display.
*
* @param stdClass $row
* @return string
*/
public function col_userid(stdClass $row)
{
global $USER;
$edit = '';
$actions = array();
$urlparams = array('id' => $this->assignment->get_course_module()->id, 'rownum' => $this->rownum, 'action' => 'grade');
$url = new moodle_url('/mod/assign/view.php', $urlparams);
$noimage = null;
if (!$row->grade) {
$description = get_string('grade');
} else {
$description = get_string('updategrade', 'assign');
}
$actions['grade'] = new action_menu_link_secondary($url, $noimage, $description);
// Everything we need is in the row.
$submission = $row;
$flags = $row;
if ($this->assignment->get_instance()->teamsubmission) {
// Use the cache for this.
$submission = false;
$group = false;
$this->get_group_and_submission($row->id, $group, $submission, -1);
}
$submissionsopen = $this->assignment->submissions_open($row->id, true, $submission, $flags, $this->gradinginfo);
$caneditsubmission = $this->assignment->can_edit_submission($row->id, $USER->id);
// Hide for offline assignments.
if ($this->assignment->is_any_submission_plugin_enabled()) {
if (!$row->status || $row->status == ASSIGN_SUBMISSION_STATUS_DRAFT || !$this->assignment->get_instance()->submissiondrafts) {
if (!$row->locked) {
$urlparams = array('id' => $this->assignment->get_course_module()->id, 'userid' => $row->id, 'action' => 'lock', 'sesskey' => sesskey(), 'page' => $this->currpage);
$url = new moodle_url('/mod/assign/view.php', $urlparams);
$description = get_string('preventsubmissionsshort', 'assign');
$actions['lock'] = new action_menu_link_secondary($url, $noimage, $description);
} else {
$urlparams = array('id' => $this->assignment->get_course_module()->id, 'userid' => $row->id, 'action' => 'unlock', 'sesskey' => sesskey(), 'page' => $this->currpage);
$url = new moodle_url('/mod/assign/view.php', $urlparams);
$description = get_string('allowsubmissionsshort', 'assign');
$actions['unlock'] = new action_menu_link_secondary($url, $noimage, $description);
}
}
if ($submissionsopen && $USER->id != $row->id && $caneditsubmission) {
$urlparams = array('id' => $this->assignment->get_course_module()->id, 'userid' => $row->id, 'action' => 'editsubmission', 'sesskey' => sesskey(), 'page' => $this->currpage);
$url = new moodle_url('/mod/assign/view.php', $urlparams);
$description = get_string('editsubmission', 'assign');
$actions['editsubmission'] = new action_menu_link_secondary($url, $noimage, $description);
}
}
if (($this->assignment->get_instance()->duedate || $this->assignment->get_instance()->cutoffdate) && $this->hasgrantextension) {
$urlparams = array('id' => $this->assignment->get_course_module()->id, 'userid' => $row->id, 'action' => 'grantextension', 'sesskey' => sesskey(), 'page' => $this->currpage);
$url = new moodle_url('/mod/assign/view.php', $urlparams);
$description = get_string('grantextension', 'assign');
$actions['grantextension'] = new action_menu_link_secondary($url, $noimage, $description);
}
if ($row->status == ASSIGN_SUBMISSION_STATUS_SUBMITTED && $this->assignment->get_instance()->submissiondrafts) {
$urlparams = array('id' => $this->assignment->get_course_module()->id, 'userid' => $row->id, 'action' => 'reverttodraft', 'sesskey' => sesskey(), 'page' => $this->currpage);
$url = new moodle_url('/mod/assign/view.php', $urlparams);
$description = get_string('reverttodraftshort', 'assign');
$actions['reverttodraft'] = new action_menu_link_secondary($url, $noimage, $description);
}
if ($row->status == ASSIGN_SUBMISSION_STATUS_DRAFT && $this->assignment->get_instance()->submissiondrafts && $caneditsubmission && $submissionsopen && $row->id != $USER->id) {
$urlparams = array('id' => $this->assignment->get_course_module()->id, 'userid' => $row->id, 'action' => 'submitotherforgrading', 'sesskey' => sesskey(), 'page' => $this->currpage);
$url = new moodle_url('/mod/assign/view.php', $urlparams);
$description = get_string('submitforgrading', 'assign');
$actions['submitforgrading'] = new action_menu_link_secondary($url, $noimage, $description);
}
$ismanual = $this->assignment->get_instance()->attemptreopenmethod == ASSIGN_ATTEMPT_REOPEN_METHOD_MANUAL;
$hassubmission = !empty($row->status);
$notreopened = $hassubmission && $row->status != ASSIGN_SUBMISSION_STATUS_REOPENED;
$isunlimited = $this->assignment->get_instance()->maxattempts == ASSIGN_UNLIMITED_ATTEMPTS;
$hasattempts = $isunlimited || $row->attemptnumber < $this->assignment->get_instance()->maxattempts - 1;
if ($ismanual && $hassubmission && $notreopened && $hasattempts) {
$urlparams = array('id' => $this->assignment->get_course_module()->id, 'userid' => $row->id, 'action' => 'addattempt', 'sesskey' => sesskey(), 'page' => $this->currpage);
$url = new moodle_url('/mod/assign/view.php', $urlparams);
$description = get_string('addattempt', 'assign');
$actions['addattempt'] = new action_menu_link_secondary($url, $noimage, $description);
}
$menu = new action_menu();
$menu->set_owner_selector('.gradingtable-actionmenu');
$menu->set_alignment(action_menu::TL, action_menu::BL);
$menu->set_constraint('.gradingtable > .no-overflow');
$menu->set_menu_trigger(get_string('edit'));
foreach ($actions as $action) {
$menu->add($action);
}
// Prioritise the menu ahead of all other actions.
$menu->prioritise = true;
$edit .= $this->output->render($menu);
return $edit;
}
示例3: col_userid
/**
* Format a column of data for display.
*
* @param stdClass $row
* @return string
*/
public function col_userid(stdClass $row) {
global $USER;
$edit = '';
$actions = array();
$urlparams = array('id'=>$this->assignment->get_course_module()->id,
'rownum'=>$this->rownum,
'action'=>'grade');
$url = new moodle_url('/mod/assign/view.php', $urlparams);
if (!$row->grade) {
$description = get_string('grade');
} else {
$description = get_string('updategrade', 'assign');
}
$actions[$url->out(false)] = $description;
$submissionsopen = $this->assignment->submissions_open($row->id);
$caneditsubmission = $this->assignment->can_edit_submission($row->id, $USER->id);
// Hide for offline assignments.
if ($this->assignment->is_any_submission_plugin_enabled()) {
if (!$row->status ||
$row->status == ASSIGN_SUBMISSION_STATUS_DRAFT ||
!$this->assignment->get_instance()->submissiondrafts) {
if (!$row->locked) {
$urlparams = array('id' => $this->assignment->get_course_module()->id,
'userid'=>$row->id,
'action'=>'lock',
'sesskey'=>sesskey(),
'page'=>$this->currpage);
$url = new moodle_url('/mod/assign/view.php', $urlparams);
$description = get_string('preventsubmissionsshort', 'assign');
$actions[$url->out(false)] = $description;
} else {
$urlparams = array('id' => $this->assignment->get_course_module()->id,
'userid'=>$row->id,
'action'=>'unlock',
'sesskey'=>sesskey(),
'page'=>$this->currpage);
$url = new moodle_url('/mod/assign/view.php', $urlparams);
$description = get_string('allowsubmissionsshort', 'assign');
$actions[$url->out(false)] = $description;
}
}
if (($this->assignment->get_instance()->duedate ||
$this->assignment->get_instance()->cutoffdate) &&
$this->hasgrantextension) {
$urlparams = array('id' => $this->assignment->get_course_module()->id,
'userid'=>$row->id,
'action'=>'grantextension',
'sesskey'=>sesskey(),
'page'=>$this->currpage);
$url = new moodle_url('/mod/assign/view.php', $urlparams);
$description = get_string('grantextension', 'assign');
$actions[$url->out(false)] = $description;
}
if ($submissionsopen &&
$USER->id != $row->id &&
$caneditsubmission) {
$urlparams = array('id' => $this->assignment->get_course_module()->id,
'userid'=>$row->id,
'action'=>'editsubmission',
'sesskey'=>sesskey(),
'page'=>$this->currpage);
$url = new moodle_url('/mod/assign/view.php', $urlparams);
$description = get_string('editsubmission', 'assign');
$actions[$url->out(false)] = $description;
}
}
if ($row->status == ASSIGN_SUBMISSION_STATUS_SUBMITTED &&
$this->assignment->get_instance()->submissiondrafts) {
$urlparams = array('id' => $this->assignment->get_course_module()->id,
'userid'=>$row->id,
'action'=>'reverttodraft',
'sesskey'=>sesskey(),
'page'=>$this->currpage);
$url = new moodle_url('/mod/assign/view.php', $urlparams);
$description = get_string('reverttodraftshort', 'assign');
$actions[$url->out(false)] = $description;
}
if ($row->status == ASSIGN_SUBMISSION_STATUS_DRAFT &&
$this->assignment->get_instance()->submissiondrafts &&
$caneditsubmission &&
$submissionsopen &&
$row->id != $USER->id) {
$urlparams = array('id' => $this->assignment->get_course_module()->id,
'userid'=>$row->id,
'action'=>'submitotherforgrading',
//.........这里部分代码省略.........
示例4: save_submission
/**
* Save a student submission for a single assignment
*
* @param int $assignmentid The id of the assignment
* @param array $plugindata - The submitted data for plugins
* @return array of warnings to indicate any errors
* @since Moodle 2.6
*/
public static function save_submission($assignmentid, $plugindata)
{
global $CFG, $USER;
require_once "{$CFG->dirroot}/mod/assign/locallib.php";
$params = self::validate_parameters(self::save_submission_parameters(), array('assignmentid' => $assignmentid, 'plugindata' => $plugindata));
$cm = get_coursemodule_from_instance('assign', $params['assignmentid'], 0, false, MUST_EXIST);
$context = context_module::instance($cm->id);
self::validate_context($context);
$assignment = new assign($context, $cm, null);
$notices = array();
if (!$assignment->submissions_open($USER->id)) {
$notices[] = get_string('duedatereached', 'assign');
} else {
$submissiondata = (object) $params['plugindata'];
$assignment->save_submission($submissiondata, $notices);
}
$warnings = array();
foreach ($notices as $notice) {
$warnings[] = self::generate_warning($params['assignmentid'], 'couldnotsavesubmission', $notice);
}
return $warnings;
}
示例5: testable_submissions_open
public function testable_submissions_open($userid = 0) {
return parent::submissions_open($userid);
}