diff --git a/admin/reports_projects_details.php b/admin/reports_projects_details.php index 996fd14..ebfddc3 100644 --- a/admin/reports_projects_details.php +++ b/admin/reports_projects_details.php @@ -31,8 +31,7 @@ $type=$_GET['type']; - if($type=="pdf") - { + if($type=="pdf") { $rep=new lpdf( i18n($config['fairname']), i18n("Project Details"), @@ -47,6 +46,9 @@ $rep=new lcsv(i18n("Project Details")); } +// $regstatus=" AND ( registrations.status='complete' OR registrations.status='paymentpending' ) "; +$regstatus=""; + $projq=mysql_query("SELECT registrations.id AS reg_id, registrations.num AS reg_num, @@ -72,8 +74,7 @@ projects.conferences_id='".$conference['id']."' AND projectdivisions.conferences_id='".$conference['id']."' AND projectcategories.conferences_id='".$conference['id']."' - AND ( registrations.status='complete' - OR registrations.status='paymentpending' ) + $regstatus ORDER BY projects.projectnumber "); @@ -90,7 +91,7 @@ FROM users WHERE - students.registrations_id='$proj->reg_id' + users.registrations_id='$proj->reg_id' "); $students=""; @@ -102,7 +103,6 @@ $studnum++; } $rep->heading(i18n("Project Information")); - $rep->nextline(); $table=array(); // $table['header']=array(i18n("Timeslot"),i18n("Judging Team")); @@ -121,28 +121,44 @@ unset($table); $q=mysql_query("SELECT * FROM mentors WHERE registrations_id='".$proj->reg_id."'"); - $rep->nextline(); $rep->heading(i18n("Mentor Information")); - $rep->nextline(); - - if(mysql_num_rows($q)) - { - while($r=mysql_fetch_object($q)) - { - $rep->addText(i18n("%1 %2 from %3",array($r->firstname,$r->lastname,$r->organization))); - $rep->addText(i18n("Phone: %1 Email: %2",array($r->phone,$r->email))); + if(mysql_num_rows($q)) { + while($r=mysql_fetch_object($q)) + { + $rep->addText(i18n("%1 %2 from %3",array($r->firstname,$r->lastname,$r->organization))); + $rep->addText(i18n("Phone: %1 Email: %2",array($r->phone,$r->email))); + } } - } - else - { + else { $rep->addText(i18n("No mentors")); } + $rep->nextline(); $rep->heading(i18n("Project Summary")); - $rep->nextline(); $rep->addText($proj->summary); + $q=mysql_query("SELECT safetyquestions.question, + safety.answer + FROM safetyquestions + JOIN safety ON safetyquestions.id=safety.safetyquestions_id + WHERE safety.registrations_id='".$proj->reg_id."' + ORDER BY safetyquestions.ord"); + + $rep->nextline(); + $rep->heading(i18n("Safety Questions")); + $table=array(); +// $table['header']=array(i18n("Timeslot"),i18n("Judging Team")); + $table['widths']=array( 6.25, 0.5); + $table['dataalign']=array("left","left"); + + while($r=mysql_fetch_object($q)) { + $table['data'][]=array(i18n($r->question),$r->answer); + } + $rep->addTable($table); + unset($table); + + if($projectcount!=$totalprojects) $rep->newPage(); } diff --git a/admin/reports_students.inc.php b/admin/reports_students.inc.php index 5290ff0..7156cc3 100644 --- a/admin/reports_students.inc.php +++ b/admin/reports_students.inc.php @@ -35,6 +35,30 @@ function reports_students_numstudents(&$report, $field, $text) return mysql_num_rows($q); } +function report_student_safety_question(&$report, $field, $text) { + + + /* Field is 'question_x', users_id is passed in $text */ + $q_ord = substr($field, 15); + $conferences_id = $report['conferences_id']; + $regid = $text; + + + $q=mysql_query("SELECT safetyquestions.question, + safety.answer + FROM safetyquestions + JOIN safety ON safetyquestions.id=safety.safetyquestions_id + WHERE safety.registrations_id='".$regid."' + ORDER BY safetyquestions.ord LIMIT $q_ord,1"); + + $r=mysql_fetch_object($q); + return $r->answer; + + +} + + + function reports_students_award_selfnom_num(&$report, $field, $text, $n) { $conferences_id = $report['conferences_id']; @@ -836,6 +860,77 @@ $report_students_fields = array( 'total' => true, 'group_by' => array('users.tshirt')), + 'safetyquestion_1' => array( + 'start_option_group' => 'Project Safety Questions', + 'name' => 'Project Safety -- Safety Question 1', + 'header' => 'Q1', + 'width' => 15 /*mm*/, + 'table' => 'users.registrations_id', + 'exec_function' => 'report_student_safety_question'), + + 'safetyquestion_2' => array( + 'name' => 'Project Safety -- Safety Question 2', + 'header' => 'Q2', + 'width' => 15 /*mm*/, + 'table' => 'users.registrations_id', + 'exec_function' => 'report_student_safety_question'), + + 'safetyquestion_3' => array( + 'name' => 'Project Safety -- Safety Question 3', + 'header' => 'Q3', + 'width' => 15 /*mm*/, + 'table' => 'users.registrations_id', + 'exec_function' => 'report_student_safety_question'), + + 'safetyquestion_4' => array( + 'name' => 'Project Safety -- Safety Question 4', + 'header' => 'Q4', + 'width' => 15 /*mm*/, + 'table' => 'users.registrations_id', + 'exec_function' => 'report_student_safety_question'), + + 'safetyquestion_5' => array( + 'name' => 'Project Safety -- Safety Question 5', + 'header' => 'Q5', + 'width' => 15 /*mm*/, + 'table' => 'users.registrations_id', + 'exec_function' => 'report_student_safety_question'), + + 'safetyquestion_6' => array( + 'name' => 'Project Safety -- Safety Question 6', + 'header' => 'Q6', + 'width' => 15 /*mm*/, + 'table' => 'users.registrations_id', + 'exec_function' => 'report_student_safety_question'), + + 'safetyquestion_7' => array( + 'name' => 'Project Safety -- Safety Question 7', + 'header' => 'Q7', + 'width' => 15 /*mm*/, + 'table' => 'users.registrations_id', + 'exec_function' => 'report_student_safety_question'), + + 'safetyquestion_8' => array( + 'name' => 'Project Safety -- Safety Question 8', + 'header' => 'Q8', + 'width' => 15 /*mm*/, + 'table' => 'users.registrations_id', + 'exec_function' => 'report_student_safety_question'), + + 'safetyquestion_9' => array( + 'name' => 'Project Safety -- Safety Question 9', + 'header' => 'Q9', + 'width' => 15 /*mm*/, + 'table' => 'users.registrations_id', + 'exec_function' => 'report_student_safety_question'), + + 'safetyquestion_10' => array( + 'name' => 'Project Safety -- Safety Question 10', + 'header' => 'Q10', + 'width' => 15 /*mm*/, + 'table' => 'users.registrations_id', + 'exec_function' => 'report_student_safety_question'), + );