forked from science-ation/science-ation
Take website first/last name censent into consideration for app
Update project info
This commit is contained in:
parent
ade9e1b876
commit
a1b0c33a64
@ -57,21 +57,40 @@
|
|||||||
");
|
");
|
||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
$r=mysql_fetch_assoc($q);
|
$r=mysql_fetch_assoc($q);
|
||||||
|
if($r) {
|
||||||
|
|
||||||
$regid=$r['reg_id'];
|
$regid=$r['reg_id'];
|
||||||
|
|
||||||
$q2=mysql_query("SELECT firstname,lastname FROM users WHERE registrations_id='$regid' ORDER BY lastname");
|
$q2=mysql_query("SELECT firstname,lastname,webfirst,weblast,schools.school FROM users JOIN schools ON users.schools_id=schools.id WHERE registrations_id='$regid' ORDER BY lastname");
|
||||||
$students="";
|
$students="";
|
||||||
while($stud=mysql_fetch_object($q2)) {
|
while($stud=mysql_fetch_object($q2)) {
|
||||||
$students.=$stud->firstname." ".$stud->lastname."\n";
|
|
||||||
|
if($stud->webfirst=="yes")
|
||||||
|
$students.="$stud->firstname ";
|
||||||
|
if($stud->weblast=="yes")
|
||||||
|
$students.="$stud->lastname ";
|
||||||
|
if($stud->webfirst=="yes" || $stud->weblast=="yes")
|
||||||
|
$students.=", ";
|
||||||
|
//we just use the last school, it should match
|
||||||
|
$school=$stud->school;
|
||||||
|
}
|
||||||
|
if(strlen($students))
|
||||||
|
$students=substr($students,0,-2);
|
||||||
|
|
||||||
|
$ret=array();
|
||||||
|
foreach($r AS $k=>$v) {
|
||||||
|
$ret[$k]=trim($v); //iconv("ISO-8859-1","UTF-8//TRANSLIT",trim($v));
|
||||||
|
}
|
||||||
|
$ret['students']=trim($students); //iconv("ISO-8859-1","UTF-8//TRANSLIT",trim($students));
|
||||||
|
$ret['school']=trim($school); //iconv("ISO-8859-1","UTF-8//TRANSLIT",trim($school));
|
||||||
|
$ret['photo']="";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
$ret=array();
|
{
|
||||||
foreach($r AS $k=>$v) {
|
$ret=array();
|
||||||
$ret[$k]=trim($v);
|
$ret['status']="error";
|
||||||
|
$ret['error']="No such project number ($pn)";
|
||||||
}
|
}
|
||||||
$ret['students']=trim($students);
|
|
||||||
$ret['photo']="";
|
|
||||||
}
|
}
|
||||||
//simulate slow loading
|
//simulate slow loading
|
||||||
// usleep(2000000);
|
// usleep(2000000);
|
||||||
|
91
app/projects.php
Normal file
91
app/projects.php
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<?
|
||||||
|
/*
|
||||||
|
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);
|
||||||
|
$ret=array();
|
||||||
|
|
||||||
|
if($r->test) {
|
||||||
|
$ret['status']="ok";
|
||||||
|
|
||||||
|
$q=mysql_query("SELECT registrations.id AS reg_id,
|
||||||
|
registrations.status,
|
||||||
|
projects.id AS projects_id,
|
||||||
|
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.conferences_id='".$conference['id']."'
|
||||||
|
AND projectcategories.conferences_id='".$conference['id']."'
|
||||||
|
AND projectdivisions.conferences_id='".$conference['id']."'
|
||||||
|
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";
|
||||||
|
$projects=array();
|
||||||
|
while($r=mysql_fetch_object($q)) {
|
||||||
|
if(!$r->title) $t="{no title}";
|
||||||
|
else $t=$r->title;
|
||||||
|
|
||||||
|
if(file_exists("../data/photos/{$conference['id']}/{$r->projects_id}.jpg")) {
|
||||||
|
$photo=true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$photo=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$projects["[".$r->projectcategories_id."] ".$r->category." - ".$r->division][]=array(
|
||||||
|
"n"=>$r->projectnumber,
|
||||||
|
"t"=>trim($t),
|
||||||
|
"p"=>$photo);
|
||||||
|
//we're already UTF8, no need to convert
|
||||||
|
//"t"=>iconv("ISO-8859-1","UTF-8//TRANSLIT",trim($t)),
|
||||||
|
}
|
||||||
|
$ret['projects']=$projects;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$ret['status']="error";
|
||||||
|
$ret['error']="Project list for this fair will be made public on {$config['dates']['postparticipants']}";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($ret);
|
||||||
|
?>
|
Loading…
Reference in New Issue
Block a user