Commit Justin's code (modified slightly) for student info viewer

Fixes BR#82
http://www.sfiab.ca/bugtracker/view.php?id=82
This commit is contained in:
james 2006-03-28 23:32:43 +00:00
parent cb280ebc1f
commit 82a45a9d26
2 changed files with 101 additions and 1 deletions

View File

@ -27,6 +27,17 @@
require("../register_participants.inc.php");
send_header("Participant Registration - List and Statistics");
?>
<script language="javascript" type="text/javascript">
function openstudentinfo(id)
{
window.open("students_info.php?id="+id,"StudentInfo","location=no,menubar=no,directories=no,toolbar=no,width=770,height=500,scrollbars=yes");
return false;
}
</script>
<?
echo "<a href=\"index.php\">&lt;&lt; ".i18n("Back to Administration")."</a>";
echo " &nbsp; ";
echo "<a href=\"registration.php\">&lt;&lt; ".i18n("Back to Registration")."</a>";
@ -136,6 +147,7 @@ else $wherestatus="";
$sq=mysql_query("SELECT students.firstname,
students.lastname,
students.id,
schools.school
FROM
students,schools
@ -151,7 +163,7 @@ else $wherestatus="";
$students="";
while($studentinfo=mysql_fetch_object($sq))
{
$students.="$studentinfo->firstname $studentinfo->lastname <br />";
$students.="<a href=\"\" onclick=\"return openstudentinfo($studentinfo->id)\">$studentinfo->firstname $studentinfo->lastname </a><br />";
$schools.="$studentinfo->school <br />";
$stats_totalstudents++;
}

88
admin/students_info.php Normal file
View File

@ -0,0 +1,88 @@
<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
Copyright (C) 2005 James Grant <james@lightbox.org>
Copyright (C) 2006 Justin Reardon <webmaster@rcrsf.ca>
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.
*/
?>
<?
//this file is meant to be used as a popup from the registration list page to view student info
//it needs the student ID passed into it.
//thus, we do not need the normal header and footer
require("../common.inc.php");
auth_required('admin');
if($_GET['id'])
{
$q=mysql_query("SELECT
students.*,
schools.school
FROM
students
LEFT OUTER JOIN schools ON schools.id=students.schools_id
WHERE
students.id='".$_GET['id']."'");
echo mysql_error();
$studentinfo=mysql_fetch_object($q);
send_popup_header(i18n("Student Information - %1 %2",array($studentinfo->firstname,$studentinfo->lastname)));
echo "<table class=\"viewtable\">\n";
echo "<tr>\n";
echo " <th>".i18n("First Name")."</th><td>$studentinfo->firstname</td>\n";
echo " <th>".i18n("Last Name")."</th><td>$studentinfo->lastname</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <th>".i18n("Grade")."</th><td>$studentinfo->grade</td>\n";
echo " <th>".i18n("Sex")."</th><td>$studentinfo->sex</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <th>".i18n("Email Address")."</th><td>$studentinfo->email</td>\n";
echo " <th>".i18n("Phone")."</th><td>$studentinfo->phone</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <th>".i18n("Address")."</th><td>$studentinfo->address</td>\n";
echo " <th>".i18n("City")."</th><td>$studentinfo->city</td>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <th>".i18n("Province")."</th><td>$studentinfo->province";
echo " <th>".i18n("Postal Code")."</th><td>$studentinfo->postalcode</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <th>".i18n("Medical Information")."</th><td>$studentinfo->medicalalert";
echo " <th>".i18n("School")."</th><td>$studentinfo->school</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <th>".i18n("Teacher Name")."</th><td>$studentinfo->teachername";
echo " <th>".i18n("Teacher Email")."</th><td>$studentinfo->teacheremail</td>\n";
echo "</tr>\n";
echo "</table>";
}
else
{
send_popup_header("Student Information");
echo error(i18n("No Student ID passed to Student Info"));
}
send_popup_footer();
?>