本文整理汇总了PHP中workshop::view_url方法的典型用法代码示例。如果您正苦于以下问题:PHP workshop::view_url方法的具体用法?PHP workshop::view_url怎么用?PHP workshop::view_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类workshop
的用法示例。
在下文中一共展示了workshop::view_url方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
break;
}
}
}
$edit = ($editable and $edit);
$seenaspublished = false;
// is the submission seen as a published submission?
if ($submission->id and ($ownsubmission or $canviewall or $isreviewer)) {
// ok you can go
} elseif ($submission->id and $ispublished) {
// ok you can go
$seenaspublished = true;
} elseif (is_null($submission->id) and $cansubmit) {
// ok you can go
} else {
print_error('nopermissions', 'error', $workshop->view_url(), 'view or create submission');
}
if ($assess and $submission->id and !$isreviewer and $canallocate and $workshop->assessing_allowed($USER->id)) {
require_sesskey();
$assessmentid = $workshop->add_allocation($submission, $USER->id);
redirect($workshop->assess_url($assessmentid));
}
if ($edit) {
require_once dirname(__FILE__) . '/submission_form.php';
$maxfiles = $workshop->nattachments;
$maxbytes = $workshop->maxbytes;
$contentopts = array('trusttext' => true, 'subdirs' => false, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes, 'context' => $workshop->context, 'return_types' => FILE_INTERNAL | FILE_EXTERNAL);
$attachmentopts = array('subdirs' => true, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes, 'return_types' => FILE_INTERNAL);
$submission = file_prepare_standard_editor($submission, 'content', $contentopts, $workshop->context, 'mod_workshop', 'submission_content', $submission->id);
$submission = file_prepare_standard_filemanager($submission, 'attachment', $attachmentopts, $workshop->context, 'mod_workshop', 'submission_attachment', $submission->id);
$mform = new workshop_submission_form($PAGE->url, array('current' => $submission, 'workshop' => $workshop, 'contentopts' => $contentopts, 'attachmentopts' => $attachmentopts));
示例2: stdclass
// no example specified - create new one
require_capability('mod/workshop:manageexamples', $workshop->context);
$example = new stdclass();
$example->id = null;
$example->authorid = $USER->id;
$example->example = 1;
}
$canmanage = has_capability('mod/workshop:manageexamples', $workshop->context);
$canassess = has_capability('mod/workshop:peerassess', $workshop->context);
$refasid = $DB->get_field('workshop_assessments', 'id', array('submissionid' => $example->id, 'weight' => 1));
if ($example->id and ($canmanage or $workshop->assessing_examples_allowed() and $canassess)) {
// ok you can go
} elseif (is_null($example->id) and $canmanage) {
// ok you can go
} else {
print_error('nopermissions', 'error', $workshop->view_url(), 'view or manage example submission');
}
if ($id and $delete and $confirm and $canmanage) {
require_sesskey();
$workshop->delete_submission($example);
redirect($workshop->view_url());
}
if ($id and $assess and $canmanage) {
// reference assessment of an example is the assessment with the weight = 1. There should be just one
// such assessment
require_sesskey();
if (!$refasid) {
$refasid = $workshop->add_allocation($example, $USER->id, 1);
}
redirect($workshop->exassess_url($refasid));
}
示例3: workshop
}
$workshop = new workshop($workshop, $cm, $course);
$PAGE->set_url($workshop->exassess_url($assessment->id));
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add(get_string('assessingexample', 'workshop'));
$currenttab = 'assessment';
$canmanage = has_capability('mod/workshop:manageexamples', $workshop->context);
$isreviewer = ($USER->id == $assessment->reviewerid);
if ($isreviewer or $canmanage) {
// such a user can continue
} else {
print_error('nopermissions', 'error', $workshop->view_url(), 'assess example submission');
}
// only the reviewer is allowed to modify the assessment
if (($canmanage and $assessment->weight == 1) or ($isreviewer and $workshop->assessing_examples_allowed())) {
$assessmenteditable = true;
} else {
$assessmenteditable = false;
}
// load the grading strategy logic
$strategy = $workshop->grading_strategy_instance();
// load the assessment form and process the submitted data eventually
$mform = $strategy->get_assessment_form($PAGE->url, 'assessment', $assessment, $assessmenteditable);
示例4: array
$workshoprecord = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
} else {
$workshoprecord = $DB->get_record('workshop', array('id' => $w), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id' => $workshoprecord->course), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('workshop', $workshoprecord->id, $course->id, false, MUST_EXIST);
}
require_login($course, true, $cm);
require_capability('mod/workshop:view', $PAGE->context);
$workshop = new workshop($workshoprecord, $cm, $course);
// Mark viewed
$completion = new completion_info($course);
$completion->set_module_viewed($cm);
$eventdata = array();
$eventdata['objectid'] = $workshop->id;
$eventdata['context'] = $workshop->context;
$PAGE->set_url($workshop->view_url());
$event = \mod_workshop\event\course_module_viewed::create($eventdata);
$event->add_record_snapshot('course', $course);
$event->add_record_snapshot('workshop', $workshoprecord);
$event->add_record_snapshot('course_modules', $cm);
$event->trigger();
// If the phase is to be switched, do it asap. This just has to happen after triggering
// the event so that the scheduled allocator had a chance to allocate submissions.
if ($workshop->phase == workshop::PHASE_SUBMISSION and $workshop->phaseswitchassessment and $workshop->submissionend > 0 and $workshop->submissionend < time()) {
$workshop->switch_phase(workshop::PHASE_ASSESSMENT);
// Disable the automatic switching now so that it is not executed again by accident
// if the teacher changes the phase back to the submission one.
$DB->set_field('workshop', 'phaseswitchassessment', 0, array('id' => $workshop->id));
$workshop->phaseswitchassessment = 0;
}
if (!is_null($editmode) && $PAGE->user_allowed_editing()) {
示例5:
$PAGE->set_url($workshop->assess_url($assessment->id));
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add(get_string('assessingsubmission', 'workshop'));
$canviewallassessments = has_capability('mod/workshop:viewallassessments', $workshop->context);
$canviewallsubmissions = has_capability('mod/workshop:viewallsubmissions', $workshop->context);
$cansetassessmentweight = has_capability('mod/workshop:allocate', $workshop->context);
$canoverridegrades = has_capability('mod/workshop:overridegrades', $workshop->context);
$isreviewer = ($USER->id == $assessment->reviewerid);
$isauthor = ($USER->id == $submission->authorid);
if ($isreviewer or $isauthor or ($canviewallassessments and $canviewallsubmissions)) {
// such a user can continue
} else {
print_error('nopermissions', 'error', $workshop->view_url(), 'view this assessment');
}
if ($isauthor and !$isreviewer and !$canviewallassessments and $workshop->phase != workshop::PHASE_CLOSED) {
// 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
示例6: redirect
// todo: check if there already is some assessment done and do not allowed the change of the form
// once somebody already used it to assess
$PAGE->set_url($workshop->editform_url());
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add(get_string('editingassessmentform', 'workshop'));
// load the grading strategy logic
$strategy = $workshop->grading_strategy_instance();
// load the form to edit the grading strategy dimensions
$mform = $strategy->get_edit_strategy_form($PAGE->url);
if ($mform->is_cancelled()) {
redirect($workshop->view_url());
} elseif ($data = $mform->get_data()) {
if (($data->workshopid != $workshop->id) or ($data->strategy != $workshop->strategy)) {
// this may happen if someone changes the workshop setting while the user had the
// editing form opened
throw new invalid_parameter_exception('Invalid workshop ID or the grading strategy has changed.');
}
$strategy->save_edit_strategy_form($data);
if (isset($data->saveandclose)) {
redirect($workshop->view_url());
} elseif (isset($data->saveandpreview)) {
redirect($workshop->previewform_url());
} else {
// save and continue - redirect to self to prevent data being re-posted by pressing "Reload"
redirect($PAGE->url);
}
示例7: workshop_cron
/**
* Regular jobs to execute via cron
*
* @return boolean true on success, false otherwise
*/
function workshop_cron() {
global $CFG, $DB;
$now = time();
mtrace(' processing workshop subplugins ...');
cron_execute_plugin_type('workshopallocation', 'workshop allocation methods');
// now when the scheduled allocator had a chance to do its job, check if there
// are some workshops to switch into the assessment phase
$workshops = $DB->get_records_select("workshop",
"phase = 20 AND phaseswitchassessment = 1 AND submissionend > 0 AND submissionend < ?", array($now));
if (!empty($workshops)) {
mtrace('Processing automatic assessment phase switch in '.count($workshops).' workshop(s) ... ', '');
require_once($CFG->dirroot.'/mod/workshop/locallib.php');
foreach ($workshops as $workshop) {
$cm = get_coursemodule_from_instance('workshop', $workshop->id, $workshop->course, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$workshop = new workshop($workshop, $cm, $course);
$workshop->switch_phase(workshop::PHASE_ASSESSMENT);
$workshop->log('update switch phase', $workshop->view_url(), $workshop->phase);
// disable the automatic switching now so that it is not executed again by accident
// if the teacher changes the phase back to the submission one
$DB->set_field('workshop', 'phaseswitchassessment', 0, array('id' => $workshop->id));
// todo inform the teachers
}
mtrace('done');
}
return true;
}
示例8: elseif
if ($assessment->submissionid != $example->id) {
print_error('invalidarguments');
}
$mformassessment = $strategy->get_assessment_form($PAGE->url, 'assessment', $assessment, false);
if ($refasid = $DB->get_field('workshop_assessments', 'id', array('submissionid' => $example->id, 'weight' => 1))) {
$reference = $workshop->get_assessment_by_id($refasid);
$mformreference = $strategy->get_assessment_form($PAGE->url, 'assessment', $reference, false);
}
$canmanage = has_capability('mod/workshop:manageexamples', $workshop->context);
$isreviewer = $USER->id == $assessment->reviewerid;
if ($canmanage) {
// ok you can go
} elseif ($isreviewer and $workshop->assessing_examples_allowed()) {
// ok you can go
} else {
print_error('nopermissions', 'error', $workshop->view_url(), 'compare example assessment');
}
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add(get_string('examplecomparing', 'workshop'));
// Output starts here
$output = $PAGE->get_renderer('mod_workshop');
echo $output->header();
echo $output->heading(get_string('assessedexample', 'workshop'), 2);
echo $output->render($workshop->prepare_example_submission($example));
if (!empty($mformreference)) {
echo $output->heading(get_string('assessmentreference', 'workshop'), 2);
$a = new stdclass();
$a->received = $workshop->real_grade($reference->grade);
$a->max = $workshop->real_grade(100);
echo $output->heading(get_string('gradeinfo', 'workshop', $a), 3);
示例9: array
if (count($workshop->get_assessments_of_submission($submission->id)) > 0) {
$deletable = false;
} else {
$deletable = true;
}
}
if ($submission->id and $delete and $confirm and $deletable) {
require_sesskey();
$workshop->delete_submission($submission);
// Event information.
$params = array('context' => $workshop->context, 'courseid' => $workshop->course->id, 'relateduserid' => $submission->authorid, 'other' => array('submissiontitle' => $submission->title));
$params['objectid'] = $submission->id;
$event = \mod_workshop\event\submission_deleted::create($params);
$event->add_record_snapshot('workshop', $workshoprecord);
$event->trigger();
redirect($workshop->view_url());
}
$seenaspublished = false;
// is the submission seen as a published submission?
if ($submission->id and ($ownsubmission or $canviewall or $isreviewer)) {
// ok you can go
} elseif ($submission->id and $ispublished) {
// ok you can go
$seenaspublished = true;
} elseif (is_null($submission->id) and $cansubmit) {
// ok you can go
} else {
print_error('nopermissions', 'error', $workshop->view_url(), 'view or create submission');
}
if ($assess and $submission->id and !$isreviewer and $canallocate and $workshop->assessing_allowed($USER->id)) {
require_sesskey();
示例10: array
// course module
$phase = required_param('phase', PARAM_INT);
// the code of the new phase
$confirm = optional_param('confirm', false, PARAM_BOOL);
// confirmation
$cm = get_coursemodule_from_id('workshop', $cmid, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$workshop = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
$workshop = new workshop($workshop, $cm, $course);
$PAGE->set_url($workshop->switchphase_url($phase), array('cmid' => $cmid, 'phase' => $phase));
require_login($course, false, $cm);
require_capability('mod/workshop:switchphase', $PAGE->context);
if ($confirm) {
if (!confirm_sesskey()) {
throw new moodle_exception('confirmsesskeybad');
}
if (!$workshop->switch_phase($phase)) {
print_error('errorswitchingphase', 'workshop', $workshop->view_url());
}
redirect($workshop->view_url());
}
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add(get_string('switchingphase', 'workshop'));
//
// Output starts here
//
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($workshop->name));
echo $OUTPUT->confirm(get_string('switchphase' . $phase . 'info', 'workshop'), new moodle_url($PAGE->url, array('confirm' => 1)), $workshop->view_url());
echo $OUTPUT->footer();
示例11: dirname
require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
require_once dirname(__FILE__) . '/locallib.php';
$cmid = required_param('cmid', PARAM_INT);
// course module
$confirm = optional_param('confirm', false, PARAM_BOOL);
// confirmation
// the params to be re-passed to view.php
$page = optional_param('page', 0, PARAM_INT);
$sortby = optional_param('sortby', 'lastname', PARAM_ALPHA);
$sorthow = optional_param('sorthow', 'ASC', PARAM_ALPHA);
$cm = get_coursemodule_from_id('workshop', $cmid, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$workshop = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
$workshop = new workshop($workshop, $cm, $course);
$PAGE->set_url($workshop->aggregate_url(), compact('confirm', 'page', 'sortby', 'sorthow'));
require_login($course, false, $cm);
require_capability('mod/workshop:overridegrades', $PAGE->context);
// load and init the grading evaluator
$evaluator = $workshop->grading_evaluation_instance();
$settingsform = $evaluator->get_settings_form($PAGE->url);
if ($settingsdata = $settingsform->get_data()) {
$workshop->aggregate_submission_grades();
// updates 'grade' in {workshop_submissions}
$evaluator->update_grading_grades($settingsdata);
// updates 'gradinggrade' in {workshop_assessments}
$workshop->aggregate_grading_grades();
// updates 'gradinggrade' in {workshop_aggregations}
$workshop->log('update aggregate grades');
}
redirect(new moodle_url($workshop->view_url(), compact('page', 'sortby', 'sorthow')));
示例12: array
$workshoprecord = $DB->get_record('workshop', array('id' => $w), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id' => $workshoprecord->course), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('workshop', $workshoprecord->id, $course->id, false, MUST_EXIST);
}
require_login($course, true, $cm);
require_capability('mod/workshop:view', $PAGE->context);
$workshop = new workshop($workshoprecord, $cm, $course);
// Mark viewed
$completion = new completion_info($course);
$completion->set_module_viewed($cm);
$eventdata = array();
$eventdata['objectid'] = $workshop->id;
$eventdata['context'] = $workshop->context;
$eventdata['courseid'] = $course->id;
$eventdata['other']['content'] = $workshop->phase;
$PAGE->set_url($workshop->view_url());
$event = \mod_workshop\event\course_module_viewed::create($eventdata);
$event->add_record_snapshot('course', $course);
$event->add_record_snapshot('workshop', $workshoprecord);
$event->add_record_snapshot('course_modules', $cm);
$event->set_page_detail();
$event->trigger();
// If the phase is to be switched, do it asap. This just has to happen after triggering
// the event so that the scheduled allocator had a chance to allocate submissions.
if ($workshop->phase == workshop::PHASE_SUBMISSION and $workshop->phaseswitchassessment and $workshop->submissionend > 0 and $workshop->submissionend < time()) {
$workshop->switch_phase(workshop::PHASE_ASSESSMENT);
$workshop->log('update switch phase', $workshop->view_url(), $workshop->phase);
// Disable the automatic switching now so that it is not executed again by accident
// if the teacher changes the phase back to the submission one.
$DB->set_field('workshop', 'phaseswitchassessment', 0, array('id' => $workshop->id));
$workshop->phaseswitchassessment = 0;
示例13: stdclass
$example = new stdclass();
$example->id = null;
$example->authorid = $USER->id;
$example->example = 1;
}
$canmanage = has_capability('mod/workshop:manageexamples', $workshop->context);
$canassess = has_capability('mod/workshop:peerassess', $workshop->context);
$refasid = $DB->get_field('workshop_assessments', 'id', array('submissionid' => $example->id, 'weight' => 1));
if ($example->id and ($canmanage or ($workshop->assessing_examples_allowed() and $canassess))) {
// ok you can go
} elseif (is_null($example->id) and $canmanage) {
// ok you can go
} else {
print_error('nopermissions', 'error', $workshop->view_url(), 'view or manage example submission');
}
if ($id and $delete and $confirm and $canmanage) {
require_sesskey();
$workshop->delete_submission($example);
redirect($workshop->view_url());
}
if ($id and $assess and $canmanage) {
// reference assessment of an example is the assessment with the weight = 1. There should be just one
// such assessment
require_sesskey();
if (!$refasid) {
$refasid = $workshop->add_allocation($example, $USER->id, 1);
}
示例14: array
$cm = get_coursemodule_from_id('workshop', $cmid, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$workshop = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
$workshop = new workshop($workshop, $cm, $course);
$PAGE->set_url($workshop->switchphase_url($phase), array('cmid' => $cmid, 'phase' => $phase));
require_login($course, false, $cm);
require_capability('mod/workshop:switchphase', $PAGE->context);
if ($confirm) {
if (!confirm_sesskey()) {
throw new moodle_exception('confirmsesskeybad');
}
if (!$workshop->switch_phase($phase)) {
print_error('errorswitchingphase', 'workshop', $workshop->view_url());
}
$workshop->log('update switch phase', $workshop->view_url(), $workshop->phase);
redirect($workshop->view_url());
}
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add(get_string('switchingphase', 'workshop'));
//
// Output starts here
//
echo $OUTPUT->header();
echo $OUTPUT->confirm(get_string('switchphase' . $phase . 'info', 'workshop'),
new moodle_url($PAGE->url, array('confirm' => 1)), $workshop->view_url());