adding capability, indenting, putting in brackets etc

This commit is contained in:
toyomoyo 2006-08-29 03:20:51 +00:00
parent d63545d8e8
commit 38ac07d284

View file

@ -6,7 +6,6 @@
*/
class assignment_upload extends assignment_base {
function print_student_answer($userid, $return=false){
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
if (!$submission->data1)
if (!$submission->data1) {
$submission_status = get_string('submissionstatusblank','assignment');
else
}
else {
$submission_status = $submission->data1;
}
//display submisison status
notify("<b>".get_string('submissionstatus', 'assignment')." </b> ".$submission_status);
@ -142,7 +143,8 @@ class assignment_upload extends assignment_base {
global $offset;
//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();
@ -154,10 +156,9 @@ class assignment_upload extends assignment_base {
} else {
//if this is upload of teacher's response
$id = optional_param('id'); // Course module ID
$a = optional_param('a'); // Assignment ID
$userid = required_param('userid'); // Stores student id for uploading a review file to
$id = optional_param('id', 0, PARAM_INT); // Course module ID
$a = optional_param('a', 0, PARAM_INT); // Assignment ID
$userid = required_param('userid', 0, PARAM_INT); // Stores student id for uploading a review file to
$this->response_upload($userid); // Upload files
echo "<form action=\"submissions.php\">";
echo "<input type=\"hidden\" value=\"$userid\" name=\"userid\">";
@ -172,9 +173,7 @@ class assignment_upload extends assignment_base {
function submission_upload() {
global $CFG, $USER, $counter;
if (isguest($USER->id)) {
error(get_string('guestnoupload','assignment'));
}
require_capability('mod/assignment:submit', get_context_instance(CONTEXT_MODULE, $this->cm->id));
$this->view_header(get_string('upload'));
@ -207,16 +206,23 @@ class assignment_upload extends assignment_base {
//$submission->timemodified = time();
$flag=false;
foreach ($files as $key => $file) {
if ($file == $newfile_name)
if ($file == $newfile_name) {
$flag = true;
}
}
//if this is an assignment for single upload
if (!$this->assignment->var1) {
//if numfiles=1
if ( $submission->numfiles==0 && !$flag) $submission->numfiles ++;
}else
if ($submission->numfiles==0 && !$flag) {
$submission->numfiles ++;
}
} else {
//if file with the same name has not been uploaded before
if (!$flag) $submission->numfiles ++;
if (!$flag) {
$submission->numfiles ++;
}
}
$submission->comment = addslashes($submission->comment);
unset($submission->data1); // 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->timemarked = time();
//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");
else
}
else {
$newsubmission->data1 = get_string("submissionstatusreturned", "assignment");
}
//unset($newsubmission->data1); // 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
if ($submission->grade != -1 )
if ($submission->grade != -1 ) {
$submission->data1 = get_string("submissionstatusmarked", "assignment");
else
}
else {
$submission->data1 = get_string("submissionstatusreturned", "assignment");
}
if ($commenting) {
$commentvalue = trim($_POST['comment'][$id]);
$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
}
$output .= '<img align="middle" src="'.$CFG->pixpath.'/f/'.$icon.'" height="16" width="16" alt="'.$icon.'" />'.$file.' ['.$filesize.']'.$remove_link.'<br />';
}else
} else {
$output .= '';
// }
}
}
}
}
@ -1211,9 +1219,9 @@ function display_submission() {
}
//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");
}
if (!empty($auser->submissionid)) {
///Prints student answer and student modified date
///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';
}
if ($view == 'student') $this->view_header();
if ($view == 'student') {
$this->view_header();
}
if (!empty($confirm)) {