First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
$ValidAccess = 2010;
|
||||
require_once("include/globals.php");
|
||||
|
||||
|
||||
//
|
||||
// Ensure that the user is logged in
|
||||
//
|
||||
if (SessionActive() != 1 || !UserLoggedIn()) {
|
||||
echo("<br>\n");
|
||||
$error_message = "Invalid Access";
|
||||
include "form.messages.php";
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
// Check permissions
|
||||
$AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator','Administration Team','Schedule Team');
|
||||
if (checkPermission($AllowedUserTypes) != 1) {
|
||||
echo("<br>\n");
|
||||
$error_message = "Invalid Access";
|
||||
include "form.messages.php";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Setup the PDF
|
||||
//
|
||||
$template_file = "Blank.pdf";
|
||||
$document_font = $school_record['document_font'];
|
||||
if (strlen($document_font) == 0) $document_font = "Helvetica";
|
||||
|
||||
$document_font_weight = "";
|
||||
$document_text_color = "#000000";
|
||||
$document_font_size = 9;
|
||||
|
||||
|
||||
//
|
||||
// Setup PDF document
|
||||
//
|
||||
define('FPDF_FONTPATH',"include/font/");
|
||||
require("include/fpdi.php");
|
||||
|
||||
$pdf= new fpdi('P','mm','Letter');
|
||||
|
||||
$pagecount = $pdf->setSourceFile("$template_file");
|
||||
$tplidx = $pdf->ImportPage(1);
|
||||
|
||||
$pdf->addPage();
|
||||
$pdf->useTemplate($tplidx);
|
||||
|
||||
$font_red = hexdec("00");
|
||||
$font_green = hexdec("00");
|
||||
$font_blue = hexdec("00");
|
||||
|
||||
$pdf->SetTextColor($font_red,$font_green,$font_blue);
|
||||
|
||||
$school_name = $school_record['school_name'];
|
||||
$pac_name = $school_record['pac_name'];
|
||||
$url = $school_record['url'];
|
||||
|
||||
|
||||
// Set parameters for this document
|
||||
$max_rows = 120;
|
||||
$left_col = 15;
|
||||
|
||||
$center_col = 100;
|
||||
|
||||
$start_row = 20;
|
||||
|
||||
|
||||
//
|
||||
// Get parent list
|
||||
//
|
||||
$query = "select * " .
|
||||
"from users " .
|
||||
"where school_num = $base_school_num " .
|
||||
"and type = 'Parent' " .
|
||||
"and (email = '' or email is null) " .
|
||||
"order by last_name";
|
||||
$parents = db_query($query);
|
||||
|
||||
|
||||
//
|
||||
// Get parents notice text
|
||||
//
|
||||
$parent_text = db_getVal("select text_data from text_data where school_num = $school_num and text_id = 'Parent Reminder'");
|
||||
|
||||
|
||||
|
||||
// Process the parents
|
||||
if (db_num_rows($parents) > 0) {
|
||||
|
||||
// Process each menu date
|
||||
$count = 0;
|
||||
while ($row = db_fetch_array($parents)) {
|
||||
extract($row);
|
||||
|
||||
// Add a page if this is not the first entry
|
||||
if ($count > 0) {
|
||||
$pdf->addPage();
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
|
||||
$count++;
|
||||
|
||||
// Setup new page
|
||||
$curr_row = $start_row;
|
||||
$incr = 4;
|
||||
|
||||
$pdf->SetFillColor(hexdec("cc"),hexdec("cc"),hexdec("cc"));
|
||||
$pdf->SetFont("Arial","B",$document_font_size + 1);
|
||||
|
||||
|
||||
// Page titles
|
||||
$pdf->SetXY($left_col,$curr_row);
|
||||
$pdf->Cell(180,$incr + 1,"$pac_name",'0',1,'L',true);
|
||||
|
||||
$curr_row += $incr + 6;
|
||||
|
||||
$pdf->SetFillColor(hexdec("ee"),hexdec("ee"),hexdec("ee"));
|
||||
$pdf->SetFont("Arial","",$document_font_size);
|
||||
|
||||
$name = "$first_name $last_name";
|
||||
|
||||
$pdf->SetXY($left_col,$curr_row);
|
||||
$pdf->Cell(180,$incr,$name,'0',1,'L',true);
|
||||
|
||||
$curr_row += $incr + 5;
|
||||
|
||||
|
||||
$pdf->SetXY($left_col,$curr_row);
|
||||
$pdf->MultiCell(180,$incr,$parent_text,'0','L',false);
|
||||
|
||||
$curr_row = $pdf->GetY() + 2;
|
||||
|
||||
$text = "\n" .
|
||||
" " . getLanguageText('TEXT-WEB-SITE') . ": http://" . $school_record['url'] . "\n" .
|
||||
" " . getLanguageText('TEXT-USER-ID') . ": $userid\n" .
|
||||
" " . getLanguageText('TEXT-PASSWORD') . ": $password\n\n";
|
||||
|
||||
// Get students
|
||||
$query = "select * from people " .
|
||||
"where school_num = $base_school_num " .
|
||||
"and people_type = 'Student' " .
|
||||
"and user_num = $record_num " .
|
||||
"order by last_name,first_name";
|
||||
$results = db_query($query);
|
||||
|
||||
if (db_num_rows($results) > 0) {
|
||||
$text .= " " . $GlobalText['Students'] . ":\n";
|
||||
while ($row = db_fetch_array($results)) {
|
||||
$child = $row['first_name'] . ' ' . $row['last_name'];
|
||||
$class_num = $row['class_num'];
|
||||
$query = "select c.*,program_name from classes as c left join class_programs as cp on c.class_program = cp.record_num " .
|
||||
"where c.school_num = $base_school_num " .
|
||||
"and c.record_num = $class_num";
|
||||
$cresults = db_query($query);
|
||||
$class = db_fetch_array($cresults);
|
||||
|
||||
$class_info = "";
|
||||
$teachers = "";
|
||||
if ($school_record['p_display_teachers'] == 'Y') {
|
||||
if ($class['teacher1'] > 0)
|
||||
$teachers = db_getVal("select concat_ws(' ',title,first_name,last_name) from people where record_num = $class[teacher1]");
|
||||
if ($class['teacher2'] > 0 && $class['display_teacher2'] == 'Y')
|
||||
$teachers .= " / " . db_getVal("select concat_ws(' ',title,first_name,last_name) from people where record_num = $class[teacher2]");
|
||||
if ($class['teacher3'] > 0 && $class['display_teacher3'] == 'Y')
|
||||
$teachers .= " / " . db_getVal("select concat_ws(' ',title,first_name,last_name) from people where record_num = $class[teacher3]");
|
||||
if ($class['teacher4'] > 0 && $class['display_teacher4'] == 'Y')
|
||||
$teachers .= " / " . db_getVal("select concat_ws(' ',title,first_name,last_name) from people where record_num = $class[teacher4]");
|
||||
if ($class['teacher5'] > 0 && $class['display_teacher5'] == 'Y')
|
||||
$teachers .= " / " . db_getVal("select concat_ws(' ',title,first_name,last_name) from people where record_num = $class[teacher5]");
|
||||
}
|
||||
|
||||
$grade = $class['grade'];
|
||||
$div = $class['division'];
|
||||
$prog = $class['program_name'];
|
||||
$desc = $class['description'];
|
||||
|
||||
if ($school_record['p_display_program'] == 'Y' && strlen($prog)) $class_info .= " $prog";
|
||||
|
||||
if ($school_record['p_display_grade'] == 'Y' && isset($grade) && $grade) {
|
||||
if ($grade == 'K') $class_info .= " - Kindergarten";
|
||||
else $class_info .= " - Gr: $grade";
|
||||
}
|
||||
|
||||
if ($school_record['p_display_division'] == 'Y') $class_info .= " - $school_record[division_class_num_text]: $div";
|
||||
if ($school_record['p_display_description'] == 'Y' && strlen($desc)) $class_info .= " - $desc";
|
||||
if ($school_record['p_display_teachers'] == 'Y') $class_info .= "\n - $teachers";
|
||||
|
||||
$text .= " * $child - $class_info\n\n";
|
||||
}
|
||||
$text .= "\n";
|
||||
}
|
||||
else {
|
||||
$text .= " You have no active students registered in the system\n\n";
|
||||
}
|
||||
|
||||
$pdf->SetXY($left_col + 20,$curr_row);
|
||||
$pdf->MultiCell(140,$incr,$text,'1','L',true);
|
||||
|
||||
$pdf->SetFont("Arial","",$document_font_size - 1);
|
||||
$date = date("F j, Y",time());
|
||||
$pdf->SetXY(20,255);
|
||||
$pdf->Cell(182,$incr - 1,"Printed: $date ($record_num)",'0',0,'R');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 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=parent-notice.pdf");
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
|
||||
$pdf->Output("parent-notice.pdf","D");
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user