From c338261abcbea685c268927cfafddad50d371661 Mon Sep 17 00:00:00 2001 From: james Date: Thu, 17 Mar 2011 23:06:16 +0000 Subject: [PATCH] Add iPhone app stuff to trunk/ --- admin/reports_students.inc.php | 8 ++++ app/projectinfo.php | 79 ++++++++++++++++++++++++++++++++++ app/projectlist.php | 70 ++++++++++++++++++++++++++++++ common.inc.bootstrap.php | 2 + tcpdf.inc.php | 5 +++ 5 files changed, 164 insertions(+) create mode 100644 app/projectinfo.php create mode 100644 app/projectlist.php diff --git a/admin/reports_students.inc.php b/admin/reports_students.inc.php index 30cf3a3..72c2dc9 100644 --- a/admin/reports_students.inc.php +++ b/admin/reports_students.inc.php @@ -112,6 +112,14 @@ $report_students_fields = array( 'table' => 'projects.projectnumber', 'table_sort' => 'projects.projectsort, projects.projectnumber'), + 'projectbarcode' => array( + 'name' => 'Project Barcode', + 'header' => 'Barcode', + 'width' => 1, + 'table' => 'projects.projectnumber', + 'table_sort' => 'projects.projectsort, projects.projectnumber', + ), + 'last_name' => array( 'start_option_group' => 'Student Name Information', 'name' => 'Student -- Last Name', diff --git a/app/projectinfo.php b/app/projectinfo.php new file mode 100644 index 0000000..cc51bf4 --- /dev/null +++ b/app/projectinfo.php @@ -0,0 +1,79 @@ + + + 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. +*/ +?> +='".$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.conferences_id='".$conference['id']."' + AND projectcategories.conferences_id='".$conference['id']."' + AND projectdivisions.conferences_id='".$conference['id']."' + 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 users 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]=trim($v); + } + $ret['students']=trim($students); + $ret['photo']=""; + } + //simulate slow loading +// usleep(2000000); + echo json_encode($ret); +?> diff --git a/app/projectlist.php b/app/projectlist.php new file mode 100644 index 0000000..4887d90 --- /dev/null +++ b/app/projectlist.php @@ -0,0 +1,70 @@ + + + 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. +*/ +?> +='".$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.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"; + 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"=>$t)); + } + } + + echo json_encode($ret); +?> diff --git a/common.inc.bootstrap.php b/common.inc.bootstrap.php index e35e5e4..5a00169 100644 --- a/common.inc.bootstrap.php +++ b/common.inc.bootstrap.php @@ -46,6 +46,8 @@ else if(substr(getcwd(),-3)=="/db" || substr(getcwd(),-3)=="\\db") $prependdir="../"; else if(substr(getcwd(),-8)=="/scripts" || substr(getcwd(),-8)=="\\scripts") $prependdir="../"; +else if(substr(getcwd(),-4)=="/app" || substr(getcwd(),-4)=="\\app") + $prependdir="../"; else $prependdir=""; diff --git a/tcpdf.inc.php b/tcpdf.inc.php index 4680efc..0b8c690 100644 --- a/tcpdf.inc.php +++ b/tcpdf.inc.php @@ -405,6 +405,11 @@ class pdf extends TCPDF { 300, '', false, false, $show_box ? 1 : 0, true); } + function barcode($code, $type, $x='', $y='', $w='', $h='', $style='', $align='', $distort=false) { + $this->write2DBarcode($code,$type, $this->lMargin+$x, $this->tMargin+$y, $w, $h, $style, $align, $distort); + } + + /**************************************************************************** * Table handling */ function hr()