function getSupportMembers() { global $error_message, $iLimit, $iCur, $student_id; if (!connectIPPDB()) { $system_message = $system_message . $error_message; //just to remember we need this IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } // LEFT JOIN area_list ON support_list.uid=area_list.support_list_uid LEFT JOIN area_type ON area_list.area_type_id=area_type.area_type_id // original $query = "SELECT * FROM support_list where student_id=" . $student_id . " ORDER BY egps_username ASC LIMIT $iCur,$iLimit"; $query = "SELECT * FROM support_list where student_id=" . $student_id . " ORDER BY egps_username ASC"; $result = mysql_query($query); if (!$result) { $error_message = "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$query}'<BR>"; return NULL; } return $result; }
function echoJSServicesArray() { global $system_message; $acclist_query = "SELECT accomodation FROM typical_accomodation WHERE 1 ORDER BY `order` DESC, accomodation ASC LIMIT 400"; $acclist_result = mysql_query($acclist_query); if (!$acclist_result) { $error_message = "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$acclist_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } else { //call the function to create the javascript array... if (mysql_num_rows($acclist_result)) { echo createJavaScript($acclist_result, "popuplist"); } } }
function getLogTotals() { global $error_message, $iLimit, $iCur, $szLevel; if (!connectIPPDB()) { $error_message = $error_message; //just to remember we need this IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } if ($szLevel == "ALL") { $log_query = "SELECT * FROM error_log WHERE 1=1"; } else { $log_query = "SELECT * FROM error_log WHERE level='{$szLevel}'"; } $log_result = mysql_query($log_query); if (!$log_result) { $error_message = "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$log_query}'<BR>"; return NULL; } return mysql_num_rows($log_result); }
function runQuery() { global $target_result; if (isset($_GET['target'])) { $target_query = ""; switch ($_GET['target']) { case "guardian": if (!isset($_GET['guardian_id'])) { $system_message = $system_message . "You have arrived at this page without supplying a valid guardian_id (" . __FILE__ . ":" . __LINE__ . ")<BR>"; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } else { $target_query = "SELECT guardian.*,guardian.first_name as guardian_first_name,guardian.last_name as guardian_last_name,guardians.*,student.first_name,student.last_name,address.* FROM guardian LEFT JOIN guardians ON guardian.guardian_id=guardians.guardian_id LEFT JOIN student ON guardians.student_id=student.student_id LEFT JOIN address ON guardian.address_id=address.address_id WHERE guardian.guardian_id=" . $_GET['guardian_id']; } break; } $target_result = mysql_query($target_query); if (!$target_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$target_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } } }
function echoJSServicesArray() { global $system_message, $student_id; //get a list of all available goal categories... $catlist_query = "SELECT name FROM typical_long_term_goal_category WHERE is_deleted='N' ORDER BY name ASC"; $catlist_result = mysql_query($catlist_query); if (!$catlist_result) { $error_message = "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$catlist_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); return; } else { //call the function to create the javascript array... echo createJavaScript($catlist_result, "popuplist"); } }
function parse_submission() { if (!$_POST['first_name']) { return "You must supply a first name<BR>"; } if (!$_POST['last_name']) { return "You must supply a last name<BR>"; } //check that date is the correct pattern... $regexp = '/^\\d\\d\\d\\d-\\d\\d?-\\d\\d?$/'; if (!preg_match($regexp, $_POST['birthday'])) { return "Birthday must be in YYYY-MM-DD format<BR>"; } if (!preg_match($regexp, $_POST['at_school_since'])) { return "At School Since must be in YYYY-MM-DD format<BR>"; } //if(!$_POST['prov_ed_num']) return "You must supply a Provincial Education Number<BR>"; //if(!$_POST['ab_ed_code']) return "You must supply an Alberta Education Coding Value<BR>"; //check duplicate prov ed number... if (!connectIPPDB()) { $error_message = $error_message; //just to remember we need this $system_message = $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } if ($_POST['prov_ed_num'] != "") { $duplicate_query = "SELECT * FROM student WHERE prov_ed_num='" . mysql_real_escape_string($_POST['prov_ed_num']) . "'"; $duplicate_result = mysql_query($duplicate_query); if (mysql_num_rows($duplicate_result) > 0) { $duplicate_row = mysql_fetch_array($duplicate_result); return "Duplicate Provincial Education Number (name:" . $duplicate_row['first_name'] . " " . $duplicate_row['last_name'] . "),<BR>This student probably already exists in the database<BR>"; } } //$duplicate_query = "SELECT * FROM student WHERE ab_ed_code='" . mysql_real_escape_string($_POST['ab_ed_code']) ."'"; //$duplicate_result= mysql_query($duplicate_query); //if(mysql_num_rows($duplicate_result) > 0) {$duplicate_row = mysql_fetch_array($duplicate_result);return "Duplicate Alberta Education Code Number (name:" . $duplicate_row['first_name'] . " " . $duplicate_row['last_name'] ."),<BR>This student probably already exists in the database<BR>"; } return NULL; }
function echoJSServicesArray() { global $system_message; $acclist_query = "SELECT DISTINCT egps_username FROM support_list WHERE 1 ORDER BY egps_username ASC"; $acclist_result = mysql_query($acclist_query); if (!$acclist_result) { $error_message = "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$acclist_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } else { //call the function to create the javascript array... echo createJavaScript($acclist_result, "popuplist"); } }
/** @fn getStudents() * @brief Gets a count of students from the database that go to a member * @return NULL|resource * @todo get_student_count() */ function getStudents() { global $error_message, $IPP_MIN_VIEW_LIST_ALL_LOCAL_STUDENTS, $permission_level, $system_message, $IPP_MIN_VIEW_LIST_ALL_STUDENTS, $iLimit, $iCur, $szSchool, $szTotalStudents; if (!connectIPPDB()) { $system_message = $system_message . $error_message; //just to remember we need this IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } //do a subquery to find our school code...easier than messing with the ugly //query below... $school_code_query = "SELECT school_code FROM support_member WHERE egps_username='******'egps_username']) . "'"; $school_code_result = mysql_query($school_code_query); if (!$school_code_result) { $error_message = "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$school_code_query}'<BR>"; return NULL; } $school_code_row = mysql_fetch_array($school_code_result); $school_code = $school_code_row['school_code']; //$student_query = "SELECT student.student_id,last_name,first_name,school_history.school_code,school.* FROM student LEFT JOIN school_history ON student.student_id=school_history.student_id LEFT JOIN school ON school_history.school_code=school.school_code WHERE end_date IS NULL "; $student_query = "SELECT DISTINCT student.student_id,last_name,first_name,school_history.school_code,school.* FROM student LEFT JOIN support_list ON student.student_id = support_list.student_id LEFT JOIN school_history ON student.student_id=school_history.student_id LEFT JOIN school ON school_history.school_code=school.school_code WHERE ((support_list.egps_username='******'egps_username']) . "' AND school_history.end_date IS NULL AND support_list.student_id IS NOT NULL) OR ("; //prior to march 18/06: $student_query = "SELECT DISTINCT student.student_id,last_name,first_name,school_history.school_code,school.* FROM student LEFT JOIN support_list ON student.student_id = support_list.student_id LEFT JOIN school_history ON student.student_id=school_history.student_id LEFT JOIN school ON school_history.school_code=school.school_code WHERE (support_list.egps_username='******'egps_username']) . "' AND support_list.student_id IS NOT NULL) OR ("; if (!($IPP_MIN_VIEW_LIST_ALL_STUDENTS >= $permission_level)) { //$IPP_MIN_VIEW_LIST_ALL_LOCAL_STUDENTS >= $permission_level) { $student_query = $student_query . "school_history.school_code='{$school_code}' AND "; //prior to 2006-03-21: $student_query = $student_query . "school_history.school_code='$school_code' AND "; if ($IPP_MIN_VIEW_LIST_ALL_LOCAL_STUDENTS < $permission_level) { //$system_message .= "debug: permission level: $IPP_MIN_VIEW_LIST_ALL_LOCAL_STUDENTS < $permission_level<BR><BR>"; $student_query .= "support_list.egps_username='******'egps_username']) . "' AND "; } $student_query .= "end_date IS NULL) "; } else { $student_query = $student_query . "end_date IS NULL) "; } if (isset($_GET['SEARCH'])) { switch ($_GET['field']) { case 'last_name': $student_query = $student_query . "AND student.last_name LIKE '" . mysql_real_escape_string($_GET['szSearchVal']) . "' "; break; case 'first_name': $student_query = $student_query . "AND student.first_name LIKE '" . mysql_real_escape_string($_GET['szSearchVal']) . "' "; break; case 'last_name': $student_query = $student_query . "AND student.last_name LIKE '" . mysql_real_escape_string($_GET['szSearchVal']) . "' "; break; case 'school_name': $student_query = $student_query . "AND school.school_name LIKE '" . mysql_real_escape_string($_GET['szSearchVal']) . "' "; break; case 'school_code': $student_query = $student_query . "AND school_history.school_code LIKE '" . mysql_real_escape_string($_GET['szSearchVal']) . "' "; } } //added 2006-04-20: to prevent null school histories from showing up as active. $student_query .= ") AND EXISTS (SELECT school_history.student_id FROM school_history WHERE school_history.student_id=student.student_ID) "; //end added 2006-04-20 $student_query_limit = $student_query . "ORDER BY school_history.school_code,student.last_name ASC LIMIT {$iCur},{$iLimit}"; $student_result_limit = mysql_query($student_query_limit); if (!$student_result_limit) { $error_message = "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$student_query_limit}'<BR>"; return NULL; } //$system_message = $system_message . "debug: " . $student_query_limit . "<BR>"; //find the totals... $student_result_total = mysql_query($student_query); if (!$student_result_total) { $error_message = "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$student_query}'<BR>"; return NULL; } $szTotalStudents = mysql_num_rows($student_result_total); return $student_result_limit; }
function echoJSServicesArray() { global $system_message; //get a list of all available goal categories... $catlist_query = "SELECT * FROM typical_long_term_goal_category where is_deleted='N'"; $catlist_result = mysql_query($catlist_query); if (!$catlist_result) { $error_message = "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$catlist_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); return; } while ($catlist = mysql_fetch_array($catlist_result)) { $objlist_query = "SELECT typical_long_term_goal.goal FROM typical_long_term_goal WHERE cid=" . $catlist['cid'] . " AND typical_long_term_goal.is_deleted='N'"; $objlist_result = mysql_query($objlist_query); if (!$objlist_result) { $error_message = "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$objlist_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } else { //call the function to create the javascript array... echo createJavaScript($objlist_result, $catlist['name']); } } }
function create_pdf($student_id) { global $system_message, $student_row; $student_query = "SELECT * FROM student WHERE student_id = " . mysql_real_escape_string($student_id); $student_result = mysql_query($student_query); if (!$student_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$student_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } else { $student_row = mysql_fetch_array($student_result); } //get the goals... $long_goal_query = "SELECT * FROM long_term_goal WHERE student_id={$student_id} ORDER BY area ASC, is_complete DESC, goal ASC"; $long_goal_result = mysql_query($long_goal_query); if (!$long_goal_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$long_goal_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); echo $system_message; exit; } //get the supervisor... $supervisor_row = ""; $supervisor_query = "SELECT * FROM supervisor WHERE student_id={$student_id}"; $supervisor_result = mysql_query($supervisor_query); if (!$supervisor_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$supervisor_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); //echo $system_message; //exit(); //just carry on } else { $supervisor_row = mysql_fetch_array($supervisor_result); } //get the school code... $school_row = ""; $school_query = "SELECT * FROM school_history LEFT JOIN school on school_history.school_code=school.school_code WHERE student_id=" . $student_id . " AND end_date IS NULL"; $school_result = mysql_query($school_query); if (!$school_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$school_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } else { $school_row = mysql_fetch_array($school_result); } //get the school code... $school_history_row = ""; $school_history_query = "SELECT * FROM school_history WHERE student_id=" . $student_id . " AND end_date IS NOT NULL ORDER BY end_date DESC"; $school_history_result = mysql_query($school_history_query); if (!$school_history_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$school_history_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); //just carry on } //get the coding and history... $code = ""; $code_text = "(?)"; $ipp_history = "Unknown"; $code_query = "SELECT * FROM coding LEFT JOIN valid_coding ON coding.code=valid_coding.code_number WHERE student_id=" . $student_id . " ORDER BY end_date ASC"; $code_result = mysql_query($code_query); if (!$code_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$code_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); //just carry on } else { if (mysql_num_rows($code_result)) { $code_row = mysql_fetch_array($code_result); $code = $code_row['code']; $code_text = " (" . $code_row['code_text'] . ")"; $ipp_history = "Code " . $code_row['code'] . " from " . $code_row['start_date'] . " to "; if ($code_row['end_date'] == "") { $ipp_history .= "present"; } else { $ipp_history .= $code_row['end_date']; } while ($code_row = mysql_fetch_array($code_result)) { $ipp_history .= "\nCode " . $code_row['code'] . " from " . $code_row['start_date'] . " to "; if ($code_row['end_date'] == "") { $ipp_history .= "present"; } else { $ipp_history .= $code_row['end_date']; } } } } //get the guardian information... $guardian_query = "SELECT * FROM guardians LEFT JOIN guardian ON guardians.guardian_id=guardian.guardian_id LEFT JOIN address ON guardian.address_id=address.address_id WHERE guardians.to_date IS NULL AND student_id=" . $student_id . " ORDER BY last_name ASC, first_name ASC"; $guardian_result = mysql_query($guardian_query); if (!$guardian_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$guardian_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); //just carry on } $supervisors = "none listed"; $supervisor_query = "SELECT * FROM supervisor LEFT JOIN support_member ON supervisor.egps_username=support_member.egps_username WHERE student_id=" . $student_id . " AND end_date IS NULL"; $supervisor_result = mysql_query($supervisor_query); if (!$supervisor_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$supervisor_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); //just carry on } else { if (mysql_num_rows($supervisor_result)) { $supervisors = ""; while ($supervisor_row = mysql_fetch_array($supervisor_result)) { $supervisors .= $supervisor_row['first_name'] . " " . $supervisor_row['last_name'] . ", "; //username_to_common($supervisor_row['egps_username']) . ", "; } //strip off the trailing ', ' $supervisors = substr($supervisors, 0, -2); } } $support_team = "none listed"; $support_team_query = "SELECT * FROM support_list LEFT JOIN support_member ON support_list.egps_username=support_member.egps_username WHERE student_id=" . $student_id; $support_team_result = mysql_query($support_team_query); if (!$support_team_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$support_team_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); //just carry on } else { if (mysql_num_rows($support_team_result)) { $support_team = ""; while ($support_team_row = mysql_fetch_array($support_team_result)) { $support_team .= $support_team_row['first_name'] . " " . $support_team_row['last_name'] . ", "; //username_to_common($support_team_row['egps_username']) . ", "; } //strip off the trailing ', ' $support_team = substr($support_team, 0, -2); } } //get strengths... $strengths = "none listed"; $strength_query = "SELECT * FROM area_of_strength_or_need WHERE strength_or_need='Strength' AND is_valid='Y' AND student_id=" . $student_id . " ORDER BY description ASC"; $strength_result = mysql_query($strength_query); if (!$strength_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$strength_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); $strengths = "-error-"; //just carry on } else { if (mysql_num_rows($strength_result)) { $strengths = ""; $count = 1; while ($strength_row = mysql_fetch_array($strength_result)) { $strengths .= $count . ") " . $strength_row['description'] . "\n\n"; $count++; } //strip off the trailing '\n' $strengths = substr($strengths, 0, -1); } } //get strengths... $needs = "none listed"; $needs_query = "SELECT * FROM area_of_strength_or_need WHERE strength_or_need='Need' AND is_valid='Y' AND student_id=" . $student_id . " ORDER BY description ASC"; $needs_result = mysql_query($needs_query); if (!$needs_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$needs_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); $needs = "-error-"; //just carry on } else { if (mysql_num_rows($needs_result)) { $needs = ""; $count = 1; while ($needs_row = mysql_fetch_array($needs_result)) { $needs .= $count . ") " . $needs_row['description'] . "\n\n"; $count++; } //strip off the trailing '\n' $needs = substr($needs, 0, -1); } } //get medical information... $medical_query = "SELECT * FROM medical_info WHERE student_id=" . $student_id . " ORDER BY is_priority ASC, date DESC"; $medical_result = mysql_query($medical_query); if (!$medical_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$medical_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); //just carry on } //get medications... $medication_query = "SELECT * FROM medication WHERE end_date IS NULL AND student_id=" . $student_id . " ORDER BY start_date DESC"; $medication_result = mysql_query($medication_query); if (!$medication_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$medication_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); //just carry on } //get testing to support coding information... $testing_query = "SELECT * FROM testing_to_support_code WHERE student_id=" . $student_id . " ORDER BY date DESC"; $testing_result = mysql_query($testing_query); if (!$testing_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$testing_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); //just carry on } //get background information... $background_query = "SELECT * FROM background_info WHERE student_id=" . $student_id . " ORDER BY type ASC"; $background_result = mysql_query($background_query); if (!$background_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$background_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); //just carry on } //get current level of performance and achievement... $cla_query = "SELECT * FROM performance_testing WHERE student_id=" . $student_id . " ORDER BY date DESC"; $cla_result = mysql_query($cla_query); if (!$cla_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$cla_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); //just carry on } //get coordination of services... $services_query = "SELECT * FROM coordination_of_services WHERE student_id=" . $student_id . " ORDER BY date DESC"; $services_result = mysql_query($services_query); if (!$services_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$services_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); //just carry on } //get accommodations... $accommodations_query = "SELECT * FROM accomodation WHERE student_id=" . $student_id . " ORDER BY end_date DESC"; $accommodations_result = mysql_query($accommodations_query); if (!$accommodations_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$accommodations_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); //just carry on } //get transition plans... $transition_query = "SELECT * FROM transition_plan WHERE student_id=" . $student_id . " ORDER BY date DESC"; $transition_result = mysql_query($transition_query); if (!$transition_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$transition_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); //just carry on } //get assistive technology... $at_query = "SELECT * FROM assistive_technology WHERE student_id=" . $student_id . " ORDER BY technology ASC"; $at_result = mysql_query($at_query); if (!$at_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$at_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); //just carry on } //lets get some PDF making done... class IPP extends FPDF { function Header() { global $PDF_LOGO_PATH, $IPP_ORGANIZATION, $student_row, $IPP_ORGANIZATION_ADDRESS1, $IPP_ORGANIZATION_ADDRESS2, $IPP_ORGANIZATION_ADDRESS3; //Set a colour $this->SetTextColor(153, 153, 153); //greyish //Arial bold 15 $this->SetFont('Arial', 'B', 12); //Move to the right $this->Cell(60); //out organization $this->Ln(); $this->Cell(60); $this->Cell(0, 5, $IPP_ORGANIZATION, 'B', 1, 'R'); //$this->Ln(); $this->SetFont('Arial', 'I', 5); $this->Cell(60, 0, '', 0, 0, ''); $this->Cell(0, 5, $IPP_ORGANIZATION_ADDRESS1 . ', ' . $IPP_ORGANIZATION_ADDRESS2 . ', ' . $IPP_ORGANIZATION_ADDRESS3, 0, 0, 'R'); //Logo $this->Image($PDF_LOGO_PATH, 10, 8, 50); //Line break $this->Ln(15); //Set colour back $this->SetTextColor(153, 153, 153); // Well, I'm back in black, yes I'm back in black! Ow! } //Page footer function Footer() { global $student_row; //Set a colour $this->SetTextColor(153, 153, 153); //greyish //Position at 1.5 cm from bottom $this->SetY(-10); //Arial italic 8 $this->SetFont('Arial', 'I', 8); //Page number $this->Cell(0, 3, 'Individualized Education Program for ' . $student_row['first_name'] . ' ' . $student_row['last_name'] . '-' . date('dS \\of F Y') . ' (Page ' . $this->PageNo() . '/{nb})', 0, 1, 'C'); //output a little information on this $this->SetFont('Arial', 'i', 6); $this->SetTextColor(153, 153, 153); //greyish $this->SetFillColor(255, 255, 255); $this->Ln(1); $this->MultiCell(0, 5, "MYIEP System Copyright 2014 Chelsea School | �2005-2007 Grasslands Public Schools | licensed under the Gnu Public License", 'T', 'C', 1); //Set colour back $this->SetTextColor(0, 0, 0); // Well, I'm back in black, yes I'm back in black! } } //Instanciation of inherited class $pdf = new IPP(); $pdf->AliasNbPages(); $pdf->AddPage(); //set the pdf information $pdf->SetAuthor(username_to_common($_SESSION['egps_username'])); $pdf->SetCreator('MyIEP Special Education Program Management'); $pdf->SetTitle('Individual Program Plan - ' . $student_row['first_name'] . ' ' . $student_row['last_name']); //begin pdf... $pdf->SetFont('Times', '', 20); $pdf->SetTextColor(220, 50, 50); //set the colour a loverly redish $pdf->Cell(30); $pdf->Cell(130, 5, ' Program Plan ', 0, 0, 'C'); //$pdf->Image(IPP_PATH . 'images/bounding_box.png',$pdf->GetX()-1,$pdf->GetY()-4); $mark = $pdf->GetY(); /* if(isset($code) && is_numeric($code)) { $pdf->SetFont('Times','B',50); if($code > 99) $pdf->SetFont('Times','B',30); if($code >999) $pdf->SetFont('Times','B',25); if($code >9999) $pdf->SetFont('Times','B',20); }else { */ $pdf->SetFont('Times', 'B', 10); //$code=$code; // $code = "Not Coded"; // } $pdf->SetTextColor(0, 51, 0); //grey $pdf->SetFillColor(240, 240, 240); // white $pdf->SetDrawColor(0, 0, 0); //blueish $pdf->Cell(19, 14, $code, 0, 1); //move back $pdf->SetY($mark); $pdf->Ln(10); $pdf->SetFont('Times', 'B', 15); $pdf->SetTextColor(220, 50, 50); //set the colour a loverly redish $pdf->Cell(0, 0, '- ' . $student_row['first_name'] . " " . $student_row['last_name'] . ' -', 0, 0, 'C'); //Set colour back $pdf->Ln(15); $pdf->SetTextColor(0, 0, 0); // Well, I'm back in black, yes I'm back in black! Ow! //Begin student information $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->MultiCell(0, 5, 'Student Information', 'B', 'L', 0); $pdf->Ln(5); $pdf->SetDrawColor(0, 0, 0); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'Student Name: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $pdf->Cell(50, 5, iconv('UTF-8', 'Windows-1252', $student_row['first_name']) . ' ' . iconv('UTF-8', 'Windows-1252', $student_row['last_name']), 0, 0); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'Student Number: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $pdf->Cell(0, 5, iconv('UTF-8', 'Windows-1252', $student_row['prov_ed_num']), 0, 1); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'Date of Birth: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $pdf->Cell(50, 5, $student_row['birthday'], 0, 0); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'Current Grade: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); switch ($student_row['current_grade']) { case '-1': $pdf->Cell(50, 5, "District Program", 0, 0); break; case '0': $pdf->Cell(50, 5, "Kindergarten or Pre-K", 0, 0); break; default: $pdf->Cell(50, 5, $student_row['current_grade'], 0, 0); } $pdf->Cell(0, 5, $current_grade, 0, 1); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'Gender: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $gender = "Unknown"; if ($student_row['gender'] == 'M') { $gender = "Male"; } if ($student_row['gender'] == 'F') { $gender = "Female"; } $pdf->Cell(50, 5, $gender, 0, 0); //find the age function get_age_by_date($yyyymmdd) { global $system_message; $bdate = explode("-", $yyyymmdd); $dob_month = $bdate[1]; $dob_day = $bdate[2]; $dob_year = $bdate[0]; if (checkdate($dob_month, $dob_day, $dob_year)) { $dob_date = "{$dob_year}" . "{$dob_month}" . "{$dob_day}"; $age = floor((date("Ymd") - intval($dob_date)) / 10000); if ($age < 0 or $age > 114) { return $age . "<BR> -->Age warning: Negative or Zero (check D.O.B)<--"; } return $age; } return "-unknown-"; } $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'Current Age: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $pdf->Cell(0, 5, get_age_by_date($student_row['birthday']), 0, 1); //$pdf->Cell(10); //$pdf->SetFont('Arial','B',10); //$pdf->Cell(50,5,'Date of Birth: ',0,0); //$pdf->SetFont('Arial','I',10); //$pdf->Cell(0,5,$student_row['birthday'],0,1); $pdf->Ln(5); //End student information //Begin School Information $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->MultiCell(0, 5, 'School Information', 'B', 'L', 0); $pdf->Ln(5); $pdf->SetDrawColor(0, 0, 0); $pdf->Cell(10); $top_bounding_box = $pdf->GetY(); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'Current School: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); if ($school_row['school_name'] == '') { $pdf->Cell(50, 5, "Archived Student", 0, 1); } else { $pdf->Cell(50, 5, $school_row['school_name'] . ' (' . $school_row['school_code'] . ')', 0, 0); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'Since: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $pdf->Cell(0, 5, $school_row['start_date'], 0, 1); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'Address: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $pdf->MultiCell(0, 5, $school_row['school_address'], 0, 1); } //school history: $pdf->SetDrawColor(220, 220, 220); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(160, 5, 'School History', 'B', 1); $pdf->SetFont('Arial', 'I', 10); $pdf->Ln(2); $pdf->SetDrawColor(220, 220, 220); $pdf->SetFillColor(220, 220, 220); $pdf->SetFont('Arial', 'I', 8); if (mysql_num_rows($school_history_result) <= 0) { $pdf->Cell(30); $pdf->MultiCell(120, 5, 'No history entered', 0, 'C', 0); } while ($school_history_row = mysql_fetch_array($school_history_result)) { $pdf->Cell(30); $school_history_date = $school_history_row['start_date']; if (!$school_history_row['end_date']) { $school_history_date .= " to present"; } else { $school_history_date .= " to " . $school_history_row['end_date']; } $pdf->Cell(120, 3, $school_history_date, 'B', 1, 'R'); $pdf->SetFont('Arial', 'B', 8); $pdf->Cell(30); if ($school_history_row['address'] == "") { $address = "Unknown"; } else { $address = $school_history_row['school_address']; } $pdf->MultiCell(120, 5, $school_history_row['school_name'], 0, 'L', 1); $pdf->SetFont('Arial', 'I', 8); if ($school_history_row['school_address'] != "") { $pdf->Cell(30); $pdf->Cell(30, 5, 'Address:', 0, 0, 'J', 0); $patterns[0] = '/,\\n/'; $patterns[1] = '/,.\\n/'; $patterns[2] = '/\\n/'; $replacements[0] = ', '; $replacements[1] = ', '; $replacements[2] = ', '; $pdf->MultiCell(90, 5, preg_replace($patterns, $replacements, $school_history_row['school_address']), 0, 'L', 0); $pdf->Cell(30); $pdf->Cell(120, 0, '', 'B'); $pdf->Ln(1); } if ($school_history_row['grades'] != "") { $pdf->Cell(30); $pdf->Cell(30, 5, 'Grades:', 0, 0, 'J', 0); $pdf->MultiCell(90, 5, $school_history_row['grades'], 0, 'L', 0); $pdf->Cell(30); $pdf->Cell(120, 0, '', 'B'); $pdf->Ln(1); } if ($school_history_row['accommodations'] != "") { $pdf->Cell(30); $pdf->Cell(30, 5, 'Accommodations:', 0, 0, 'J', 0); $pdf->MultiCell(90, 5, iconv('UTF-8', 'Windows-1252', $school_history_row['accommodations']), 0, 'L', 0); $pdf->Cell(30); $pdf->Cell(120, 0, '', 'B'); $pdf->Ln(1); } $ipp_present_text = ""; switch ($school_history_row['ipp_present']) { case 'Y': $ipp_present_text = "IPP present at this school"; break; case 'N': $ipp_present_text = "IPP not present at this school"; break; default: $ipp_present_text = "Unknown if IPP present at this school"; } $pdf->Cell(30); $pdf->Cell(30, 5, 'IPP Present:', 0, 0, 'J', 0); $pdf->MultiCell(90, 5, $ipp_present_text, 0, 'L', 0); $pdf->Cell(30); $pdf->Cell(120, 0, '', 'B'); $pdf->Ln(3); } $pdf->Ln(1); $pdf->Cell(10); $pdf->SetDrawColor(220, 220, 220); $pdf->Cell(160, 0, '', 'T', 0, 1); $pdf->Ln(1); $pdf->Ln(5); //End School Information //BEGIN IPP information $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->MultiCell(0, 5, 'Individual Program Plan Information', 'B', 'L', 0); $pdf->Ln(5); $pdf->SetDrawColor(0, 0, 0); $pdf->Cell(10); $top_bounding_box = $pdf->GetY(); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'Current Date: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $school_year = ""; if (date('n') < 9) { $school_year = date('Y') - 1 . "-" . date('Y'); } else { $school_year = date('Y') . "-" . (date('Y') + 1); } $pdf->Cell(50, 5, date('l dS \\of F Y'), 0, 0); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'School Year: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $pdf->Cell(0, 5, $school_year, 0, 1); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'Current Code: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $pdf->Cell(0, 5, $code . $code_text, 0, 1); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'Supervisor(s): ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $pdf->MultiCell(0, 5, iconv('UTF-8', 'Windows-1252', $supervisors), 0, 1); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'Support Team: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $pdf->MultiCell(0, 5, iconv('UTF-8', 'Windows-1252', $support_team), 0, 1); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'IPP History: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $pdf->MultiCell(0, 5, $ipp_history, 0, 1); $pdf->Ln(5); //END IPP information //BEGIN Guardian Information $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->MultiCell(0, 5, 'Guardians', 'B', 'L', 0); $pdf->Ln(5); $pdf->SetDrawColor(220, 220, 220); while ($guardian_row = mysql_fetch_array($guardian_result)) { $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(60, 5, iconv('UTF-8', 'Windows-1252', $guardian_row['first_name']) . ' ' . iconv('UTF-8', 'Windows-1252', $guardian_row['last_name']), 'T', 0); $pdf->SetFont('Arial', 'I', 10); $guardian_info = ""; if ($guardian_row['home_ph'] != "") { $guardian_info = "Home Phone: " . iconv('UTF-8', 'Windows-1252', $guardian_row['home_ph']) . "\n"; } if ($guardian_row['business_ph'] != "") { $guardian_info .= "Business Phone: " . iconv('UTF-8', 'Windows-1252', $guardian_row['business_ph']) . "\n"; } if ($guardian_row['cell_ph'] != "") { $guardian_info .= "Cell Phone: " . iconv('UTF-8', 'Windows-1252', $guardian_row['cell_ph']) . "\n"; } if ($guardian_row['email_address'] != "") { $guardian_info .= "Email: " . iconv('UTF-8', 'Windows-1252', $guardian_row['email_address']) . "\n"; } if ($guardian_row['po_box'] != "") { $guardian_info .= iconv('UTF-8', 'Windows-1252', $guardian_row['po_box']) . "\n"; } if ($guardian_row['street'] != "") { $guardian_info .= "Street: " . iconv('UTF-8', 'Windows-1252', $guardian_row['street']) . "\n"; } if ($guardian_row['city'] != "") { $guardian_info .= "City: " . iconv('UTF-8', 'Windows-1252', $guardian_row['city']) . "\n"; } if ($guardian_row['province'] != "") { $guardian_info .= "Province: " . iconv('UTF-8', 'Windows-1252', $guardian_row['province']) . "\n"; } if ($guardian_row['country'] != "") { $guardian_info .= "Country: " . iconv('UTF-8', 'Windows-1252', $guardian_row['country']) . "\n"; } if ($guardian_row['postal_code'] != "") { $guardian_info .= "Postal Code: " . iconv('UTF-8', 'Windows-1252', $guardian_row['postal_code']) . "\n"; } if ($guardian_info == "") { $guardian_info = "no information available"; } $pdf->MultiCell(100, 5, $guardian_info, 'T', 'L', 0); $pdf->Ln(1); } $pdf->Cell(10); $pdf->Cell(160, 0, '', 'T'); $pdf->Ln(5); //END Guardian Information //BEGIN Background Information $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->MultiCell(0, 5, 'Background Information', 'B', 'L', 0); $pdf->Ln(5); $pdf->SetDrawColor(220, 220, 220); $pdf->SetFillColor(220, 220, 220); $pdf->SetFont('Arial', 'I', 8); while ($background_row = mysql_fetch_array($background_result)) { $pdf->Cell(30); $pdf->Cell(120, 3, '' . $background_row['date'], 'B', 1, 'R'); $pdf->SetFont('Arial', 'B', 8); $pdf->Cell(30); $pdf->MultiCell(120, 5, $background_row['type'], 'T', 'L', 1); $pdf->SetFont('Arial', 'I', 8); $pdf->Cell(30); $pdf->MultiCell(120, 5, iconv('UTF-8', 'Windows-1252', $background_row['description']), 0, 'L', 0); $pdf->Ln(2); } $pdf->Ln(5); //END Background Information //BEGIN Accommodations (2x m's 2x c's) $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->MultiCell(0, 5, 'Accommodations', 'B', 'L', 0); $pdf->Ln(5); $pdf->SetDrawColor(220, 220, 220); $pdf->SetFillColor(220, 220, 220); $pdf->SetFont('Arial', 'I', 8); while ($accommodations_row = mysql_fetch_array($accommodations_result)) { $pdf->Cell(30); $accommodations_date = $accommodations_row['start_date'] . "-"; if (!$accommodations_row['end_date']) { $accommodations_date .= " Current"; } $pdf->Cell(120, 3, $accommodations_date, 'B', 1, 'R'); $pdf->SetFont('Arial', 'B', 8); $pdf->Cell(30); if ($accommodations_row['subject'] == "") { $subject = "Unspecified"; } else { $subject = $accommodations_row['subject']; } $pdf->MultiCell(120, 5, "Subject/Area: " . iconv('UTF-8', 'Windows-1252', $subject), 0, 'L', 1); $pdf->SetFont('Arial', 'I', 8); $pdf->Cell(30); $pdf->MultiCell(120, 5, iconv('UTF-8', 'Windows-1252', $accommodations_row['accomodation']), 0, 'J', 0); //yeah, spelling is wrong...so what. $pdf->Ln(2); } $pdf->Ln(5); //END Accommodations //BEGIN Strengths & Needs information $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->MultiCell(0, 5, 'Strengths & Needs', 'B', 'L', 0); $pdf->Ln(5); $pdf->SetDrawColor(0, 0, 0); $pdf->SetDrawColor(220, 220, 220); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(60, 5, 'Strengths:', 'T', 0); $pdf->SetFont('Arial', 'I', 10); if ($strengths == "") { $strengths = "no information available"; } $pdf->MultiCell(100, 5, iconv('UTF-8', 'Windows-1252', $strengths), 'T', 'L', 0); $pdf->Ln(1); $pdf->Cell(10); $pdf->SetDrawColor(220, 220, 220); //$pdf->Cell(160,0,'','T',0,1); $pdf->Ln(1); $pdf->SetDrawColor(220, 220, 220); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(60, 5, 'Needs:', 'T', 0); $pdf->SetFont('Arial', 'I', 10); if ($needs == "") { $needs = "no information available"; } $pdf->MultiCell(100, 5, iconv('UTF-8', 'Windows-1252', $needs), 'T', 'L', 0); $pdf->Ln(1); $pdf->Cell(10); $pdf->SetDrawColor(220, 220, 220); $pdf->Cell(160, 0, '', 'T'); $pdf->Ln(5); //END Strengths and Needs //BEGIN Medical Information $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->MultiCell(0, 5, 'Medical', 'B', 'L', 0); $pdf->Ln(5); $pdf->SetDrawColor(0, 0, 0); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(10); $pdf->Cell(15, 5, 'Medical Conditions that Impact Schooling:', 0, 1); $pdf->Ln(1); $pdf->SetFont('Arial', 'I', 8); $pdf->SetDrawColor(220, 220, 220); if (mysql_num_rows($medical_result) < 1) { $pdf->Cell(30); $pdf->MultiCell(120, 5, 'No Known Medical Conditions', 'TB', 'C', 0); $pdf->Ln(2); } while ($medical_row = mysql_fetch_array($medical_result)) { $pdf->Cell(30); $pdf->Cell(120, 3, 'Date: ' . $medical_row['date'], 'B', 1, 'R'); //$pdf->Ln(3); //check if this is a priority entry... if ($medical_row['is_priority'] == 'Y') { $pdf->Image(IPP_PATH . 'images/caution.png', $pdf->GetX() + 23, $pdf->GetY(), 5); } $pdf->Cell(30); $pdf->MultiCell(120, 5, iconv('UTF-8', 'Windows-1252', $medical_row['description']), 'B', 'J', 0); $pdf->Ln(2); } $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(10); $pdf->Cell(15, 5, 'Current Medications:', 0, 1); $pdf->Ln(1); $pdf->SetFont('Arial', 'I', 8); while ($medication_row = mysql_fetch_array($medication_result)) { $pdf->Cell(30); $pdf->Cell(120, 3, 'Started: ' . $medication_row['start_date'], 'B', 1, 'R'); $pdf->Cell(30); $pdf->MultiCell(120, 5, iconv('UTF-8', 'Windows-1252', $medication_row['medication_name']) . ' (Doctor: ' . iconv('UTF-8', 'Windows-1252', $medication_row['doctor']) . ')', 'B', 'J', 0); $pdf->Ln(2); } $pdf->Ln(5); //END Medical Information //BEGIN Testing to Support Coding $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->MultiCell(0, 5, 'Testing to Support Coding (Assessment)', 'B', 'L', 0); $pdf->Ln(5); $pdf->SetDrawColor(220, 220, 220); $pdf->SetFillColor(220, 220, 220); $pdf->SetFont('Arial', 'I', 8); while ($testing_row = mysql_fetch_array($testing_result)) { $pdf->Cell(30); $pdf->Cell(120, 3, 'Date: ' . $testing_row['date'], 'B', 1, 'R'); $pdf->SetFont('Arial', 'B', 8); $pdf->Cell(30); if ($testing_row['administered_by'] == "") { $admin_by = "-unknown-"; } else { $admin_by = $testing_row['administered_by']; } $pdf->MultiCell(120, 5, iconv('UTF-8', 'Windows-1252', $testing_row['test_description']) . ' (Administered by: ' . iconv('UTF-8', 'Windows-1252', $admin_by) . ')', 'T', 'L', 1); $pdf->SetFont('Arial', 'I', 8); $pdf->Cell(30); $pdf->MultiCell(120, 5, iconv('UTF-8', 'Windows-1252', $testing_row['recommendations']), 0, 'L', 0); $pdf->Ln(2); } $pdf->Ln(5); //END Testing to Support Coding //BEGIN Current Level of Performance and Achievement $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->MultiCell(0, 5, 'Current Level of Performance & Achievement', 'B', 'L', 0); $pdf->Ln(5); $pdf->SetDrawColor(220, 220, 220); $pdf->SetFillColor(220, 220, 220); $pdf->SetFont('Arial', 'I', 8); while ($cla_row = mysql_fetch_array($cla_result)) { $pdf->Cell(30); $pdf->Cell(120, 3, 'Date: ' . $cla_row['date'], 'B', 1, 'R'); $pdf->SetFont('Arial', 'B', 8); $pdf->Cell(30); //if($testing_row['administered_by'] == "") $admin_by = "-unknown-"; // else $admin_by = $testing_row['administered_by']; $pdf->MultiCell(120, 5, iconv('UTF-8', 'Windows-1252', $cla_row['test_name']), 0, 'L', 1); $pdf->SetFont('Arial', 'I', 8); $pdf->Cell(30); $pdf->MultiCell(120, 5, iconv('UTF-8', 'Windows-1252', $cla_row['results']), 0, 'J', 0); $pdf->Ln(2); } $pdf->Ln(5); //END Current Level of Performance and Achievement //BEGIN Coordination of Services $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->MultiCell(0, 5, 'Co-ordination of Services', 'B', 'L', 0); $pdf->Ln(5); $pdf->SetDrawColor(220, 220, 220); $pdf->SetFillColor(220, 220, 220); $pdf->SetFont('Arial', 'I', 8); while ($services_row = mysql_fetch_array($services_result)) { $pdf->Cell(30); $pdf->Cell(120, 3, 'Date: ' . $services_row['date'], 'B', 1, 'R'); $pdf->SetFont('Arial', 'B', 8); $pdf->Cell(30); //if($testing_row['administered_by'] == "") $admin_by = "-unknown-"; // else $admin_by = $testing_row['administered_by']; $pdf->MultiCell(120, 5, iconv('UTF-8', 'Windows-1252', $services_row['agency']), 0, 'L', 1); $pdf->SetFont('Arial', 'I', 8); $pdf->Cell(30); $pdf->MultiCell(120, 5, iconv('UTF-8', 'Windows-1252', $services_row['description']), 0, 'J', 0); $pdf->Ln(2); } $pdf->Ln(5); //END Coordination of Services //BEGIN Assistive Technology $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->MultiCell(0, 5, 'Assistive Technology', 'B', 'L', 0); $pdf->Ln(5); $pdf->SetDrawColor(220, 220, 220); $pdf->SetFillColor(220, 220, 220); $pdf->SetFont('Arial', 'I', 8); while ($at_row = mysql_fetch_array($at_result)) { $pdf->Cell(30); $pdf->Cell(120, 3, ' ', 'B', 1, 'R'); $pdf->Cell(30); $pdf->MultiCell(120, 5, iconv('UTF-8', 'Windows-1252', $at_row['technology']), 'B', 'J', 0); $pdf->Ln(2); } $pdf->Ln(5); //END Assistive Technology //begin goal overview... $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->MultiCell(0, 5, 'Goals Overview', 'B', 'L', 0); $pdf->Ln(5); $pdf->SetDrawColor(0, 0, 0); $goal_row = mysql_fetch_array($long_goal_result); while ($goal_row) { $pdf->SetFont('Arial', 'B', 10); $current_area = $goal_row['area']; //output the current area: $pdf->Cell(10); $pdf->Cell(0, 5, 'Area: ' . iconv('UTF-8', 'Windows-1252', $goal_row['area']), 0, 1); $pdf->Ln(2); while ($current_area == $goal_row['area']) { //output this goal $pdf->SetFont('Arial', '', 8); $x = $pdf->GetX(); $y = $pdf->GetY(); if ($goal_row['is_complete'] == 'Y') { $pdf->Image(IPP_PATH . 'images/checkmark_black.png', $x + 12, $y, 3); } else { $pdf->Image(IPP_PATH . 'images/arrow_black.png', $x + 12, $y, 3); } $pdf->Cell(15); $pdf->SetFont('Arial', 'B', 8); $pdf->Cell(8, 5, 'Goal: ', 0, 0); $pdf->SetFont('Arial', '', 8); $pdf->MultiCell(150, 5, preg_replace("/\\n/", " ", iconv('UTF-8', 'Windows-1252', $goal_row['goal'])), 0, 1); //add the objectives... $objective_query = "SELECT * FROM short_term_objective WHERE goal_id='" . mysql_real_escape_string($goal_row['goal_id']) . "' ORDER BY achieved ASC"; $objective_result = mysql_query($objective_query); if (!$objective_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$objective_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } $pdf->SetFont('Arial', '', 8); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); while ($objective_row = mysql_fetch_array($objective_result)) { $pdf->Cell(15); $x = $pdf->GetX(); $y = $pdf->GetY(); if ($objective_row['achieved'] == 'Y') { $pdf->Image(IPP_PATH . 'images/checkmark_black.png', $x + 6, $y, 3); } else { $pdf->Image(IPP_PATH . 'images/arrow_black.png', $x + 6, $y, 3); } $pdf->Cell(10); $pdf->MultiCell(130, 5, preg_replace("/\\n/", " ", iconv('UTF-8', 'Windows-1252', $objective_row['description'])), 0, 1); } $pdf->SetDrawColor(0, 0, 0); $goal_row = mysql_fetch_array($long_goal_result); } } $pdf->Ln(5); //end overview //move the pointer back... if (mysql_num_rows($long_goal_result)) { mysql_data_seek($long_goal_result, 0); } //begin details... $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->MultiCell(0, 5, 'Goals Details', 'B', 'L', 0); $pdf->Ln(3); $pdf->SetDrawColor(0, 0, 0); $goal_row = mysql_fetch_array($long_goal_result); while ($goal_row) { $pdf->SetFont('Arial', 'BU', 14); $current_area = $goal_row['area']; //output the current area: $pdf->Cell(5); $pdf->Cell(0, 5, $goal_row['area'], 0, 1); $pdf->Ln(5); while ($current_area == $goal_row['area']) { //output this goal $pdf->SetFont('Arial', '', 14); $x = $pdf->GetX(); $y = $pdf->GetY(); if ($goal_row['is_complete'] == 'Y') { $pdf->Image(IPP_PATH . 'images/checkmark_black.png', $x + 8, $y, 3); } else { $pdf->Image(IPP_PATH . 'images/arrow_black.png', $x + 8, $y, 3); } $pdf->Cell(12); $pdf->SetFont('Arial', 'B', 14); $pdf->Cell(15, 5, 'Goal: ', 0, 0); $pdf->SetFont('Arial', '', 14); $pdf->MultiCell(150, 5, iconv('UTF-8', 'Windows-1252', $goal_row['goal']), 0, 1); //add the objectives... $objective_query = "SELECT * FROM short_term_objective WHERE goal_id='" . mysql_real_escape_string($goal_row['goal_id']) . "' ORDER BY achieved ASC"; $objective_result = mysql_query($objective_query); if (!$objective_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$objective_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } $pdf->SetFont('Arial', '', 12); $pdf->SetDrawColor(220, 220, 220); $pdf->SetFillColor(220, 220, 220); while ($objective_row = mysql_fetch_array($objective_result)) { $pdf->SetFont('Arial', '', 10); $pdf->Ln(5); $pdf->Cell(10); $x = $pdf->GetX(); $y = $pdf->GetY(); if ($objective_row['achieved'] == 'Y') { $pdf->Image(IPP_PATH . 'images/checkmark_black.png', $x + 6, $y, 3); } else { $pdf->Image(IPP_PATH . 'images/arrow_black.png', $x + 6, $y, 3); } $pdf->Cell(10); $pdf->MultiCell(0, 5, iconv('UTF-8', 'Windows-1252', $objective_row['description']), 0, 1); if ($objective_row['strategies'] != "") { //we print the 'strategies' $pdf->SetFont('Arial', 'B', 10); $pdf->Ln(2); $pdf->Cell(30); $pdf->Cell(15, 5, 'Strategies:', 0, 1); $pdf->SetFont('Arial', 'I', 10); $pdf->Cell(30); $pdf->MultiCell(120, 5, iconv('UTF-8', 'Windows-1252', $objective_row['strategies']), 'TB', 'J', 0); } if ($objective_row['assessment_procedure'] != "") { //we print the 'assessement procedure' $pdf->SetFont('Arial', 'B', 10); $pdf->Ln(2); $pdf->Cell(30); $pdf->Cell(15, 5, 'Assessment Procedure:', 0, 1); $pdf->SetFont('Arial', 'I', 10); $pdf->Cell(30); $pdf->MultiCell(120, 5, iconv('UTF-8', 'Windows-1252', $objective_row['assessment_procedure']), 'TB', 'J', 0); } if ($objective_row['results_and_recommendations'] != "") { //we print the 'results and recommendations' $pdf->SetFont('Arial', 'B', 10); $pdf->Ln(2); $pdf->Cell(30); $pdf->Cell(15, 5, 'Progress Review:', 0, 1); $pdf->SetFont('Arial', 'I', 10); $pdf->Cell(30); $pdf->MultiCell(120, 5, iconv('UTF-8', 'Windows-1252', $objective_row['results_and_recommendations']), 'TB', 'J', 0); } //$pdf->SetFont('Arial','',8); //$pdf->Cell(30); //$output = "Strategies:\n\n" . preg_replace("/\\n/", " ",$objective_row['strategies']) . "\n\nResults & Recommendations\n\n" . preg_replace("/\\n/", " ", $objective_row['results_and_recommendations']); //$pdf->MultiCell(150,5,$output,1,'L',1); //$pdf->SetFont('Arial','',10); //$pdf->Cell(0); } $pdf->SetDrawColor(0, 0, 0); $pdf->Ln(5); $goal_row = mysql_fetch_array($long_goal_result); } } $pdf->Ln(5); //end details //begin transition plan $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->MultiCell(0, 5, 'Transition Plans (Year End Recommendations):', 'B', 'L', 0); $pdf->Ln(5); $pdf->SetDrawColor(0, 0, 0); $pdf->SetFont('Arial', 'I', 8); $pdf->SetDrawColor(220, 220, 220); while ($transition_row = mysql_fetch_array($transition_result)) { $pdf->Cell(30); $pdf->Cell(120, 3, 'Date: ' . $transition_row['date'], 'B', 1, 'R'); //$pdf->Ln(3); $pdf->Cell(30); $pdf->MultiCell(120, 5, iconv('UTF-8', 'Windows-1252', $transition_row['plan']), 'B', 'J', 0); $pdf->Ln(2); } //$pdf->Ln(5); //end transition plan //begin signature page $pdf->AddPage(); $pdf->SetFont('Times', '', 20); $pdf->SetTextColor(220, 50, 50); //set the colour a loverly redish $pdf->Cell(30); $pdf->Cell(130, 15, 'Signatures', 0, 1, 'C'); $pdf->SetFont('Times', 'B', 15); $pdf->SetTextColor(220, 50, 50); //set the colour a loverly redish $pdf->Cell(0, 0, '- ' . $student_row['first_name'] . " " . $student_row['last_name'] . ' -', 0, 0, 'C'); //disclaimer... $pdf->SetTextColor(255, 0, 0); $pdf->SetFont('Arial', 'BI', 10); $pdf->Ln(8); $pdf->Cell(15); $pdf->MultiCell(160, 5, 'I understand and agree with the information contained in this Program Plan', 0, 1, 'L'); //Set colour back $pdf->Ln(5); $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->SetTextColor(0, 0, 0); $pdf->MultiCell(0, 5, 'Signatures (Review Date 1)', 'BI', 'L', 0); $pdf->Ln(12); $pdf->SetDrawColor(0, 0, 0); $pdf->SetTextColor(153, 153, 153); $pdf->SetFont('Arial', 'I', 10); $pdf->Cell(5); $pdf->Cell(80, 5, 'Parent/Guardian Date', 'T', 0, 'C'); $pdf->Cell(14, 5, '', 0); $pdf->Cell(80, 5, 'Coordinator/Teacher Date', 'T', 1, 'C'); $pdf->Ln(8); $pdf->Cell(5); $pdf->Cell(80, 5, 'Principal Date', 'T', 0, 'C'); $pdf->Cell(14, 5, '', 0); $pdf->Cell(80, 5, 'Student Date', 'T', 1, 'C'); $pdf->Ln(8); $pdf->Cell(5); $pdf->Cell(80, 5, '[ ] Date', 'T', 0, 'C'); $pdf->Cell(14, 5, '', 0); $pdf->Cell(80, 5, '[ ] Date', 'T', 1, 'C'); $pdf->Ln(8); $pdf->Cell(5); $pdf->Cell(80, 5, '[ ] Date', 'T', 0, 'C'); $pdf->Cell(14, 5, '', 0); $pdf->Cell(80, 5, '[ ] Date', 'T', 1, 'C'); //$pdf->Cell(50); $pdf->Cell(73,5,'Principal','T',1,'C'); //$pdf->Ln(8); //$pdf->Cell(50);$pdf->Cell(73,5,'Signature Date','T',0,'C'); $pdf->Ln(8); $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->SetTextColor(0, 0, 0); $pdf->MultiCell(0, 5, 'Signatures (Review Date 2)', 'BI', 'L', 0); $pdf->Ln(12); $pdf->SetDrawColor(0, 0, 0); $pdf->SetTextColor(153, 153, 153); $pdf->SetFont('Arial', 'I', 10); $pdf->Cell(5); $pdf->Cell(80, 5, 'Parent/Guardian Date', 'T', 0, 'C'); $pdf->Cell(14, 5, '', 0); $pdf->Cell(80, 5, 'Coordinator/Teacher Date', 'T', 1, 'C'); $pdf->Ln(8); $pdf->Cell(5); $pdf->Cell(80, 5, 'Principal Date', 'T', 0, 'C'); $pdf->Cell(14, 5, '', 0); $pdf->Cell(80, 5, 'Student Date', 'T', 1, 'C'); $pdf->Ln(8); $pdf->Cell(5); $pdf->Cell(80, 5, '[ ] Date', 'T', 0, 'C'); $pdf->Cell(14, 5, '', 0); $pdf->Cell(80, 5, '[ ] Date', 'T', 1, 'C'); $pdf->Ln(8); $pdf->Cell(5); $pdf->Cell(80, 5, '[ ] Date', 'T', 0, 'C'); $pdf->Cell(14, 5, '', 0); $pdf->Cell(80, 5, '[ ] Date', 'T', 1, 'C'); $pdf->Ln(8); $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->SetTextColor(0, 0, 0); $pdf->MultiCell(0, 5, 'Signatures (Review Date 3)', 'BI', 'L', 0); $pdf->Ln(12); $pdf->SetDrawColor(0, 0, 0); $pdf->SetTextColor(153, 153, 153); $pdf->SetFont('Arial', 'I', 10); $pdf->Cell(5); $pdf->Cell(80, 5, 'Parent/Guardian Date', 'T', 0, 'C'); $pdf->Cell(14, 5, '', 0); $pdf->Cell(80, 5, 'Coordinator/Teacher Date', 'T', 1, 'C'); $pdf->Ln(8); $pdf->Cell(5); $pdf->Cell(80, 5, 'Principal Date', 'T', 0, 'C'); $pdf->Cell(14, 5, '', 0); $pdf->Cell(80, 5, 'Student Date', 'T', 1, 'C'); $pdf->Ln(8); $pdf->Cell(5); $pdf->Cell(80, 5, '[ ] Date', 'T', 0, 'C'); $pdf->Cell(14, 5, '', 0); $pdf->Cell(80, 5, '[ ] Date', 'T', 1, 'C'); $pdf->Ln(8); $pdf->Cell(5); $pdf->Cell(80, 5, '[ ] Date', 'T', 0, 'C'); $pdf->Cell(14, 5, '', 0); $pdf->Cell(80, 5, '[ ] Date', 'T', 1, 'C'); //end signature page return $pdf; }
$system_message = $system_message . $error_message; if (isset($_SESSION['egps_username'])) { IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } else { IPP_LOG($system_message, 'no session', 'ERROR'); } require IPP_PATH . 'index.php'; exit; } } else { if (!validate()) { $system_message = $system_message . $error_message; if (isset($_SESSION['egps_username'])) { IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } else { IPP_LOG($system_message, "no session", 'ERROR'); } require IPP_PATH . 'index.php'; exit; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
function getUsers() { global $error_message, $iLimit, $iCur, $bShowNav, $system_message; if (!connectIPPDB()) { $system_message = $system_message . $error_message; //just to remember we need this IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } if (!isset($_GET['username'])) { if (isset($_GET['showall'])) { $query = "SELECT * FROM support_member LEFT JOIN school ON support_member.school_code=school.school_code where 1=1 ORDER BY egps_username ASC"; } else { $query = "SELECT * FROM support_member LEFT JOIN school ON support_member.school_code=school.school_code where 1=1 ORDER BY egps_username ASC LIMIT {$iCur},{$iLimit}"; $bShowNav = TRUE; } } else { $query = "SELECT * FROM support_member LEFT JOIN school ON support_member.school_code=school.school_code WHERE egps_username LIKE '" . $_GET['username'] . "' ORDER BY egps_username ASC"; } if (isset($_GET['index'])) { $query = "SELECT * FROM support_member LEFT JOIN school on support_member.school_code=school.school_code WHERE ASCII(LOWER(egps_username)) >= ASCII('" . mysql_real_escape_string($_GET['index']) . "') ORDER BY egps_username ASC LIMIT {$iLimit}"; //do some moronic thing to find our index- were I not so lazy I'd find a more elegant method. $get_index_query = "SELECT * FROM support_member LEFT JOIN school on support_member.school_code=school.school_code WHERE ASCII(LOWER(egps_username)) < ASCII('" . mysql_real_escape_string($_GET['index']) . "')"; $get_index_result = mysql_query($get_index_query); if ($get_index_result) { $iCur = mysql_num_rows($get_index_result); } else { $system_message .= "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$get_index_query}'<BR>"; } } $result = mysql_query($query); if (!$result) { $error_message = "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$query}'<BR>"; return NULL; } return $result; }
function create_anecdotals($student_id) { global $system_message, $student_row; $student_query = "SELECT * FROM student WHERE student_id = " . mysql_real_escape_string($student_id); $student_result = mysql_query($student_query); if (!$student_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$student_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } else { $student_row = mysql_fetch_array($student_result); } //get the goals... $anecdotal_query = "SELECT * FROM anecdotal WHERE student_id={$student_id} ORDER BY date ASC"; $anecdotal_result = mysql_query($anecdotal_query); if (!$anecdotal_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$anecdotal_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); //todo investigate and expand logging; implement email alerts on certain log key words echo $system_message; exit; } //get the coding and history... $code = ""; $code_text = ""; $ipp_history = "Unknown"; $code_query = "SELECT * FROM coding LEFT JOIN valid_coding ON coding.code=valid_coding.code_number WHERE student_id=" . $student_id . " ORDER BY end_date ASC"; $code_result = mysql_query($code_query); if (!$code_result) { $error_message = $error_message . "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$code_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); //just carry on } else { if (mysql_num_rows($code_result)) { $code_row = mysql_fetch_array($code_result); $code = $code_row['code']; $code_text = " (" . $code_row['code_text'] . ")"; } } //lets get some PDF making done... class IPP extends FPDF { //Page header function Header() { global $IPP_ORGANIZATION, $student_row, $IPP_ORGANIZATION_ADDRESS1, $IPP_ORGANIZATION_ADDRESS2, $IPP_ORGANIZATION_ADDRESS3; //Set a colour $this->SetTextColor(153, 153, 153); //greyish //Arial bold 15 $this->SetFont('Arial', 'B', 12); //Move to the right $this->Cell(60); //out organization $this->Ln(); $this->Cell(60); $this->Cell(0, 5, $IPP_ORGANIZATION, 'B', 1, 'R'); //$this->Ln(); $this->SetFont('Arial', 'I', 5); $this->Cell(60, 0, '', 0, 0, ''); $this->Cell(0, 5, $IPP_ORGANIZATION_ADDRESS1 . ', ' . $IPP_ORGANIZATION_ADDRESS2 . ', ' . $IPP_ORGANIZATION_ADDRESS3, 0, 0, 'R'); //Logo $this->Image(IPP_PATH . 'images/logo_pb.png', 10, 8, 50); // todo: html folk should not icon location for customization features //Line break $this->Ln(15); //Set colour back $this->SetTextColor(153, 153, 153); // Well, I'm back in black, yes I'm back in black! Ow! Todo: note again nature of comment } //Page footer function Footer() { global $student_row; //Set a colour $this->SetTextColor(153, 153, 153); //greyish //Position at 1.5 cm from bottom $this->SetY(-10); //Arial italic 8 $this->SetFont('Arial', 'I', 8); //Page number $this->Cell(0, 3, 'Anecdotal report for ' . $student_row['first_name'] . ' ' . $student_row['last_name'] . '-' . date('dS \\of F Y') . ' (Page ' . $this->PageNo() . '/{nb})', 0, 1, 'C'); //output a little information on this $this->SetFont('Arial', 'i', 6); $this->SetTextColor(153, 153, 153); //greyish $this->SetFillColor(255, 255, 255); $this->Ln(1); $this->MultiCell(0, 5, "Grasslands Individual Program Plan System (�2005-2006 Grasslands Public Schools)", 'T', 'C', 1); //todo: this should be a variable controlled on admin console //Set colour back $this->SetTextColor(0, 0, 0); // Well, I'm back in black, yes I'm back in black! Todo: note the dev listened to ACDC } } //Instanciation of inherited class $pdf = new IPP(); $pdf->AliasNbPages(); $pdf->AddPage(); //set the pdf information $pdf->SetAuthor(username_to_common($_SESSION['egps_username'])); $pdf->SetCreator('Grasslands IPP System- Michael Nielsen Developer'); //todo strip the vanity of the dev $pdf->SetTitle('Individual Program Plan - ' . $student_row['first_name'] . ' ' . $student_row['last_name']); //begin pdf... $pdf->SetFont('Times', '', 20); $pdf->SetTextColor(220, 50, 50); //set the colour a loverly redish $pdf->Cell(30); $pdf->Cell(130, 5, 'Anecdotal Report ', 0, 0, 'C'); $pdf->Image(IPP_PATH . 'images/bounding_box.png', $pdf->GetX() - 1, $pdf->GetY() - 4); $mark = $pdf->GetY(); if ($code != "") { if ($code > 99) { $pdf->SetFont('Times', 'B', 30); } else { $pdf->SetFont('Times', 'B', 50); } } else { $pdf->SetFont('Times', 'B', 10); $code = " Not\nCoded"; } $pdf->SetTextColor(0, 51, 0); //grey $pdf->SetFillColor(240, 240, 240); // white $pdf->SetDrawColor(0, 0, 0); //blueish $pdf->Cell(19, 14, $code, 0, 1); //move back $pdf->SetY($mark); $pdf->Ln(10); $pdf->SetFont('Times', 'B', 15); $pdf->SetTextColor(220, 50, 50); //set the colour a loverly redish $pdf->Cell(0, 0, '- ' . $student_row['first_name'] . " " . $student_row['last_name'] . ' -', 0, 0, 'C'); //Set colour back $pdf->Ln(15); $pdf->SetTextColor(0, 0, 0); // Well, I'm back in black, yes I'm back in black! Ow! //Begin student information $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->MultiCell(0, 5, 'Student Information', 'B', 'L', 0); $pdf->Ln(5); $pdf->SetDrawColor(0, 0, 0); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'Student Name: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $pdf->Cell(50, 5, iconv('UTF-8', 'Windows-1252', $student_row['first_name']) . ' ' . iconv('UTF-8', 'Windows-1252', $student_row['last_name']), 0, 0); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'AB Ed. Number: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $pdf->Cell(0, 5, iconv('UTF-8', 'Windows-1252', $student_row['prov_ed_num']), 0, 1); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'Date of Birth: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $pdf->Cell(50, 5, $student_row['birthday'], 0, 0); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'Current Grade: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); switch ($student_row['current_grade']) { case '-1': $pdf->Cell(50, 5, "District Program", 0, 0); break; case '0': $pdf->Cell(50, 5, "Kindergarten or Pre-K", 0, 0); break; default: $pdf->Cell(50, 5, $student_row['current_grade'], 0, 0); } //$pdf->Cell(0,5,$current_grade,0,1); $pdf->Cell(0, 5, "", 0, 1); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'Gender: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $gender = "Unknown"; if ($student_row['gender'] == 'M') { $gender = "Male"; } if ($student_row['gender'] == 'F') { $gender = "Female"; } $pdf->Cell(50, 5, $gender, 0, 0); //find the age function get_age_by_date($yyyymmdd) { global $system_message; $bdate = explode("-", $yyyymmdd); $dob_month = $bdate[1]; $dob_day = $bdate[2]; $dob_year = $bdate[0]; if (checkdate($dob_month, $dob_day, $dob_year)) { $dob_date = "{$dob_year}" . "{$dob_month}" . "{$dob_day}"; $age = floor((date("Ymd") - intval($dob_date)) / 10000); if ($age < 0 or $age > 114) { return $age . "<BR> -->Age warning: Negative or Zero (check D.O.B)<--"; } return $age; } return "-unknown-"; } $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'Current Age: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $pdf->Cell(0, 5, get_age_by_date($student_row['birthday']), 0, 1); //$pdf->Cell(10); //$pdf->SetFont('Arial','B',10); //$pdf->Cell(50,5,'Date of Birth: ',0,0); //$pdf->SetFont('Arial','I',10); //$pdf->Cell(0,5,$student_row['birthday'],0,1); $pdf->Ln(5); //End student information //BEGIN Anecdotals information $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->MultiCell(0, 5, 'Anecdotal Information', 'B', 'L', 0); $pdf->Ln(5); $pdf->SetDrawColor(0, 0, 0); $pdf->Cell(10); $top_bounding_box = $pdf->GetY(); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'Current Date: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $school_year = ""; if (date('n') < 9) { $school_year = date('Y') - 1 . "-" . date('Y'); } else { $school_year = date('Y') . "-" . (date('Y') + 1); } $pdf->Cell(50, 5, date('l dS \\of F Y'), 0, 0); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'School Year: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $pdf->Cell(0, 5, $school_year, 0, 1); $pdf->Cell(10); $pdf->SetFont('Arial', 'B', 10); $pdf->Cell(30, 5, 'Current Code: ', 0, 0); $pdf->SetFont('Arial', 'I', 10); $pdf->Cell(0, 5, $code . $code_text, 0, 1); $pdf->Ln(5); //END Anecdotals information //BEGIN Anecdotal reports Coding $pdf->SetFont('Arial', 'B', 14); $pdf->SetFillColor(204, 255, 255); $pdf->SetDrawColor(0, 80, 180); $pdf->MultiCell(0, 5, 'Anecdotals', 'B', 'L', 0); $pdf->Ln(5); $pdf->SetDrawColor(220, 220, 220); $pdf->SetFillColor(220, 220, 220); $pdf->SetFont('Arial', 'I', 8); while ($anecdotal_row = mysql_fetch_array($anecdotal_result)) { $pdf->Cell(30); $pdf->Cell(120, 3, 'Date: ' . $anecdotal_row['date'], 'B', 1, 'R'); $pdf->SetFont('Arial', 'B', 8); $pdf->Cell(30); $pdf->MultiCell(120, 5, iconv('UTF-8', 'Windows-1252', $anecdotal_row['report']), 0, 'L', 0); //todo note encoding here is utf-8. standardize charset $pdf->Ln(2); } $pdf->Ln(5); //END Anecdotal reports return $pdf; }
function echoJSServicesArray() { global $system_message; $coordlist_query = "SELECT DISTINCT `name`, COUNT(`name`) AS `count` FROM typical_long_term_goal_category WHERE is_deleted='N' GROUP BY `name` ORDER BY `name` DESC LIMIT 200"; $coordlist_result = mysql_query($coordlist_query); if (!$coordlist_result) { $error_message = "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$coordlist_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } else { //call the function to create the javascript array... echo createJavaScript($coordlist_result, "popuplist"); } }
function echoJSServicesArray() { global $system_message; $coordlist_query = "SELECT DISTINCT `agency`, COUNT(`agency`) AS `count` FROM coordination_of_services GROUP BY `agency` ORDER BY `count` DESC LIMIT 200"; $coordlist_result = mysql_query($coordlist_query); if (!$coordlist_result) { $error_message = "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$coordlist_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } else { //call the function to create the javascript array... if (mysql_num_rows($coordlist_result)) { echo createJavaScript($coordlist_result, "popuplist"); } } }
function echoJSServicesArray() { global $system_message; //while($catlist=mysql_fetch_array($catlist_result)) { if (isset($_GET['goal_area']) && !$_GET['goal_area'] == "") { $objlist_query = "SELECT typical_long_term_goal.goal FROM typical_long_term_goal WHERE cid=" . mysql_real_escape_string($_GET['goal_area']) . " AND typical_long_term_goal.is_deleted='N'"; $objlist_result = mysql_query($objlist_query); if (!$objlist_result) { $error_message = "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$objlist_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } else { //call the function to create the javascript array... if (mysql_num_rows($objlist_result)) { echo createJavaScript($objlist_result, "popuplist"); } } } //} }
require IPP_PATH . 'index.php'; exit; } } else { if (!validate()) { $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); require IPP_PATH . 'index.php'; exit; } } //************* SESSION active past here ************************** //check permission levels if (getPermissionLevel($_SESSION['egps_username']) > $MINIMUM_AUTHORIZATION_LEVEL && !isLocalAdministrator($_SESSION['egps_username'])) { $system_message = $system_message . "You do not have permission to view this page (IP: " . $_SERVER['REMOTE_ADDR'] . ")"; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); require IPP_PATH . 'security_error.php'; exit; } //************** validated past here SESSION ACTIVE**************** $szBackGetVars = ""; foreach ($_GET as $key => $value) { $szBackGetVars = $szBackGetVars . $key . "=" . $value . "&"; } //strip trailing '&' $szBackGetVars = substr($szBackGetVars, 0, -1); ?> <!DOCTYPE HTML> <HTML lang=en> <HEAD>
function getStudents() { global $error_message, $permission_level, $system_message, $IPP_MIN_VIEW_LIST_ALL_LOCAL_STUDENTS, $IPP_MIN_VIEW_LIST_ALL_STUDENTS, $iLimit, $iCur, $szSchool, $szTotalStudents; if (!connectIPPDB()) { $system_message = $system_message . $error_message; //just to remember we need this IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); } //do a subquery to find our school code...easier than messing with the ugly //query below... $school_code_query = "SELECT school_code FROM support_member WHERE egps_username='******'egps_username']) . "'"; $school_code_result = mysql_query($school_code_query); if (!$school_code_result) { $error_message = "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$school_code_query}'<BR>"; return NULL; } $school_code_row = mysql_fetch_array($school_code_result); $school_code = $school_code_row['school_code']; $student_query = "SELECT DISTINCT student.student_id,last_name,first_name FROM student LEFT JOIN support_list ON student.student_id = support_list.student_id LEFT JOIN school_history ON student.student_id=school_history.student_id WHERE ((support_list.egps_username='******'egps_username']) . "' AND support_list.student_id IS NOT NULL)"; //prior to april 20/06: $student_query = "SELECT DISTINCT student.student_id,last_name,first_name FROM student LEFT JOIN support_list ON student.student_id = support_list.student_id LEFT JOIN school_history ON student.student_id=school_history.student_id WHERE ((support_list.egps_username='******'egps_username']) . "' AND support_list.student_id IS NOT NULL)"; //prior to march 18/06: $student_query = "SELECT DISTINCT student.student_id,last_name,first_name,school_history.school_code,school.* FROM student LEFT JOIN support_list ON student.student_id = support_list.student_id LEFT JOIN school_history ON student.student_id=school_history.student_id LEFT JOIN school ON school_history.school_code=school.school_code WHERE (support_list.egps_username='******'egps_username']) . "' AND support_list.student_id IS NOT NULL) OR ("; if ($IPP_MIN_VIEW_LIST_ALL_STUDENTS >= $permission_level) { //orig 2006-04-20: $student_query = $student_query . " OR (end_date IS NOT NULL)"; $student_query = $student_query . " OR (student.student_id IS NOT NULL)"; } $student_query .= ") AND NOT EXISTS (SELECT student.student_id,last_name,first_name FROM school_history WHERE school_history.student_id=student.student_id AND school_history.end_date IS NULL)"; $student_query_limit = $student_query . " ORDER BY student.last_name ASC LIMIT {$iCur},{$iLimit}"; $student_result_limit = mysql_query($student_query_limit); if (!$student_result_limit) { $error_message = "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$student_query_limit}'<BR>"; return NULL; } //$system_message = $system_message . "rows returned: " . mysql_num_rows($student_result_limit) . "<BR>"; //$system_message = $system_message . $student_query_limit . "<BR>"; //find the totals... $student_result_total = mysql_query($student_query); if (!$student_result_total) { $error_message = "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$student_query}'<BR>"; return NULL; } $szTotalStudents = mysql_num_rows($student_result_total); $system_message = $system_message . "Number of archived students: {$szTotalStudents}<BR>"; $system_message = $system_message . "(Showing: " . mysql_num_rows($student_result_limit) . ")<BR>"; //$system_message = $system_message . "<BR>$student_query<BR><BR>"; return $student_result_limit; }
function parse_submission() { //returns null on success else returns $szError global $content, $fileName, $fileType; if (!$_POST['test_name']) { return "You must supply a test name<BR>"; } //check that date is the correct pattern... $regexp = '/^\\d\\d\\d\\d-\\d\\d?-\\d\\d?$/'; if (!preg_match($regexp, $_POST['date'])) { return "Date must be in YYYY-MM-DD format<BR>"; } if ($_FILES['supporting_file']['size'] <= 0) { $fileName = ""; $tmpName = ""; $fileSize = 0; $fileType = null; return NULL; } //handle no file upload. if ($_FILES['supporting_file']['size'] >= 1048576) { return "File must be smaller than 1MB (1048567Bytes) but is " . $_FILES['supporting_file']['size'] . "MB"; } //Must be less than 1 Megabyte //we have a file so get the file information... $fileName = mysql_real_escape_string($_FILES['supporting_file']['name']); $tmpName = $_FILES['supporting_file']['tmp_name']; $fileSize = mysql_real_escape_string($_FILES['supporting_file']['size']); //$fileType = mysql_real_escape_string($_FILES['supporting_file']['type']); $fileType = ""; if (is_uploaded_file($tmpName)) { $ext = explode('.', $fileName); $ext = $ext[count($ext) - 1]; } else { return "Security problem: file does not look like an uploaded file<BR>"; } $fp = fopen($tmpName, 'rb'); if (!$fp) { return "Unable to open temporary upload file {$tmpname}<BR>"; } $content = fread($fp, filesize($tmpName)); $content = mysql_real_escape_string($content); fclose($fp); //return $fileType . "<-filetype<BR>"; switch ($ext) { case "txt": case "rtf": case "TXT": case "RTF": //make sure we don't have binary data here. for ($i = 0; $i < strlen($content); $i++) { if (ord($content[$i]) > 127) { IPP_LOG("Attempted to upload binary data as txt in IPP Coordination of Services page for student #{$student_id}", $_SESSION['egps_username'], 'ERROR'); return "Not a valid Text file: contains binary data<BR>"; } } $content = mysql_real_escape_string($content); $fileType = "text/plain"; break; case "pdf": case "PDF": if (strncmp("%PDF-", $content, 5) != 0) { IPP_LOG("Attempted to upload file not recognized as PDF in first few bytes in IPP Coordination of Services page for student #{$student_id}", $_SESSION['egps_username'], 'ERROR'); return "File does not appear to be a valid PDF file<BR>"; } $fileType = "application/pdf"; break; case "doc": case "DOC": //check for 0xD0CF (word document magic number) for ($i = 0; $i < 2; $i++) { $msg = $msg . $content[$i]; } $msg = "0x" . bin2hex($msg); if ($msg != "0xd0cf") { IPP_LOG("Attempted to upload file not recognized as MS Word Document in IPP Coordination of Services page for student #{$student_id}", $_SESSION['egps_username'], 'ERROR'); return "File does not appear to be a valid MS Word Document file<BR>"; } $fileType = "application/msword"; break; default: return "File extension '{$ext}' on '{$fileName}' is not a recognized type please upload only MS Word, Plain Text, or PDF documents<BR>"; } return NULL; }
function echoJSServicesArray() { global $system_message; //get a list of all available goal categories... $catlist_query = "SELECT typical_short_term_objective.goal FROM long_term_goal RIGHT JOIN typical_long_term_goal ON long_term_goal.goal LIKE typical_long_term_goal.goal RIGHT JOIN typical_short_term_objective ON typical_long_term_goal.ltg_id=typical_short_term_objective.ltg_id WHERE long_term_goal.goal_id=" . mysql_real_escape_string($_GET['goal_id']) . " AND student_id=" . mysql_real_escape_string($_GET['student_id']); $catlist_result = mysql_query($catlist_query); if (!$catlist_result) { $error_message = "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '{$catlist_query}'<BR>"; $system_message = $system_message . $error_message; IPP_LOG($system_message, $_SESSION['egps_username'], 'ERROR'); return; } else { //$system_message = $system_message . "Rows returned=" . mysql_num_rows($catlist_result) . " Query=$catlist_query<BR><BR>"; echo createJavaScript($catlist_result, "popuplist"); } //This code block was commented out by dev. //while($catlist=mysql_fetch_array($catlist_result)) { //$objlist_query="SELECT typical_long_term_goal.goal FROM typical_long_term_goal WHERE cid=" . $catlist['cid'] . " AND typical_long_term_goal.is_deleted='N'"; //$objlist_result = mysql_query($objlist_query); //if(!$objlist_result) { // $error_message = "Database query failed (" . __FILE__ . ":" . __LINE__ . "): " . mysql_error() . "<BR>Query: '$objlist_query'<BR>"; // $system_message= $system_message . $error_message; // IPP_LOG($system_message,$_SESSION['egps_username'],'ERROR'); //} else { //call the function to create the javascript array... // echo createJavaScript($objlist_result,$catlist['name']); //} //} }