diff --git a/admin/project_editor.php b/admin/project_editor.php
index 84c738e..1b8eac1 100644
--- a/admin/project_editor.php
+++ b/admin/project_editor.php
@@ -139,6 +139,8 @@ function project_save()
"req_table='".mysql_escape_string(stripslashes($_POST['req_table']))."', ".
"req_electricity='".mysql_escape_string(stripslashes($_POST['req_electricity']))."', ".
"req_special='".mysql_escape_string(iconv("UTF-8","ISO-8859-1//TRANSLIT",stripslashes($_POST['req_special'])))."', ".
+ "human_participants='".mysql_escape_string(stripslashes($_POST['human_participants']))."', ".
+ "animal_participants='".mysql_escape_string(stripslashes($_POST['animal_participants']))."', ".
"summary='".mysql_escape_string(iconv("UTF-8","ISO-8859-1//TRANSLIT",stripslashes($_POST['summary'])))."', ".
"summarycountok='$summarycountok',".
"feedback='".mysql_escape_string(iconv("UTF-8","ISO-8859-1//TRANSLIT",stripslashes($_POST['feedback'])))."', ".
@@ -369,6 +371,33 @@ if($config['project_type'] == 'yes'){
echo "";
+
+ if($config['ethics_questions']=="yes")
+ // If we have set ethics questions to yes then ask the ethics questions!
+ {
+ echo "
".i18n("Summary").": | ".REQUIREDFIELD." ";
diff --git a/admin/registration_receivedforms.php b/admin/registration_receivedforms.php
index b562f8c..bfc28bc 100644
--- a/admin/registration_receivedforms.php
+++ b/admin/registration_receivedforms.php
@@ -20,6 +20,10 @@
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
+
+ // This file was modified March of 2015 by Sebastian Ruan
+ // Receive all button was added
+
?>
require("../common.inc.php");
@@ -292,7 +296,8 @@ echo mysql_Error();
if($showformatbottom)
- {
+ {echo "";
+ echo "";
echo " | ";
+ echo "This button does not keep track of payments";
+ echo " | ";
+ echo "";
+ echo " | ";
+ echo " ";
+ echo " ";
+ echo i18n(" 'Receive All' notes: - The button will mark all open-status students that have completed registration as having their $signatureformpermissionform received.
+
- Students with above status will be emailed a \"$signatureformpermissionform received\" confirmation.
+
- Project numbers will be assigned to these students' projects.
+
");
}
- send_footer();
-?>
+
+if ($_POST['action'] == 'recieve_all')
+{
+ // Grab all projects that don't have project numbers. Status should therefor be open or new but not complete
+ $query_noprojectnumber = mysql_query("SELECT * FROM projects WHERE projectnumber IS NULL AND year =".$config['FAIRYEAR']."");
+ // Define arrays to append to later
+ $completed_students = array();
+ $incomplete_students = array();
+ $newstatus_students = array();
+
+ // loop through each project that doesn't have a project number
+ while($studentproject=mysql_fetch_assoc($query_noprojectnumber))
+ {
+ // Grab registration information about the current project
+ $q=mysql_query("SELECT * FROM registrations WHERE id='".$studentproject['registrations_id']."' AND year='".$config['FAIRYEAR']."'");
+
+ $r=mysql_fetch_object($q);
+ $reg_id=$r->id;
+ $reg_num=$r->num;
+ $reg_status=$r->status;
+
+ // student has completed some or all of the registration process for their project. Let's find out which one is true
+ if ($r->status!='new')
+ {
+ //make sure all of the statuses are correct
+ $statusstudent=studentStatus($reg_id);
+ $statusemergencycontact=emergencycontactStatus($reg_id);
+ $statusproject=projectStatus($reg_id);
+ if($config['participant_mentor']=="yes")
+ $statusmentor=mentorStatus($reg_id);
+ else
+ $statusmentor="complete";
+ $statussafety=safetyStatus($reg_id);
+ $statusnamecheck=namecheckStatus($reg_id);
+
+ if(
+ $statusstudent == "complete" &&
+ $statusemergencycontact == "complete" &&
+ //S$statusproject == "complete" &&
+ $statusmentor == "complete" &&
+ $statussafety == "complete" &&
+ $statusnamecheck == "complete" &&
+ $r->status!='complete'
+ //above: project status must not be complete. If it is complete signature page/permission form has already been received.
+ ) {
+
+ // Generate project number and update it in data base
+ list($projectnumber,$ps,$pns,$pss) = generateProjectNumber($reg_id);
+ mysql_query("UPDATE projects SET projectnumber='$projectnumber',
+ projectsort='$ps',projectnumber_seq='$pns',projectsort_seq='$pss'
+ WHERE registrations_id='$reg_id' AND year='{$config['FAIRYEAR']}'");
+
+ //email stuff
+ //get all students with this registration number
+ //$recipients=getEmailRecipientsForRegistration($reg_id);
+
+ //Set status to 'complete'
+ mysql_query("UPDATE registrations SET status='complete' WHERE num='$reg_num' AND year='{$config['FAIRYEAR']}'");
+
+ /*foreach($recipients AS $recip) {
+ $to=$recip['to'];
+ $subsub=array();
+ $subbod=array(
+ "TO"=>$recip['to'],
+ "EMAIL"=>$recip['email'],
+ "FIRSTNAME"=>$recip['firstname'],
+ "LASTNAME"=>$recip['lastname'],
+ "NAME"=>$recip['firstname']." ".$recip['lastname'],
+ "REGNUM"=>$regnum,
+ "PROJECTNUMBER"=>$projectnumber,
+ );
+ email_send("register_participants_received",$to,$subsub,$subbod);
+ }*/
+
+ // End email stuff
+ //add cuurent registration number to completed_students array
+ $completed_students[] = $reg_num;
+
+ }else{
+ // or add current registration number to incomplete_student array
+ $incomplete_students[] = $reg_num;
+ }
+
+
+ }
+ //New status automatically means student has not completed the registration process for their project. So execute below:
+ else{
+ // or add current registration number to newstatus_students array
+ $newstatus_students[] = $reg_num;
+ }
+
+
+ }
+ // Find how many project numbers were assigned/how many projects have complete status (ie signature page/permission form is considered received)
+ $total_completed = count($completed_students);
+
+ // since incomplete_students and newstatus_students both did not get project numbers and are not considered as having signature page/permission form received
+ // combine them
+ $total_incomplete = array_merge($incomplete_students, $newstatus_students);
+
+ echo "
";
+ echo "";
+ echo "".i18n("$total_completed student(s) registered as $non_capital_participationform received.")." | ";
+
+ //display below only if there are registration numbers that don't have project numbers and the students have not completed the registration process
+ if (count($total_incomplete) > 0) {
+ echo "".i18n("Registration numbers which are NOT marked as having their $non_capital_participationform received are shown below:")." | ";
+ echo "  | ";
+ $string = "";
+ echo "";
+
+ //create a string that contains all incomplete registration numbers
+ foreach ($total_incomplete as $regnum){
+ $string = $string.i18n($regnum);
+ $string = $string.", ";
+ }
+
+ // delete the comma at the end of the string
+ $string = substr($string, 0, strlen($string)-2);
+ echo $string;
+ echo " | ";
+ echo "  | ";
+ echo "";
+ echo i18n("The above registration numbers correspond to projects in which the registration process has not been completed by the student.");
+ echo " | ";
+ }
+ echo " ";
+ echo happy_(i18n("Received all permision forms for complete students"));
+}
+
+send_footer();
+
+?>
\ No newline at end of file
diff --git a/admin/reports_students.inc.php b/admin/reports_students.inc.php
index 563e2da..1e0d935 100644
--- a/admin/reports_students.inc.php
+++ b/admin/reports_students.inc.php
@@ -503,6 +503,20 @@ $report_students_fields = array(
'width' => .5,
'table' => "projects.req_table",
'value_map' => array ('no' => '', 'yes' => 'Yes')),
+
+ 'human_participants' => array(
+ 'name' => 'Project -- If the project uses human participants',
+ 'header' => 'Human Par.',
+ 'width' => .5,
+ 'table' => "projects.human_participants",
+ 'value_map' => array ('no' => 'No', 'yes' => 'Yes')),
+
+ 'animal_participants' => array(
+ 'name' => 'Project -- If the project requires animals',
+ 'header' => 'animal Par',
+ 'width' => .5,
+ 'table' => "projects.animal_participants",
+ 'value_map' => array ('no' => 'No', 'yes' => 'Yes')),
'req_special' => array(
'name' => 'Project -- Any special requirements the project has',
diff --git a/admin/user_editor_window.php b/admin/user_editor_window.php
index b6d3e60..22ba5d7 100644
--- a/admin/user_editor_window.php
+++ b/admin/user_editor_window.php
@@ -184,5 +184,5 @@ $icon_path = $config['SFIABDIRECTORY']."/images/16/";
$icon_exitension = $config['icon_extension'];
- send_popup_footer();
+ //send_popup_footer();
?>
diff --git a/admin/user_list.php b/admin/user_list.php
index 18fc0dd..a2ad87f 100644
--- a/admin/user_list.php
+++ b/admin/user_list.php
@@ -427,19 +427,22 @@ function update (id)
if($first) {
+ if ($name == ' ')
+ $name = 'Noname';
+
/* Finish off the the first line */
// If judge not in current fair year need seperate icons so that all icons align nicely in the table
if ($t == 'judge' and $r['year'] != $config['FAIRYEAR']){
echo " | ";
echo "      "; // aligns icons
echo " ";
- echo "";
+ echo "";
echo " ";
}else{
echo " | ";
echo " ";
- echo "";
+ echo "";
}
diff --git a/config/backuprestore.php b/config/backuprestore.php
index bd7909c..e6df131 100644
--- a/config/backuprestore.php
+++ b/config/backuprestore.php
@@ -83,6 +83,8 @@ header("Content-Length: ".strlen($dump));
header("Pragma: public");
echo $dump;
}
+
+
else if($_POST['action']=="restore") {
echo send_header("Database Backup/Restore",
array('Committee Main' => 'committee_main.php',
@@ -196,6 +198,106 @@ else if($_POST['action']=="restoreproceed") {
send_footer();
}
+
+
+else if ($_POST['action'] == 'clean_judges') {
+
+ //select all judges
+ $query = mysql_query('SELECT * FROM users WHERE types LIKE "judge"');
+ echo mysql_error();
+
+ // Go through each judge and test:
+ while($judge = mysql_fetch_assoc($query)){
+
+ //if they are deleted
+ if ($judge['deleted'] == 'yes') {
+ // Make types an array if it isn't already. Allows user_purge function to work properly
+ if (!is_array($judge['types'])){
+ $judge['types'] = array($judge['types']);
+ }
+
+ user_purge($judge, 'judge');
+
+ }
+
+ else{
+ // Find max year of judge
+ $max_year_query = mysql_query('SELECT year FROM users WHERE uid = '. $judge['uid'] .' ORDER BY year DESC limit 1');
+ $judge_max_year = mysql_fetch_assoc($max_year_query);
+ // Grab old judge info.
+ // Old judge info consists of all entries in the database that are not the most recent for the specific judge
+ $deletable = mysql_query('SELECT * FROM users WHERE uid ='. $judge['uid'] .' AND year NOT LIKE '.$judge_max_year['year']);
+
+ // and if they have old data from previous fair years
+ if (mysql_num_rows($deletable) > 0){
+ // delete old data one by one
+ while ($old_judge_data = mysql_fetch_assoc($deletable)){
+ if (!is_array($old_judge_data['type'])){
+ $old_judge_data['types'] = array($old_judge_data['types']);
+ }
+ user_purge($old_judge_data, 'judge');
+
+
+ }
+
+ }
+ }
+ }
+
+ echo send_header("Database Backup/Restore",
+ array('Committee Main' => 'committee_main.php',
+ 'SFIAB Configuration' => 'config/index.php')
+ ,"backup_restore"
+ );
+
+ mysql_query("OPTIMIZE TABLE users, users_judge");
+
+ $str = mysql_error();
+
+ echo $str;
+
+ if($str == '')
+ echo happy(i18n("Old judge data purged."));
+
+ else{
+ error(i18n($str));}
+
+}
+else if ($_POST['action'] == 'clean_parents') {
+
+ $query_parents = mysql_query('SELECT * FROM users WHERE types LIKE "parent" AND year !='.$config['FAIRYEAR']);
+
+ while($parent = mysql_fetch_assoc($query_parents)){
+
+ if (!is_array($parent['types'])){
+ $parent['types'] = array($parent['types']);
+ }
+
+ user_purge($parent, 'parent');
+
+ }
+
+ echo send_header("Database Backup/Restore",
+ array('Committee Main' => 'committee_main.php',
+ 'SFIAB Configuration' => 'config/index.php')
+ ,"backup_restore"
+ );
+
+ mysql_query("OPTIMIZE TABLE users, users_parent");
+
+ $str = mysql_error();
+
+ echo $str;
+
+ if($str == '')
+ echo happy(i18n("Old parent data purged."));
+
+ else{
+ error(i18n($str));}
+
+}
+
+
else
{
echo send_header("Database Backup/Restore",
@@ -236,6 +338,31 @@ else
echo "\n";
+
+ echo " ";
+ echo "".i18n("Clean Database")."\n";
+ echo error(i18n("WARNING: Cleaning the database COMPLETELY DELETES old data on users"));
+
+ echo " RECOMMENDED: Backup database before using the below buttons
";
+
+ echo " Remove Old Judge Data - All information about who has judged in past fairs will be lost
+
- All deleted judges will be purged from the system
";
+
+ echo " Remove Old Emergency Contact / Parent Data - All parent information or other emergency contact information from all previous fair years will be purged from the system
+
- It will no longer be possible to email any emergency contacts from previous fair years once the button is clicked
";
+ echo "";
+ echo "";
+ echo "";
+ echo " | ";
+
+ echo "";
+
send_footer();
}
diff --git a/db/db.code.version.txt b/db/db.code.version.txt
index f84d24e..a14f8d5 100644
--- a/db/db.code.version.txt
+++ b/db/db.code.version.txt
@@ -1 +1 @@
-178
+179
diff --git a/db/db.update.179.sql b/db/db.update.179.sql
new file mode 100644
index 0000000..380ef8b
--- /dev/null
+++ b/db/db.update.179.sql
@@ -0,0 +1,13 @@
+/* This file was created March of 2015 by Sebastian Ruan
+ below is the updated table, projects*/
+
+INSERT INTO `config` ( `var` , `val` , `category` , `type` , `type_values` , `ord` , `description` , `year`) VALUES (
+'ethics_questions', 'yes', 'Participant Registration', 'yesno', '', '2550', 'Ask if the project requires human and/or animal participants.', '-1');
+
+ALTER TABLE `projects` ADD
+ (human_participants ENUM( 'no', 'yes' ) COLLATE latin1_swedish_ci,
+ animal_participants ENUM( 'no', 'yes' ) COLLATE latin1_swedish_ci);
+
+INSERT INTO `translations` (lang, strmd5, str, val, argsdesc) VALUES
+('fr','fa7eac4f388ce0bb76f280026f10d181','My project involves human participants','',''),
+('fr','0b6e87dd18d0cb0df5a63ea74bee6989','My project involves animals','','');
\ No newline at end of file
diff --git a/register_participants.inc.php b/register_participants.inc.php
index 7dee2f7..7aefe90 100644
--- a/register_participants.inc.php
+++ b/register_participants.inc.php
@@ -125,6 +125,11 @@ function projectStatus($reg_id="")
if($config['participant_short_title_enable'] == 'yes')
$required_fields[] = 'shorttitle';
+ if($config['ethics_questions'] == 'yes'){
+ $required_fields[] = 'human_participants';
+ $required_fields[] = 'animal_participants';
+ }
+
if($config['participant_project_summary_wordmin'] > 0)
$required_fields[] = 'summary';
diff --git a/register_participants_project.php b/register_participants_project.php
index 05a75e1..9f396a1 100644
--- a/register_participants_project.php
+++ b/register_participants_project.php
@@ -123,6 +123,8 @@ echo mysql_error();
"req_table='".mysql_escape_string(stripslashes($_POST['req_table']))."', ".
"req_electricity='".mysql_escape_string(stripslashes($_POST['req_electricity']))."', ".
"req_special='".mysql_escape_string(stripslashes($_POST['req_special']))."', ".
+ "human_participants='".mysql_escape_string(stripslashes($_POST['human_participants']))."', ".
+ "animal_participants='".mysql_escape_string(stripslashes($_POST['animal_participants']))."', ".
"summary='".mysql_escape_string(stripslashes($_POST['summary']))."', ".
"summarycountok='$summarycountok'".
"WHERE id='".$_POST['id']."'");
@@ -350,6 +352,35 @@ if($config['project_type'] == 'yes'){
echo " | ";
+
+if($config['ethics_questions']=="yes")
+ // If we have set ethics questions to yes then ask the ethics questions!
+ {
+ echo "".i18n("Ethics Questions").": | ";
+ echo "";
+
+}
+
+
echo " | ".i18n("Summary").": | ".REQUIREDFIELD." ";
$summarywords=preg_split("/[\s,]+/",trim($projectinfo->summary));
| |