From: Simon H. <sim...@us...> - 2010-12-09 14:25:10
|
Update of /cvsroot/stack/stack-dev/lib/items In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv30562/lib/items Modified Files: Tag: item_state_separation StudentAns.php ItemOption.php Log Message: Intermediate debugging Index: ItemOption.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/ItemOption.php,v retrieving revision 1.19.8.4 retrieving revision 1.19.8.5 diff -C2 -d -r1.19.8.4 -r1.19.8.5 *** ItemOption.php 1 Dec 2010 18:21:32 -0000 1.19.8.4 --- ItemOption.php 9 Dec 2010 14:25:00 -0000 1.19.8.5 *************** *** 29,53 **** * from the question itself * ! * All questions are stored in a options array and are made up of StackOptions * which are responsible for validating themselves. - * */ class ItemOption { ! // Attributes ! /** ! * List of default stackOptions in format name => stackOption ! * ! * @var array(stackOption) ! * @access private ! */ ! static private $options; // the defaults ! ! /** ! * Selected values for stackOptions in format name => stackOption ! * ! * @var array(name=>value) ! * @access private ! */ ! private $selected; // the selected values - SPH /** --- 29,52 ---- * from the question itself * ! * All questions are stored in an options array and are made up of StackOptions * which are responsible for validating themselves. */ class ItemOption { ! // Attributes ! /** ! * List of default stackOptions in format name => stackOption ! * ! * @var array(stackOption) ! * @access private ! */ ! static public $options; // the defaults ! ! /** ! * Selected values for stackOptions in format name => stackOption ! * ! * @var array(name=>value) ! * @access private ! */ ! private $selected; // the selected values - SPH /** *************** *** 107,117 **** $this->addOption('OptWorkedSol','list','true',array('true' => get_string('stack_True','stack',''),'false' => get_string('stack_False', 'stack','')),'',''); } ! /* public function __clone() { // obsolete? ! echo "6:17pm:";var_dump(self::$options); } ! */ /** * Validates every option. --- 106,116 ---- $this->addOption('OptWorkedSol','list','true',array('true' => get_string('stack_True','stack',''),'false' => get_string('stack_False', 'stack','')),'',''); } ! public function __clone() { // obsolete? ! //echo "6:17pm:";var_dump(self::$options); } ! //*/ /** * Validates every option. *************** *** 157,160 **** --- 156,160 ---- { self::$options[$name] = $tmp; // new option for ItemOption + //echo "domut123:";print_r(self::$options[$name], 1); $this->selected[$name] = $default; // and value set for the instance } *************** *** 367,372 **** public function setSelected($name, $value) { ! echo "6pm:";var_dump(self::$options); ! if(array_key_exists($name, self::$options)) // we have the option { $this->selected[$name] = $value; --- 367,372 ---- public function setSelected($name, $value) { ! //echo "6pm:";print_r(debug_backtrace());var_dump(ItemOption::$options); ! if(array_key_exists($name, ItemOption::$options)) // we have the option { $this->selected[$name] = $value; *************** *** 467,470 **** --- 467,474 ---- return true; } + + public function debug() { + return 'from debug():<pre>DEAFULTS'.print_r(self::$options, 1).'SELECTED'.print_r($this->selected, 1).'</pre>'; + } } ?> \ No newline at end of file Index: StudentAns.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/StudentAns.php,v retrieving revision 1.42.6.2.2.2 retrieving revision 1.42.6.2.2.3 diff -C2 -d -r1.42.6.2.2.2 -r1.42.6.2.2.3 *** StudentAns.php 1 Dec 2010 18:21:32 -0000 1.42.6.2.2.2 --- StudentAns.php 9 Dec 2010 14:25:00 -0000 1.42.6.2.2.3 *************** *** 217,221 **** { $itemOptions = clone $itemOpts; ! echo "snow:<pre>";print_r($itemOpts); $toReturn = true; foreach($this->studentAnswers as $label => $sAns) --- 217,222 ---- { $itemOptions = clone $itemOpts; ! //echo "snow:<pre>".$itemOpts->debug(); ! //print_r(ItemOption::$options,1); $toReturn = true; foreach($this->studentAnswers as $label => $sAns) |