forked from science-ation/science-ation
Add files needed for iphone app
This commit is contained in:
parent
648d3f3e56
commit
606937b8d9
79
app/projectinfo.php
Normal file
79
app/projectinfo.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?
|
||||
/*
|
||||
This file is part of the 'Science Fair In A Box' project
|
||||
SFIAB Website: http://www.sfiab.ca
|
||||
|
||||
Copyright (C) 2011 James Grant <james@lightbox.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation, version 2.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
require("../common.inc.php");
|
||||
|
||||
//first, lets make sure someone isng tryint to see something that they arent allowed to!
|
||||
$q=mysql_query("SELECT (NOW()>='".$config['dates']['postparticipants']."') AS test");
|
||||
$r=mysql_fetch_object($q);
|
||||
|
||||
$pn=trim(mysql_real_escape_string($_GET['n']));
|
||||
|
||||
if($r->test) {
|
||||
|
||||
$q=mysql_query("SELECT
|
||||
registrations.id AS reg_id,
|
||||
registrations.status,
|
||||
projects.title,
|
||||
projects.summary,
|
||||
projects.projectnumber,
|
||||
projects.projectcategories_id,
|
||||
projects.projectdivisions_id,
|
||||
projectcategories.category,
|
||||
projectdivisions.division
|
||||
|
||||
FROM
|
||||
registrations
|
||||
LEFT JOIN projects on projects.registrations_id=registrations.id
|
||||
LEFT JOIN projectcategories ON projectcategories.id=projects.projectcategories_id
|
||||
LEFT JOIN projectdivisions ON projectdivisions.id=projects.projectdivisions_id
|
||||
WHERE
|
||||
registrations.year='".$config['FAIRYEAR']."'
|
||||
AND projectcategories.year='".$config['FAIRYEAR']."'
|
||||
AND projectdivisions.year='".$config['FAIRYEAR']."'
|
||||
AND (status='complete' OR status='paymentpending')
|
||||
AND projects.projectnumber='$pn'
|
||||
LIMIT 1
|
||||
");
|
||||
echo mysql_error();
|
||||
$r=mysql_fetch_assoc($q);
|
||||
|
||||
$regid=$r['reg_id'];
|
||||
|
||||
$q2=mysql_query("SELECT firstname,lastname FROM students WHERE registrations_id='$regid' ORDER BY lastname");
|
||||
$students="";
|
||||
while($stud=mysql_fetch_object($q2)) {
|
||||
$students.=$stud->firstname." ".$stud->lastname."\n";
|
||||
}
|
||||
|
||||
$ret=array();
|
||||
foreach($r AS $k=>$v) {
|
||||
$ret[$k]=iconv("ISO-8859-1","UTF-8",trim($v));
|
||||
}
|
||||
$ret['students']=iconv("ISO-8859-1","UTF-8",trim($students));
|
||||
$ret['photo']="";
|
||||
}
|
||||
//simulate slow loading
|
||||
// usleep(2000000);
|
||||
echo json_encode($ret);
|
||||
?>
|
70
app/projectlist.php
Normal file
70
app/projectlist.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?
|
||||
/*
|
||||
This file is part of the 'Science Fair In A Box' project
|
||||
SFIAB Website: http://www.sfiab.ca
|
||||
|
||||
Copyright (C) 2011 James Grant <james@lightbox.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation, version 2.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
require("../common.inc.php");
|
||||
|
||||
//first, lets make sure someone isnt trying to see something that they arent allowed to!
|
||||
$q=mysql_query("SELECT (NOW()>='".$config['dates']['postparticipants']."') AS test");
|
||||
$r=mysql_fetch_object($q);
|
||||
|
||||
if($r->test) {
|
||||
|
||||
$q=mysql_query("SELECT registrations.id AS reg_id,
|
||||
registrations.status,
|
||||
projects.title,
|
||||
projects.projectnumber,
|
||||
projects.projectcategories_id,
|
||||
projects.projectdivisions_id,
|
||||
projectcategories.category,
|
||||
projectdivisions.division
|
||||
|
||||
FROM
|
||||
registrations
|
||||
LEFT JOIN projects on projects.registrations_id=registrations.id
|
||||
LEFT JOIN projectcategories ON projectcategories.id=projects.projectcategories_id
|
||||
LEFT JOIN projectdivisions ON projectdivisions.id=projects.projectdivisions_id
|
||||
WHERE
|
||||
1
|
||||
AND registrations.year='".$config['FAIRYEAR']."'
|
||||
AND projectcategories.year='".$config['FAIRYEAR']."'
|
||||
AND projectdivisions.year='".$config['FAIRYEAR']."'
|
||||
AND (status='complete' OR status='paymentpending')
|
||||
ORDER BY
|
||||
projectcategories.id,
|
||||
projectdivisions.id,
|
||||
projects.projectnumber
|
||||
");
|
||||
echo mysql_error();
|
||||
|
||||
$lastcat="something_that_does_not_exist";
|
||||
$lastdiv="something_that_does_not_exist";
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
if(!$r->title) $t="{no title}";
|
||||
else $t=$r->title;
|
||||
|
||||
$ret["[".$r->projectcategories_id."] ".$r->category." - ".$r->division][]=array("n"=>$r->projectnumber, "t"=>iconv("ISO-8859-1","UTF-8",$t));
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($ret);
|
||||
?>
|
Loading…
Reference in New Issue
Block a user