|
From: Chris S. <san...@us...> - 2009-06-26 23:11:13
|
Update of /cvsroot/stack/stack-dev/lib/database In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13313/lib/database Modified Files: StackDBItem.php StackDBReporting.php devCache.php Log Message: Index: StackDBItem.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/database/StackDBItem.php,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** StackDBItem.php 23 Jun 2009 14:39:35 -0000 1.29 --- StackDBItem.php 26 Jun 2009 23:11:10 -0000 1.30 *************** *** 19,22 **** --- 19,23 ---- $root = $config->get('docroot'); require_once 'StackDBADOdb.php'; + require_once 'StackDBCache.php'; require_once 'MoodleDB.php'; require_once $root.'/lib/dateTime.php'; *************** *** 560,562 **** } ! ?> --- 561,563 ---- } ! ?> \ No newline at end of file Index: devCache.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/database/devCache.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** devCache.php 26 Jun 2009 18:12:16 -0000 1.5 --- devCache.php 26 Jun 2009 23:11:10 -0000 1.6 *************** *** 1,3 **** --- 1,4 ---- <?php + session_start(); /** *************** *** 13,24 **** global $config; $root = $config->get('docroot'); require_once $root.'/lib/database/StackDBCache.php'; require_once $root.'/lib/ui/DisplayItem.php'; require_once $root.'/lib/ui/frontend.php'; ! echo html_head('dev cache','../../',"@import \"../../styles.css\";\n"); ! ! // anti-plagiarism check: developers can uncomment line below ! die("Cache view for developers must be enabled in devCache.php"); $cache = new StackDBCache(); --- 14,24 ---- global $config; $root = $config->get('docroot'); + // Ensure admin is logged in. + require $root.'/lib/ui/AdminInterface.php'; require_once $root.'/lib/database/StackDBCache.php'; require_once $root.'/lib/ui/DisplayItem.php'; require_once $root.'/lib/ui/frontend.php'; ! //echo html_head('dev cache','../../',"@import \"../../styles.css\";\n"); $cache = new StackDBCache(); *************** *** 59,61 **** <frame src="devCache.php?side"> <frame name="main" src="devCache.php?main"> ! </frameset> \ No newline at end of file --- 59,61 ---- <frame src="devCache.php?side"> <frame name="main" src="devCache.php?main"> ! </frameset> \ No newline at end of file Index: StackDBReporting.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/database/StackDBReporting.php,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** StackDBReporting.php 26 Jun 2009 16:01:22 -0000 1.24 --- StackDBReporting.php 26 Jun 2009 23:11:10 -0000 1.25 *************** *** 384,388 **** $qid = $param["questionSelector"]; ! $sql = "SELECT attempt_meta_prt.PRTName , attempt_meta_prt.RawMark , attempt_meta_prt.AnsNote, COUNT( attempt_meta_prt.AnsNote ) as Count FROM question_attempts, attempt_meta_prt, display_cache, display_cache_sequence WHERE --- 384,388 ---- $qid = $param["questionSelector"]; ! $sql = "SELECT attempt_meta_prt.PRTName , attempt_meta_prt.RawMark , display_cache.questionNote, attempt_meta_prt.AnsNote, COUNT( attempt_meta_prt.AnsNote ) as Count FROM question_attempts, attempt_meta_prt, display_cache, display_cache_sequence WHERE *************** *** 397,402 **** (display_cache_sequence.nextNode != display_cache_sequence.currentNode)"; ! $sql.= "GROUP BY AnsNote ! ORDER BY PRTName ASC, RawMark DESC "; //echo $sql; --- 397,402 ---- (display_cache_sequence.nextNode != display_cache_sequence.currentNode)"; ! $sql.= "GROUP BY display_cache.id ! ORDER BY attempt_meta_prt.PRTName ASC, attempt_meta_prt.RawMark DESC "; //echo $sql; *************** *** 405,445 **** $no = $this->noRows(); ! $xhtml = '<table class="reportsStatsTable" border="1" cellpadding="2" cellspacing="0"> ! <tbody> ! <tr class="tableHeader"> ! <td>PRTName</td> ! <td>RawMark</td> ! <td>AnsNote</td> ! <td>Count</td> ! <td>%</td> ! </tr>'; ! $total = array(); ! for($i=0; $i < $no; $i++) ! { ! $PRTName = $this->result($i,'PRTName'); ! $count = $this->result($i,'Count'); ! $total[$PRTName] += $count; ! } ! for($i=0; $i < $no; $i++) ! { ! $PRTName = $this->result($i,'PRTName'); ! $RawMark = $this->result($i,'RawMark'); ! $AnsNote = $this->result($i,'AnsNote'); ! $count = $this->result($i,'Count'); ! $per = round(100*$count/$total[$PRTName],1); ! $xhtml .= "<tr> ! <td>$PRTName</td> ! <td>$RawMark</td> ! <td>$AnsNote</td> ! <td>$count</td> ! <td>$per</td> ! </tr>"; } - //total attempts - //$xhtml .= "<tr> <td></td><td></td><td>Total Attempts</td><td>$total</td></tr>"; - $xhtml .= '</tbody></table>'; return $xhtml; } --- 405,472 ---- $no = $this->noRows(); ! $xhtml = ''; ! if ($no>0) { ! $total = array(); ! $RawMark = array(); ! $summary = array(); ! $data = array(); ! $allAnsNotes = array(); ! $allQueNotes = array(); ! for($i=0; $i < $no; $i++) ! { ! $PRTName = $this->result($i,'PRTName'); ! $questionNote = $this->result($i,'questionNote'); ! $allQueNotes[$questionNote] = true; ! $AnsNote = $this->result($i,'AnsNote'); ! $allAnsNotes[$AnsNote] = true; ! $count = $this->result($i,'Count'); ! $total[$PRTName] += $count; ! $RawMark[$PRTName][$AnsNote] = $this->result($i,'RawMark'); ! $summary[$PRTName][$AnsNote] += $count; ! $data[$PRTName][$AnsNote][$questionNote] += $count; ! } ! $allPRTNames = array_keys($data); ! $allQueNotes = array_keys($allQueNotes); ! $xhtml .= '<h2>Comparison of question versions</h2>'; ! ! $xhtml .= '<table class="reportsStatsTable" border="1" cellpadding="2" cellspacing="0"> ! <tbody> ! <tr class="tableHeader"> ! <td></td> ! <td>Question Note</td> ! </tr>'; ! foreach($allQueNotes as $key => $note) { ! $xhtml .= "<tr><td>$key</td><td>$note</td></tr>"; ! } ! $xhtml .= '</tbody></table>'; ! ! foreach($allPRTNames as $keyp => $PRT) { ! ! $allAnsNotes = array_keys($data[$PRT]); ! ! $xhtml .= '<h3>Potential response: '.$PRT.'</h2>'; ! $xhtml .= '<table class="reportsStatsTable" border="1" cellpadding="2" cellspacing="0"><tbody><tr class="tableHeader"><td></td><td>Raw Mark</td>'; ! foreach($allQueNotes as $key => $note) { ! $xhtml .= "<td>$key</td>"; ! } ! $xhtml .= "<td>Total</td><td>%</td>"; ! $xhtml .= '</tr>'; ! foreach($allAnsNotes as $anote) { ! $xhtml .= '<tr><td>'.$anote.'</td><td>'.round($RawMark[$PRT][$anote],2).'</td>'; ! foreach($allQueNotes as $qnote) { ! $count = $data[$PRT][$anote][$qnote]; ! $xhtml .= "<td>$count</td>"; ! } ! $xhtml .= '<td>'.$summary[$PRT][$anote].'</td>'; ! $xhtml .= '<td>'.round(100*$summary[$PRT][$anote]/$total[$PRT],1).'</td>'; ! $xhtml .= '</tr>'; ! } ! $xhtml .= '</tbody></table>'; ! ! } } return $xhtml; } |