Add fields for project safety question answers to report buildeir

This commit is contained in:
james 2011-03-14 22:04:30 +00:00
parent d182699702
commit 41085e2c46
2 changed files with 130 additions and 19 deletions

View File

@ -31,8 +31,7 @@
$type=$_GET['type']; $type=$_GET['type'];
if($type=="pdf") if($type=="pdf") {
{
$rep=new lpdf( i18n($config['fairname']), $rep=new lpdf( i18n($config['fairname']),
i18n("Project Details"), i18n("Project Details"),
@ -47,6 +46,9 @@
$rep=new lcsv(i18n("Project Details")); $rep=new lcsv(i18n("Project Details"));
} }
// $regstatus=" AND ( registrations.status='complete' OR registrations.status='paymentpending' ) ";
$regstatus="";
$projq=mysql_query("SELECT $projq=mysql_query("SELECT
registrations.id AS reg_id, registrations.id AS reg_id,
registrations.num AS reg_num, registrations.num AS reg_num,
@ -72,8 +74,7 @@
projects.conferences_id='".$conference['id']."' projects.conferences_id='".$conference['id']."'
AND projectdivisions.conferences_id='".$conference['id']."' AND projectdivisions.conferences_id='".$conference['id']."'
AND projectcategories.conferences_id='".$conference['id']."' AND projectcategories.conferences_id='".$conference['id']."'
AND ( registrations.status='complete' $regstatus
OR registrations.status='paymentpending' )
ORDER BY ORDER BY
projects.projectnumber projects.projectnumber
"); ");
@ -90,7 +91,7 @@
FROM FROM
users users
WHERE WHERE
students.registrations_id='$proj->reg_id' users.registrations_id='$proj->reg_id'
"); ");
$students=""; $students="";
@ -102,7 +103,6 @@
$studnum++; $studnum++;
} }
$rep->heading(i18n("Project Information")); $rep->heading(i18n("Project Information"));
$rep->nextline();
$table=array(); $table=array();
// $table['header']=array(i18n("Timeslot"),i18n("Judging Team")); // $table['header']=array(i18n("Timeslot"),i18n("Judging Team"));
@ -121,28 +121,44 @@
unset($table); unset($table);
$q=mysql_query("SELECT * FROM mentors WHERE registrations_id='".$proj->reg_id."'"); $q=mysql_query("SELECT * FROM mentors WHERE registrations_id='".$proj->reg_id."'");
$rep->nextline();
$rep->heading(i18n("Mentor Information")); $rep->heading(i18n("Mentor Information"));
$rep->nextline(); if(mysql_num_rows($q)) {
if(mysql_num_rows($q))
{
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))
{ {
$rep->addText(i18n("%1 %2 from %3",array($r->firstname,$r->lastname,$r->organization))); $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))); $rep->addText(i18n("Phone: %1 Email: %2",array($r->phone,$r->email)));
} }
} }
else else {
{
$rep->addText(i18n("No mentors")); $rep->addText(i18n("No mentors"));
} }
$rep->nextline(); $rep->nextline();
$rep->heading(i18n("Project Summary")); $rep->heading(i18n("Project Summary"));
$rep->nextline();
$rep->addText($proj->summary); $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) if($projectcount!=$totalprojects)
$rep->newPage(); $rep->newPage();
} }

View File

@ -35,6 +35,30 @@ function reports_students_numstudents(&$report, $field, $text)
return mysql_num_rows($q); 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) function reports_students_award_selfnom_num(&$report, $field, $text, $n)
{ {
$conferences_id = $report['conferences_id']; $conferences_id = $report['conferences_id'];
@ -836,6 +860,77 @@ $report_students_fields = array(
'total' => true, 'total' => true,
'group_by' => array('users.tshirt')), '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'),
); );