~ubuntu-branches/ubuntu/natty/moodle/natty

« back to all changes in this revision

Viewing changes to question/type/multichoice/edit_multichoice_form.php

  • Committer: Bazaar Package Importer
  • Author(s): Tomasz Muras
  • Date: 2010-10-30 12:19:28 UTC
  • mfrom: (1.1.12 upstream) (3.1.10 squeeze)
  • Revision ID: james.westby@ubuntu.com-20101030121928-qzobi6mctpnk4dif
Tags: 1.9.9.dfsg2-2
* Added Romanian translation
* Updated Japanese translation (closes: #596820)
* Backporting security fixes from Moodle 1.9.10 (closes: #601384)
   - Updated embedded CAS to 1.1.3
   - Added patch for MDL-24523:
     clean_text() not filtering text in markdown format
   - Added patch for MDL-24810 and upgraded customized HTML Purifier to 4.2.0 
   - Added patch for MDL-24258:
     students can delete their forum posts later than $CFG->maxeditingtime 
     under certain conditions
   - Added patch for MDL-23377:
     Can't delete quiz attempts in course without enrolled students

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
 
1
<?php  // $Id: edit_multichoice_form.php,v 1.12.2.4 2009/02/19 01:09:34 tjhunt Exp $
2
2
/**
3
3
 * Defines the editing form for the multichoice question type.
4
4
 *
41
41
        $mform->closeHeaderBefore('answersinstruct');
42
42
*/
43
43
        $creategrades = get_grade_options();
44
 
        $gradeoptions = $creategrades->gradeoptionsfull;
45
 
        $repeated = array();
46
 
        $repeated[] =& $mform->createElement('header', 'choicehdr', get_string('choiceno', 'qtype_multichoice', '{no}'));
47
 
        $repeated[] =& $mform->createElement('text', 'answer', get_string('answer', 'quiz'), array('size' => 50));
48
 
        $repeated[] =& $mform->createElement('select', 'fraction', get_string('grade'), $gradeoptions);
49
 
        $repeated[] =& $mform->createElement('htmleditor', 'feedback', get_string('feedback', 'quiz'),
50
 
                                array('course' => $this->coursefilesid));
51
 
 
52
 
        if (isset($this->question->options)){
53
 
            $countanswers = count($this->question->options->answers);
54
 
        } else {
55
 
            $countanswers = 0;
56
 
        }
57
 
        if ($this->question->formoptions->repeatelements){
58
 
            $repeatsatstart = max(5, QUESTION_NUMANS_START, $countanswers + QUESTION_NUMANS_ADD);
59
 
        } else {
60
 
            $repeatsatstart = $countanswers;
61
 
        }
62
 
        $repeatedoptions = array();
63
 
        $repeatedoptions['fraction']['default'] = 0;
64
 
        $mform->setType('answer', PARAM_RAW);
65
 
        $this->repeat_elements($repeated, $repeatsatstart, $repeatedoptions, 'noanswers', 'addanswers', QUESTION_NUMANS_ADD, get_string('addmorechoiceblanks', 'qtype_multichoice'));
 
44
        $this->add_per_answer_fields($mform, get_string('choiceno', 'qtype_multichoice', '{no}'),
 
45
                $creategrades->gradeoptionsfull, max(5, QUESTION_NUMANS_START));
66
46
 
67
47
        $mform->addElement('header', 'overallfeedbackhdr', get_string('overallfeedback', 'qtype_multichoice'));
68
48
 
69
 
        $mform->addElement('htmleditor', 'correctfeedback', get_string('correctfeedback', 'qtype_multichoice'),
70
 
                                array('course' => $this->coursefilesid));
71
 
        $mform->setType('correctfeedback', PARAM_RAW);
72
 
 
73
 
        $mform->addElement('htmleditor', 'partiallycorrectfeedback', get_string('partiallycorrectfeedback', 'qtype_multichoice'),
74
 
                                array('course' => $this->coursefilesid));
75
 
        $mform->setType('partiallycorrectfeedback', PARAM_RAW);
76
 
 
77
 
        $mform->addElement('htmleditor', 'incorrectfeedback', get_string('incorrectfeedback', 'qtype_multichoice'),
78
 
                                array('course' => $this->coursefilesid));
79
 
        $mform->setType('incorrectfeedback', PARAM_RAW);
 
49
        foreach (array('correctfeedback', 'partiallycorrectfeedback', 'incorrectfeedback') as $feedbackname) {
 
50
            $mform->addElement('htmleditor', $feedbackname, get_string($feedbackname, 'qtype_multichoice'),
 
51
                                array('course' => $this->coursefilesid));
 
52
            $mform->setType($feedbackname, PARAM_RAW);
 
53
        }
80
54
 
81
55
    }
82
56