forked from science-ation/science-ation
Implement web consent restrictions, settable by the admin (under the admin->participant registration menu) to prevent firstname and or lastname (and or photos once they are implemented) of students, on a per studnet basis, from being displayed on the website. It currently affects the confirmed participants page, and the winners page (the only two public places where sutdent info is available thorugh the system)
This commit is contained in:
parent
97c2b65a93
commit
c95df2b912
@ -29,6 +29,7 @@
|
||||
echo "<br />";
|
||||
echo "<a href=\"registration_receivedforms.php\">".i18n("Input Received Forms")."</a> <br />";
|
||||
echo "<a href=\"registration_list.php\">".i18n("Registration List and Statistics")."</a> <br />";
|
||||
echo "<a href=\"registration_webconsent.php\">".i18n("Registration Website Consent")."</a> <br />";
|
||||
|
||||
|
||||
|
||||
|
123
admin/registration_webconsent.php
Normal file
123
admin/registration_webconsent.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?
|
||||
/*
|
||||
This file is part of the 'Science Fair In A Box' project
|
||||
SFIAB Website: http://www.sfiab.ca
|
||||
|
||||
Copyright (C) 2005-2006 Sci-Tech Ontario Inc <info@scitechontario.org>
|
||||
Copyright (C) 2005-2006 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");
|
||||
auth_required('admin');
|
||||
|
||||
send_header("Participant Registration - Web Consent");
|
||||
|
||||
echo "<a href=\"index.php\"><< ".i18n("Back to Administration")."</a>";
|
||||
echo " ";
|
||||
echo " ";
|
||||
echo "<a href=\"registration.php\"><< ".i18n("Back to Registration")."</a>";
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
|
||||
if(is_array($_POST['changed']))
|
||||
{
|
||||
$numchanged=0;
|
||||
foreach($_POST['changed'] AS $id=>$val)
|
||||
{
|
||||
if($val==1)
|
||||
{
|
||||
$numchanged++;
|
||||
$webfirst=$_POST['webfirst'][$id]=="yes"?"yes":"no";
|
||||
$weblast=$_POST['weblast'][$id]=="yes"?"yes":"no";
|
||||
$webphoto=$_POST['webphoto'][$id]=="yes"?"yes":"no";
|
||||
mysql_query("UPDATE students SET
|
||||
webfirst='$webfirst',
|
||||
weblast='$weblast',
|
||||
webphoto='$webphoto'
|
||||
WHERE
|
||||
id='$id'");
|
||||
}
|
||||
}
|
||||
if($numchanged==1)
|
||||
echo happy(i18n("1 student record updated"));
|
||||
else if($numchanged>1)
|
||||
echo happy(i18n("%1 student records updated",array($numchanged)));
|
||||
else
|
||||
echo error(i18n("No student records where changed"));
|
||||
}
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function changed(id)
|
||||
{
|
||||
var o=document.getElementById('changed_'+id);
|
||||
o.value=1;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?
|
||||
|
||||
$sq=mysql_query("SELECT students.firstname,
|
||||
students.lastname,
|
||||
students.id,
|
||||
projects.projectnumber,
|
||||
students.webfirst,
|
||||
students.weblast,
|
||||
students.webphoto
|
||||
FROM
|
||||
students,
|
||||
registrations,
|
||||
projects
|
||||
WHERE
|
||||
students.registrations_id=registrations.id
|
||||
AND ( registrations.status = 'complete' OR registrations.status='paymentpending' )
|
||||
AND projects.registrations_id=registrations.id
|
||||
AND registrations.year='".$config['FAIRYEAR']."'
|
||||
AND projects.year='".$config['FAIRYEAR']."'
|
||||
AND students.year='".$config['FAIRYEAR']."'
|
||||
ORDER BY projectnumber
|
||||
");
|
||||
echo mysql_error();
|
||||
|
||||
echo "<form method=\"post\" action=\"registration_webconsent.php\">";
|
||||
echo "<table class=\"tableview\">";
|
||||
echo "<tr>";
|
||||
echo " <th>".i18n("Proj #")."</th>";
|
||||
echo " <th>".i18n("Student Name")."</th>";
|
||||
echo " <th>".i18n("First")."</th>";
|
||||
echo " <th>".i18n("Last")."</th>";
|
||||
echo " <th>".i18n("Photo")."</th>";
|
||||
echo "</tr>";
|
||||
while($r=mysql_fetch_object($sq))
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>$r->projectnumber<input id=\"changed_$r->id\" type=\"hidden\" name=\"changed[$r->id]\" value=\"0\"></td>";
|
||||
echo "<td>$r->firstname $r->lastname</td>";
|
||||
$ch=$r->webfirst=="yes"?"checked=\"checked\"":"";
|
||||
echo "<td><input $ch type=\"checkbox\" name=\"webfirst[$r->id]\" value=\"yes\" onchange=\"changed($r->id)\"></td>";
|
||||
$ch=$r->weblast=="yes"?"checked=\"checked\"":"";
|
||||
echo "<td><input $ch type=\"checkbox\" name=\"weblast[$r->id]\" value=\"yes\" onchange=\"changed($r->id)\"></td>";
|
||||
$ch=$r->webphoto=="yes"?"checked=\"checked\"":"";
|
||||
echo "<td><input $ch type=\"checkbox\" name=\"webphoto[$r->id]\" value=\"yes\" onchange=\"changed($r->id)\"></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
echo "<input type=\"submit\" value=\"".i18n("Save Changes")."\">";
|
||||
echo "</form>";
|
||||
|
||||
send_footer();
|
||||
?>
|
@ -120,6 +120,8 @@
|
||||
$sq=mysql_query("SELECT students.firstname,
|
||||
students.lastname,
|
||||
students.id,
|
||||
students.webfirst,
|
||||
students.weblast,
|
||||
schools.school
|
||||
FROM
|
||||
students,schools
|
||||
@ -137,7 +139,12 @@
|
||||
$lastschool="";
|
||||
while($studentinfo=mysql_fetch_object($sq))
|
||||
{
|
||||
$students.="$studentinfo->firstname $studentinfo->lastname<br />";
|
||||
if($studentinfo->webfirst=="yes")
|
||||
$students.="$studentinfo->firstname ";
|
||||
if($studentinfo->weblast=="yes")
|
||||
$students.="$studentinfo->lastname ";
|
||||
if($r->studentinfo->webfirst=="yes" || $studentinfo->weblast=="yes") $students.="<br />";
|
||||
|
||||
$schools.="$studentinfo->school <br />";
|
||||
if($lastschool)
|
||||
{
|
||||
|
@ -1 +1 @@
|
||||
49
|
||||
50
|
||||
|
3
db/db.update.50.sql
Normal file
3
db/db.update.50.sql
Normal file
@ -0,0 +1,3 @@
|
||||
ALTER TABLE `students` ADD `webfirst` ENUM( 'no', 'yes' ) DEFAULT 'yes' NOT NULL ,
|
||||
ADD `weblast` ENUM( 'no', 'yes' ) DEFAULT 'yes' NOT NULL ,
|
||||
ADD `webphoto` ENUM( 'no', 'yes' ) DEFAULT 'yes' NOT NULL ;
|
15
winners.php
15
winners.php
@ -128,6 +128,9 @@ if($_GET['year'] && $_GET['type'])
|
||||
$sq=mysql_query("SELECT students.firstname,
|
||||
students.lastname,
|
||||
students.schools_id,
|
||||
students.webfirst,
|
||||
students.weblast,
|
||||
students.webphoto,
|
||||
schools.school
|
||||
FROM
|
||||
students,
|
||||
@ -141,7 +144,17 @@ if($_GET['year'] && $_GET['type'])
|
||||
$students="";
|
||||
while($studentinfo=mysql_fetch_object($sq))
|
||||
{
|
||||
if($studnum>0) $students.=", ";
|
||||
if($studnum>0 && $prev) $students.=", ";
|
||||
|
||||
if($studentinfo->webfirst=="yes")
|
||||
$students.="$studentinfo->firstname ";
|
||||
if($studentinfo->weblast=="yes")
|
||||
$students.="$studentinfo->lastname ";
|
||||
if($r->studentinfo->webfirst=="yes" || $studentinfo->weblast=="yes")
|
||||
$prev=true;
|
||||
else
|
||||
$prev=false;
|
||||
|
||||
$students.="$studentinfo->firstname $studentinfo->lastname";
|
||||
$studnum++;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user