Update of /cvsroot/stack/stack-dev/lib/items In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29766/lib/items Modified Files: Tag: question_reporting StackOption.php Meta.php PotentialResponseTree.php ItemOption.php QuestionType.php InstantiatedItem.php ItemState.php QTList.php ItemTests.php CasTextType.php Item.php StudentAns.php RawKeyVal.php CasString.php InteractionElement.php QuestionPart.php PotentialResponse.php Log Message: Merging from the current HEAD into question_reporting. Apologies in advance if this all goes horribly wrong. Index: StudentAns.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/StudentAns.php,v retrieving revision 1.42 retrieving revision 1.42.2.1 diff -C2 -d -r1.42 -r1.42.2.1 *** StudentAns.php 27 Aug 2009 16:23:00 -0000 1.42 --- StudentAns.php 22 Nov 2010 23:05:45 -0000 1.42.2.1 *************** *** 60,63 **** --- 60,64 ---- //first parse out the students variables $sAns = $this->parser($posted); + if($sAns != NULL) { *************** *** 117,121 **** if($ans == '') { - //echo 'here'; $this->studentAnswers[$label]->setRawAns($ans); $this->studentAnswers[$label]->setStatus(NULL); --- 118,121 ---- *************** *** 127,131 **** //if answer has changed, but not blank $prev = $this->studentAnswers[$label]->getRawAns(); ! if($ans != $prev) { $this->studentAnswers[$label]->setRawAns($ans); --- 127,131 ---- //if answer has changed, but not blank $prev = $this->studentAnswers[$label]->getRawAns(); ! if($ans !== $prev) { $this->studentAnswers[$label]->setRawAns($ans); *************** *** 220,225 **** foreach($this->studentAnswers as $label => $sAns) { - // echo "<hr>Checking $label<br>"; - //override items standard itemOptions with those specified in the question part related to this questionpart. if($questionPart !== NULL && array_key_exists($label, $questionPart)) --- 220,223 ---- *************** *** 246,250 **** $castext = '@'.$rawString.'@'; - // for some reason is returning text not the boolean values required. if($itemOptions->getSelected('InformalSyntax') == 'false') --- 244,247 ---- *************** *** 280,283 **** --- 277,281 ---- if(($valid === true) && ($questionPart !== NULL)) { + //from the question part associated with the student answer, check the student has not entered a forbidden keyword. if(array_key_exists($label, $questionPart)) *************** *** 320,334 **** } } - - // check for passed-through qmchar - if(false !== strpos('qmchar', $sym)) $valid = $sym.' contains question marks.'; - } - } } //check against implicitly forbidden words (IE the question variables and tans) - if(($valid === true) && (!empty($implictForbid))) { --- 318,326 ---- *************** *** 359,362 **** --- 351,360 ---- } + // Check for ?s in an answer, passed-through Maxima as "qmchar". These are not permitted + $qm_pos = strpos($sAns->getRawAns(),'?'); + if (false !== $qm_pos) { + $valid = $valid.get_string('stackCas_qmchar', 'stack', ''); + } + if($valid === true) { *************** *** 397,401 **** { //we only want answers that have passed the syntax checks ! if($sAns->getStatus() == 'valid') { $casText .= '@'; --- 395,399 ---- { //we only want answers that have passed the syntax checks ! if($sAns->getStatus() == 'valid' || $sAns->getStatus() == 'score') { $casText .= '@'; *************** *** 405,409 **** } - /*commands are send with insert stars on and strict syntax off, the least strict settings * this is to allow us to send all students answers through at the same time to the cas --- 403,406 ---- *************** *** 413,417 **** $ct = new casText($casText, 's', false, true); //need itemOptions settings - //add in float checking & type checking $i = 0; --- 410,413 ---- *************** *** 421,426 **** //echo $sAns->getRawAns(); //echo $sAns->getStatus(); ! //echo "<pre>";print_r($questionPart[$label]);echo "</pre>"; ! if($sAns->getStatus() == 'valid') { //create a castext string, for checking float status --- 417,422 ---- //echo $sAns->getRawAns(); //echo $sAns->getStatus(); ! //echo "<pre>";print_r($questionPart[$label]);echo "</pre>"; ! if($sAns->getStatus() == 'valid' || $sAns->getStatus() == 'score') { //create a castext string, for checking float status *************** *** 446,454 **** if($sameType == 'false') { ! $casCommands["caschat$i"] = 'stack_validate_typeless('.$starredAnswer.','.$ForbidFloats.','.$LowestTerms.')'; } else { ! $casCommands["caschat$i"] = 'stack_validate('.$starredAnswer.','.$ForbidFloats.','.$LowestTerms.','.$TAns.')'; } $validLabels[] = $label; --- 442,450 ---- if($sameType == 'false') { ! $casCommands["caschat$i"] = 'stack_validate_typeless(['.$starredAnswer.'],'.$ForbidFloats.','.$LowestTerms.')'; } else { ! $casCommands["caschat$i"] = 'stack_validate(['.$starredAnswer.'],'.$ForbidFloats.','.$LowestTerms.','.$TAns.')'; } $validLabels[] = $label; *************** *** 463,467 **** elseif ($casCommands === NULL) { ! //no cas commands to extract, valid = true, in a manor of thinking. } else --- 459,463 ---- elseif ($casCommands === NULL) { ! //no cas commands to extract, valid = true, in a manner of thinking. } else *************** *** 469,473 **** $displayFormat = $itemOptions->getSelected('Display'); ! //Student answers should not be simplyfied for display. $itemOptions->setSelected('Simplify','false'); --- 465,469 ---- $displayFormat = $itemOptions->getSelected('Display'); ! //Student answers should not be simplified for display. $itemOptions->setSelected('Simplify','false'); *************** *** 481,485 **** //echo "<pre>";print_r($displayResults);echo "</pre>"; - $i = 0; foreach($validLabels as $vLabel) --- 477,480 ---- *************** *** 555,558 **** --- 550,566 ---- } + /** + * Where an IE status can be fastracked from valid to score, do it. + */ + public function scoreIfValid($questionPart = NULL) { + if(!empty($this->studentAnswers)) { + foreach($this->studentAnswers as $label => $sAns) { + if($sAns->getStatus() == 'valid' && $questionPart[$label]->getStudentVerify()->getSelected() == 'false') { + $sAns->setStatus('score'); + } + } + } + } + /** * If casString not set will return null. Index: InteractionElement.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/InteractionElement.php,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -C2 -d -r1.9 -r1.9.2.1 *** InteractionElement.php 27 Aug 2009 16:23:00 -0000 1.9 --- InteractionElement.php 22 Nov 2010 23:05:45 -0000 1.9.2.1 *************** *** 106,110 **** */ public function getLabel() ! { return $this->label; } --- 106,110 ---- */ public function getLabel() ! { return $this->label; } *************** *** 117,121 **** */ public function getRawAns() ! { //strip $, ;, or : from answer $str = new stringUtil($this->rawAns); --- 117,121 ---- */ public function getRawAns() ! { //strip $, ;, or : from answer $str = new stringUtil($this->rawAns); *************** *** 130,134 **** */ public function getStatus() ! { return $this->status; } --- 130,134 ---- */ public function getStatus() ! { return $this->status; } *************** *** 141,145 **** */ public function getCasAns() ! { return $this->casValue; } --- 141,145 ---- */ public function getCasAns() ! { return $this->casValue; } *************** *** 152,156 **** */ public function getDisplayValue() ! { return $this->displayValue; } --- 152,156 ---- */ public function getDisplayValue() ! { return $this->displayValue; } *************** *** 164,168 **** */ public function setStatus($changedStatus) ! { $nullStatus = array(NULL,'new','solutionSeen'); //changes that are valid if status is Null now $newStatus = array(NULL,'new','valid','invalid'); --- 164,168 ---- */ public function setStatus($changedStatus) ! { $nullStatus = array(NULL,'new','solutionSeen'); //changes that are valid if status is Null now $newStatus = array(NULL,'new','valid','invalid'); *************** *** 241,245 **** */ public function setCasAns($ans) ! { $this->casValue = $ans; } --- 241,245 ---- */ public function setCasAns($ans) ! { $this->casValue = $ans; } *************** *** 253,257 **** */ public function setRawAns($ans) ! { $this->rawAns = $ans; } --- 253,257 ---- */ public function setRawAns($ans) ! { $this->rawAns = $ans; } *************** *** 265,269 **** */ public function setDisplayValue($disp) ! { $this->displayValue = $disp; } --- 265,269 ---- */ public function setDisplayValue($disp) ! { $this->displayValue = $disp; } *************** *** 277,281 **** */ public function getFeedback() ! { return $this->feedback; } --- 277,281 ---- */ public function getFeedback() ! { return $this->feedback; } *************** *** 289,293 **** */ public function setFeedback($feedback) ! { $this->feedback = $feedback; } --- 289,293 ---- */ public function setFeedback($feedback) ! { $this->feedback = $feedback; } Index: QuestionPart.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/QuestionPart.php,v retrieving revision 1.32 retrieving revision 1.32.2.1 diff -C2 -d -r1.32 -r1.32.2.1 *** QuestionPart.php 27 Aug 2009 16:23:00 -0000 1.32 --- QuestionPart.php 22 Nov 2010 23:05:45 -0000 1.32.2.1 *************** *** 129,133 **** private $insertStars; - /** * Whether to enable type checking on students answer or not. --- 129,132 ---- *************** *** 138,141 **** --- 137,155 ---- private $sameType; + /** + * Whether student answer needs to be visually verified by student + * + * @var boolean + * @access private + */ + private $studentVerify; + + /** + * Whether student receives feedback for this question part + * + * @var boolean + * @access private + */ + private $hideFeedback; /** *************** *** 145,148 **** --- 159,163 ---- * @access private */ + private $inputTypeParam; *************** *** 180,185 **** $this->insertStars = new StackOption('list','false',array('true' => get_string('stack_True', 'stack', ''), 'false' => get_string('stack_False', 'stack', ''))); $this->sameType = new StackOption('list', 'true', array('true' => get_string('stackOption_checkType','stack',''), 'false' => get_string('stackOption_doNotCheckType','stack',''))); ! //set the default input type paramters for the selected input type $this->loadITDefaults(); } --- 195,202 ---- $this->insertStars = new StackOption('list','false',array('true' => get_string('stack_True', 'stack', ''), 'false' => get_string('stack_False', 'stack', ''))); $this->sameType = new StackOption('list', 'true', array('true' => get_string('stackOption_checkType','stack',''), 'false' => get_string('stackOption_doNotCheckType','stack',''))); + $this->studentVerify = new StackOption('list','true',array('true' => get_string('stack_True', 'stack', ''), 'false' => get_string('stack_False', 'stack', ''))); + $this->hideFeedback = new StackOption('list','false',array('true' => get_string('stack_True', 'stack', ''), 'false' => get_string('stack_False', 'stack', ''))); ! //set the default input type parameters for the selected input type $this->loadITDefaults(); } *************** *** 374,378 **** { $this->inputType->setSelection($inputType); ! } /** --- 391,395 ---- { $this->inputType->setSelection($inputType); ! } /** *************** *** 617,620 **** --- 634,680 ---- } + /** + * Returns the stackoption for controlling whether to check students needs to verify their valid answer + * @access public + * @return stackOption studentVerify + */ + public function getStudentVerify() { + return $this->studentVerify; + } + + /** + * Sets the studentVerify value + * @access public + * @param string new value + * @return void + */ + public function setStudentVerify($val) { + if($this->studentVerify !== NULL) + { + $this->studentVerify->setSelected($val); + } + } + + /* Returns the stackoption for controlling whether to check students needs to verify their valid answer + * @access public + * @return stackOption studentVerify + */ + public function getHideFeedback() { + return $this->hideFeedback; + } + + /** + * Sets the studentVerify value + * @access public + * @param string new value + * @return void + */ + public function setHideFeedback($val) { + if($this->hideFeedback !== NULL) + { + $this->hideFeedback->setSelected($val); + } + } + /** * Sets the sameType value *************** *** 654,658 **** /** ! * set the default input type paramters for the selected input type * * @param array $parameters The set values, if any. --- 714,718 ---- /** ! * set the default input type options and parameters for the selected input type * * @param array $parameters The set values, if any. *************** *** 661,670 **** public function loadITDefaults($parameters=NULL) { ! $inputType = $this->inputType->getSelection(); $iType = new InputTypeController($inputType); $this->inputTypeParam = $iType->getDefaultParam($parameters); } - /** * Updates the Input Type parameters with the passed in values from an associative array. --- 721,729 ---- public function loadITDefaults($parameters=NULL) { ! $inputType = $this->inputType->getSelection(); $iType = new InputTypeController($inputType); $this->inputTypeParam = $iType->getDefaultParam($parameters); } /** * Updates the Input Type parameters with the passed in values from an associative array. *************** *** 685,692 **** if(array_key_exists($label, $this->inputTypeParam)) { - /*echo '<pre>'; - var_dump($this->inputTypeParam); - echo '</pre>';*/ - $this->inputTypeParam[$label]->setSelection($value); } --- 744,747 ---- *************** *** 799,802 **** --- 854,885 ---- } + public function equals($other) { + return $this->allowedWords == $other->allowedWords + && $this->boxSize == $other->boxSize + && $this->forbiddenWords == $other->forbiddenWords + && $this->forbidFloats == $other->forbidFloats + && $this->formalSyntax == $other->formalSyntax + && $this->inputType == $other->inputType + && $this->inputTypeParam == $other->inputTypeParam + && $this->insertStars == $other->insertStars + && $this->lowestTerms == $other->lowestTerms + && $this->qpName == $other->qpName + && $this->sameType == $other->sameType + && $this->studentAnsKey == $other->studentAnsKey + && $this->syntaxHint == $other->syntaxHint + && $this->teacherAns == $other->teacherAns + && $this->studentVerify == $other->studentVerify + && $this->hideFeedback == $other->hideFeedback; + } + + /** + * Ensure this Question Part has all latest options. For legacy Items. + * @param none + * @return none + */ + public function ensureCompleteOptions() { + if(!isset($this->studentVerify)) $this->studentVerify = new StackOption('list','true',array('true' => get_string('stack_True', 'stack', ''), 'false' => get_string('stack_False', 'stack', ''))); + if(!isset($this->hideFeedback)) $this->hideFeedback = new StackOption('list','false',array('true' => get_string('stack_True', 'stack', ''), 'false' => get_string('stack_False', 'stack', ''))); + } } Index: QuestionType.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/QuestionType.php,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -C2 -d -r1.11 -r1.11.2.1 *** QuestionType.php 27 Aug 2009 16:23:00 -0000 1.11 --- QuestionType.php 22 Nov 2010 23:05:44 -0000 1.11.2.1 *************** *** 75,79 **** /** ! * The questionType type, may be keyval,castext,caschat, or meta. Fixed at the class level. * Used so each questiontype subclass can identify its own type. * --- 75,79 ---- /** ! * The questionType type, may be keyval,castext, caschat or meta. Fixed at the class level. * Used so each questiontype subclass can identify its own type. * *************** *** 87,94 **** * @access protected */ ! protected $errorLog; /** ! * Whether this questiontype forbids floats (ofcourse pointless in the meta class. * @var bool * @access protected --- 87,94 ---- * @access protected */ ! protected static $errorLog; /** ! * Whether this questiontype forbids floats (of course pointless in the meta class). * @var bool * @access protected *************** *** 97,101 **** /** ! * Where this questionType should be simplyfied when sent to the cas or not. * * @access protected --- 97,101 ---- /** ! * Where this questionType should be simplified when sent to the cas or not. * * @access protected *************** *** 125,129 **** $this->metaType = $metatype; $this->xmlType = $xmlType; ! $this->errorLog = new error(); } --- 125,130 ---- $this->metaType = $metatype; $this->xmlType = $xmlType; ! //$this->errorLog = new error(); ! if(self::$errorLog == null) self::$errorLog = new error(); } *************** *** 210,214 **** $toReturn = false; $msg = $this->required.' is an invalid option for a required field. Must be either optional, required or system.'; ! $this->errorLog->addError($msg); } --- 211,215 ---- $toReturn = false; $msg = $this->required.' is an invalid option for a required field. Must be either optional, required or system.'; ! self::$errorLog->addError($msg); } *************** *** 220,224 **** $msg = $this->xmlType.' is an invalid XML type'; ! $this->errorLog->addError($msg); } return $toReturn; --- 221,225 ---- $msg = $this->xmlType.' is an invalid XML type'; ! self::$errorLog->addError($msg); } return $toReturn; *************** *** 245,249 **** //var_dump($this->errorLog); ! return $this->errorLog->toString(); } --- 246,250 ---- //var_dump($this->errorLog); ! return self::$errorLog->toString();//$this->errorLog->toString(); } *************** *** 262,266 **** { //display a simple text box ! $widget = '<input type="text" name="'.$name.'" size="'.$size.'" value="'.$this->default.'"'; } else --- 263,267 ---- { //display a simple text box ! $widget = '<input type="text" name="'.$name.'" id="'.$name.'" size="'.$size.'" value="'.$this->default.'"'; } else *************** *** 334,340 **** return $node->textContent; } - - - } --- 335,338 ---- Index: ItemTests.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/ItemTests.php,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** ItemTests.php 27 Aug 2009 16:23:00 -0000 1.3 --- ItemTests.php 22 Nov 2010 23:05:44 -0000 1.3.2.1 *************** *** 218,222 **** --- 218,231 ---- } + public function equals($other) { + if(!empty($this->tests)) { + if(empty($other->tests)) return false; + foreach($this->tests as $key => $val) { + if($val != $other->tests[$key]) return false; + } + } else if(!empty($other->tests)) return false; + return true; + } } Index: PotentialResponse.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/PotentialResponse.php,v retrieving revision 1.48 retrieving revision 1.48.4.1 diff -C2 -d -r1.48 -r1.48.4.1 *** PotentialResponse.php 27 Jun 2009 08:51:41 -0000 1.48 --- PotentialResponse.php 22 Nov 2010 23:05:45 -0000 1.48.4.1 *************** *** 583,586 **** --- 583,608 ---- /** + * Returns the quiet setting. + * + * @access public + * @return string + */ + public function getQuiet() + { + return $this->quiet; + } + + /** + * Returns the teacher note. + * + * @access public + * @return string + */ + public function getTeacherNote() + { + return $this->teacherNote; + } + + /** * Returns the answertest used in this PR. * *************** *** 665,669 **** $form = '<div class="PR">'; $form .= "<strong>".get_string('stack_num','stack','')." $id</strong><br />"; - $form .= '<span style="float: right">'.get_string('stackQuestion_PR_remove','stack','').'<input type="checkbox" name="'.$prefix.'-remove" value="true"></span> '; $form .= get_string('stackQuestion_PR_SAns2','stack','').': <input type="text" size="10" name="'.$prefix.'-sans" value="'.$this->sAns.'" /> '; //sans $form .= get_string('stackQuestion_PR_TAns2','stack','').': <input type="text" size="10" name="'.$prefix.'-tans" value="'.$this->tAns.'" /> '; //tans --- 687,690 ---- *************** *** 704,721 **** } ! ! //True Array ! $form .= '<div class="PRTTrue"><strong>'.get_string('stack_true','stack','').'</strong><br />'; //rawmarkmod dropdown box ! $form .= get_string('stackQuestion_PR_RawMarkMod2','stack','').': <select name="'.$prefix.'-trueModMark">'; - $modOpts = array('=','+','-','=AT'); foreach($modOpts as $mod) { ! if($mod == $this->trueArray['rawModMark']) { ! $form .= "<option value=\"$mod\" selected>$mod</option>"; } else --- 725,743 ---- } + $modOpts = array('=','+','-','=AT'); ! // False PR box output first for rendering reasons ! $form .= "<div>";// container for true/false boxes ! //if false ! $form .= '<div class="PRTFalse"><strong>'.get_string('stack_false','stack','').'</strong><br />'; //rawmarkmod dropdown box ! $form .= get_string('stackQuestion_PR_RawMarkMod2','stack','').': <select name="'.$prefix.'-falseModMark">'; foreach($modOpts as $mod) { ! if($mod == $this->falseArray['rawModMark']) { ! $form .= "<option value=\"$mod\" selected='selected'>$mod</option>"; } else *************** *** 727,740 **** $form .= '</select> '; ! $form .= get_string('Mark','stack','').': <input type="text" size="2" name="'.$prefix.'-trueMark" value="'.$this->trueArray['rawmark'].'" /> '; //mark ! $form .= get_string('ShowAt_Penalty','stack','').': <input type="text" size="2" name="'.$prefix.'-truePenalty" value="'.$this->trueArray['penalty'].'" /> '; //penalty ! $form .= get_string('stackQuestion_PR_nextPR','stack','').' <select name="'.$prefix.'-trueNextPR">'; foreach($potentialPRs as $ppr) { ! if($ppr == $this->nextPRTrue) { ! $form .= "<option value=\"$ppr\" selected>$ppr</option>"; } else --- 749,762 ---- $form .= '</select> '; ! $form .= get_string('Mark','stack','').': <input type="text" size="2" name="'.$prefix.'-falseMark" value="'.$this->falseArray['rawmark'].'" /> '; //mark ! $form .= get_string('ShowAt_Penalty','stack','').': <input type="text" size="2" name="'.$prefix.'-falsePenalty" value="'.$this->falseArray['penalty'].'" /> '; //penalty ! $form .= get_string('stackQuestion_PR_nextPR','stack','').' <select name="'.$prefix.'-falseNextPR">'; foreach($potentialPRs as $ppr) { ! if($ppr == $this->nextPRFalse) { ! $form .= "<option value=\"$ppr\" selected='selected'>$ppr</option>"; } else *************** *** 745,779 **** $form .= '</select>'; $form .= '<br /><br />'; ! $form .= get_string('ShowAt_FeedBack','stack','').': <textarea cols="45" rows="1" name="'.$prefix.'-trueFeedback" >'.$this->trueArray['feedback'].'</textarea>'; //feedback ! //$form .= 'Feedback: '.$this->trueArray['feedback']->editWidget("$prefix-trueFeedback", 45, 1); // CJS 10/10/2008 // If the AnswerNote is empty, we should add something useful. ! $the_an = $this->trueArray['AnsNote']; ! if ('' === $the_an) { ! $the_an = substr($prefix,14).'-T '; } ! $form .= get_string('ShowAt_AnswerNote','stack','').': <textarea cols="45" rows="1" name="'.$prefix.'-trueAnsNote" >'.$the_an.'</textarea>'; //Ansnote ! ! if(!empty($validationErrors['truefeedback'])) { ! $form .= '<p class="error">'.get_string('ShowAt_FeedBack','stack','').': '.$validationErrors['truefeedback'].'</p>'; } - $form .= '</div>'; ! ! //if false ! $form .= '<div class="PRTFalse"><strong>'.get_string('stack_false','stack','').'</strong><br />'; //rawmarkmod dropdown box ! $form .= get_string('stackQuestion_PR_RawMarkMod2','stack','').': <select name="'.$prefix.'-falseModMark">'; foreach($modOpts as $mod) { ! if($mod == $this->falseArray['rawModMark']) { ! $form .= "<option value=\"$mod\" selected='selected'>$mod</option>"; } else --- 767,800 ---- $form .= '</select>'; $form .= '<br /><br />'; ! ! $form .= get_string('ShowAt_FeedBack','stack','').': <textarea cols="40" rows="1" name="'.$prefix.'-falseFeedback" >'.$this->falseArray['feedback'].'</textarea>'; ! //$form .= 'Feedback: '.$this->falseArray['feedback']->editWidget("$prefix-falseFeedback", 45, 1); // CJS 10/10/2008 // If the AnswerNote is empty, we should add something useful. ! $the_an = $this->falseArray['AnsNote']; ! if ('' == $the_an) { ! // knock off "PR-PotResTree_" ! $the_an = substr($prefix,14).'-F '; } + $form .= '<br />'.get_string('ShowAt_AnswerNote','stack','').': <textarea cols="40" rows="1" name="'.$prefix.'-falseAnsNote" >'.$the_an.'</textarea>'; //Ansnote ! if(!empty($validationErrors['falsefeedback'])) { ! $form .= '<p class="error">'.get_string('ShowAt_FeedBack','stack','').': '.$validationErrors['falsefeedback'].'</p>'; } $form .= '</div>'; ! //True Array ! $form .= '<div class="PRTTrue"><strong>'.get_string('stack_true','stack','').'</strong><br />'; //rawmarkmod dropdown box ! $form .= get_string('stackQuestion_PR_RawMarkMod2','stack','').': <select name="'.$prefix.'-trueModMark">'; foreach($modOpts as $mod) { ! if($mod == $this->trueArray['rawModMark']) { ! $form .= "<option value=\"$mod\" selected>$mod</option>"; } else *************** *** 785,798 **** $form .= '</select> '; ! $form .= get_string('Mark','stack','').': <input type="text" size="2" name="'.$prefix.'-falseMark" value="'.$this->falseArray['rawmark'].'" /> '; //mark ! $form .= get_string('ShowAt_Penalty','stack','').': <input type="text" size="2" name="'.$prefix.'-falsePenalty" value="'.$this->falseArray['penalty'].'" /> '; //penalty ! $form .= get_string('stackQuestion_PR_nextPR','stack','').' <select name="'.$prefix.'-falseNextPR">'; foreach($potentialPRs as $ppr) { ! if($ppr == $this->nextPRFalse) { ! $form .= "<option value=\"$ppr\" selected='selected'>$ppr</option>"; } else --- 806,819 ---- $form .= '</select> '; ! $form .= get_string('Mark','stack','').': <input type="text" size="2" name="'.$prefix.'-trueMark" value="'.$this->trueArray['rawmark'].'" /> '; //mark ! $form .= get_string('ShowAt_Penalty','stack','').': <input type="text" size="2" name="'.$prefix.'-truePenalty" value="'.$this->trueArray['penalty'].'" /> '; //penalty ! $form .= get_string('stackQuestion_PR_nextPR','stack','').' <select name="'.$prefix.'-trueNextPR">'; foreach($potentialPRs as $ppr) { ! if($ppr == $this->nextPRTrue) { ! $form .= "<option value=\"$ppr\" selected>$ppr</option>"; } else *************** *** 803,827 **** $form .= '</select>'; $form .= '<br /><br />'; ! ! $form .= get_string('ShowAt_FeedBack','stack','').': <textarea cols="45" rows="1" name="'.$prefix.'-falseFeedback" >'.$this->falseArray['feedback'].'</textarea>'; ! //$form .= 'Feedback: '.$this->falseArray['feedback']->editWidget("$prefix-falseFeedback", 45, 1); // CJS 10/10/2008 // If the AnswerNote is empty, we should add something useful. ! $the_an = $this->falseArray['AnsNote']; ! if ('' == $the_an) { ! // knock off "PR-PotResTree_" ! $the_an = substr($prefix,14).'-F '; } - $form .= get_string('ShowAt_AnswerNote','stack','').': <textarea cols="45" rows="1" name="'.$prefix.'-falseAnsNote" >'.$the_an.'</textarea>'; //Ansnote ! if(!empty($validationErrors['falsefeedback'])) { ! $form .= '<p class="error">'.get_string('ShowAt_FeedBack','stack','').': '.$validationErrors['falsefeedback'].'</p>'; } $form .= '</div>'; $form .= '<div class="row"><span class="label">'.get_string('stackAuthor_teachersNote','stack','').' <br></span><span class="formw"><textarea cols="65" rows="1" name="'.$prefix.'-teacherNotes">'.$this->teacherNote.'</textarea></span></div>'; ! $form .= '<div class="clearer"> </div>'; $form .= '</div>'; --- 824,850 ---- $form .= '</select>'; $form .= '<br /><br />'; ! $form .= get_string('ShowAt_FeedBack','stack','').': <textarea cols="40" rows="1" name="'.$prefix.'-trueFeedback" >'.$this->trueArray['feedback'].'</textarea>'; //feedback ! //$form .= 'Feedback: '.$this->trueArray['feedback']->editWidget("$prefix-trueFeedback", 45, 1); // CJS 10/10/2008 // If the AnswerNote is empty, we should add something useful. ! $the_an = $this->trueArray['AnsNote']; ! if ('' === $the_an) { ! $the_an = substr($prefix,14).'-T '; } ! $form .= '<br />'.get_string('ShowAt_AnswerNote','stack','').': <textarea cols="40" rows="1" name="'.$prefix.'-trueAnsNote" >'.$the_an.'</textarea>'; //Ansnote ! ! if(!empty($validationErrors['truefeedback'])) { ! $form .= '<p class="error">'.get_string('ShowAt_FeedBack','stack','').': '.$validationErrors['truefeedback'].'</p>'; } + $form .= '</div>'; + $form .= '</div>'; // close true/false container $form .= '<div class="row"><span class="label">'.get_string('stackAuthor_teachersNote','stack','').' <br></span><span class="formw"><textarea cols="65" rows="1" name="'.$prefix.'-teacherNotes">'.$this->teacherNote.'</textarea></span></div>'; ! //$form .= '<div class="clearer"> </div>'; ! $form .= '<span style="float: right">'.get_string('stackQuestion_PR_remove','stack','').'<input type="checkbox" name="'.$prefix.'-remove" value="true"></span> '; $form .= '</div>'; Index: Meta.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/Meta.php,v retrieving revision 1.18 retrieving revision 1.18.2.1 diff -C2 -d -r1.18 -r1.18.2.1 *** Meta.php 27 Aug 2009 16:23:00 -0000 1.18 --- Meta.php 22 Nov 2010 23:05:44 -0000 1.18.2.1 *************** *** 58,62 **** //set selected to default initially $this->selection = $default; ! $this->errorLog = new error(); } --- 58,62 ---- //set selected to default initially $this->selection = $default; ! // done in parent (and statically) $this->errorLog = new error(); } *************** *** 288,292 **** } } - ?> \ No newline at end of file --- 288,294 ---- } + public function equals($other) { + return $this->forbidFloats == $other->forbidFloats; + } } ?> \ No newline at end of file Index: QTList.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/QTList.php,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** QTList.php 27 Aug 2009 16:23:00 -0000 1.3 --- QTList.php 22 Nov 2010 23:05:44 -0000 1.3.2.1 *************** *** 460,464 **** break; } ! echo 'selected: '.$selected.'<Br />'; if(trim($selected) == '') { --- 460,464 ---- break; } ! echo 'selected: '.$selected.'<br />'; if(trim($selected) == '') { Index: PotentialResponseTree.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/PotentialResponseTree.php,v retrieving revision 1.71 retrieving revision 1.71.4.1 diff -C2 -d -r1.71 -r1.71.4.1 *** PotentialResponseTree.php 27 Jun 2009 08:51:41 -0000 1.71 --- PotentialResponseTree.php 22 Nov 2010 23:05:44 -0000 1.71.4.1 *************** *** 289,302 **** $preCalcValues = $this->prtPreCalc($preCalcValues, $maximaPreferences, $seed); - //requirements have been met, traverse the tree. - $nextPR = 0; //always start at PR 0 - //find the PR with the lowest id to start with. - $PRkeys = array_keys($this->PResponses); - sort($PRkeys); - $nextPR = $PRkeys[0]; - - //var_dump($this->PResponses); - //echo '<br><br>'; while($nextPR != -1) { --- 289,304 ---- $preCalcValues = $this->prtPreCalc($preCalcValues, $maximaPreferences, $seed); + // Do we have errors from the above? + if (-1==$preCalcValues) { + $nextPR=-1; + } else { + //requirements have been met, traverse the tree. + $nextPR = 0; //always start at PR 0 + //find the PR with the lowest id to start with. + $PRkeys = array_keys($this->PResponses); + sort($PRkeys); + $nextPR = $PRkeys[0]; + } while($nextPR != -1) { *************** *** 1045,1049 **** /** ! * Sends the student & teachers answers from each PR to the cas * @param array $precalc * @return array --- 1047,1051 ---- /** ! * Sends the student & teacher's answers from each PR to the CAS * @param array $precalc * @return array *************** *** 1140,1148 **** if($mconn->displayErrorString() !== NULL) { ! echo '<div class="error">'; ! echo '<p>'.'The Potential response tree caused the following problems:'.'</p>';; ! echo $mconn->displayErrorString(); ! echo '</div>'; ! die(); } else --- 1142,1155 ---- if($mconn->displayErrorString() !== NULL) { ! $err = '<div class="error">'; ! $err .= '<p>'.get_string('PR_ERROR','STACK').'</p>';; ! $err .= $mconn->displayErrorString(); ! $err .= '</div>'; ! $this->ansNote .='|PR_ERROR|'; ! $this->feedback .= $err; ! $this->penalty =0; ! $this->mark =0; ! //die(); ! return -1; } else *************** *** 1386,1389 **** --- 1393,1450 ---- return $node; } + + public function equals($other) { + // test PResponses first + if(!empty($this->PResponses)) + { + if(empty($other->PResponses) + || sizeof($this->PResponses) != sizeof($other->PResponses)) { + return false; + } + + if($this->penalty != $other->penalty) return false; + + foreach($this->PResponses as $name => $pr) + { + $opr = $other->PResponses[$name]; + if(empty($opr)) return false; + if($pr->getAnsTest() != $opr->getAnsTest() + || $pr->getTAns() != $opr->getTAns() + || $pr->getSAns() != $opr->getSAns() + || $pr->getTrueAN() != $opr->getTrueAN() + || $pr->getFalseAN() != $opr->getFalseAN() + || $pr->getTestOp() != $opr->getTestOp() + || $pr->getQuiet() != $opr->getQuiet() + || $pr->getTeacherNote() != $opr->getTeacherNote() + ) return false; + + // compare trueArray and falseArray + foreach($pr->ifTrue() as $key => $val) { + $array = $opr->ifTrue(); + if($array[$key] != $val) return false; + } + + foreach($pr->ifFalse() as $key => $val) { + $array = $opr->ifFalse(); + if($array[$key] != $val) return false; + } + } + + return true; + } + + return $this->ansNote == $other->ansNote + && $this->ansRequirements == $other->ansRequirements + && $this->ansTestError == $other->ansTestError + && $this->autoSimplify == $other->autoSimplify + && $this->description == $other->description + && $this->feedback == $other->feedback + && $this->feedbackVariables == $other->feedbackVariables + && $this->genericFeedback == $other->genericFeedback + && $this->mark == $other->mark + && $this->penalty == $other->penalty + && $this->PRTName == $other->PRTName + && $this->questionValue == $other->questionValue; + } } Index: CasString.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/CasString.php,v retrieving revision 1.16 retrieving revision 1.16.2.1 diff -C2 -d -r1.16 -r1.16.2.1 *** CasString.php 27 Aug 2009 16:23:00 -0000 1.16 --- CasString.php 22 Nov 2010 23:05:45 -0000 1.16.2.1 *************** *** 257,261 **** { $cs = trim($this->casString); ! $validString = '@ev(stack_validate_typeless('.$cs.', '.$forbidFloats.', '.$lowestTerms.'), simp: '.$simplify.')@'; return $validString; } --- 257,261 ---- { $cs = trim($this->casString); ! $validString = '@ev(stack_validate_typeless(['.$cs.'], '.$forbidFloats.', '.$lowestTerms.'), simp: '.$simplify.')@'; return $validString; } Index: StackOption.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/StackOption.php,v retrieving revision 1.12 retrieving revision 1.12.2.1 diff -C2 -d -r1.12 -r1.12.2.1 *** StackOption.php 27 Aug 2009 16:23:00 -0000 1.12 --- StackOption.php 22 Nov 2010 23:05:44 -0000 1.12.2.1 *************** *** 18,22 **** /** ! * A option for a question. Some options are kept seperate from the item itself * as these may be changed at a quiz or higher level * --- 18,22 ---- /** ! * An option for a question. Some options are kept separate from the item itself * as these may be changed at a quiz or higher level * *************** *** 69,74 **** * @var error * @access private ! */ ! private $errorLog; /** --- 69,76 ---- * @var error * @access private ! */ ! private static $errorLog; ! ! //private $logger; /** *************** *** 89,94 **** $this->casType = $casType; $this->selected = $default; ! $this->errorLog = new error(); ! } --- 91,96 ---- $this->casType = $casType; $this->selected = $default; ! //$this->errorLog = new error(); ! if(self::$errorLog == null) self::$errorLog = new error(); } *************** *** 177,181 **** { $msg = 'Invalid StackOption type: '.$this->type; ! $this->errorLog->addError($msg); $toReturn = false; } --- 179,183 ---- { $msg = 'Invalid StackOption type: '.$this->type; ! self::$errorLog->addError($msg); $toReturn = false; } *************** *** 184,188 **** { $msg = 'Undefined casKey for casType: '.$this->casType; ! $this->errorLog->addError($msg); $toReturn = false; } --- 186,190 ---- { $msg = 'Undefined casKey for casType: '.$this->casType; ! self::$errorLog->addError($msg); $toReturn = false; } *************** *** 192,196 **** $msg = 'Undefined casType for casKey: '.$this->casKey; //echo $msg; ! $this->errorLog->addError($msg); $toReturn = false; } --- 194,198 ---- $msg = 'Undefined casType for casKey: '.$this->casKey; //echo $msg; ! self::$errorLogaddError($msg); $toReturn = false; } *************** *** 207,211 **** public function getErrors() { ! return $this->errorLog->toString(); } --- 209,213 ---- public function getErrors() { ! return self::$errorLog->toString(); } *************** *** 223,227 **** if(empty($this->values)) { ! //display a text imput box $widget = '<input type="text" name="'.$name.'" size="'.$size.'" value="'.$this->selected.'"/>'; } --- 225,229 ---- if(empty($this->values)) { ! //display a text input box $widget = '<input type="text" name="'.$name.'" size="'.$size.'" value="'.$this->selected.'"/>'; } *************** *** 334,337 **** } } - ?> \ No newline at end of file --- 336,338 ---- Index: InstantiatedItem.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/InstantiatedItem.php,v retrieving revision 1.81 retrieving revision 1.81.2.1 diff -C2 -d -r1.81 -r1.81.2.1 *** InstantiatedItem.php 28 Aug 2009 10:09:23 -0000 1.81 --- InstantiatedItem.php 22 Nov 2010 23:05:44 -0000 1.81.2.1 *************** *** 332,336 **** if(!empty($this->PRTrees)) { - $this->updatePreCalc($sAns); //update precalculated values --- 332,335 ---- *************** *** 352,355 **** --- 351,355 ---- if(!empty($prtRequirements)) { + foreach($PRT->getRequirements() as $ansKey) { *************** *** 363,366 **** --- 363,369 ---- $changed = true; } + elseif(isset($previously[$ansKey]) && isset($currently[$ansKey]) && $previously[$ansKey] !== $currently[$ansKey]) { + $changed = true; + } } } Index: RawKeyVal.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/RawKeyVal.php,v retrieving revision 1.28 retrieving revision 1.28.2.1 diff -C2 -d -r1.28 -r1.28.2.1 *** RawKeyVal.php 27 Aug 2009 16:23:00 -0000 1.28 --- RawKeyVal.php 22 Nov 2010 23:05:45 -0000 1.28.2.1 *************** *** 79,83 **** public function __construct($rawstring, $required = 'optional', $default = NULL, $values = NULL, $metatag = NULL, $metatype = NULL, $xmlType = NULL) { ! //generic $this->required = $required; --- 79,83 ---- public function __construct($rawstring, $required = 'optional', $default = NULL, $values = NULL, $metatag = NULL, $metatype = NULL, $xmlType = NULL) { ! // can we not just invoke the parent contructor for the below? //generic $this->required = $required; *************** *** 87,91 **** $this->metaType = $metatype; $this->xmlType = $xmlType; ! $this->errorLog = new error(); //rawKeyVal specific --- 87,91 ---- $this->metaType = $metatype; $this->xmlType = $xmlType; ! if(self::$errorLog == null) self::$errorLog = new error(); //rawKeyVal specific *************** *** 518,522 **** { $kv = trim($pair->getMaximaPair()); ! $castext .= '@ev(stack_validate_typeless('.$kv.', '.$forbidFloats.', '.$lowestTerms.'), simp: '.$simplify.')@'; } return $castext; --- 518,522 ---- { $kv = trim($pair->getMaximaPair()); ! $castext .= '@ev(stack_validate_typeless(['.$kv.'], '.$forbidFloats.', '.$lowestTerms.'), simp: '.$simplify.')@'; } return $castext; *************** *** 640,644 **** public function contains_rand() { ! if (false===strpos($this->raw,'rand(')) return false; else --- 640,646 ---- public function contains_rand() { ! if (false===strpos($this->raw,'rand(') && ! false===strpos($this->raw,'rand_with_step(') && ! false===strpos($this->raw,'rand_with_prohib(')) return false; else *************** *** 646,650 **** --- 648,661 ---- } + public function equals($other) { + if(count($other->keyVals) != count($this->keyVals)) return false; + + foreach($this->keyVals as $v) { + // look for keyVal with same key and value in other + } + } + } + ?> \ No newline at end of file Index: CasTextType.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/CasTextType.php,v retrieving revision 1.25 retrieving revision 1.25.2.1 diff -C2 -d -r1.25 -r1.25.2.1 *** CasTextType.php 20 Oct 2009 10:15:28 -0000 1.25 --- CasTextType.php 22 Nov 2010 23:05:44 -0000 1.25.2.1 *************** *** 261,265 **** { //display text input ! $widget = '<input type="text" name="'.$name.'" size="'.$size.'" value="'.$this->casText.'"/>'; } else --- 261,265 ---- { //display text input ! $widget = '<input type="text" name="'.$name.'" size="'.$size.'" value="'.stripslashes(htmlspecialchars($this->casText)).'"/>'; } else *************** *** 403,407 **** { $cmd = trim($cmd); ! $castext .= '@ev(stack_validate_typeless('.$cmd.', '.$forbidFloats.', '.$lowestTerms.'), simp: '.$simplify.')@'; } return $castext; --- 403,407 ---- { $cmd = trim($cmd); ! $castext .= '@ev(stack_validate_typeless(['.$cmd.'], '.$forbidFloats.', '.$lowestTerms.'), simp: '.$simplify.')@'; } return $castext; *************** *** 426,430 **** $selection = $dom->createElement("castext"); ! $selectionText = $dom->createTextNode($this->casText); $selection->appendChild($selectionText); --- 426,430 ---- $selection = $dom->createElement("castext"); ! $selectionText = $dom->createTextNode(utf8_encode($this->casText)); $selection->appendChild($selectionText); Index: ItemOption.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/ItemOption.php,v retrieving revision 1.19 retrieving revision 1.19.2.1 diff -C2 -d -r1.19 -r1.19.2.1 *** ItemOption.php 27 Aug 2009 16:23:00 -0000 1.19 --- ItemOption.php 22 Nov 2010 23:05:44 -0000 1.19.2.1 *************** *** 76,80 **** $this->addOption('Display','list','LaTeX',array('LaTeX','MathML'),'OPT_OUTPUT','string'); $this->addOption('MultiplicationSign','list','dot',array('(none)' => get_string('stackOption_none', 'stack', ''),'dot'=> get_string('stackOption_dot', 'stack', ''),'cross'=> get_string('stackOption_cross', 'stack', '')),'make_multsgn','fun'); ! $this->addOption('ComplexNo','list','i',array('i','j'),'make_complexJ','fun'); $this->addOption('Floats','list','true',array('true' => get_string('stack_True','stack',''),'false' => get_string('stack_False', 'stack','')),'OPT_NoFloats','ex'); $this->addOption('SqrtSign','list','true',array('true' => get_string('stack_True','stack',''),'false' => get_string('stack_False', 'stack','')),'sqrtdispflag','ex'); --- 76,80 ---- $this->addOption('Display','list','LaTeX',array('LaTeX','MathML'),'OPT_OUTPUT','string'); $this->addOption('MultiplicationSign','list','dot',array('(none)' => get_string('stackOption_none', 'stack', ''),'dot'=> get_string('stackOption_dot', 'stack', ''),'cross'=> get_string('stackOption_cross', 'stack', '')),'make_multsgn','fun'); ! $this->addOption('ComplexNo','list','i',array('i','j','symi','symj'),'make_complexJ','fun'); $this->addOption('Floats','list','true',array('true' => get_string('stack_True','stack',''),'false' => get_string('stack_False', 'stack','')),'OPT_NoFloats','ex'); $this->addOption('SqrtSign','list','true',array('true' => get_string('stack_True','stack',''),'false' => get_string('stack_False', 'stack','')),'sqrtdispflag','ex'); *************** *** 97,100 **** --- 97,101 ---- $this->addOption('FeedbackGenericIncorrect','html',get_string('stackOptions_FeedBackGenericIncorrect_def','stack',''),''); $this->addOption('FeedbackGenericPCorrect','html',get_string('stackOptions_FeedBackGenericPCorrect_def','stack',''),''); + $this->addOption('OptWorkedSol','list','true',array('true' => get_string('stack_True','stack',''),'false' => get_string('stack_False', 'stack','')),'',''); } *************** *** 430,434 **** return $node; } - } ?> \ No newline at end of file --- 431,469 ---- return $node; } + /* Copies values from passed ItemOption to this. + * Useful where default options are an extension of stored ones. + * i.e. for updating old question instances. + */ + public function copyFrom($src) { + if(!empty($src->options)) + { + foreach($src->options as $optName => $option) + { + // check src option even exists in this + if(array_key_exists($optName, $this->options)) { + + $selected = $src->options[$optName]->getSelected(); + + // copy value over, involves checks. + $this->options[$optName]->setSelected($src->options[$optName]->getSelected()); + + } else { + $this->errorLog->addError('Attempted to copy selection of '.$optName.' which does not exist in current item.'); + } + } + } + } + + public function equals($other) { + if(empty($this->options) != empty($other->options)) return false; + if(!empty($this->options)) + { + foreach($this->options as $optName => $option) { + if($other->options[$optName]->getSelected() != $option->getSelected()) return false; + } + } + return true; + } + } ?> \ No newline at end of file Index: Item.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/Item.php,v retrieving revision 1.61 retrieving revision 1.61.2.1 diff -C2 -d -r1.61 -r1.61.2.1 *** Item.php 27 Aug 2009 16:23:00 -0000 1.61 --- Item.php 22 Nov 2010 23:05:44 -0000 1.61.2.1 *************** *** 40,44 **** * -holds potential response trees * -Used for editing & displaying questions ! * -Superclass of instatiated item. Instatiated item is the class which creates * a question for display, and answering by the student. * --- 40,44 ---- * -holds potential response trees * -Used for editing & displaying questions ! * -Superclass of instantiated item. Instantiated item is the class which creates * a question for display, and answering by the student. * *************** *** 53,56 **** --- 53,63 ---- protected $qID; + // Attributes + /** + * @var String + * @access protected + */ + protected $line; + /** * @var Array *************** *** 331,334 **** --- 338,342 ---- $this->questionStatus = $questionVariables['questionStatus']; $this->published = $questionVariables['published']; + $this->line = $questionVariables['line']; } else *************** *** 339,342 **** --- 347,356 ---- } + // handle legacy items + if(NULL !== $this->questionPart) { + foreach($this->questionPart as $qp) { + $qp->ensureCompleteOptions(); + } + } //load in the keywords from the database *************** *** 361,365 **** //$db->connect(); ! //because of how PHP does database connections $db and $kwDB's connections are essencially combinded into one connection. if($itemOpt == NULL) { --- 375,379 ---- //$db->connect(); ! //because of how PHP does database connections $db and $kwDB's connections are essentially combined into one connection. if($itemOpt == NULL) { *************** *** 371,385 **** die(); } ! $this->itemOptions = $db->base64_unserialize($serialised); // CJS 6/1/9. Not needed in the long term. New option added. if (NULL === $this->itemOptions->getOption('Feedback')) { $this->itemOptions->addOption('Feedback','list','TGS',array('TGS' => get_string('stackOption_Feedback_TGS', 'stack', ''),'TG'=> get_string('stackOption_Feedback_TG', 'stack', ''),'GS'=> get_string('stackOption_Feedback_GS', 'stack', ''),'G'=> get_string('stackOption_Feedback_G', 'stack', ''),'S'=> get_string('stackOption_Feedback_S', 'stack', ''),'none'=> get_string('stackOption_Feedback_none', 'stack', ''))); } ! } else { ! $this->itemOptions = $itemOpt; } --- 385,407 ---- die(); } ! /* ! * Approach is to overwrite default options rather than just ! * clone them. Allows us to extend options without fear. ! */ ! $this->itemOptions = new ItemOption(); // future-proofing ! $this->itemOptions->copyFrom($db->base64_unserialize($serialised)); + /* + * SPH 18/2/10. Covered by overwriting approach above. // CJS 6/1/9. Not needed in the long term. New option added. if (NULL === $this->itemOptions->getOption('Feedback')) { $this->itemOptions->addOption('Feedback','list','TGS',array('TGS' => get_string('stackOption_Feedback_TGS', 'stack', ''),'TG'=> get_string('stackOption_Feedback_TG', 'stack', ''),'GS'=> get_string('stackOption_Feedback_GS', 'stack', ''),'G'=> get_string('stackOption_Feedback_G', 'stack', ''),'S'=> get_string('stackOption_Feedback_S', 'stack', ''),'none'=> get_string('stackOption_Feedback_none', 'stack', ''))); } ! **/ } else { ! $this->itemOptions = new ItemOption(); // see 'future-proofing' above ! $this->itemOptions->copyFrom($itemOpt); } *************** *** 418,421 **** --- 440,444 ---- global $config; $this->qID = NULL; //not yet been assigned, once stored gets a question ID + //$this->version = 0; // set according to version scheme $this->PRTrees = array(); *************** *** 522,526 **** /** ! * Stores the question in the the database, if $asnew is set to true, adds as a new question. * * @param bool $asNew --- 545,549 ---- /** ! * Stores the question revision in the the database, if $asNew is set to true, adds as a new question line. * * @param bool $asNew *************** *** 530,546 **** public function store($asNew = false) { ! if($a... [truncated message content] |