ÿØÿà JFIF    ÿÛ „  ( %"1!%)+...383,7(-.+  -+++--++++---+-+-----+---------------+---+-++7-----ÿÀ  ß â" ÿÄ     ÿÄ H    !1AQaq"‘¡2B±ÁÑð#R“Ò Tbr‚²á3csƒ’ÂñDS¢³$CÿÄ   ÿÄ %  !1AQa"23‘ÿÚ   ? ôÿ ¨pŸªáÿ —åYõõ\?àÒü©ŠÄï¨pŸªáÿ —åYõõ\?àÓü©ŠÄá 0Ÿªáÿ Ÿå[úƒ ú®ði~TÁbqÐ8OÕpÿ ƒOò¤Oè`–RÂáœá™êi€ßÉ< FtŸI“öÌ8úDf´°å}“¾œ6  öFá°y¥jñÇh†ˆ¢ã/ÃÐ:ªcÈ "Y¡ðÑl>ÿ ”ÏËte:qž\oäŠe÷󲍷˜HT4&ÿ ÓÐü6ö®¿øþßèô Ÿ•7Ñi’•j|“ñì>b…þS?*Óôÿ ÓÐü*h¥£ír¶ü UãS炟[AÐaè[ûª•õ&õj?†Éö+EzP—WeÒírJFt ‘BŒ†Ï‡%#tE Øz ¥OÛ«!1›üä±Í™%ºÍãö]°î(–:@<‹ŒÊö×òÆt¦ãº+‡¦%ÌÁ²h´OƒJŒtMÜ>ÀÜÊw3Y´•牋4ǍýʏTì>œú=Íwhyë,¾Ôò×õ¿ßÊa»«þˆѪQ|%6ž™A õ%:øj<>É—ÿ Å_ˆCbõ¥š±ý¯Ýƒï…¶|RëócÍf溪“t.СøTÿ *Ä¿-{†çàczůŽ_–^XþŒ±miB[X±d 1,é”zEù»& î9gœf™9Ð'.;—™i}!ôšåîqêÛ٤ёý£½ÆA–àôe"A$˝Úsäÿ ÷Û #°xŸëí(l »ý3—¥5m! rt`†0~'j2(]S¦¦kv,ÚÇ l¦øJA£Šƒ J3E8ÙiŽ:cÉžúeZ°€¯\®kÖ(79«Ž:¯X”¾³Š&¡* ….‰Ž(ÜíŸ2¥ª‡×Hi²TF¤ò[¨íÈRëÉ䢍mgÑ.Ÿ<öäS0í„ǹÁU´f#Vß;Õ–…P@3ío<ä-±»Ž.L|kªÀê›fÂ6@»eu‚|ÓaÞÆŸ…¨ááå>åŠ?cKü6ùTÍÆ”†sĤÚ;H2RÚ†õ\Ö·Ÿn'¾ ñ#ºI¤Å´%çÁ­‚â7›‹qT3Iï¨ÖÚ5I7Ë!ÅOóŸ¶øÝñØôת¦$Tcö‘[«Ö³šÒ';Aþ ¸èíg A2Z"i¸vdÄ÷.iõ®§)¿]¤À†–‡É&ä{V¶iŽ”.Ó×Õÿ û?h¬Mt–íª[ÿ Ñÿ ÌV(í}=ibÔ¡›¥¢±b Lô¥‡piη_Z<‡z§èŒ)iÖwiÇ 2hÙ3·=’d÷8éŽ1¦¸c¤µ€7›7Ø ð\á)} ¹fËí›pAÃL%âc2 í§æQz¿;T8sæ°qø)QFMð‰XŒÂ±N¢aF¨…8¯!U  Z©RÊ ÖPVÄÀÍin™Ì-GˆªÅËŠ›•zË}º±ŽÍFò¹}Uw×#ä5B¤{î}Ð<ÙD é©¤&‡ïDbàÁôMÁ.. /** * Defines the editing form for the multiple choice question type. * * @package qtype * @subpackage multichoice * @copyright 2007 Jamie Pratt * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); /** * Multiple choice editing form definition. * * @copyright 2007 Jamie Pratt * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class qtype_multichoice_edit_form extends question_edit_form { /** * Add question-type specific form fields. * * @param object $mform the form being built. */ protected function definition_inner($mform) { $menu = array( get_string('answersingleno', 'qtype_multichoice'), get_string('answersingleyes', 'qtype_multichoice'), ); $mform->addElement('select', 'single', get_string('answerhowmany', 'qtype_multichoice'), $menu); $mform->setDefault('single', $this->get_default_value('single', get_config('qtype_multichoice', 'answerhowmany'))); $mform->addElement('advcheckbox', 'shuffleanswers', get_string('shuffleanswers', 'qtype_multichoice'), null, null, array(0, 1)); $mform->addHelpButton('shuffleanswers', 'shuffleanswers', 'qtype_multichoice'); $mform->setDefault('shuffleanswers', $this->get_default_value('shuffleanswers', get_config('qtype_multichoice', 'shuffleanswers'))); $mform->addElement('select', 'answernumbering', get_string('answernumbering', 'qtype_multichoice'), qtype_multichoice::get_numbering_styles()); $mform->setDefault('answernumbering', $this->get_default_value('answernumbering', get_config('qtype_multichoice', 'answernumbering'))); $mform->addElement('selectyesno', 'showstandardinstruction', get_string('showstandardinstruction', 'qtype_multichoice'), null, null, [0, 1]); $mform->addHelpButton('showstandardinstruction', 'showstandardinstruction', 'qtype_multichoice'); $mform->setDefault('showstandardinstruction', $this->get_default_value('showstandardinstruction', get_config('qtype_multichoice', 'showstandardinstruction'))); $this->add_per_answer_fields($mform, get_string('choiceno', 'qtype_multichoice', '{no}'), question_bank::fraction_options_full(), max(5, QUESTION_NUMANS_START)); $this->add_combined_feedback_fields(true); $mform->disabledIf('shownumcorrect', 'single', 'eq', 1); $this->add_interactive_settings(true, true); } protected function get_per_answer_fields($mform, $label, $gradeoptions, &$repeatedoptions, &$answersoption) { $repeated = array(); $repeated[] = $mform->createElement('editor', 'answer', $label, ['rows' => 2], $this->editoroptions); $repeated[] = $mform->createElement('select', 'fraction', get_string('gradenoun'), $gradeoptions); $repeated[] = $mform->createElement('editor', 'feedback', get_string('feedback', 'question'), ['rows' => 2], $this->editoroptions); $repeatedoptions['answer']['type'] = PARAM_RAW; $repeatedoptions['fraction']['default'] = 0; $answersoption = 'answers'; return $repeated; } protected function get_hint_fields($withclearwrong = false, $withshownumpartscorrect = false) { list($repeated, $repeatedoptions) = parent::get_hint_fields($withclearwrong, $withshownumpartscorrect); $repeatedoptions['hintclearwrong']['disabledif'] = array('single', 'eq', 1); $repeatedoptions['hintshownumcorrect']['disabledif'] = array('single', 'eq', 1); return array($repeated, $repeatedoptions); } protected function data_preprocessing($question) { $question = parent::data_preprocessing($question); $question = $this->data_preprocessing_answers($question, true); $question = $this->data_preprocessing_combined_feedback($question, true); $question = $this->data_preprocessing_hints($question, true, true); if (!empty($question->options)) { $question->single = $question->options->single; $question->shuffleanswers = $question->options->shuffleanswers; $question->answernumbering = $question->options->answernumbering; $question->showstandardinstruction = $question->options->showstandardinstruction; } return $question; } public function validation($data, $files) { $errors = parent::validation($data, $files); $answers = $data['answer']; $answercount = 0; $totalfraction = 0; $maxfraction = -1; foreach ($answers as $key => $answer) { // Check no of choices. $trimmedanswer = trim($answer['text']); $fraction = (float) $data['fraction'][$key]; if ($trimmedanswer === '' && empty($fraction)) { continue; } if ($trimmedanswer === '') { $errors['fraction['.$key.']'] = get_string('errgradesetanswerblank', 'qtype_multichoice'); } $answercount++; // Check grades. if ($data['fraction'][$key] > 0) { $totalfraction += $data['fraction'][$key]; } if ($data['fraction'][$key] > $maxfraction) { $maxfraction = $data['fraction'][$key]; } } if ($answercount == 0) { $errors['answer[0]'] = get_string('notenoughanswers', 'qtype_multichoice', 2); $errors['answer[1]'] = get_string('notenoughanswers', 'qtype_multichoice', 2); } else if ($answercount == 1) { $errors['answer[1]'] = get_string('notenoughanswers', 'qtype_multichoice', 2); } // Perform sanity checks on fractional grades. if ($data['single']) { if ($maxfraction != 1) { $errors['fraction[0]'] = get_string('errfractionsnomax', 'qtype_multichoice', $maxfraction * 100); } } else { $totalfraction = round($totalfraction, 2); if ($totalfraction != 1) { $errors['fraction[0]'] = get_string('errfractionsaddwrong', 'qtype_multichoice', $totalfraction * 100); } } return $errors; } public function qtype() { return 'multichoice'; } }