本文整理汇总了PHP中workshop::get_submission_by_author方法的典型用法代码示例。如果您正苦于以下问题:PHP workshop::get_submission_by_author方法的具体用法?PHP workshop::get_submission_by_author怎么用?PHP workshop::get_submission_by_author使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类workshop
的用法示例。
在下文中一共展示了workshop::get_submission_by_author方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
// authors can see assessments of their work at the end of workshop only
print_error('nopermissions', 'error', $workshop->view_url(), 'view assessment of own work before workshop is closed');
}
// only the reviewer is allowed to modify the assessment
if ($isreviewer and $workshop->assessing_allowed($USER->id)) {
$assessmenteditable = true;
} else {
$assessmenteditable = false;
}
// check that all required examples have been assessed by the user
if ($assessmenteditable and $workshop->useexamples and $workshop->examplesmode == workshop::EXAMPLES_BEFORE_ASSESSMENT
and !has_capability('mod/workshop:manageexamples', $workshop->context)) {
// the reviewer must have submitted their own submission
$reviewersubmission = $workshop->get_submission_by_author($assessment->reviewerid);
if (!$reviewersubmission) {
// no money, no love
$assessmenteditable = false;
echo $output->header();
echo $output->heading(get_string('exampleneedsubmission', 'workshop'), 2);
echo $output->footer();
exit;
} else {
$examples = $workshop->get_examples_for_reviewer($assessment->reviewerid);
foreach ($examples as $exampleid => $example) {
if (is_null($example->grade)) {
$assessmenteditable = false;
echo $output->header();
echo $output->heading(get_string('exampleneedassessed', 'workshop'), 2);
echo $output->footer();
示例2: array
}
$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;
$submission->example = 0;
$submission->grade = null;
$submission->gradeover = null;
$submission->published = null;
$submission->feedbackauthor = null;
$submission->feedbackauthorformat = editors_get_preferred_format();
}
}
$ownsubmission = $submission->authorid == $USER->id;
$canviewall = has_capability('mod/workshop:viewallsubmissions', $workshop->context);
$cansubmit = has_capability('mod/workshop:submit', $workshop->context);
$canallocate = has_capability('mod/workshop:allocate', $workshop->context);
示例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)) {
$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));
}
}
}
}
示例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)) {
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));
}
}
}
}
示例5: array
$usernames = array_merge($usernames,$a);
}
$users = $DB->get_records_list('user','username',$usernames,'','username,id,firstname,lastname');
$failures = array(); // username => reason
foreach($csv as $a) {
if(!empty($a)) {
$reviewee = trim($a[0]);
$reviewers = array_slice($a,1);
if (empty($reviewee)) continue;
if (empty($reviewers)) continue;
$submission = $workshop->get_submission_by_author($users[$reviewee]->id);
if (empty($users[$reviewee])) {
$failures[$reviewee] = "error::No user for username $reviewee";
continue;
}
if ($submission === false) {
$failures[$reviewee] = "error::No submission for {$users[$reviewee]->firstname} {$users[$reviewee]->lastname} ($reviewee)";
continue;
}
foreach($reviewers as $i) {
if (empty($i)) continue;
if (!empty($users[$i])) {
$res = $workshop->add_allocation($submission, $users[$i]->id);
示例6: array
$output .= '<a href="' . $path . '" >' . $OUTPUT->pix_icon(file_file_icon($file), get_mimetype_description($file), 'moodle', array('class' => 'icon')) . s($filename) . '</a><br>';
}
echo $output;
}
}
$type = $assignment->assignment->assignmenttype;
if ($type == 'online') {
require_once "{$CFG->dirroot}/mod/assignment/type/online/assignment.class.php";
$assignment_online = new assignment_online($modid);
echo $assignment_online->get_submission($userid)->data1;
}
} elseif ($mod->modname == 'workshop') {
$context = context_module::instance($mod->id);
require_once $CFG->dirroot . '/mod/workshop/locallib.php';
$workshop = new workshop($instance, $mod, $course);
$submission = $workshop->get_submission_by_author($user->id);
if (is_object($submission)) {
$content = format_text($submission->content, $submission->contentformat, array('overflowdiv' => true));
$content = file_rewrite_pluginfile_urls($content, 'pluginfile.php', $context->id, 'mod_workshop', 'submission_content', $submission->id);
print_r($content);
$fs = get_file_storage();
$ctx = $context;
$files = $fs->get_area_files($ctx->id, 'mod_workshop', 'submission_attachment', $submission->id);
echo '<ul>';
foreach ($files as $file) {
if ($file->is_directory()) {
continue;
}
$filepath = $file->get_filepath();
$filename = $file->get_filename();
$fileurl = file_encode_url($CFG->wwwroot . '/blocks/evalcomix/assessment/pluginfile.php', '/' . $ctx->id . '/mod_workshop/submission_attachment/' . $submission->id . $filepath . $filename, false);
示例7: __construct
//.........这里部分代码省略.........
} 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->teammode && $workshop->get_submission_by_author($userid,'s.id') !== false) {
$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)) {
if ($workshop->phaseswitchassessment) {
$task = new stdClass();
$allocator = $DB->get_record('workshopallocation_scheduled', array('workshopid' => $workshop->id));
if (empty($allocator)) {
$task->completed = false;
} else if ($allocator->enabled and is_null($allocator->resultstatus)) {
$task->completed = true;
} else if ($workshop->submissionend > time()) {
$task->completed = null;
} else {
$task->completed = false;
}
$task->title = get_string('setup', 'workshopallocation_scheduled');
$task->link = $workshop->allocation_url('scheduled');
$phase->tasks['allocatescheduled'] = $task;
}
$task = new stdclass();
$task->title = get_string('allocate', 'workshop');
$task->link = $workshop->allocation_url();
$numofauthors = $workshop->count_potential_authors(false);
//these two counting methods need different code for teammode and normal mode
if ($workshop->teammode) {