|
@@ -5,11 +5,10 @@ require_once('locallib.php');
|
|
|
require_once('lib.php');
|
|
|
require_once('submission_form.php');
|
|
|
|
|
|
-echo "pagina submission";
|
|
|
-
|
|
|
|
|
|
$cmid = required_param('cmid', PARAM_INT); // Course Module ID
|
|
|
-$id = required_param('id' , PARAM_INT); //Gradeimporter id
|
|
|
+$id = optional_param('id' , 0, PARAM_INT); //Gradeimporter id
|
|
|
+$subid = optional_param('subid', 1, PARAM_INT); //submission id
|
|
|
//$delete = optional_param('delete', 0, PARAM_INT);
|
|
|
//$confirm = optional_param('confirm', 0, PARAM_INT);
|
|
|
|
|
@@ -60,7 +59,7 @@ $submission = file_prepare_standard_filemanager($submission, 'submission', $subm
|
|
|
|
|
|
$submission->cmid = $cm->id;
|
|
|
|
|
|
-$mform = new mod_gradeimporter_submission_form(null, array('submission'=>$submission, 'cm'=>$cm, 'descriptionoptions'=>$descriptionoptions, 'submissionoptions'=>$submissionoptions));
|
|
|
+$mform = new mod_gradeimporter_submission_form(null, array('submission'=>$submission, 'cm'=>$cm, 'descriptionoptions'=>$descriptionoptions, 'submissionoptions'=>$submissionoptions, 'gradeimporterid'=>$gradeimporter->id));
|
|
|
|
|
|
if ($mform->is_cancelled()){
|
|
|
if ($id){
|
|
@@ -118,7 +117,7 @@ if ($mform->is_cancelled()){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- redirect("view.php?id=$cm->id&edition=1");
|
|
|
+ redirect("view.php?id=$cm->id&edit=1");
|
|
|
}
|
|
|
|
|
|
if(!empty($id)) {
|
|
@@ -135,84 +134,4 @@ if ($gradeimporter->intro){
|
|
|
|
|
|
$mform->display();
|
|
|
|
|
|
-echo $OUTPUT->footer();
|
|
|
-
|
|
|
-//codigo antigo
|
|
|
-/*if (!$gradeimporter = $DB->get_record('gradeimporter', array('id' => $id))) {
|
|
|
- print_error('invalidgradeimproterdid', 'gradeimporter');
|
|
|
-}
|
|
|
-
|
|
|
-list($course, $cm) = get_course_and_cm_from_instance($gradeimporter, 'gradeimporter');
|
|
|
-
|
|
|
-if ($delete && ! $submission = $DB->get_record('gradeimporter_sumbmission', array('gradeimporterid' => $gradeimporter->id, 'id' => $delete))) {
|
|
|
- print_error('Invalid comment ID');
|
|
|
-}
|
|
|
-
|
|
|
-require_login($course, true, $cm);
|
|
|
-
|
|
|
-$PAGE->set_cm($cm);
|
|
|
-$PAGE->set_url('/mod/gradeimporter/view.php', array('id' => $id));
|
|
|
-$PAGE->set_title($gradeimporter->name);
|
|
|
-$page->set_heading($course->shortname);
|
|
|
-
|
|
|
-$context = context_module::instance($cm->id);
|
|
|
-
|
|
|
-$gradeimporterurl = $CFG->wwwroot.'mod/gradeimporter/view.php?id='.$cm->id;
|
|
|
-
|
|
|
-if ($delete && has_capability('mod/wavefront:edit', $context)) {
|
|
|
- if($confirm && confirm_sesskey()) {
|
|
|
- $DB->delete_records('gradeimporter_submission', array('id' => $comment->id));
|
|
|
- redirect($gradeimporterurl);
|
|
|
- } else {
|
|
|
- echo $OUTPUT->header();
|
|
|
- $paramyes = array('id' => $gradeimporter->id, 'delete' => $gradeimporter->id, 'sesskey' => sesskey(), 'confirm' => 1);
|
|
|
- $paramsno = array('id' => $cm->id);
|
|
|
- echo $OUTPUT->confirm(get_string('submissiondelete', 'gradeimporter'),
|
|
|
- new moodle_url('/mod/gradeimporter/submission.php', $paramsyes),
|
|
|
- new moodle_url('/mod/gradeimporter/view.php', $paramsno));
|
|
|
- echo $OUTPUT->footer();
|
|
|
- die();
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-require_capability('mod/gradeimporter/addsubmission', $context);
|
|
|
-
|
|
|
-if(!$gradeimporter->submission) {
|
|
|
- print_error('Submissions disabled', $gradeimporterurl);
|
|
|
-}
|
|
|
-
|
|
|
-$mform = new mod_gradeimporter_submission_form(null, $gradeimporter);
|
|
|
-
|
|
|
-if ($mform-is_cancelled()) {
|
|
|
- redirect($gradeimporterurl);
|
|
|
-} else if ($formdata = $mform->get_data()) {
|
|
|
- $newsubmission = new stdClass;
|
|
|
- $newsubmission->gradeimporter = $gradeimporter->id;
|
|
|
- $newsubmission->type = $formdata->type;
|
|
|
- $newsubmission->timemodified = time();
|
|
|
- $newsubmission->usermodified = $USER->id;
|
|
|
- //$newsubmission->name = $formdata->name;
|
|
|
- //$newsubmission->info = $formdata->info;
|
|
|
- $newsubmission->position = $formdata->position;
|
|
|
- $newsubmission->visibility = $formdata->visibility;
|
|
|
-
|
|
|
- if ($DB->insert_record('gradeimporter_submission', $newsubmission)) {
|
|
|
- $params = array($cmid = required_param('cmid', PARAM_INT); // Course Module ID
|
|
|
- 'context' => $context,
|
|
|
- 'other' => array(
|
|
|
- 'gradeimporterid' => $gradeimporter->id
|
|
|
- )
|
|
|
- );
|
|
|
- $event = \mod_gradeimporter\event\gradeimporter_submission_created::create($params);
|
|
|
- $event->trigger();
|
|
|
- redirect($gradeimporterurl, get_string('submission added', 'gradeimporter'));
|
|
|
- } else {
|
|
|
- print_error('gradeimporter creation failed');
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-echo $OUTPUT->header();
|
|
|
-
|
|
|
-$mform->display();
|
|
|
-
|
|
|
-echo $OUTPUT->footer();*/
|
|
|
+echo $OUTPUT->footer();
|