本文整理汇总了PHP中workshop::submission_url方法的典型用法代码示例。如果您正苦于以下问题:PHP workshop::submission_url方法的具体用法?PHP workshop::submission_url怎么用?PHP workshop::submission_url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类workshop
的用法示例。
在下文中一共展示了workshop::submission_url方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
// course module id
$id = optional_param('id', 0, PARAM_INT);
// submission id
$edit = optional_param('edit', false, PARAM_BOOL);
// open for editing?
$assess = optional_param('assess', false, PARAM_BOOL);
// instant assessment required
$cm = get_coursemodule_from_id('workshop', $cmid, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
require_login($course, false, $cm);
if (isguestuser()) {
print_error('guestsarenotallowed');
}
$workshoprecord = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
$workshop = new workshop($workshoprecord, $cm, $course);
$PAGE->set_url($workshop->submission_url(), array('cmid' => $cmid, 'id' => $id));
if ($edit) {
$PAGE->url->param('edit', $edit);
}
if ($id) {
// submission is specified
$submission = $workshop->get_submission_by_id($id);
$params = array('objectid' => $submission->id, 'context' => $workshop->context, 'courseid' => $workshop->course->id, 'relateduserid' => $submission->authorid, 'other' => array('workshopid' => $workshop->id));
$event = \mod_workshop\event\submission_viewed::create($params);
$event->trigger();
} else {
// no submission specified
if (!($submission = $workshop->get_submission_by_author($USER->id))) {
$submission = new stdclass();
$submission->id = null;
$submission->authorid = $USER->id;
示例2: __construct
//.........这里部分代码省略.........
$task->link = $workshop->updatemod_url();
if (trim($workshop->instructreviewers)) {
$task->completed = true;
} elseif ($workshop->phase >= workshop::PHASE_ASSESSMENT) {
$task->completed = false;
}
$phase->tasks['instructreviewers'] = $task;
}
if ($workshop->useexamples and $workshop->examplesmode == workshop::EXAMPLES_BEFORE_SUBMISSION
and has_capability('mod/workshop:submit', $workshop->context, $userid, false)
and !has_capability('mod/workshop:manageexamples', $workshop->context, $userid)) {
$task = new stdclass();
$task->title = get_string('exampleassesstask', 'workshop');
$examples = $this->get_examples();
$a = new stdclass();
$a->expected = count($examples);
$a->assessed = 0;
foreach ($examples as $exampleid => $example) {
if (!is_null($example->grade)) {
$a->assessed++;
}
}
$task->details = get_string('exampleassesstaskdetails', 'workshop', $a);
if ($a->assessed == $a->expected) {
$task->completed = true;
} elseif ($workshop->phase >= workshop::PHASE_ASSESSMENT) {
$task->completed = false;
}
$phase->tasks['examples'] = $task;
}
if (has_capability('mod/workshop:submit', $workshop->context, $userid, false)) {
$task = new stdclass();
$task->title = get_string('tasksubmit', 'workshop');
$task->link = $workshop->submission_url();
if ($DB->record_exists('workshop_submissions', array('workshopid'=>$workshop->id, 'example'=>0, 'authorid'=>$userid))) {
$task->completed = true;
} elseif ($workshop->phase >= workshop::PHASE_ASSESSMENT) {
$task->completed = false;
} else {
$task->completed = null; // still has a chance to submit
}
$phase->tasks['submit'] = $task;
}
if (has_capability('mod/workshop:allocate', $workshop->context, $userid)) {
$task = new stdclass();
$task->title = get_string('allocate', 'workshop');
$task->link = $workshop->allocation_url();
$numofauthors = count(get_users_by_capability($workshop->context, 'mod/workshop:submit', 'u.id', '', '', '',
'', '', false, true));
$numofsubmissions = $DB->count_records('workshop_submissions', array('workshopid'=>$workshop->id, 'example'=>0));
$sql = 'SELECT COUNT(s.id) AS nonallocated
FROM {workshop_submissions} s
LEFT JOIN {workshop_assessments} a ON (a.submissionid=s.id)
WHERE s.workshopid = :workshopid AND s.example=0 AND a.submissionid IS NULL';
$params['workshopid'] = $workshop->id;
$numnonallocated = $DB->count_records_sql($sql, $params);
if ($numofsubmissions == 0) {
$task->completed = null;
} elseif ($numnonallocated == 0) {
$task->completed = true;
} elseif ($workshop->phase > workshop::PHASE_SUBMISSION) {
$task->completed = false;
} else {
$task->completed = null; // still has a chance to allocate
}
$a = new stdclass();
示例3: workshop_user_complete
/**
* Print a detailed representation of what a user has done with
* a given particular instance of this module, for user activity reports.
*
* @return string HTML
*/
function workshop_user_complete($course, $user, $mod, $workshop)
{
global $CFG, $DB, $OUTPUT;
require_once dirname(__FILE__) . '/locallib.php';
require_once $CFG->libdir . '/gradelib.php';
$workshop = new workshop($workshop, $mod, $course);
$grades = grade_get_grades($course->id, 'mod', 'workshop', $workshop->id, $user->id);
if (!empty($grades->items[0]->grades)) {
$submissiongrade = reset($grades->items[0]->grades);
$info = get_string('submissiongrade', 'workshop') . ': ' . $submissiongrade->str_long_grade;
echo html_writer::tag('li', $info, array('class' => 'submissiongrade'));
}
if (!empty($grades->items[1]->grades)) {
$assessmentgrade = reset($grades->items[1]->grades);
$info = get_string('gradinggrade', 'workshop') . ': ' . $assessmentgrade->str_long_grade;
echo html_writer::tag('li', $info, array('class' => 'gradinggrade'));
}
if (has_capability('mod/workshop:viewallsubmissions', $workshop->context)) {
if ($submission = $workshop->get_submission_by_author($user->id)) {
$title = format_string($submission->title);
$url = $workshop->submission_url($submission->id);
$link = html_writer::link($url, $title);
$info = get_string('submission', 'workshop') . ': ' . $link;
echo html_writer::tag('li', $info, array('class' => 'submission'));
}
}
if (has_capability('mod/workshop:viewallassessments', $workshop->context)) {
if ($assessments = $workshop->get_assessments_by_reviewer($user->id)) {
foreach ($assessments as $assessment) {
$a = new stdclass();
$a->submissionurl = $workshop->submission_url($assessment->submissionid)->out();
$a->assessmenturl = $workshop->assess_url($assessment->id)->out();
$a->submissiontitle = s($assessment->submissiontitle);
echo html_writer::tag('li', get_string('assessmentofsubmission', 'workshop', $a));
}
}
}
}
示例4: workshop_user_complete
/**
* Print a detailed representation of what a user has done with
* a given particular instance of this module, for user activity reports.
*
* @return string HTML
*/
function workshop_user_complete($course, $user, $mod, $workshop) {
global $CFG, $DB, $OUTPUT;
require_once(dirname(__FILE__).'/locallib.php');
require_once($CFG->libdir.'/gradelib.php');
$workshop = new workshop($workshop, $mod, $course);
$grades = grade_get_grades($course->id, 'mod', 'workshop', $workshop->id, $user->id);
if (!empty($grades->items[0]->grades)) {
$submissiongrade = reset($grades->items[0]->grades);
$info = get_string('submissiongrade', 'workshop') . ': ' . $submissiongrade->str_long_grade;
echo html_writer::tag('li', $info, array('class'=>'submissiongrade'));
}
if (!empty($grades->items[1]->grades)) {
$assessmentgrade = reset($grades->items[1]->grades);
$info = get_string('gradinggrade', 'workshop') . ': ' . $assessmentgrade->str_long_grade;
echo html_writer::tag('li', $info, array('class'=>'gradinggrade'));
}
if (has_capability('mod/workshop:viewallsubmissions', $workshop->context)) {
$canviewsubmission = true;
if (groups_get_activity_groupmode($workshop->cm) == SEPARATEGROUPS) {
// user must have accessallgroups or share at least one group with the submission author
if (!has_capability('moodle/site:accessallgroups', $workshop->context)) {
$usersgroups = groups_get_activity_allowed_groups($workshop->cm);
$authorsgroups = groups_get_all_groups($workshop->course->id, $user->id, $workshop->cm->groupingid, 'g.id');
$sharedgroups = array_intersect_key($usersgroups, $authorsgroups);
if (empty($sharedgroups)) {
$canviewsubmission = false;
}
}
}
if ($canviewsubmission and $submission = $workshop->get_submission_by_author($user->id)) {
$title = format_string($submission->title);
$url = $workshop->submission_url($submission->id);
$link = html_writer::link($url, $title);
$info = get_string('submission', 'workshop').': '.$link;
echo html_writer::tag('li', $info, array('class'=>'submission'));
}
}
if (has_capability('mod/workshop:viewallassessments', $workshop->context)) {
if ($assessments = $workshop->get_assessments_by_reviewer($user->id)) {
foreach ($assessments as $assessment) {
$a = new stdclass();
$a->submissionurl = $workshop->submission_url($assessment->submissionid)->out();
$a->assessmenturl = $workshop->assess_url($assessment->id)->out();
$a->submissiontitle = s($assessment->submissiontitle);
echo html_writer::tag('li', get_string('assessmentofsubmission', 'workshop', $a));
}
}
}
}
示例5: array
// course module id
$id = optional_param('id', 0, PARAM_INT);
// submission id
$edit = optional_param('edit', false, PARAM_BOOL);
// open for editing?
$assess = optional_param('assess', false, PARAM_BOOL);
// instant assessment required
$cm = get_coursemodule_from_id('workshop', $cmid, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
require_login($course, false, $cm);
if (isguestuser()) {
print_error('guestsarenotallowed');
}
$workshop = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
$workshop = new workshop($workshop, $cm, $course);
$PAGE->set_url($workshop->submission_url(), array('cmid' => $cmid, 'id' => $id, 'edit' => $edit));
if ($id) {
// submission is specified
$submission = $workshop->get_submission_by_id($id);
$workshop->log('view submission', $workshop->submission_url($submission->id), $submission->id);
} else {
// no submission specified
if (!($submission = $workshop->get_submission_by_author($USER->id))) {
$submission = new stdclass();
$submission->id = null;
$submission->authorid = $USER->id;
$submission->example = 0;
$submission->grade = null;
$submission->gradeover = null;
$submission->published = null;
$submission->feedbackauthor = null;