mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
adding capability, indenting, putting in brackets etc
This commit is contained in:
parent
d63545d8e8
commit
38ac07d284
1 changed files with 230 additions and 220 deletions
|
@ -6,7 +6,6 @@
|
||||||
*/
|
*/
|
||||||
class assignment_upload extends assignment_base {
|
class assignment_upload extends assignment_base {
|
||||||
|
|
||||||
|
|
||||||
function print_student_answer($userid, $return=false){
|
function print_student_answer($userid, $return=false){
|
||||||
global $CFG, $USER;
|
global $CFG, $USER;
|
||||||
|
|
||||||
|
@ -70,10 +69,12 @@ class assignment_upload extends assignment_base {
|
||||||
}
|
}
|
||||||
|
|
||||||
//display Blank if there were no files uploaded yet, otherwithe display submission status
|
//display Blank if there were no files uploaded yet, otherwithe display submission status
|
||||||
if (!$submission->data1)
|
if (!$submission->data1) {
|
||||||
$submission_status = get_string('submissionstatusblank','assignment');
|
$submission_status = get_string('submissionstatusblank','assignment');
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
$submission_status = $submission->data1;
|
$submission_status = $submission->data1;
|
||||||
|
}
|
||||||
|
|
||||||
//display submisison status
|
//display submisison status
|
||||||
notify("<b>".get_string('submissionstatus', 'assignment')." </b> ".$submission_status);
|
notify("<b>".get_string('submissionstatus', 'assignment')." </b> ".$submission_status);
|
||||||
|
@ -142,7 +143,8 @@ class assignment_upload extends assignment_base {
|
||||||
global $offset;
|
global $offset;
|
||||||
|
|
||||||
//if this is final submit
|
//if this is final submit
|
||||||
if ($_POST['save']===get_string('sendformarking','assignment')){
|
$savestr = optional_param('save', '', PARAM_ALPHA);
|
||||||
|
if ($savestr === get_string('sendformarking','assignment')) {
|
||||||
|
|
||||||
$this->final_upload();
|
$this->final_upload();
|
||||||
|
|
||||||
|
@ -154,10 +156,9 @@ class assignment_upload extends assignment_base {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//if this is upload of teacher's response
|
//if this is upload of teacher's response
|
||||||
$id = optional_param('id'); // Course module ID
|
$id = optional_param('id', 0, PARAM_INT); // Course module ID
|
||||||
$a = optional_param('a'); // Assignment ID
|
$a = optional_param('a', 0, PARAM_INT); // Assignment ID
|
||||||
$userid = required_param('userid'); // Stores student id for uploading a review file to
|
$userid = required_param('userid', 0, PARAM_INT); // Stores student id for uploading a review file to
|
||||||
|
|
||||||
$this->response_upload($userid); // Upload files
|
$this->response_upload($userid); // Upload files
|
||||||
echo "<form action=\"submissions.php\">";
|
echo "<form action=\"submissions.php\">";
|
||||||
echo "<input type=\"hidden\" value=\"$userid\" name=\"userid\">";
|
echo "<input type=\"hidden\" value=\"$userid\" name=\"userid\">";
|
||||||
|
@ -172,9 +173,7 @@ class assignment_upload extends assignment_base {
|
||||||
function submission_upload() {
|
function submission_upload() {
|
||||||
global $CFG, $USER, $counter;
|
global $CFG, $USER, $counter;
|
||||||
|
|
||||||
if (isguest($USER->id)) {
|
require_capability('mod/assignment:submit', get_context_instance(CONTEXT_MODULE, $this->cm->id));
|
||||||
error(get_string('guestnoupload','assignment'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->view_header(get_string('upload'));
|
$this->view_header(get_string('upload'));
|
||||||
|
|
||||||
|
@ -207,16 +206,23 @@ class assignment_upload extends assignment_base {
|
||||||
//$submission->timemodified = time();
|
//$submission->timemodified = time();
|
||||||
$flag=false;
|
$flag=false;
|
||||||
foreach ($files as $key => $file) {
|
foreach ($files as $key => $file) {
|
||||||
if ($file == $newfile_name)
|
if ($file == $newfile_name) {
|
||||||
$flag = true;
|
$flag = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//if this is an assignment for single upload
|
//if this is an assignment for single upload
|
||||||
if (!$this->assignment->var1) {
|
if (!$this->assignment->var1) {
|
||||||
//if numfiles=1
|
//if numfiles=1
|
||||||
if ( $submission->numfiles==0 && !$flag) $submission->numfiles ++;
|
if ($submission->numfiles==0 && !$flag) {
|
||||||
}else
|
$submission->numfiles ++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
//if file with the same name has not been uploaded before
|
//if file with the same name has not been uploaded before
|
||||||
if (!$flag) $submission->numfiles ++;
|
if (!$flag) {
|
||||||
|
$submission->numfiles ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$submission->comment = addslashes($submission->comment);
|
$submission->comment = addslashes($submission->comment);
|
||||||
unset($submission->data1); // Don't need to update this.
|
unset($submission->data1); // Don't need to update this.
|
||||||
//unset($submission->data2); // Don't need to update this.
|
//unset($submission->data2); // Don't need to update this.
|
||||||
|
@ -494,11 +500,12 @@ class assignment_upload extends assignment_base {
|
||||||
$newsubmission->mailed = 0; // Make sure mail goes out (again, even)
|
$newsubmission->mailed = 0; // Make sure mail goes out (again, even)
|
||||||
$newsubmission->timemarked = time();
|
$newsubmission->timemarked = time();
|
||||||
//marker graded assignment then status set into Marked; if marker didn't grade it then status set into Returned
|
//marker graded assignment then status set into Marked; if marker didn't grade it then status set into Returned
|
||||||
if (/*$feedback->grade != 0 && */ $feedback->grade != -1 )
|
if (/*$feedback->grade != 0 && */ $feedback->grade != -1 ) {
|
||||||
$newsubmission->data1 = get_string("submissionstatusmarked", "assignment");
|
$newsubmission->data1 = get_string("submissionstatusmarked", "assignment");
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
$newsubmission->data1 = get_string("submissionstatusreturned", "assignment");
|
$newsubmission->data1 = get_string("submissionstatusreturned", "assignment");
|
||||||
|
}
|
||||||
//unset($newsubmission->data1); // Don't need to update this.
|
//unset($newsubmission->data1); // Don't need to update this.
|
||||||
//unset($newsubmission->data2); // Don't need to update this.
|
//unset($newsubmission->data2); // Don't need to update this.
|
||||||
|
|
||||||
|
@ -593,11 +600,12 @@ class assignment_upload extends assignment_base {
|
||||||
}
|
}
|
||||||
|
|
||||||
//change status if assignment was graded or returned
|
//change status if assignment was graded or returned
|
||||||
if ($submission->grade != -1 )
|
if ($submission->grade != -1 ) {
|
||||||
$submission->data1 = get_string("submissionstatusmarked", "assignment");
|
$submission->data1 = get_string("submissionstatusmarked", "assignment");
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
$submission->data1 = get_string("submissionstatusreturned", "assignment");
|
$submission->data1 = get_string("submissionstatusreturned", "assignment");
|
||||||
|
}
|
||||||
if ($commenting) {
|
if ($commenting) {
|
||||||
$commentvalue = trim($_POST['comment'][$id]);
|
$commentvalue = trim($_POST['comment'][$id]);
|
||||||
$updatedb = $updatedb || ($submission->comment != stripslashes($commentvalue));
|
$updatedb = $updatedb || ($submission->comment != stripslashes($commentvalue));
|
||||||
|
@ -1044,9 +1052,9 @@ function display_submission() {
|
||||||
$remove_link= '[<a href="'.$deleteurl.'">'.get_string("removelink", "assignment").'</a>]'; //students of the course
|
$remove_link= '[<a href="'.$deleteurl.'">'.get_string("removelink", "assignment").'</a>]'; //students of the course
|
||||||
}
|
}
|
||||||
$output .= '<img align="middle" src="'.$CFG->pixpath.'/f/'.$icon.'" height="16" width="16" alt="'.$icon.'" />'.$file.' ['.$filesize.']'.$remove_link.'<br />';
|
$output .= '<img align="middle" src="'.$CFG->pixpath.'/f/'.$icon.'" height="16" width="16" alt="'.$icon.'" />'.$file.' ['.$filesize.']'.$remove_link.'<br />';
|
||||||
}else
|
} else {
|
||||||
$output .= '';
|
$output .= '';
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1211,9 +1219,9 @@ function display_submission() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//if there is no upload status, then display "blank"
|
//if there is no upload status, then display "blank"
|
||||||
if (empty($auser->upload_status))
|
if (empty($auser->upload_status)) {
|
||||||
$auser->upload_status=get_string("submissionstatusblank", "assignment");
|
$auser->upload_status=get_string("submissionstatusblank", "assignment");
|
||||||
|
}
|
||||||
if (!empty($auser->submissionid)) {
|
if (!empty($auser->submissionid)) {
|
||||||
///Prints student answer and student modified date
|
///Prints student answer and student modified date
|
||||||
///attach file or print link to student answer, depending on the type of the assignment.
|
///attach file or print link to student answer, depending on the type of the assignment.
|
||||||
|
@ -1370,7 +1378,9 @@ function display_submission() {
|
||||||
$action_url = '../../view.php';
|
$action_url = '../../view.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($view == 'student') $this->view_header();
|
if ($view == 'student') {
|
||||||
|
$this->view_header();
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($confirm)) {
|
if (!empty($confirm)) {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue