From: Simon H. <sim...@us...> - 2010-09-01 16:51:12
|
Update of /cvsroot/stack/stack-dev/lib/reporting In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv9386/lib/reporting Modified Files: Tag: STACK2_2 SkillsResources.php DiagnosticReport.php Log Message: Brutally hacked diagnostic report to use the canonical skills and resources. Index: DiagnosticReport.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/reporting/Attic/DiagnosticReport.php,v retrieving revision 1.1.2.11 retrieving revision 1.1.2.12 diff -C2 -d -r1.1.2.11 -r1.1.2.12 *** DiagnosticReport.php 1 Sep 2010 12:22:45 -0000 1.1.2.11 --- DiagnosticReport.php 1 Sep 2010 16:51:00 -0000 1.1.2.12 *************** *** 29,32 **** --- 29,34 ---- require_once $root.'/opaque/MoodleDisplayItem.php'; + require_once $root . '/lib/reporting/SkillsResources.php'; + class DiagnosticReport { *************** *** 43,46 **** --- 45,49 ---- public function __construct($student = NULL, $quiz = NULL) { + $this->logger = new Logger('DiagnosticReport'); $this->student = $student; $this->quiz = $quiz; *************** *** 48,53 **** //$this->answerNotes = $reporting->studentAnswerNotes($this->student, $this->quiz); $this->loadResources(); - - $this->logger = new Logger('DiagnosticReport'); } --- 51,54 ---- *************** *** 58,70 **** */ private function loadResources() { ! // firstly, skill (and sub-skill) codes ! $this->skill = array( ! 'NUM' => 'Number', ! 'NUM-REL' => 'Relative size', ! 'NUM-RTP' => 'Ration / Proportion', ! 'NUM-FRC' => 'Fractions', ! 'ART' => 'Arithmetic', ! 'ART-ADD' => 'Addition' ! ); // merge this into lang files? // then learning resource links --- 59,64 ---- */ private function loadResources() { ! $skillsResources = new SkillsResources(); ! $this->skill = $skillsResources->getSkills(); // then learning resource links *************** *** 72,76 **** $this->resources[] = array("Sesame Street Learning About Numbers 4", "http://www.youtube.com/watch?v=Qxm6c7U8gxc", ! "NUM-REL"); $this->resources[] = array("BBC - KS2 Bitesize: Maths - Fractions - activity", "http://www.bbc.co.uk/schools/ks2bitesize/maths/number/fractions/play.shtml", --- 66,70 ---- $this->resources[] = array("Sesame Street Learning About Numbers 4", "http://www.youtube.com/watch?v=Qxm6c7U8gxc", ! "NUM-ADD"); $this->resources[] = array("BBC - KS2 Bitesize: Maths - Fractions - activity", "http://www.bbc.co.uk/schools/ks2bitesize/maths/number/fractions/play.shtml", *************** *** 82,85 **** --- 76,86 ---- public function resourcesFor($subskills) { + $skillsResources = new SkillsResources(); + //$this->logger->debug(print_r($skillsResources->getResourcesForSkills(array('EQN-SIM')), 1)); + //$subskills = array('EQN-SIM'); + $resources = $skillsResources->getResourcesForSkills($subskills); + + return $resources; + /* foreach($subskills as $subskill) { foreach($this->resources as $resource) { *************** *** 91,95 **** // sort by frequency ! return $toReturn; } --- 92,96 ---- // sort by frequency ! return $toReturn;*/ } *************** *** 148,152 **** // assuming format aaa-bbb-[true|false] if(preg_match("/^([a-z]{3})-([a-z]{3})-(true|false)/xi", $change, $m)) { ! $this->logger->debug("M:".print_r($m,1)); if($m[3] == 'TRUE') $value = 1; elseif($m[3] == 'FALSE') $value = -1; --- 149,153 ---- // assuming format aaa-bbb-[true|false] if(preg_match("/^([a-z]{3})-([a-z]{3})-(true|false)/xi", $change, $m)) { ! //$this->logger->debug("M:".print_r($m,1)); if($m[3] == 'TRUE') $value = 1; elseif($m[3] == 'FALSE') $value = -1; *************** *** 214,219 **** //$out .= print_r($recommendations, 1); $out .= "<ul>"; ! foreach($recommendations as $recommendation) { ! $out .= "<li><a href='".$recommendation[1]."'>".$recommendation[0]."</a></li>"; } $out .= "</ul>"; --- 215,220 ---- //$out .= print_r($recommendations, 1); $out .= "<ul>"; ! foreach($recommendations[0] as $recommendation) { ! $out .= "<li><a href='".$recommendation['URL']."'>".$recommendation['title']."</a></li>"; } $out .= "</ul>"; Index: SkillsResources.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/reporting/Attic/SkillsResources.php,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** SkillsResources.php 1 Sep 2010 16:19:28 -0000 1.1.2.4 --- SkillsResources.php 1 Sep 2010 16:51:00 -0000 1.1.2.5 *************** *** 310,313 **** --- 310,314 ---- $db -> connect(); + // Ought to go via StackDBItem, really! $sql = "SELECT questionID, questionName FROM stackquestion, question_keyword, keywords, question_lines WHERE (keyword LIKE ".$db->dbSafeString($keyword)." ) AND *************** *** 331,335 **** $db = new StackDBADOdb(); $db -> connect(); ! $sql = "SELECT stackquestion.questionID, stackquestion.questionName, display_cache.xhtml FROM question_keyword, keywords, display_cache, display_cache_sequence, question_lines, stackquestion WHERE (keyword LIKE ".$db->dbSafeString($keyword)." ) AND --- 332,336 ---- $db = new StackDBADOdb(); $db -> connect(); ! // Ought to go via StackDBItem, really! $sql = "SELECT stackquestion.questionID, stackquestion.questionName, display_cache.xhtml FROM question_keyword, keywords, display_cache, display_cache_sequence, question_lines, stackquestion WHERE (keyword LIKE ".$db->dbSafeString($keyword)." ) AND *************** *** 572,575 **** --- 573,586 ---- } + public function getSkills() { + return $this->skills; + } + // return a (ranked?) list of resources for the passed skills + public function getResourcesForSkills($skills) { + foreach($skills as $skill) { + $return[] = $this->resourceMap[$skill]; + } + return $return; + } } \ No newline at end of file |