SetFillColor(hexdec("bb"),hexdec("bb"),hexdec("bb")); $this->SetFont($document_font,"B",$document_font_size + 1); $this->SetXY($left_col,$curr_row); $this->Cell($title_width,$incr + 1,$report_title,'0',1,'L',true,'',1); $curr_row += $incr + 2; if (isset($report_subtitle) && strlen($report_subtitle) > 0) { $this->SetXY($left_col,$curr_row); $this->Cell($title_width,$incr + 1,$report_subtitle,'0',1,'L',true,'',1); } $this->SetFont($document_font,"B",$document_font_size); $this->SetFillColor(hexdec("dd"),hexdec("dd"),hexdec("dd")); $curr_row += $incr + 2; // Print the menu title $this->SetXY($left_col,$curr_row); $this->Cell($line_width,$incr,$menu_title,'0',1,'L',true,'',1); $this->SetXY($date_col,$curr_row); $this->Cell($date_width,$incr,$mdate,'0',1,'R',true,'',1); } function Footer() { global $logo_row, $document_font, $document_font_size, $siteType, $school_record, $incr; $document_name = getLanguageText('TEXT-VOLUNTEER-LIST'); // Add logo to page $this->Image("images/".$school_record['logo_image'],10,$logo_row + 5,50); $this->SetFont($document_font,"",$document_font_size - 1); $this->SetXY(80,$logo_row + 5); $date = dateString('datetime'); $this->Cell(120,$incr - 1,$document_name . ": $date",'0',1,'R',false,'',1); $school_name = $school_record['school_name']; $this->SetXY(80,$logo_row + 5 + $incr); $this->Cell(120,$incr - 1,"$school_name",'0',1,'R'); $this->SetFont($document_font,"",$document_font_size); } } // Force exact physical size for Letter: 8.5 x 11 inches => 215.9mm x 279.4mm (portrait) $pageFormat = array(215.9, 279.4); $pdf= new PDF('P', 'mm', $pageFormat, true, 'UTF-8', false); $font_red = hexdec("00"); $font_green = hexdec("00"); $font_blue = hexdec("00"); $pdf->SetTextColor($font_red,$font_green,$font_blue); $curr_row = $max_rows + 5; $pageNum = 0; $orderBy = "last_name,first_name"; if ($school_record['volunteer_sorting'] == 'Manual Sorting') $orderBy = "sequence,$orderBy"; while ($row = db_fetch_array($menu_dates)) { extract($row); $menu_num = $record_num; $menu_title .= " ($menu_num)"; $mdate = date("D M jS, Y",strtotime($menu_date) + 60 * 60 * 12); // Get volunteers for this menu date $query = "select first_name,last_name,email,home_phone,user_num " . "from hotlunch_volunteers as hlv, users as u " . "where hlv.school_num = $school_num " . "and u.school_num = $base_school_num " . "and schedule_num = $schedule_num " . "and menu_num = $menu_num " . "and user_num = u.record_num " . "and hlv.deleted != 'Y' " . "order by $orderBy"; $volunteers = db_query($query); $num_volunteers = db_num_rows($volunteers); $num_lines = ($num_volunteers + 2) * $incr; if ($school_record['include_volunteer_details'] == 'Y') $num_lines = intval(2.1 * $num_lines); if ($curr_row + $num_lines > $max_rows - 2) { $pdf->addPage(); $pageNum++; $curr_row = $start_row + $incr * 4 + 1; } else { $pdf->SetFont($document_font,"B",$document_font_size); $pdf->SetFillColor(hexdec("dd"),hexdec("dd"),hexdec("dd")); // Print the menu title $pdf->SetXY($left_col,$curr_row); $pdf->Cell($line_width,$incr,$menu_title,'0',1,'L',true,'',1); $pdf->SetXY($date_col,$curr_row); $pdf->Cell($date_width,$incr,$mdate,'0',1,'R',true,'',1); $curr_row += $incr + 1; } // Print set of volunteers $pdf->SetFillColor(hexdec("ee"),hexdec("ee"),hexdec("ee")); $count = 0; while ($row = db_fetch_array($volunteers)) { $bg = $count % 2; $count++; if ($curr_row > $max_rows) { $pdf->addPage(); $pageNum++; $curr_row = $start_row + $incr * 4 + 1; } $pdf->SetFont($document_font,"",$document_font_size); $name = $row['first_name'] . ' ' . $row['last_name']; $phone = $row['home_phone']; $email = $row['email']; $pdf->SetXY($name_col,$curr_row); $pdf->Cell($name_width,$incr,$name,'0',1,'L',$bg,'',1); $pdf->SetXY($phone_col,$curr_row); $pdf->Cell($phone_width,$incr,$phone,'0',1,'L',$bg,'',1); $pdf->SetXY($email_col,$curr_row); $pdf->Cell($email_width,$incr,$email,'0',1,'L',$bg,'',1); // Display student grades $user_num = $row['user_num']; $query = "SELECT c.* FROM people AS p, classes AS c " . "WHERE p.school_num = $base_school_num " . "AND p.user_num = $user_num " . "AND c.school_num = $base_school_num " . "AND p.class_num = c.record_num"; $classes = db_query($query); $cinfo = ""; while ($class = db_fetch_assoc($classes)) { $grade = $class['grade']; $division = $class['division']; $class_num = $class['record_num']; if (strlen($cinfo)) $cinfo .= " // "; $cinfo .= getClassInfo($class_num, 'internal', 0); } $pdf->SetXY($class_col,$curr_row); $pdf->Cell($class_width,$incr,$cinfo,'0',1,'L',$bg,'',1); // Display student names if required if ($school_record['include_volunteer_details'] == 'Y') { $pdf->SetFont($document_font,"",$document_font_size - 1); $user_num = $row['user_num']; $students = db_query("SELECT * FROM people WHERE school_num = $base_school_num AND user_num = $user_num"); while ($student = db_fetch_array($students)) { $name = $student['first_name'] . ' ' . $student['last_name']; $class = $student['class_num']; $class_info = getClassInfo($class,'internal',1); $curr_row += $incr - .5; $pdf->SetXY($left_col,$curr_row); $pdf->Cell($line_width,$incr," " . "- $name: $class_info",'0',1,'L',$bg,'',1); } $pdf->SetFont($document_font,"",$document_font_size); $curr_row += 1; } $curr_row += $incr; } $curr_row += $incr; if ($school_record['include_volunteer_details'] == 'Y') $curr_row += $incr; } // Output the completed PDF header('Pragma: public'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: private',false); header('Content-type: application/pdf'); header("Content-Disposition: attachment; filename=volunteer-list.pdf"); header('Content-Transfer-Encoding: binary'); $pdf->Output("volunteer-list.pdf","D"); return; ?>