code cleanup - see SC #110

This commit is contained in:
skodak
2005-07-05 05:44:23 +00:00
parent 3cb97ea9fb
commit 88cfea17a9
3 changed files with 20 additions and 4 deletions
+1
View File
@@ -19,6 +19,7 @@
redirect($CFG->wwwroot.'/course/view.php?id='.$course->id);
}
$form->assignmenttype = clean_param($form->assignmenttype, PARAM_SAFEDIR);
require_once("$CFG->dirroot/mod/assignment/type/$form->assignmenttype/assignment.class.php");
+9 -1
View File
@@ -134,7 +134,9 @@ class assignment_base {
*/
function view_intro() {
print_simple_box_start('center', '', '', '', 'generalbox', 'intro');
echo format_text($this->assignment->description, $this->assignment->format);
$formatoptions = new stdClass;
$formatoptions->noclean = true;
echo format_text($this->assignment->description, $this->assignment->format, $formatoptions);
print_simple_box_end();
}
@@ -279,6 +281,8 @@ class assignment_base {
}
if (empty($form->assignmenttype)) {
$form->assignmenttype = "";
} else {
$form->assignmenttype = clean_param($form->assignmenttype, PARAM_SAFEDIR);
}
if (empty($form->description)) {
$form->description = "";
@@ -325,6 +329,8 @@ class assignment_base {
// will create a new instance and return the id number
// of the new instance.
$assignment->assignmenttype = clean_param($assignment->assignmenttype, PARAM_SAFEDIR);
$assignment->timemodified = time();
if (empty($assignment->dueenable)) {
$assignment->timedue = 0;
@@ -388,6 +394,8 @@ class assignment_base {
// will create a new instance and return the id number
// of the new instance.
$assignment->assignmenttype = clean_param($assignment->assignmenttype, PARAM_SAFEDIR);
$assignment->timemodified = time();
$assignment->timemodified = time();
if (empty($assignment->dueenable)) {
@@ -162,7 +162,7 @@ class assignment_online extends assignment_base {
$output = '<div class="files">'.
'<img align="middle" src="'.$CFG->pixpath.'/f/html.gif" height="16" width="16" alt="html" />'.
link_to_popup_window ('/mod/assignment/type/online/file.php?id='.$this->cm->id.'&amp;userid='.
$submission->userid, 'file'.$userid, shorten_text($submission->data1, 15), 450, 580,
$submission->userid, 'file'.$userid, shorten_text(strip_tags(format_text($submission->data1,$submission->data2)), 15), 450, 580,
get_string('submission', 'assignment'), 'none', true).
'</div>';
@@ -174,8 +174,15 @@ class assignment_online extends assignment_base {
function preprocess_submission(&$submission) {
if ($this->assignment->var1 && empty($submission->comment)) { // comment inline
$submission->comment = $submission->data1; // Copy student data to teacher
$submission->format = $submission->data2;
if ($this->usehtmleditor) {
// Convert to html, clean & copy student data to teacher
$submission->comment = format_text($submission->data1, $submission->data2);
$submission->format = FORMAT_HTML;
} else {
// Copy student data to teacher
$submission->comment = $submission->data1;
$submission->format = $submission->data2;
}
}
}