From: Simon H. <sim...@us...> - 2010-09-30 16:56:55
|
Update of /cvsroot/stack/stack-dev/lib/items In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv28438/lib/items Modified Files: ItemTests.php StudentAns.php ItemOption.php QuestionPart.php InstantiatedItem.php InteractionElement.php CasTextType.php RawKeyVal.php Item.php Meta.php PotentialResponse.php PotentialResponseTree.php QuestionType.php Log Message: Merging 2.2 branch (with some additional fixes to ensure seamless updating for version lines) Index: InteractionElement.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/InteractionElement.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** InteractionElement.php 27 Aug 2009 16:23:00 -0000 1.9 --- InteractionElement.php 30 Sep 2010 16:56:15 -0000 1.10 *************** *** 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.33 diff -C2 -d -r1.32 -r1.33 *** QuestionPart.php 27 Aug 2009 16:23:00 -0000 1.32 --- QuestionPart.php 30 Sep 2010 16:56:15 -0000 1.33 *************** *** 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.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** QuestionType.php 11 Jan 2010 17:23:36 -0000 1.12 --- QuestionType.php 30 Sep 2010 16:56:15 -0000 1.13 *************** *** 263,267 **** { //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 Index: ItemTests.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/ItemTests.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ItemTests.php 27 Aug 2009 16:23:00 -0000 1.3 --- ItemTests.php 30 Sep 2010 16:56:15 -0000 1.4 *************** *** 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.49 diff -C2 -d -r1.48 -r1.49 *** PotentialResponse.php 27 Jun 2009 08:51:41 -0000 1.48 --- PotentialResponse.php 30 Sep 2010 16:56:15 -0000 1.49 *************** *** 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.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Meta.php 11 Jan 2010 17:23:36 -0000 1.19 --- Meta.php 30 Sep 2010 16:56:15 -0000 1.20 *************** *** 287,290 **** --- 287,294 ---- return NULL; } + + public function equals($other) { + return $this->forbidFloats == $other->forbidFloats; + } } ?> \ No newline at end of file Index: RawKeyVal.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/RawKeyVal.php,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** RawKeyVal.php 23 Feb 2010 10:27:10 -0000 1.31 --- RawKeyVal.php 30 Sep 2010 16:56:15 -0000 1.32 *************** *** 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 contrustor for the below? //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; *************** *** 648,652 **** --- 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: PotentialResponseTree.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/PotentialResponseTree.php,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** PotentialResponseTree.php 27 Jun 2009 08:51:41 -0000 1.71 --- PotentialResponseTree.php 30 Sep 2010 16:56:15 -0000 1.72 *************** *** 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: StudentAns.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/StudentAns.php,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** StudentAns.php 18 Jan 2010 18:36:19 -0000 1.45 --- StudentAns.php 30 Sep 2010 16:56:15 -0000 1.46 *************** *** 118,122 **** if($ans == '') { - //echo 'here'; $this->studentAnswers[$label]->setRawAns($ans); $this->studentAnswers[$label]->setStatus(NULL); --- 118,121 ---- *************** *** 221,226 **** 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 ---- *************** *** 398,402 **** { //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 .= '@'; *************** *** 406,410 **** } - /*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 ---- *************** *** 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 *************** *** 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: InstantiatedItem.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/InstantiatedItem.php,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** InstantiatedItem.php 28 Aug 2009 10:09:23 -0000 1.81 --- InstantiatedItem.php 30 Sep 2010 16:56:15 -0000 1.82 *************** *** 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: CasTextType.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/CasTextType.php,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** CasTextType.php 20 Oct 2009 10:15:28 -0000 1.25 --- CasTextType.php 30 Sep 2010 16:56:15 -0000 1.26 *************** *** 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 *************** *** 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.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** ItemOption.php 18 Feb 2010 16:33:33 -0000 1.22 --- ItemOption.php 30 Sep 2010 16:56:15 -0000 1.23 *************** *** 455,458 **** --- 455,469 ---- } } + + 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.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** Item.php 18 Feb 2010 16:33:33 -0000 1.64 --- Item.php 30 Sep 2010 16:56:15 -0000 1.65 *************** *** 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) { *************** *** 426,429 **** --- 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(); *************** *** 530,534 **** /** ! * 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 *************** *** 538,554 **** public function store($asNew = false) { ! if($asNew == true) ! { ! $this->logger->finest('Storing as a new item'); ! } ! else{ ! $this->logger->finest('Saving item '.$this->qID); ! } ! //to store in the database the item is wrapped up into an array, then serialised. ! //PRTrees are stored in a seperate table. ! ! ! $db = new StackDBItem(); ! $conn = $db->connect(); if(!$conn) --- 553,559 ---- public function store($asNew = false) { ! $this->logger->debug('storing item named:'.$this->questionName->getSelection()); ! // get db connection going ! $db = new StackDBItem(); $conn = $db->connect(); if(!$conn) *************** *** 558,726 **** return false; } else { - //serialize variables - $dbItemOptions = $db->base64_serialize($this->itemOptions); //serialise is in stackDatabase - $dbItemTests = $db->base64_serialize($this->itemTests); ! $questionVariables['qID'] = $this->qID; ! $questionVariables['lastUserEditor'] = $this->lastUserEditor; ! $questionVariables['language'] = $this->language; ! $questionVariables['questionName'] = $this->questionName; ! $questionVariables['questionDescription'] = $this->questionDescription; ! $questionVariables['questionPublisher'] = $this->questionPublisher; ! $questionVariables['questionFormat'] = $this->questionFormat; ! $questionVariables['questionLearningContext'] = $this->questionLearningContext; ! $questionVariables['questionDifficulty'] = $this->questionDifficulty; ! $questionVariables['questionCompetency'] = $this->questionCompetency; ! $questionVariables['questionCompentencyLevel'] = $this->questionCompentencyLevel; ! $questionVariables['questionTimeAllocated'] = $this->questionTimeAllocated; ! $questionVariables['questionRights'] = $this->questionRights; ! $questionVariables['questionExerciseType'] = $this->questionExerciseType; ! $now = date("Y-m-d H:i:s"); ! $this->questionDateLastEdited->setSelection($now); ! $questionVariables['questionDateLastEdited'] = $this->questionDateLastEdited; ! $questionVariables['questionStem'] = $this->questionStem; ! $questionVariables['questionVariables'] = $this->questionVariables; ! $questionVariables['questionPenalty'] = $this->questionPenalty; ! $questionVariables['studentAnsKey'] = $this->studentAnsKey; ! $questionVariables['teacherAns'] = $this->teacherAns; ! $questionVariables['workedSolution'] = $this->workedSolution; ! $questionVariables['questionNote'] = $this->questionNote; ! //$questionVariables['questionAnsTest'] = $this->questionAnsTest; ! $questionVariables['questionPart'] = $this->questionPart; ! $questionVariables['valid'] = $this->valid; ! $questionVariables['questionStatus'] = $this->questionStatus; ! $questionVariables['published'] = $this->published; - //if storing as new, generate new GUID - if($asNew == true) - { - global $config; - $GUID = stack_generate_guid($config->get('weburl')); - $this->questionGUID = new Meta('system',$GUID,NULL,'identifier','dc','string'); - $questionVariables['questionGUID'] = $this->questionGUID; - } - else - { - $questionVariables['questionGUID'] = $this->questionGUID; - } - $dbQuestionVariables = $db->base64_serialize($questionVariables); - unset($questionVariables); - //get metadata for inserting into database - $meta['lastUserEditor'] = $this->lastUserEditor->getSelection(); - $meta['language'] = $this->language->getSelection(); - $meta['questionName'] = $this->questionName->getSelection(); - $meta['questionDescription'] = $this->questionDescription->getSelection(); - $meta['questionKeywords'] = $this->questionKeywords->getSelection(); - $meta['questionPublisher'] = $this->questionPublisher->getSelection(); - $meta['questionFormat'] = $this->questionFormat->getSelection(); - $meta['questionLearningContext'] = $this->questionLearningContext->getSelection(); - $meta['questionDifficulty'] = $this->questionDifficulty->getSelection(); - $meta['questionCompetency'] = $this->questionCompetency->getSelection(); - $meta['questionCompentencyLevel'] = $this->questionCompentencyLevel->getSelection(); - $meta['questionTimeAllocated'] = $this->questionTimeAllocated->getSelection(); - $meta['questionRights'] = $this->questionRights->getSelection(); - $meta['questionGUID'] = $this->questionGUID->getSelection(); - $meta['questionExerciseType'] = $this->questionExerciseType->getSelection(); - $meta['questionDateLastEdited'] = $this->questionDateLastEdited->getSelection(); ! //add to database ! if (($asNew == true) || (empty($this->qID))) ! { ! //add a new question. If qid not set, then not added to db yet. ! $status = $this->questionStatus->getSelection(); ! $published = $this->published->getSelection(); ! $result = $db->addNewItem($dbItemOptions, $dbItemTests, $dbQuestionVariables, $meta, $this->valid, $status, $published); ! //returned result is either qId of false if failed ! $this->qID = $result; ! //add PRTs ! if(!empty($this->PRTrees)) { ! foreach($this->PRTrees as $PRT) { ! $data = $PRT->toBlob(); ! $name = $PRT->getName(); ! $prtResult = $db->addPRT($this->qID, $name, $data); ! if(!$prtResult) ! { ! $this->errorLog->addError(get_string('stackDatabase_failedAddPRT','stack','')); ! $this->errorLog->addUserError('main', get_string('stackDatabase_failedAddPRT','stack','')); ! } } } - } - else - { - //update currect question - $status = $this->questionStatus->getSelection(); - $published = $this->published->getSelection(); - $result = $db->updateItem($this->qID, $dbItemOptions, $dbItemTests, $dbQuestionVariables, $meta, $this->valid, $status, $published); - //returned result is either qId of false if failed ! //remove any existing PRTs related to question then add new PRTs. ! $db->removeItemsPRT($this->qID); ! //add back in. ! if(!empty($this->PRTrees)) { ! foreach($this->PRTrees as $PRT) { ! $data = $PRT->toBlob(); ! $name = $PRT->getName(); ! $prtResult = $db->addPRT($this->qID, $name, $data); ! if(!$prtResult) ! { ! $this->errorLog->addError('Could Not add PRT to Database.'); ! $this->errorLog->addUserError('main', get_string('stackDatabase_failedAddPRT','stack','')); ! } } } } ! //add the keywords to the keywords database table ! //Keywords are stored twice, once in the item as a meta object and ! //again raw in the database to allow for searching for questions by keyword ! ! $kwDB = new StackDBKeywords(); ! $kwDB->connect(); ! ! //first remove any existing keywords ! $kwDB->removeKeywords($this->qID); ! ! //now add the keywords ! $keywords = $this->questionKeywords->getSelection(); ! $result = $kwDB->setQuestionKeywordsString($this->qID, $keywords); ! ! if($result == false) ! { ! $this->errorLog->addUserError('Database', 'Could not add keywords to database'); ! echo 'Failed to add keywords to database.'; ! } ! $kwDB->disconnect(); ! if($result === false) ! { ! $this->errorLog->addError('Could not add the Item to the database: '.$db->getErrors()); ! $this->errorLog->addUserError('main', get_string('stackDatabase_failedAddItem','stack','')); ! return false; ! } ! $db->disconnect(); ! }//else conn return true; - } --- 563,766 ---- return false; } + + if($asNew == true || !isset($this->line)) { // need to start a new line + $this->line = $db->newLine(); + $this->logger->debug('Started a new line: '.$this->line); + + } else $line = $this->line; + + + if(!$asNew){ // just saving + // check item has been changed + $prior = new Item(null, $this->qID); + if($this->equals($prior)) { + $this->logger->debug('Item unchanged. No need to store!'); + return false; + } + $this->logger->debug('Saving item '.$this->qID); + } + //to store in the database the item is wrapped up into an array, then serialised. + //PRTrees are stored in a separate table. + + //serialize variables + $dbItemOptions = $db->base64_serialize($this->itemOptions); //serialise is in stackDatabase + $dbItemTests = $db->base64_serialize($this->itemTests); + + $questionVariables['qID'] = $this->qID; + + $questionVariables['line'] = $this->line; + $questionVariables['lastUserEditor'] = $this->lastUserEditor; + $questionVariables['language'] = $this->language; + $questionVariables['questionName'] = $this->questionName; + $questionVariables['questionDescription'] = $this->questionDescription; + $questionVariables['questionPublisher'] = $this->questionPublisher; + $questionVariables['questionFormat'] = $this->questionFormat; + $questionVariables['questionLearningContext'] = $this->questionLearningContext; + $questionVariables['questionDifficulty'] = $this->questionDifficulty; + $questionVariables['questionCompetency'] = $this->questionCompetency; + $questionVariables['questionCompentencyLevel'] = $this->questionCompentencyLevel; + $questionVariables['questionTimeAllocated'] = $this->questionTimeAllocated; + $questionVariables['questionRights'] = $this->questionRights; + $questionVariables['questionExerciseType'] = $this->questionExerciseType; + + $now = date("Y-m-d H:i:s"); + $this->questionDateLastEdited->setSelection($now); + $questionVariables['questionDateLastEdited'] = $this->questionDateLastEdited; + $questionVariables['questionStem'] = $this->questionStem; + $questionVariables['questionVariables'] = $this->questionVariables; + $questionVariables['questionPenalty'] = $this->questionPenalty; + $questionVariables['studentAnsKey'] = $this->studentAnsKey; + $questionVariables['teacherAns'] = $this->teacherAns; + $questionVariables['workedSolution'] = $this->workedSolution; + $questionVariables['questionNote'] = $this->questionNote; + //$questionVariables['questionAnsTest'] = $this->questionAnsTest; + $questionVariables['questionPart'] = $this->questionPart; + $questionVariables['valid'] = $this->valid; + $questionVariables['questionStatus'] = $this->questionStatus; + $questionVariables['published'] = $this->published; + + //if storing as new, generate new GUID + if($asNew == true) + { + global $config; + $GUID = stack_generate_guid($config->get('weburl')); + $this->questionGUID = new Meta('system',$GUID,NULL,'identifier','dc','string'); + $questionVariables['questionGUID'] = $this->questionGUID; + + // avoid obvious duplicate names + $name = $this->questionName->getSelection(); + if($db->nameExists($name)) { + $np = strpos($name," (new:"); + /*if (false!==$np) { + $name = substr($name,0,$np); + } + */ + $name .= " (new: ".stack_dateDisplay().', '.date("h:i:s").")"; // single fork + + } + $this->questionName->setSelection($name); + } else { + $questionVariables['questionGUID'] = $this->questionGUID; + } ! $dbQuestionVariables = $db->base64_serialize($questionVariables); ! unset($questionVariables); ! //get metadata for inserting into database ! $meta['lastUserEditor'] = $this->lastUserEditor->getSelection(); ! $meta['language'] = $this->language->getSelection(); ! $meta['questionName'] = $this->questionName->getSelection(); ! $meta['questionDescription'] = $this->questionDescription->getSelection(); ! $meta['questionKeywords'] = $this->questionKeywords->getSelection(); ! $meta['questionPublisher'] = $this->questionPublisher->getSelection(); ! $meta['questionFormat'] = $this->questionFormat->getSelection(); ! $meta['questionLearningContext'] = $this->questionLearningContext->getSelection(); ! $meta['questionDifficulty'] = $this->questionDifficulty->getSelection(); ! $meta['questionCompetency'] = $this->questionCompetency->getSelection(); ! $meta['questionCompentencyLevel'] = $this->questionCompentencyLevel->getSelection(); ! $meta['questionTimeAllocated'] = $this->questionTimeAllocated->getSelection(); ! $meta['questionRights'] = $this->questionRights->getSelection(); ! $meta['questionGUID'] = $this->questionGUID->getSelection(); ! $meta['questionExerciseType'] = $this->questionExerciseType->getSelection(); ! $meta['questionDateLastEdited'] = $this->questionDateLastEdited->getSelection(); + $meta['line'] = $this->line; + //add to database + //if (($asNew == true) || (empty($this->qID))) + //{ + //add a new question. If qid not set, then not added to db yet. + $status = $this->questionStatus->getSelection(); + $published = $this->published->getSelection(); + $result = $db->addNewItem($dbItemOptions, $dbItemTests, $dbQuestionVariables, $meta, $this->valid, $status, $published); + //returned result is either qId or false if failed ! $this->qID = $result; ! $db->setLatestVersion($this->line, $this->qID); ! //add PRTs ! if(!empty($this->PRTrees)) ! { ! foreach($this->PRTrees as $PRT) { ! $data = $PRT->toBlob(); ! $name = $PRT->getName(); ! $prtResult = $db->addPRT($this->qID, $name, $data); ! if(!$prtResult) { ! $this->errorLog->addError(get_string('stackDatabase_failedAddPRT','stack','')); ! $this->errorLog->addUserError('main', get_string('stackDatabase_failedAddPRT','stack','')); } } } ! /*} ! else ! { ! //update current question ! $status = $this->questionStatus->getSelection(); ! $published = $this->published->getSelection(); ! $result = $db->updateItem($this->qID, $dbItemOptions, $dbItemTests, $dbQuestionVariables, $meta, $this->valid, $status, $published); ! $this->qID = $result; ! //returned result is either qId of false if failed ! if(!$result) $this->logger->debug("result of question update is 'false'"); ! ! //remove any existing PRTs related to question then add new PRTs. ! $db->removeItemsPRT($this->qID); ! //add back in. ! if(!empty($this->PRTrees)) ! { ! foreach($this->PRTrees as $PRT) { ! $data = $PRT->toBlob(); ! $name = $PRT->getName(); ! $prtResult = $db->addPRT($this->qID, $name, $data); ! if(!$prtResult) { ! $this->errorLog->addError('Could Not add PRT to Database.'); ! $this->errorLog->addUserError('main', get_string('stackDatabase_failedAddPRT','stack','')); } } } + } + */ + //add the keywords to the keywords database table + //Keywords are stored twice, once in the item as a meta object and + //again raw in the database to allow for searching for questions by keyword ! $kwDB = new StackDBKeywords(); ! $kwDB->connect(); ! //first remove any existing keywords ! $kwDB->removeKeywords($this->qID); ! //now add the keywords ! $keywords = $this->questionKeywords->getSelection(); ! $result = $kwDB->setQuestionKeywordsString($this->qID, $keywords); + if($result == false) + { + $this->errorLog->addUserError('Database', 'Could not add keywords to database'); + echo 'Failed to add keywords to database.'; + } + $kwDB->disconnect(); ! if($result === false) ! { ! $this->errorLog->addError('Could not add the Item to the database: '.$db->getErrors()); ! $this->errorLog->addUserError('main', get_string('stackDatabase_failedAddItem','stack','')); ! return false; ! } ! $db->disconnect(); return true; } *************** *** 745,749 **** $note = trim($this->questionNote->getRawCasText()); ! if(empty($note)) { $toReturn = false; --- 785,789 ---- $note = trim($this->questionNote->getRawCasText()); ! if(empty($note) AND $this->questionVariables->contains_rand()) { $toReturn = false; *************** *** 1028,1031 **** --- 1068,1091 ---- } + /** + * Returns line + * @access public + * @return int + */ + public function getLine() + { + return $this->line; + } + + /** + * Sets line + * @access public + * @return int + */ + public function setLine($line) + { + $this->line = $line; + } + /** * gets a named itemOption *************** *** 1251,1254 **** --- 1311,1473 ---- } } + + /** + * Increments the revision of the Item. + * + * @access public + * @param bool isMinor + * @param bool is a minor revision (depending on revision scheme) +... [truncated message content] |