|
From: Simon H. <sim...@us...> - 2010-11-24 16:44:34
|
Update of /cvsroot/stack/stack-dev/lib/database In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv22656/lib/database Modified Files: StackDBReporting.php Log Message: Towards restoring standard reporting option. Index: StackDBReporting.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/database/StackDBReporting.php,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** StackDBReporting.php 30 Sep 2010 16:56:13 -0000 1.28 --- StackDBReporting.php 24 Nov 2010 16:44:26 -0000 1.29 *************** *** 49,56 **** public function questionList($ids = null) { ! $sql = 'SELECT questionID, questionName, questionDescription FROM stackquestion'; ! if (isset($ids)) { ! $sql .= " WHERE questionID IN ($ids)"; ! } $this->connect(); $this->query($sql); --- 49,60 ---- public function questionList($ids = null) { [...1124 lines suppressed...] ! $PRTName = $this->result($i, 'PRTName'); ! $RawMark = $this->result($i, 'RawMark'); ! $ModMark = $this->result($i, 'ModMark'); ! ! if(!array_key_exists($questionId, $resultsArray) || !array_key_exists($userId, $resultsArray[$questionId])) ! { ! $resultsArray[$questionId][$userId] = new MarksAttempt($userId, $questionId); ! } ! $resultsArray[$questionId][$userId]->addAttempt($attemptId, $PRTName, $RawMark, $ModMark); ! } ! ! return $resultsArray; ! } ! ! public function gPieChart($values, $labels) { ! // pesky pipes conflict with gChart separators so am substituting them ! return '<img src="http://chart.apis.google.com/chart?cht=p&chs=500x100&chd=t:'.implode($values, ',').'&chdl='.str_replace('|', '~', implode($labels, '|')).'" />'; ! } } |