From c95df2b912dda5aea961f368c0c8274c111947a4 Mon Sep 17 00:00:00 2001 From: james Date: Sat, 31 Mar 2007 01:10:08 +0000 Subject: [PATCH] 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) --- admin/registration.php | 1 + admin/registration_webconsent.php | 123 ++++++++++++++++++++++++++++++ confirmed_participants.php | 9 ++- db/db.code.version.txt | 2 +- db/db.update.50.sql | 3 + winners.php | 15 +++- 6 files changed, 150 insertions(+), 3 deletions(-) create mode 100644 admin/registration_webconsent.php create mode 100644 db/db.update.50.sql diff --git a/admin/registration.php b/admin/registration.php index 0cfc7b0..31c6e76 100644 --- a/admin/registration.php +++ b/admin/registration.php @@ -29,6 +29,7 @@ echo "
"; echo "".i18n("Input Received Forms")."
"; echo "".i18n("Registration List and Statistics")."
"; + echo "".i18n("Registration Website Consent")."
"; diff --git a/admin/registration_webconsent.php b/admin/registration_webconsent.php new file mode 100644 index 0000000..1b301d9 --- /dev/null +++ b/admin/registration_webconsent.php @@ -0,0 +1,123 @@ + + Copyright (C) 2005-2006 James Grant + + 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. +*/ +?> +<< ".i18n("Back to Administration").""; + echo "   "; + echo "   "; + echo "<< ".i18n("Back to Registration").""; + echo "
"; + echo "
"; + + 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")); +} + ?> + + + "; + echo ""; + echo ""; + echo " "; + echo " "; + echo " "; + echo " "; + echo " "; + echo ""; + while($r=mysql_fetch_object($sq)) + { + echo ""; + echo ""; + echo ""; + $ch=$r->webfirst=="yes"?"checked=\"checked\"":""; + echo ""; + $ch=$r->weblast=="yes"?"checked=\"checked\"":""; + echo ""; + $ch=$r->webphoto=="yes"?"checked=\"checked\"":""; + echo ""; + echo ""; + } + echo "
".i18n("Proj #")."".i18n("Student Name")."".i18n("First")."".i18n("Last")."".i18n("Photo")."
$r->projectnumberid\" type=\"hidden\" name=\"changed[$r->id]\" value=\"0\">$r->firstname $r->lastnameid]\" value=\"yes\" onchange=\"changed($r->id)\">id]\" value=\"yes\" onchange=\"changed($r->id)\">id]\" value=\"yes\" onchange=\"changed($r->id)\">
"; + echo ""; + echo ""; + + send_footer(); +?> diff --git a/confirmed_participants.php b/confirmed_participants.php index e74c13a..6849457 100644 --- a/confirmed_participants.php +++ b/confirmed_participants.php @@ -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
"; + if($studentinfo->webfirst=="yes") + $students.="$studentinfo->firstname "; + if($studentinfo->weblast=="yes") + $students.="$studentinfo->lastname "; + if($r->studentinfo->webfirst=="yes" || $studentinfo->weblast=="yes") $students.="
"; + $schools.="$studentinfo->school
"; if($lastschool) { diff --git a/db/db.code.version.txt b/db/db.code.version.txt index 95f9650..e373ee6 100644 --- a/db/db.code.version.txt +++ b/db/db.code.version.txt @@ -1 +1 @@ -49 +50 diff --git a/db/db.update.50.sql b/db/db.update.50.sql new file mode 100644 index 0000000..0589203 --- /dev/null +++ b/db/db.update.50.sql @@ -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 ; diff --git a/winners.php b/winners.php index 3c3f7d1..bc74074 100644 --- a/winners.php +++ b/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++;