These changes were done by Sebastian Ruan

Ethics questions can now be asked as a required field for each project. 
To activate this feature navigate to Configuration >> Configuration Variables >> Participant Registration 
and change  “Ask if the project requires human and/or animal participants” to “Yes”. 

All projects with human and/or animal participants can be selected using the Report Editor.

Under “Input Received Signature Forms” a button called “Receive All” was created. 
Clicking this button will cause the program to assign project numbers and mark the 
signature page as received for all students who have completed the registration process. 
Confirmation emails are sent to each student that had their signature page marked as received.

"Remove Old Judge Data" and "Remove Old Emergency Contact/Parent Data" was added to
"Database Backup/Restore".  These permanently remove all information from the database 
about these two respective groups.  This means that all historical data will be lost but  
the most recent information about judges and emergency contacts remains. Cleaning the database 
this way dramatically improves the speed of the user editor.  Make sure the database has been
backed up before trying these.

The judge's name now appears on the cancellation popup window when deleting an individual judge.
This commit is contained in:
idziak 2015-05-06 16:55:46 +00:00
parent 99cfd97e0a
commit 28070d19cc
10 changed files with 381 additions and 7 deletions

View File

@ -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 "</table>";
if($config['ethics_questions']=="yes")
// If we have set ethics questions to yes then ask the ethics questions!
{
echo "<tr><td>".i18n("Ethics Questions").":</td><td>";
echo "<table>";
echo "<tr>";
echo " <td>".i18n("My project involves human participants").REQUIREDFIELD."</td>";
if($projectinfo->human_participants=="yes") $check="checked=\"checked\""; else $check="";
echo " <td><input $check type=\"radio\" name=\"human_participants\" value=\"yes\" />Yes</td>";
echo " <td width=\"20\">&nbsp;</td>";
if($projectinfo->human_participants=="no") $check="checked=\"checked\""; else $check="";
echo " <td><input $check type=\"radio\" name=\"human_participants\" value=\"no\" />No</td>";
echo "</tr>";
echo "<tr>";
echo " <td>".i18n("My project involves animals").REQUIREDFIELD."</td>";
if($projectinfo->animal_participants=="yes") $check="checked=\"checked\""; else $check="";
echo " <td><input $check type=\"radio\" name=\"animal_participants\" value=\"yes\" />Yes</td>";
echo " <td width=\"20\">&nbsp;</td>";
if($projectinfo->animal_participants=="no") $check="checked=\"checked\""; else $check="";
echo " <td><input $check type=\"radio\" name=\"animal_participants\" value=\"no\" />No</td>";
echo "</tr>";
echo "</table>";
}
echo "</td></tr>";
echo "<tr><td>".i18n("Summary").": </td><td><textarea onchange='countwords()' onkeypress='countwords()' cols=\"60\" rows=\"12\" id=\"summary\" name=\"summary\">".htmlspecialchars($projectinfo->summary)."</textarea>".REQUIREDFIELD."<br />";

View File

@ -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 "<table>";
echo "<tr><td>";
echo "<form id=\"inputform\" method=\"post\" action=\"registration_receivedforms.php\">";
echo "<input type=\"hidden\" name=\"action\" value=\"received\" />";
echo i18n("Enter the registration number from the $signatureformpermissionform : ")."<br />";
@ -304,7 +309,154 @@ echo mysql_Error();
document.forms.inputform.registration_number.focus();
</script>
<?
echo "<br/><br/>";
echo "</td></tr><tr><td>";
echo "<font size=\"2\" color=\"red\">This button does not keep track of payments</font>";
echo "</td></tr><tr><td>";
echo "<form method=\"post\" action=\"registration_receivedforms.php\">";
echo "<input type=\"hidden\" name=\"action\" value=\"recieve_all\" />";
echo "<input type=\"submit\" value=\"".i18n("Receive All")."\" onclick=\"return confirmClick('Are you sure you wish to mark all students as has having their $signatureformpermissionform received?')\" />";
echo "</form>";
echo "</tr></td>";
echo "</table>";
echo "<br>";
echo i18n(" <lh>'Receive All' notes:</lh> <ul><li>The button will mark all open-status students that have completed registration as having their $signatureformpermissionform received.
<li> Students with above status will be emailed a \"$signatureformpermissionform received\" confirmation.
<li> Project numbers will be assigned to these students' projects.
</ul>");
}
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 "<br><br>";
echo "<table>";
echo "<tr><td>".i18n("$total_completed student(s) registered as $non_capital_participationform received.")."</td></tr>";
//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 "<tr><td>".i18n("Registration numbers which are NOT marked as having their $non_capital_participationform received are shown below:")."</td></tr>";
echo "<tr><td>&nbsp</td></tr>";
$string = "";
echo "<tr><td>";
//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 "</td></tr>";
echo "<tr><td>&nbsp</td></tr>";
echo "<tr><td>";
echo i18n("The above registration numbers correspond to projects in which the registration process has not been completed by the student.");
echo "</td></tr>";
}
echo "</table>";
echo happy_(i18n("Received all permision forms for complete students"));
}
send_footer();
?>

View File

@ -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',

View File

@ -184,5 +184,5 @@ $icon_path = $config['SFIABDIRECTORY']."/images/16/";
$icon_exitension = $config['icon_extension'];
send_popup_footer();
//send_popup_footer();
?>

View File

@ -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 "<td $span align=\"center\">";
echo "&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp"; // aligns icons
echo "<a title = \"Edit User \" href=\"#\" onclick=\"return openeditor({$r['id']})\"><img border=0 src=\"{$config['SFIABDIRECTORY']}/images/16/edit.{$config['icon_extension']}\"></a>&nbsp;";
echo "<a title = \"Delete User\" onclick=\"return confirmClick('Are you sure you wish to completely delete this user?')\" href=\"user_list.php?action=remove&uid={$r['id']}\"><img border=0 src=\"{$config['SFIABDIRECTORY']}/images/16/button_cancel.{$config['icon_extension']}\"></a>";
echo "<a title = \"Delete User\" onclick=\"return confirmClick('Are you sure you wish to completely delete ". $name ." \\'s account?')\" href=\"user_list.php?action=remove&uid={$r['id']}\"><img border=0 src=\"{$config['SFIABDIRECTORY']}/images/16/button_cancel.{$config['icon_extension']}\"></a>";
echo "&nbsp<a title = \"Update User to Current Fair Year\"href=\"#\" onclick=\"update({$r['id']});return false;\"><img border=0 src=\"{$config['SFIABDIRECTORY']}/images/16/update2.{$config['icon_extension']}\" height = \"17\" ></a>";
}else{
echo "<td $span align=\"center\">";
echo "<a href=\"#\" onclick=\"return openeditor({$r['id']})\"><img border=0 src=\"{$config['SFIABDIRECTORY']}/images/16/edit.{$config['icon_extension']}\"></a>&nbsp;";
echo "<a onclick=\"return confirmClick('Are you sure you wish to completely delete this user?')\" href=\"user_list.php?action=remove&uid={$r['id']}\"><img border=0 src=\"{$config['SFIABDIRECTORY']}/images/16/button_cancel.{$config['icon_extension']}\"></a>";
echo "<a onclick=\"return confirmClick('Are you sure you wish to completely delete ". $name ." \\'s account?')\" href=\"user_list.php?action=remove&uid={$r['id']}\"><img border=0 src=\"{$config['SFIABDIRECTORY']}/images/16/button_cancel.{$config['icon_extension']}\"></a>";
}

View File

@ -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 "</form>\n";
echo "<br>";
echo "<h3>".i18n("Clean Database")."</h3>\n";
echo error(i18n("WARNING: Cleaning the database COMPLETELY DELETES old data on users"));
echo "<font size = 4 color=\"red\"> RECOMMENDED: Backup database before using the below buttons</font><br><br>";
echo "<font color=\"red\"> Remove Old Judge Data <ul> <li> All information about who has judged in past fairs will be lost
<li> All deleted judges will be purged from the system </ul></font>";
echo "<br><font color=\"red\"> Remove Old Emergency Contact / Parent Data<ul> <li> All parent information or other emergency contact information from all previous fair years will be purged from the system
<li> It will no longer be possible to email any emergency contacts from previous fair years once the button is clicked </ul></font><br>";
echo "<table>";
echo "<tr><td style = \"width: 46%\">";
echo "<form method=\"post\" action=\"backuprestore.php\" enctype=\"multipart/form-data\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"clean_judges\">\n";
echo "<input type=\"submit\" onClick=\"return confirmClick('Are you sure you wish to purge old judge data?')\" value=\"".i18n("Remove Old Judge Data")."\">\n";
echo "</form>";
echo "</td><td>";
echo "<form method=\"post\" action=\"backuprestore.php\" enctype=\"multipart/form-data\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"clean_parents\">\n";
echo "<input type=\"submit\" onClick=\"return confirmClick('Are you sure you wish to purge old parent data?')\" value=\"".i18n("Remove Old Emergency Contact / Parent Data")."\">\n";
echo "</form>";
send_footer();
}

View File

@ -1 +1 @@
178
179

13
db/db.update.179.sql Normal file
View File

@ -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','','');

View File

@ -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';

View File

@ -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 "</td></tr>";
if($config['ethics_questions']=="yes")
// If we have set ethics questions to yes then ask the ethics questions!
{
echo "<tr><td>".i18n("Ethics Questions").":</td><td>";
echo "<table>";
echo "<tr>";
echo " <td>".i18n("My project involves human participants").REQUIREDFIELD."</td>";
if($projectinfo->human_participants=="yes") $check="checked=\"checked\""; else $check="";
echo " <td><input $check type=\"radio\" name=\"human_participants\" value=\"yes\" />Yes</td>";
echo " <td width=\"20\">&nbsp;</td>";
if($projectinfo->human_participants=="no") $check="checked=\"checked\""; else $check="";
echo " <td><input $check type=\"radio\" name=\"human_participants\" value=\"no\" />No</td>";
echo "</tr>";
echo "<tr>";
echo " <td>".i18n("My project involves animals").REQUIREDFIELD."</td>";
if($projectinfo->animal_participants=="yes") $check="checked=\"checked\""; else $check="";
echo " <td><input $check type=\"radio\" name=\"animal_participants\" value=\"yes\" />Yes</td>";
echo " <td width=\"20\">&nbsp;</td>";
if($projectinfo->animal_participants=="no") $check="checked=\"checked\""; else $check="";
echo " <td><input $check type=\"radio\" name=\"animal_participants\" value=\"no\" />No</td>";
echo "</tr>";
echo "</table>";
}
echo "<tr><td>".i18n("Summary").": </td><td><textarea onchange='countwords()' onkeypress='countwords()' cols=\"60\" rows=\"12\" id=\"summary\" name=\"summary\">".htmlspecialchars($projectinfo->summary)."</textarea>".REQUIREDFIELD."<br />";
$summarywords=preg_split("/[\s,]+/",trim($projectinfo->summary));