From: Simon H. <sim...@us...> - 2008-12-23 15:26:47
|
Update of /cvsroot/stack/stack-dev/lib/ui In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30348/lib/ui Modified Files: Tag: stack_cache authorTest.php AuthorDisplay.php DisplayItem.php Log Message: Index: AuthorDisplay.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/AuthorDisplay.php,v retrieving revision 1.57 retrieving revision 1.57.4.1 diff -C2 -d -r1.57 -r1.57.4.1 *** AuthorDisplay.php 5 Nov 2008 16:08:19 -0000 1.57 --- AuthorDisplay.php 23 Dec 2008 15:26:40 -0000 1.57.4.1 *************** *** 28,31 **** --- 28,32 ---- require_once $root.'/lib/ui/inputTypes/InputTypeController.php'; require_once($root.'/lib/database/MoodleDB.php'); + require_once($root.'/lib/database/StackDBCache.php'); /** *************** *** 800,803 **** --- 801,812 ---- break; + case get_string('stackAuthor_button_deploy','stack'): + // sorting out the cache + // clear previous instances(?) + $db = new StackDBCache(); + $db->connect(); + $db->initialise($this->item->getQuestionId(), 10); // Hard-wired size. Expand for systematic population + break; + case 'Add to Moodle': $valid = $this->gWriter->validate(); Index: authorTest.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/authorTest.php,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -C2 -d -r1.14 -r1.14.2.1 *** authorTest.php 28 Nov 2008 22:00:06 -0000 1.14 --- authorTest.php 23 Dec 2008 15:26:40 -0000 1.14.2.1 *************** *** 97,101 **** <p><a href="../../index.php"><?php echo get_string('FE_index_main','stack','') ?></a></p> <form action="authorTest.php" method="POST"> ! <p><input type="submit" name="submit" value="<?php echo get_string('stackAuthor_button_update','stack'); ?>" /> <input type="submit" name="submit" value="<?php echo get_string('stackAuthor_button_save','stack'); ?>" /> <input type="submit" name="submit" value="<?php echo get_string('stackAuthor_button_savenew','stack'); ?>" /> <input type="submit" name="submit" value="<?php echo get_string('stackAuthor_button_exportAsXml','stack'); ?>" /></p> <?php echo $author->displayAuthor(); --- 97,101 ---- <p><a href="../../index.php"><?php echo get_string('FE_index_main','stack','') ?></a></p> <form action="authorTest.php" method="POST"> ! <p><input type="submit" name="submit" value="<?php echo get_string('stackAuthor_button_update','stack'); ?>" /> <input type="submit" name="submit" value="<?php echo get_string('stackAuthor_button_save','stack'); ?>" /> <input type="submit" name="submit" value="<?php echo get_string('stackAuthor_button_savenew','stack'); ?>" /> <input type="submit" name="submit" value="<?php echo get_string('stackAuthor_button_exportAsXml','stack'); ?>" /> <input type="submit" name="submit" value="<?php echo get_string('stackAuthor_button_deploy','stack'); ?>" /></p> <?php echo $author->displayAuthor(); Index: DisplayItem.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/DisplayItem.php,v retrieving revision 1.73.4.2 retrieving revision 1.73.4.3 diff -C2 -d -r1.73.4.2 -r1.73.4.3 *** DisplayItem.php 19 Dec 2008 16:47:06 -0000 1.73.4.2 --- DisplayItem.php 23 Dec 2008 15:26:40 -0000 1.73.4.3 *************** *** 254,258 **** $this->getAnsInputTypes(); - if(!empty($this->studentAnswers) && $reconstruct == true) { --- 254,257 ---- *************** *** 261,269 **** // set question display state ! $this->$state = new ItemState($this->studentAnswers, $this->answerBox, $this->itemOpts); $this->xhtml = ""; } - /** * If the worked solution box is ticked, then the worked solution should be displayed --- 260,267 ---- // set question display state ! $this->state = new ItemState($this->studentAnswers, $this->answerBox, $this->itemOpts); $this->xhtml = ""; } /** * If the worked solution box is ticked, then the worked solution should be displayed *************** *** 336,340 **** // Return cached xhtml if we have been here before ! if(fetchCache() != NULL) return $this->xhtml;// newly updated from cache // otherwise, carry on --- 334,338 ---- // Return cached xhtml if we have been here before ! if($this->fetchCache($posted) != NULL) return $this->xhtml;// newly updated from cache // otherwise, carry on *************** *** 1323,1326 **** --- 1321,1332 ---- } + // cache must be initialised first + private function selectItem() { + // get connection to cache + $db = new StackDBCache(); + $db->connect(); + + return $db->selectStart($this->seed); // using selection seed + } } ?> |