- Fix some of the stats reporting

This commit is contained in:
dave 2009-04-23 04:38:29 +00:00
parent 2aab58b28d
commit 566c5aecff

View File

@ -91,13 +91,14 @@
}
if($_POST['action']=="sendstats" && $_POST['xml']) {
if(function_exists('curl_init')) {
$r = curl_query($fair, $_POST['xml']);
if($r['error'][0] == 0)
echo happy(i18n("The %1 Server said:", array($fair['name'])).' '.$r['message'][0]);
else
echo error(i18n("The %1 Server said:", array($fair['name'])).' '.$r['message'][0]);
// $r = curl_query($fair, $_POST['xml']);
// if($r['error'][0] == 0)
// echo happy(i18n("The %1 Server said:", array($fair['name'])).' '.$r['message'][0]);
// else
// echo error(i18n("The %1 Server said:", array($fair['name'])).' '.$r['message'][0]);
$fairs_id = -1;
$year = $config['FAIRYEAR'];
} else {
@ -160,7 +161,7 @@
}
foreach($server_config as $k=>$v) {
$server_config[$k] = $data['statconfig'][0][$k][0];
//$server_config[$k] = $data['statconfig'][0][$k][0];
}
/* Gather all stats, then we'll decide what to send */
@ -190,19 +191,19 @@
AND registrations.year='$year'
AND (registrations.status='complete' OR registrations.status='paymentpending')");
$stats['schools_active']=mysql_num_rows($q);
$stats['students_public'] = 0;
$stats['students_private'] = 0;
$stats['schools_public'] = 0;
$stats['schools_private'] = 0;
$stats['schools_atrisk'] = 0;
$districts = array();
while($si=mysql_fetch_assoc($q)) {
if($si['designate'] == 'public')
$stats['students_public']++;
$stats['schools_public']++;
if($si['designate'] == 'independent')
$stats['students_private']++;
$stats['schools_private']++;
if($si['atrisk'] == 'yes')
$stats['schools_atrisk']++;
$bd = $si['board'].'~'.$si['district'];
if(!in_array($db, $districts)) $districts[] =$bd;
if(!in_array($bd, $districts)) $districts[] =$bd;
}
$stats['schools_districts'] = count($districts);
@ -329,6 +330,9 @@
echo i18n('At-risk/inner city schools: %1 (%2 students).',array(
$stats['schools_atrisk'], $stats['students_atrisk']));
echo '<br />';
echo i18n('Number of school boards/distrcits: %1',array(
$stats['schools_districts']));
echo '<br />';
echo '<br />';
echo '<br />';
}