Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Removed bunch of tabs and sorted out badly formatted comments

Provides fix for bug MDL-5893
  • Loading branch information...
commit ea8e7f99362f295b1708e563b04d4ea10c9c6ca5 1 parent 0d2b432
thepurpleblob authored

Showing 1 changed file with 106 additions and 218 deletions. Show diff stats Hide diff stats

  1. +106 218 question/format/blackboard_6/format.php
324 question/format/blackboard_6/format.php
@@ -35,10 +35,8 @@ function check_and_create_import_dir($unique_code) {
35 35 }
36 36
37 37 function clean_temp_dir($dir='') {
38   - // this needs to be reworked
39   -
40   -
41   - // for now we will just say everything happened okay note that a mess may be piling up in $CFG->dataroot/temp/bbquiz_import
  38 + // for now we will just say everything happened okay note
  39 + // that a mess may be piling up in $CFG->dataroot/temp/bbquiz_import
42 40 return true;
43 41
44 42 if ($dir == '') {
@@ -210,14 +208,12 @@ function readquestions ($lines) {
210 208 $xml = xmlize($text, 0);
211 209
212 210 $raw_questions = $xml['questestinterop']['#']['assessment'][0]['#']['section'][0]['#']['item'];
213   - //echo "Line 213: Raw Questions <br>";
214   - //print_object($raw_questions);
215 211 $questions = array();
216 212
217 213 foreach($raw_questions as $quest) {
218 214 $question = $this->create_raw_question($quest);
219   -
220   - switch($question->qtype) {
  215 +
  216 + switch($question->qtype) {
221 217 case "Matching":
222 218 $this->process_matching($question, $questions);
223 219 break;
@@ -242,8 +238,6 @@ function readquestions ($lines) {
242 238 }
243 239
244 240 }
245   - //echo "readquestions:";
246   - //print_object ($questions);
247 241 return $questions;
248 242 }
249 243
@@ -252,24 +246,24 @@ function readquestions ($lines) {
252 246 // the object created is NOT a moodle question object
253 247 function create_raw_question($quest) {
254 248
255   - $question = $this->defaultquestion();
  249 + $question = $this->defaultquestion();
256 250 $question->qtype = $quest['#']['itemmetadata'][0]['#']['bbmd_questiontype'][0]['#'];
257 251 $presentation->blocks = $quest['#']['presentation'][0]['#']['flow'][0]['#']['flow'];
258   -
259   - foreach($presentation->blocks as $pblock) {
  252 +
  253 + foreach($presentation->blocks as $pblock) {
260 254
261 255 $block = NULL;
262 256 $block->type = $pblock['@']['class'];
263   -
  257 +
264 258 switch($block->type) {
265 259 case 'QUESTION_BLOCK':
266 260 $sub_blocks = $pblock['#']['flow'];
267 261 foreach($sub_blocks as $sblock) {
268   - //echo "Calling process_block from line 263<br>";
  262 + //echo "Calling process_block from line 263<br>";
269 263 $this->process_block($sblock, $block);
270 264 }
271 265 break;
272   -
  266 +
273 267 case 'RESPONSE_BLOCK':
274 268 $choices = NULL;
275 269 switch($question->qtype) {
@@ -277,9 +271,8 @@ function create_raw_question($quest) {
277 271 $bb_subquestions = $pblock['#']['flow'];
278 272 $sub_questions = array();
279 273 foreach($bb_subquestions as $bb_subquestion) {
280   - $sub_question = NULL;
  274 + $sub_question = NULL;
281 275 $sub_question->ident = $bb_subquestion['#']['response_lid'][0]['@']['ident'];
282   - //echo "Calling process_block from line 277<br>";
283 276 $this->process_block($bb_subquestion['#']['flow'][0], $sub_question);
284 277 $bb_choices = $bb_subquestion['#']['response_lid'][0]['#']['render_choice'][0]['#']['flow_label'][0]['#']['response_label'];
285 278 $choices = array();
@@ -295,23 +288,17 @@ function create_raw_question($quest) {
295 288 $bb_choices = $pblock['#']['response_lid'][0]['#']['render_choice'][0]['#']['flow_label'];
296 289 $choices = array();
297 290 $this->process_choices($bb_choices, $choices);
298   - $block->choices = $choices;
299   -
300   - break;
  291 + $block->choices = $choices;
  292 + break;
301 293 case 'Essay':
302 294 // Doesn't apply since the user responds with text input
303 295 break;
304 296 case 'Multiple Choice':
305 297 $mc_choices = $pblock['#']['response_lid'][0]['#']['render_choice'][0]['#']['flow_label'];
306   -
307   - foreach($mc_choices as $mc_choice) {
  298 + foreach($mc_choices as $mc_choice) {
308 299 $choices = NULL;
309   -
310   -
311   -
312   - //echo "Calling process_block from line 307<br>";
313   - $choices = $this->process_block($mc_choice, $choices);
314   - $block->choices[] = $choices;
  300 + $choices = $this->process_block($mc_choice, $choices);
  301 + $block->choices[] = $choices;
315 302 }
316 303 break;
317 304 case 'Fill in the Blank':
@@ -328,7 +315,6 @@ function create_raw_question($quest) {
328 315 $matching_answerset = $pblock['#']['flow'];
329 316 $answerset = array();
330 317 foreach($matching_answerset as $answer) {
331   - //echo "Calling process_block from line 235<br>";
332 318 $this->process_block($answer, $bb_answer);
333 319 $answerset[] = $bb_answer;
334 320 }
@@ -344,12 +330,8 @@ function create_raw_question($quest) {
344 330 // determine response processing
345 331 // there is a section called 'outcomes' that I don't know what to do with
346 332 $resprocessing = $quest['#']['resprocessing'];
347   -
348   - $respconditions = $resprocessing[0]['#']['respcondition'];
349   - //echo "Line 347: respconditions<br>";
350   - //print_object ($respconditions);
351   -
352   - $reponses = array();
  333 + $respconditions = $resprocessing[0]['#']['respcondition'];
  334 + $reponses = array();
353 335 if ($question->qtype == 'Matching') {
354 336 $this->process_matching_responses($respconditions, $responses);
355 337 }
@@ -357,35 +339,26 @@ function create_raw_question($quest) {
357 339 $this->process_responses($respconditions, $responses);
358 340 }
359 341 $question->responses = $responses;
360   -
361 342 $feedbackset = $quest['#']['itemfeedback'];
362   -
363   - $feedbacks = array();
364   -
365   - //echo "Line 362: Calling Process Feedback:<br>";
366   - $this->process_feedback($feedbackset, $feedbacks);
  343 + $feedbacks = array();
  344 + $this->process_feedback($feedbackset, $feedbacks);
367 345 $question->feedback = $feedbacks;
368   -
369   - //echo "Line 358: ";
370   - //print_object($question);
371 346 return $question;
372 347 }
373 348
374 349 function process_block($cur_block, &$block) {
375   -
  350 + global $course, $CFG;
  351 +
376 352 $cur_type = $cur_block['@']['class'];
377   -
378   - global $course, $CFG;
379 353 switch($cur_type) {
380 354 case 'FORMATTED_TEXT_BLOCK':
381 355 $block->text = $this->strip_applet_tags_get_mathml($cur_block['#']['material'][0]['#']['mat_extension'][0]['#']['mat_formattedtext'][0]['#']);
382   - //echo "Line 378: " . $block->text . '<br>';
383   - break;
  356 + break;
384 357 case 'FILE_BLOCK':
385 358 //revisit this to make sure it is working correctly
386   -
387   - // Commented out ['matapplication']..., etc. because I noticed that when I imported a new Blackboard 6 file
388   - // and printed out the block, the tree did not extend past ['material'][0]['#'] - CT 8/3/06
  359 + // Commented out ['matapplication']..., etc. because I
  360 + // noticed that when I imported a new Blackboard 6 file
  361 + // and printed out the block, the tree did not extend past ['material'][0]['#'] - CT 8/3/06
389 362 $block->file = $cur_block['#']['material'][0]['#'];//['matapplication'][0]['@']['uri'];
390 363 if ($block->file != '') {
391 364 // if we have a file copy it to the course dir and adjust its name to be visible over the web.
@@ -394,12 +367,8 @@ function process_block($cur_block, &$block) {
394 367 }
395 368 break;
396 369 case 'Block':
397   -
398   - if (isset($cur_block['#']['material'][0]['#']['mattext'][0]['#'])) {
399   - $block->text = $cur_block['#']['material'][0]['#']['mattext'][0]['#'];
400   -
401   - //echo "line 379 - isset:" . isset($block->text);
402   - //echo "Type: " . $cur_type . " Is Object:" . is_object($block) . "<br>\r\n";
  370 + if (isset($cur_block['#']['material'][0]['#']['mattext'][0]['#'])) {
  371 + $block->text = $cur_block['#']['material'][0]['#']['mattext'][0]['#'];
403 372 }
404 373 else if (isset($cur_block['#']['material'][0]['#']['mat_extension'][0]['#']['mat_formattedtext'][0]['#'])) {
405 374 $block->text = $cur_block['#']['material'][0]['#']['mat_extension'][0]['#']['mat_formattedtext'][0]['#'];
@@ -410,16 +379,9 @@ function process_block($cur_block, &$block) {
410 379 if(!isset($block->ident)) {
411 380 if(isset($sub_blocks['@']['ident'])) {
412 381 $block->ident = $sub_blocks['@']['ident'];
413   - //echo "Line 409: <br>";
414   - //print_object($cur_block);
415 382 }
416 383 }
417 384 foreach($sub_blocks['#']['flow_mat'] as $sub_block) {
418   - //echo "Calling process_block from line 404<br>";
419   - //$block = null; // Reset $block to NULL because process_block is expecting an object
420   - // for the second argument and not a string, which is what is was set as
421   - // originally
422   -
423 385 $this->process_block($sub_block, $block);
424 386 }
425 387 }
@@ -433,7 +395,6 @@ function process_block($cur_block, &$block) {
433 395 }
434 396 foreach ($sub_blocks as $sblock) {
435 397 // this will recursively grab the sub blocks which should be of one of the other types
436   - //echo "Calling process_block from line 419<br>";
437 398 $this->process_block($sblock, $block);
438 399 }
439 400 }
@@ -449,33 +410,30 @@ function process_block($cur_block, &$block) {
449 410 }
450 411 break;
451 412 }
452   - //echo "Line 446: " . $block->text . '<br>';
453   - return $block;
  413 + return $block;
454 414 }
455 415
456 416 function process_choices($bb_choices, &$choices) {
457   -
458   - foreach($bb_choices as $choice) {
459   - if (isset($choice['@']['ident'])) {
  417 + foreach($bb_choices as $choice) {
  418 + if (isset($choice['@']['ident'])) {
460 419 $cur_choice = $choice['@']['ident'];
461 420 }
462   - else { //for multiple answer
  421 + else { //for multiple answer
463 422 $cur_choice = $choice['#']['response_label'][0];//['@']['ident'];
464   - //echo "['#']['response_label'][0]['@']['ident']<br>\r\n";
465 423 }
466   - if (isset($choice['#']['flow_mat'][0])) { //for multiple answer
  424 + if (isset($choice['#']['flow_mat'][0])) { //for multiple answer
467 425 $cur_block = $choice['#']['flow_mat'][0];
468   - $cur_choice = null; // Reset $cur_choice to NULL because process_block is expecting an object
469   - // for the second argument and not a string, which is what is was set as
470   - // originally - CT 8/7/06
471   - //echo "Calling process_block from line 448<br>";
472   - $this->process_block($cur_block, $cur_choice);
  426 + // Reset $cur_choice to NULL because process_block is expecting an object
  427 + // for the second argument and not a string, which is what is was set as
  428 + // originally - CT 8/7/06
  429 + $cur_choice = null;
  430 + $this->process_block($cur_block, $cur_choice);
473 431 }
474 432 elseif (isset($choice['#']['response_label'])) {
475   - $cur_choice = null; // Reset $cur_choice to NULL because process_block is expecting an object
476   - // for the second argument and not a string, which is what is was set as
477   - // originally - CT 8/7/06
478   - //echo "Calling process_block from line 452<br>";
  433 + // Reset $cur_choice to NULL because process_block is expecting an object
  434 + // for the second argument and not a string, which is what is was set as
  435 + // originally - CT 8/7/06
  436 + $cur_choice = null;
479 437 $this->process_block($choice, $cur_choice);
480 438 }
481 439 $choices[] = $cur_choice;
@@ -483,8 +441,6 @@ function process_choices($bb_choices, &$choices) {
483 441 }
484 442
485 443 function process_matching_responses($bb_responses, &$responses) {
486   - //echo "Line 486: Matching!<br>";
487   - //print_object($bb_responses);
488 444 foreach($bb_responses as $bb_response) {
489 445 $response = NULL;
490 446 if (isset($bb_response['#']['conditionvar'][0]['#']['varequal'])) {
@@ -501,15 +457,12 @@ function process_matching_responses($bb_responses, &$responses) {
501 457 }
502 458
503 459 function process_responses($bb_responses, &$responses) {
504   -
505   - foreach($bb_responses as $bb_response) {
506   - $response = null; //Added this line to instantiate $response.
507   - // Without instantiating the $response variable, the same object
508   - // gets added to the array
509   - //echo "Line 504: bb_response<br>";
510   - //print_object ($bb_response);
511   -
512   - if (isset($bb_response['@']['title'])) {
  460 + foreach($bb_responses as $bb_response) {
  461 + //Added this line to instantiate $response.
  462 + // Without instantiating the $response variable, the same object
  463 + // gets added to the array
  464 + $response = null;
  465 + if (isset($bb_response['@']['title'])) {
513 466 $response->title = $bb_response['@']['title'];
514 467 }
515 468 else {
@@ -543,7 +496,8 @@ function process_responses($bb_responses, &$responses) {
543 496 $response->fraction = 1;
544 497 break;
545 498 default:
546   - // I have only seen this being 0 or unset there are probably fractional values of SCORE.max, but I'm not sure what they look like
  499 + // I have only seen this being 0 or unset
  500 + // there are probably fractional values of SCORE.max, but I'm not sure what they look like
547 501 $response->fraction = 0;
548 502 break;
549 503 }
@@ -553,40 +507,24 @@ function process_responses($bb_responses, &$responses) {
553 507 $response->fraction = 0;
554 508 }
555 509
556   -
557   -
558 510 $responses[] = $response;
559   - //echo "Line 554: $responses<br>";
560   - //print_object ($responses);
561 511 }
562 512 }
563 513
564 514 function process_feedback($feedbackset, &$feedbacks) {
565   - //echo "Line 551: In Process Feedback<br>";
566   - //echo "Line 552: feedbacks<br>";
567   - //print_object($feedbacks);
568 515 foreach($feedbackset as $bb_feedback) {
569   - $feedback = null; // Added line $feedback=null so that $feedback does not get reused in the loop
570   - // and added the the $feedbacks[] array multiple times
571   - $feedback->ident = $bb_feedback['@']['ident'];
572   - //echo "Line 558: " . $feedback->ident . "<br>\r\n";
  516 + // Added line $feedback=null so that $feedback does not get reused in the loop
  517 + // and added the the $feedbacks[] array multiple times
  518 + $feedback = null;
  519 + $feedback->ident = $bb_feedback['@']['ident'];
573 520 if (isset($bb_feedback['#']['flow_mat'][0])) {
574   - //echo "Calling process_block from line 531<br>";
575 521 $this->process_block($bb_feedback['#']['flow_mat'][0], $feedback);
576   -
577 522 }
578 523 elseif (isset($bb_feedback['#']['solution'][0]['#']['solutionmaterial'][0]['#']['flow_mat'][0])) {
579   - //echo "Calling process_block from line 535<br>";
580 524 $this->process_block($bb_feedback['#']['solution'][0]['#']['solutionmaterial'][0]['#']['flow_mat'][0], $feedback);
581 525 }
582 526 $feedbacks[] = $feedback;
583   -
584   - //echo "Line 568: feedbacks<br>";
585   - //print_object($feedbacks);
586 527 }
587   - //echo "Line 571: feedbacks<br>";
588   - //print_object($feedbacks);
589   -
590 528 }
591 529
592 530 //----------------------------------------
@@ -597,9 +535,9 @@ function process_tf($quest, &$questions) {
597 535
598 536 $question->qtype = TRUEFALSE;
599 537 $question->defaultgrade = 1;
600   - $question->single = 1; // Only one answer is allowed
601   - $question->image = ""; // No images with this format
602   - $question->questiontext = addslashes($quest->QUESTION_BLOCK->text);
  538 + $question->single = 1; // Only one answer is allowed
  539 + $question->image = ""; // No images with this format
  540 + $question->questiontext = addslashes($quest->QUESTION_BLOCK->text);
603 541 // put name in question object
604 542 $question->name = $question->questiontext;
605 543
@@ -632,11 +570,7 @@ function process_tf($quest, &$questions) {
632 570 // Process Fill in the Blank
633 571 //----------------------------------------
634 572 function process_fblank($quest, &$questions) {
635   -
636   - //echo "Line 633: Quest<br>";
637   - //print_object($quest);
638   -
639   - $question = $this->defaultquestion();
  573 + $question = $this->defaultquestion();
640 574 $question->qtype = SHORTANSWER;
641 575 $question->defaultgrade = 1;
642 576 $question->single = 1;
@@ -652,56 +586,45 @@ function process_fblank($quest, &$questions) {
652 586 $feedback = array();
653 587 foreach($quest->feedback as $fback) {
654 588 if (isset($fback->ident)) {
655   - if ($fback->ident == 'correct' || $fback->ident == 'incorrect')
656   - {
657   - $feedback[$fback->ident] = $fback->text;
658   - }
  589 + if ($fback->ident == 'correct' || $fback->ident == 'incorrect') {
  590 + $feedback[$fback->ident] = $fback->text;
  591 + }
659 592 }
660 593 }
661 594
662 595 foreach($quest->responses as $response) {
663 596 if(isset($response->title)) {
664   -
665   - if (isset($response->ident[0]['varequal'][0]['#']))
666   - {
667   - //for BB Fill in the Blank, only interested in correct answers
668   - if ($response->feedback = 'correct')
669   - {
670   - $answers[] = addslashes($response->ident[0]['varequal'][0]['#']);
671   - $fractions[] = 1;
672   - if (isset($feedback['correct']))
673   - {
674   - $feedbacks[] = addslashes($feedback['correct']);
675   - }
676   - else
677   - {
678   - $feedbacks[] = '';
679   - }
680   - }
681   - }
  597 + if (isset($response->ident[0]['varequal'][0]['#'])) {
  598 + //for BB Fill in the Blank, only interested in correct answers
  599 + if ($response->feedback = 'correct') {
  600 + $answers[] = addslashes($response->ident[0]['varequal'][0]['#']);
  601 + $fractions[] = 1;
  602 + if (isset($feedback['correct'])) {
  603 + $feedbacks[] = addslashes($feedback['correct']);
  604 + }
  605 + else {
  606 + $feedbacks[] = '';
  607 + }
  608 + }
  609 + }
682 610
683 611 }
684 612 }
685   -
686   - //Adding catchall to so that students can see feedback for incorrect answers when they enter something the
687   - //instructor did not enter
688   -
689   - $answers[] = '*';
690   - $fractions[] = 0;
691   - if (isset($feedback['incorrect']))
692   - {
693   - $feedbacks[] = addslashes($feedback['incorrect']);
694   - }
695   - else
696   - {
697   - $feedbacks[] = '';
698   - }
  613 +
  614 + //Adding catchall to so that students can see feedback for incorrect answers when they enter something the
  615 + //instructor did not enter
  616 + $answers[] = '*';
  617 + $fractions[] = 0;
  618 + if (isset($feedback['incorrect'])) {
  619 + $feedbacks[] = addslashes($feedback['incorrect']);
  620 + }
  621 + else {
  622 + $feedbacks[] = '';
  623 + }
699 624
700 625 $question->answer = $answers;
701 626 $question->fraction = $fractions;
702   - $question->feedback = $feedbacks; // Changed to assign $feedbacks to $question->feedback instead of
703   - // $feedback - CT 8/10/06
704   -// $question->feedback = $feedback;
  627 + $question->feedback = $feedbacks; // Changed to assign $feedbacks to $question->feedback instead of
705 628
706 629 if (!empty($question)) {
707 630 $questions[] = $question;
@@ -713,10 +636,7 @@ function process_fblank($quest, &$questions) {
713 636 // Process Multiple Choice Questions
714 637 //----------------------------------------
715 638 function process_mc($quest, &$questions) {
716   - //echo "Line 667: Quest<br>";
717   - //print_object($quest);
718   -
719   - $question = $this->defaultquestion();
  639 + $question = $this->defaultquestion();
720 640 $question->qtype = MULTICHOICE;
721 641 $question->defaultgrade = 1;
722 642 $question->single = 1;
@@ -728,16 +648,12 @@ function process_mc($quest, &$questions) {
728 648 foreach($quest->feedback as $fback) {
729 649 $feedback[$fback->ident] = addslashes($fback->text);
730 650 }
731   -
732   - //echo "Line 683: feedback<br>";
733   - //print_object($feedback);
734 651
735 652 foreach($quest->responses as $response) {
736   -
737 653 if (isset($response->title)) {
738 654 if ($response->title == 'correct') {
739 655 // only one answer possible for this qtype so first index is correct answer
740   - $correct = $response->ident[0]['varequal'][0]['#']; // added [0]['varequal'][0]['#'] to $response->ident - CT 8/9/06
  656 + $correct = $response->ident[0]['varequal'][0]['#'];
741 657 }
742 658 }
743 659 else {
@@ -748,13 +664,10 @@ function process_mc($quest, &$questions) {
748 664 }
749 665 }
750 666 }
751   -
752   - //echo "Line 706: Correct:" . $correct . "<br>";
753 667
754 668 $i = 0;
755 669 foreach($quest->RESPONSE_BLOCK->choices as $response) {
756   -
757   - $question->answer[$i] = addslashes($response->text);
  670 + $question->answer[$i] = addslashes($response->text);
758 671 if ($correct == $response->ident) {
759 672 $question->fraction[$i] = 1;
760 673 // this is a bit of a hack to catch the feedback... first we see if a 'correct' feedback exists
@@ -796,29 +709,21 @@ function process_mc($quest, &$questions) {
796 709 // Process Multiple Choice Questions With Multiple Answers
797 710 //----------------------------------------
798 711 function process_ma($quest, &$questions) {
799   -
800   - //echo "Line 763: Quest<br>";
801   - //print_object($quest);
802   -
803   - $question = $this->defaultquestion(); // copied this from process_mc
804   - // noticed it was missing - CT 8/8/06
  712 + $question = $this->defaultquestion(); // copied this from process_mc
805 713 $question->questiontext = addslashes($quest->QUESTION_BLOCK->text);
806 714 $question->name = $question->questiontext;
807 715 $question->qtype = MULTICHOICE;
808 716 $question->defaultgrade = 1;
809   - $question->single = 0; // More than one answer allowed
810   - $question->image = ""; // No images with this format
  717 + $question->single = 0; // More than one answer allowed
  718 + $question->image = ""; // No images with this format
811 719
812 720 $answers = $quest->responses;
813 721 $correct_answers = array();
814 722 foreach($answers as $answer) {
815   -
816   - //echo 'Line 779: $answer<br>';
817   - //print_object($answer);
818 723 if($answer->title == 'correct') {
819   - $answerset = $answer->ident[0]['and'][0]['#']['varequal']; // added [0]['and'][0]['#']['varequal'] to $answer->ident - CT 8/9/06
  724 + $answerset = $answer->ident[0]['and'][0]['#']['varequal'];
820 725 foreach($answerset as $ans) {
821   - $correct_answers[] = $ans['#']; // added ['#'] to $ans - CT 8/9/06
  726 + $correct_answers[] = $ans['#'];
822 727 }
823 728 }
824 729 }
@@ -846,8 +751,6 @@ function process_ma($quest, &$questions) {
846 751 }
847 752
848 753 $questions[] = $question;
849   - //echo "Line 807: question<br>";
850   - //print_object($question);
851 754 }
852 755
853 756 //----------------------------------------
@@ -856,18 +759,13 @@ function process_ma($quest, &$questions) {
856 759 function process_essay($quest, &$questions) {
857 760 // this should be rewritten to accomodate moodle 1.6 essay question type eventually
858 761
859   - //echo "Line 822: Quest<br>";
860   - //print_object($quest);
861   -
862 762 if (defined("ESSAY")) {
863 763 // treat as short answer
864   -
865   - $question = $this->defaultquestion(); // copied this from process_mc
866   - // noticed it was missing - CT 8/8/06
  764 + $question = $this->defaultquestion(); // copied this from process_mc
867 765 $question->qtype = ESSAY;
868 766 $question->defaultgrade = 1;
869   - $question->usecase = 0; // Ignore case
870   - $question->image = ""; // No images with this format
  767 + $question->usecase = 0; // Ignore case
  768 + $question->image = ""; // No images with this format
871 769 $question->questiontext = addslashes(trim($quest->QUESTION_BLOCK->text));
872 770 $question->name = $question->questiontext;
873 771
@@ -876,24 +774,18 @@ function process_essay($quest, &$questions) {
876 774 $question->feedback = array();
877 775 // not sure where to get the correct answer from
878 776 foreach($quest->feedback as $feedback) {
879   -
880   - // Added this code to put the possible solution that the instructor gives as the Moodle answer for an essay question
881   - // - CT 8/9/06
882   - if ($feedback->ident == 'solution')
883   - {
884   - $question->feedback = $feedback->text;
885   - }
886   -
887   -
888   - }
889   -
890   - $question->fraction[] = 1; //Added because essay/questiontype.php:save_question_option is expecting a
891   - //fraction property - CT 8/10/06
  777 + // Added this code to put the possible solution that the
  778 + // instructor gives as the Moodle answer for an essay question
  779 + if ($feedback->ident == 'solution') {
  780 + $question->feedback = $feedback->text;
  781 + }
  782 + }
  783 + //Added because essay/questiontype.php:save_question_option is expecting a
  784 + //fraction property - CT 8/10/06
  785 + $question->fraction[] = 1;
892 786 if (!empty($question)) {
893 787 $questions[]=$question;
894 788 }
895   -
896   -
897 789 }
898 790 else {
899 791 print "Essay question types are not handled because the quiz question type 'Essay' does not exist in this installation of Moodle<br/>";
@@ -905,10 +797,6 @@ function process_essay($quest, &$questions) {
905 797 // Process Matching Questions
906 798 //----------------------------------------
907 799 function process_matching($quest, &$questions) {
908   -
909   - //echo "Line 910: Quest<br>";
910   - //print_object($quest);
911   -
912 800 if (defined("RENDEREDMATCH")) {
913 801 $question = $this->defaultquestion($this->defaultquestion());
914 802 $question->valid = true;

0 comments on commit ea8e7f9

Please sign in to comment.
Something went wrong with that request. Please try again.