#!/usr/bin/env php addFile($name, $filename, $total); $loaded[] = $filename; } foreach ($types as $type) { // Build samples foreach ($samples as $sample) { // Print header $sample_header = strtoupper($sample); switch ($type) { case 'average': printAverage($sample_header); break; case 'dist': case 'dist_percentage': printDistribution($sample_header); break; case 'marks': break; } // Build samples $Samples = array(); switch ($sample) { case 'global': $Samples['global'] = new ExamCalcs($Global->getDataSet()); break; case 'sections': foreach ($Global->getSections() as $section) { $tmpSample = new ExamCalcs($Global->getDataSet()); $tmpSample->filterBySections($section); $Samples[$section] = $tmpSample; } break; case 'profs': foreach ($Global->getTeachers() as $prof) { $tmpSample = new ExamCalcs($Global->getDataSet()); $tmpSample->filterByTeachers($prof); $Samples[$prof] = $tmpSample; } break; } // Print stats foreach ($Samples as $name => $S) { $stats = $S->getStats(); switch ($type) { case 'average': printAverage($name, $stats); break; case 'dist_percentage': printDistribution($name, $stats, true); break; case 'dist': printDistribution($name, $stats); break; case 'questions': echo "\"STATS ON QUESTIONS: ".strtoupper($name)."\"\n"; try { $S->printStatsOnCommonItems(); } catch (Exception $e) { echo "\"Not enough data\"\n"; } break; case 'marks': $marks = $S->getMarks(); foreach ($marks as $student) { echo implode(';', $student)."\n"; } break; } } echo "\n"; } } exit; exit; ?>