- More data, more stats

This commit is contained in:
dave 2009-04-20 05:27:06 +00:00
parent b5745656c1
commit cfdcfb7c9d
3 changed files with 53 additions and 6 deletions

View File

@ -40,6 +40,7 @@
$server_config['fair_stats_schools_ext'] = 'no'; $server_config['fair_stats_schools_ext'] = 'no';
$server_config['fair_stats_minorities'] = 'no'; $server_config['fair_stats_minorities'] = 'no';
$server_config['fair_stats_guests'] = 'no'; $server_config['fair_stats_guests'] = 'no';
$server_config['fair_stats_sffbc_misc'] = 'no';
function curl_query($fair, $xml) function curl_query($fair, $xml)
{ {
@ -137,6 +138,9 @@
exit; exit;
} }
echo i18n('This server has requested the following stats:');
echo '<br /><br />';
/* Query the server to see what stats we need */ /* Query the server to see what stats we need */
$xmldata=array("sfiab"=>array( $xmldata=array("sfiab"=>array(
"username"=>$fair['username'], "username"=>$fair['username'],
@ -189,6 +193,7 @@
$stats['students_public'] = 0; $stats['students_public'] = 0;
$stats['students_private'] = 0; $stats['students_private'] = 0;
$stats['schools_atrisk'] = 0; $stats['schools_atrisk'] = 0;
$districts = array();
while($si=mysql_fetch_assoc($q)) { while($si=mysql_fetch_assoc($q)) {
if($si['designate'] == 'public') if($si['designate'] == 'public')
$stats['students_public']++; $stats['students_public']++;
@ -196,7 +201,10 @@
$stats['students_private']++; $stats['students_private']++;
if($si['atrisk'] == 'yes') if($si['atrisk'] == 'yes')
$stats['schools_atrisk']++; $stats['schools_atrisk']++;
$bd = $si['board'].'~'.$si['district'];
if(!in_array($db, $districts)) $districts[] =$bd;
} }
$stats['schools_districts'] = count($districts);
//numbers of students: //numbers of students:
$q=mysql_query("SELECT students.*,schools.* $q=mysql_query("SELECT students.*,schools.*
@ -327,16 +335,52 @@
if($server_config['fair_stats_minorities'] != '') { if($server_config['fair_stats_minorities'] != '') {
echo '<b>'.i18n('Data on minority groups').'</b><br />'; echo '<b>'.i18n('Data on minority groups').'</b><br />';
echo '<br />'; echo '<br />';
echo '<table>';
if(strstr('firstnations',$server_config['fair_stats_minorities']) != false) {
echo '<tr><td>'.i18n('Number of First Nations students');
echo ": </td><td><input type=\"text\" name=\"firstnations\" value=\"{$stats['firstnations']}\" size=\"5\" />";
echo '</td></tr>';
}
echo '</table>';
echo '<br />'; echo '<br />';
echo '<br />'; echo '<br />';
} }
if($server_config['fair_stats_guests'] == 'yes' ) { if($server_config['fair_stats_guests'] == 'yes' ) {
echo '<b>'.i18n('Guests visiting the fair').'</b><br />'; echo '<b>'.i18n('Guests visiting the fair').'</b><br />';
echo '<br />'; echo '<br />';
echo '<table>';
echo '<tr><td>'.i18n('Number of Students that visited the fair (tours, etc.)');
echo ": </td><td><input type=\"text\" name=\"studentsvisiting\" value=\"{$stats['studentsvisiting']}\" size=\"5\" />";
echo '</td></tr>';
echo '<tr><td>'.i18n('Number of Public Guests that visited the fair');
echo ": </td><td><input type=\"text\" name=\"publicvisiting\" value=\"{$stats['publicvisiting']}\" size=\"5\" />";
echo '</td></tr>';
echo '</table>';
echo '<br />'; echo '<br />';
echo '<br />'; echo '<br />';
} }
if($server_config['fair_stats_sffbc_misc'] == 'yes') {
echo '<b>'.i18n('Misc. SFFBC Questions').'</b><br />';
echo '<br />';
echo '<table>';
echo '<tr><td>'.i18n('Number of Teachers supporting student projects: ');
echo ": </td><td><input type=\"text\" name=\"teacherssupporting\" value=\"{$stats['teacherssupporting']}\" size=\"5\" />";
echo '</td></tr>';
echo '<tr><td>'.i18n('Number of Students indicating increased interest in science & technology: ');
echo ": </td><td><input type=\"text\" name=\"increasedinterest\" value=\"{$stats['increasedinterest']}\" size=\"5\" />";
echo '</td></tr>';
echo '<tr><td>'.i18n('Number of Students considering careers in science & technology: ');
echo ": </td><td><input type=\"text\" name=\"consideringcareer\" value=\"{$stats['consideringcareer']}\" size=\"5\" />";
echo '</td></tr>';
echo '</table>';
echo '<br />';
echo '<br />';
/*Number of Teachers supporting student projects:
Number of Students indicating increased interest in science & technology:
Number of Students considering careers in science & technology:
*/
}
echo "<br />"; echo "<br />";
echo "<br />"; echo "<br />";
@ -356,6 +400,7 @@
xmlCreateRecurse($xmldata); xmlCreateRecurse($xmldata);
$xml=$output; $xml=$output;
echo '<hr />';
echo "<h3>".i18n("The following data will be sent to")." {$fair['name']}</h3>"; echo "<h3>".i18n("The following data will be sent to")." {$fair['name']}</h3>";
echo "<form method=\"post\" action=\"$PHPSELF\">"; echo "<form method=\"post\" action=\"$PHPSELF\">";
echo "<input type=\"hidden\" name=\"action\" value=\"sendstats\">"; echo "<input type=\"hidden\" name=\"action\" value=\"sendstats\">";

View File

@ -2,7 +2,8 @@ INSERT INTO `config` (`var`, `val`, `category`, `type`, `type_values`, `ord`, `d
('fair_stats_participation', 'yes', 'Science Fairs', 'yesno', '', 100, 'Gather Stats: Student and School Participation (students, gender, and projects) by age group.', -1), ('fair_stats_participation', 'yes', 'Science Fairs', 'yesno', '', 100, 'Gather Stats: Student and School Participation (students, gender, and projects) by age group.', -1),
('fair_stats_schools_ext', 'yes', 'Science Fairs', 'yesno', '', 200, 'Gather Stats: Extended school participation data.<ul>\r\n<li>Number of at-risk schools and students<li>Number of public schools and students<li>Number of private/independent schools and students</ul>', -1), ('fair_stats_schools_ext', 'yes', 'Science Fairs', 'yesno', '', 200, 'Gather Stats: Extended school participation data.<ul>\r\n<li>Number of at-risk schools and students<li>Number of public schools and students<li>Number of private/independent schools and students</ul>', -1),
('fair_stats_minorities', 'firstnations', 'Science Fairs', 'multisel', 'firstnations=Number of First Nation students|disabled=Number of Disabled students', 300, 'Gather Stats: Participant minority demographics (must be filled in manually by the fair)', -1), ('fair_stats_minorities', 'firstnations', 'Science Fairs', 'multisel', 'firstnations=Number of First Nation students|disabled=Number of Disabled students', 300, 'Gather Stats: Participant minority demographics (must be filled in manually by the fair)', -1),
('fair_stats_guests', 'yes', 'Science Fairs', 'yesno', '', 400, 'Gather Stats: Number of student and public guests (must be filled in manually by the fair)', -1); ('fair_stats_guests', 'yes', 'Science Fairs', 'yesno', '', 400, 'Gather Stats: Number of student and public guests (must be filled in manually by the fair)', -1),
('fair_stats_sffbc_misc', 'yes', 'Science Fairs', 'yesno', '', '500', 'Gather Stats: Misc. SFFBC Data<ul> <li>Supporting teachers <li>Students with increased interest in sci and tech <li>Students considering a career in science</ul>', '-1');
ALTER TABLE `fairs_stats` CHANGE `publicschools` `schools_public` INT( 11 ) NOT NULL DEFAULT '0', ALTER TABLE `fairs_stats` CHANGE `publicschools` `schools_public` INT( 11 ) NOT NULL DEFAULT '0',
CHANGE `privateschools` `schools_private` INT( 11 ) NOT NULL DEFAULT '0'; CHANGE `privateschools` `schools_private` INT( 11 ) NOT NULL DEFAULT '0';
@ -14,9 +15,9 @@ ALTER TABLE `fairs_stats` ADD `students_total` INT NOT NULL AFTER `projects_11`
ALTER TABLE `fairs_stats` CHANGE `innercity` `students_atrisk` INT( 11 ) NOT NULL DEFAULT '0'; ALTER TABLE `fairs_stats` CHANGE `innercity` `students_atrisk` INT( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `fairs_stats` ADD `schools_atrisk` INT NOT NULL AFTER `students_atrisk` ; ALTER TABLE `fairs_stats` ADD `schools_atrisk` INT NOT NULL AFTER `students_atrisk` ;
ALTER TABLE `fairs_stats` ADD `schools_active` INT NOT NULL AFTER `schools_total` ; ALTER TABLE `fairs_stats` ADD `schools_active` INT NOT NULL AFTER `schools_total` ;
ALTER TABLE `fairs_stats` ADD `committee_members` INT NOT NULL AFTER `consideringcareer` , ALTER TABLE `fairs_stats` ADD `committee_members` INT NOT NULL AFTER `consideringcareer` ,
ADD `judges` INT NOT NULL AFTER `committee_members` ; ADD `judges` INT NOT NULL AFTER `committee_members` ;
ALTER TABLE `fairs_stats` CHANGE `schooldistricts` `schools_districts` INT( 11 ) NOT NULL DEFAULT '0';
CREATE TABLE `fairs` ( CREATE TABLE `fairs` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,

View File

@ -56,7 +56,8 @@
if(array_key_exists('getstats', $data)) { if(array_key_exists('getstats', $data)) {
$year = $data['getstats'][0]['year'][0]; $year = $data['getstats'][0]['year'][0];
$vars = array('fair_stats_participation', 'fair_stats_schools_ext', $vars = array('fair_stats_participation', 'fair_stats_schools_ext',
'fair_stats_minorities', 'fair_stats_guests'); 'fair_stats_minorities', 'fair_stats_guests',
'fair_stats_sffbc_misc');
foreach($vars as $v) { foreach($vars as $v) {
$response['statconfig'][$v] = $config[$v]; $response['statconfig'][$v] = $config[$v];
} }