Permalink
Browse files

code cleaning

  • Loading branch information...
1 parent e869c37 commit b50f8fc81fdc5a6f39f0d736a5c6d9d9f3919fe0 pichetp committed Jun 17, 2008
Showing with 11 additions and 11 deletions.
  1. +11 −11 question/type/multianswer/questiontype.php
@@ -48,21 +48,21 @@ function get_question_options(&$question) {
$question->options->questions[$seq]= '';
}
if (isset($wrappedquestions) && is_array($wrappedquestions)){
- foreach ($wrappedquestions as $wrapped) {
- if (!$QTYPES[$wrapped->qtype]->get_question_options($wrapped)) {
- notify("Unable to get options for questiontype {$wrapped->qtype} (id={$wrapped->id})");
+ foreach ($wrappedquestions as $wrapped) {
+ if (!$QTYPES[$wrapped->qtype]->get_question_options($wrapped)) {
+ notify("Unable to get options for questiontype {$wrapped->qtype} (id={$wrapped->id})");
+ }else {
+ // for wrapped questions the maxgrade is always equal to the defaultgrade,
+ // there is no entry in the question_instances table for them
+ $wrapped->maxgrade = $wrapped->defaultgrade;
+ $nbvaliquestion++ ;
+ $question->options->questions[$sequence[$wrapped->id]] = clone($wrapped); // ??? Why do we need a clone here?
+ }
}
- // for wrapped questions the maxgrade is always equal to the defaultgrade,
- // there is no entry in the question_instances table for them
- $wrapped->maxgrade = $wrapped->defaultgrade;
- $nbvaliquestion++ ;
- $question->options->questions[$sequence[$wrapped->id]] = clone($wrapped); // ??? Why do we need a clone here?
- }
}
if ($nbvaliquestion == 0 ) {
notify(get_string('noquestions','qtype_multianswer',$question->name));
}
-
return true;
}
@@ -81,7 +81,7 @@ function save_question_options($question) {
if (!$oldwrappedids = get_field('question_multianswer', 'sequence', 'question', $question->id)) {
$oldwrappedquestions = array();
} else {
- $oldwrappedids = get_records_list('question', 'id', $oldwrappedids, 'id ASC','id');
+ $oldwrappedquestions = get_records_list('question', 'id', $oldwrappedids, 'id ASC');
}
$sequence = array();
foreach($question->options->questions as $wrapped) {

0 comments on commit b50f8fc

Please sign in to comment.