$sql .= "AND ssm.GRADE='{$_REQUEST['grade']}' "; } if ($_REQUEST[stuid]) { $sql .= "AND ssm.STUDENT_ID='{$_REQUEST['stuid']}' "; } if ($_REQUEST[first]) { $sql .= "AND s.FIRST_NAME LIKE '" . strtoupper($_REQUEST[first]) . "%' "; } if ($_REQUEST[last]) { $sql .= "AND s.LAST_NAME LIKE '" . strtoupper($_REQUEST[last]) . "%' "; } $sql .= "ORDER BY s.LAST_NAME,s.FIRST_NAME,s.MIDDLE_NAME "; $QI = DBQuery($sql); $lunch_RET = DBGet($QI, array('FIRST_NAME' => 'GetCapWords', 'LAST_NAME' => 'GetCapWords'), array('STUDENT_ID')); if (count($stubilling_RET) || count($lunch_RET)) { $handle = PDFStart("Letters.pdf", "Click Here to Download the Letters", "--webpage --quiet -t pdf12 --jpeg --no-links --portrait --footer t --header . --left 0.5in "); if (count($stubilling_RET)) { foreach ($stubilling_RET as $student) { if (defined('PRINT_LETTER')) { printLetter($student, 'Student Billing Notification'); } if ($lunch_RET[$student[STUDENT_ID]]) { if (defined('PRINT_LETTER')) { printLetter($lunch_RET[$student[STUDENT_ID]][1], 'Lunch Billing Notification'); } } } } if (count($lunch_RET)) { foreach ($lunch_RET as $student_id => $student) { if (defined('PRINT_LETTER')) {
} if ($_REQUEST['mp_id'] && (User('PROFILE_ID') != 0 && User('PROFILE_ID') != 3)) { $extra['WHERE'] .= ' AND sr.MARKING_PERIOD_ID=' . $_REQUEST['mp_id'] . ''; } else { $extra['WHERE'] .= ' AND sr.MARKING_PERIOD_ID IN (' . GetAllMP(GetMPTable(GetMP($_REQUEST['mp_id'], 'TABLE')), $_REQUEST['mp_id']) . ')'; } $extra['functions'] = array('MARKING_PERIOD_ID' => 'GetMP', 'DAYS' => '_makeDays'); $extra['group'] = array('STUDENT_ID'); $extra['ORDER'] = ',sp.SORT_ORDER'; if ($_REQUEST['mailing_labels'] == 'Y') { $extra['group'][] = 'ADDRESS_ID'; } Widgets('mailing_labels'); $RET = GetStuList($extra); if (count($RET)) { $handle = PDFStart(); foreach ($RET as $student_id => $courses) { echo "<meta charset='UTF-8'><table width=100% style=\" font-family:Arial; font-size:12px;\" >"; echo "<tr><td width=105>" . DrawLogo() . "</td><td style=\"font-size:15px; font-weight:bold; padding-top:20px;\">" . GetSchool(UserSchool()) . "<div style=\"font-size:12px;\">" . _('Student Schedules Report') . "</div></td><td align=right style=\"padding-top:20px;\">" . ProperDate(DBDate()) . "<br />" . _('Powered by openSIS') . "</td></tr><tr><td colspan=3 style=\"border-top:1px solid #333;\"> </td></tr></table>"; if ($_REQUEST['mailing_labels'] == 'Y') { foreach ($courses as $address) { echo '<BR>'; unset($_openSIS['DrawHeader']); echo '<table border=0>'; if ($address[1]['STUDENT_ID'] != '') { echo '<tr><td>' . _('Student ID') . ':</td>'; echo '<td>' . $address[1]['STUDENT_ID'] . '</td></tr>'; } if ($address[1]['FULL_NAME'] != '') { echo '<tr><td>' . _('Student Name') . ':</td>'; echo '<td>' . $address[1]['FULL_NAME'] . '</td></tr>';
// cache the user's preferences then force the following $_ROSARIO['Preferences']['Preferences']['NAME'][1]['VALUE'] = ''; $months = array(1 => _('January'), _('February'), _('March'), _('April'), _('May'), _('June'), _('July'), _('August'), _('September'), _('October'), _('November'), _('December')); $custom_RET = DBGet(DBQuery("SELECT TITLE,ID FROM CUSTOM_FIELDS WHERE ID IN ('200000000','200000003')"), array(), array('ID')); $extra['SELECT'] = ",ssm.CALENDAR_ID,ssm.START_DATE,ssm.END_DATE"; foreach ($custom_RET as $id => $custom) { $extra['SELECT'] .= ",CUSTOM_" . $id; } // ACTIVE logic taken from GetStuList() $extra['SELECT'] .= ',' . db_case(array("(ssm.SYEAR='" . UserSyear() . "' AND ('" . DBDate() . "'>=ssm.START_DATE AND ('" . DBDate() . "'<=ssm.END_DATE OR ssm.END_DATE IS NULL)))", 'TRUE', "'Active'", "'Inactive'")) . ' AS STATUS'; $RET = GetStuList($extra); if (count($RET)) { $school_RET = DBGet(DBQuery("SELECT TITLE FROM SCHOOLS WHERE ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "'")); // override default options $options = "--webpage --quiet -t pdf12 --jpeg --no-links --portrait --footer t --header . --left 0.25in --right 0.25in --top 0.5in --size 8.5x11in --bodyfont Courier --fontsize 8"; $handle = PDFStart($options); foreach ($RET as $student) { $calendar_RET = DBGet(DBquery("SELECT " . db_case(array("MINUTES>=" . Config('ATTENDANCE_FULL_DAY_MINUTES'), 'true', "'1.0'", "'0.5'")) . "AS POS,trim(leading '0' from to_char(SCHOOL_DATE,'MM')) AS MON,trim(leading '0' from to_char(SCHOOL_DATE,'DD')) AS DAY FROM ATTENDANCE_CALENDAR WHERE CALENDAR_ID='" . $student['CALENDAR_ID'] . "' AND SCHOOL_DATE>='" . $student['START_DATE'] . "'" . ($student['END_DATE'] ? " AND SCHOOL_DATE<='" . $student['END_DATE'] . "'" : '')), array(), array('MON', 'DAY')); $attendance_RET = DBGet(DBQuery("SELECT trim(leading '0' from to_char(ap.SCHOOL_DATE,'MM')) AS MON,trim(leading '0' from to_char(ap.SCHOOL_DATE,'DD')) AS DAY,ac.STATE_CODE,ac.SHORT_NAME FROM ATTENDANCE_PERIOD ap,ATTENDANCE_CODES ac,SCHOOL_PERIODS sp WHERE ap.STUDENT_ID='" . $student['STUDENT_ID'] . "' AND ap.PERIOD_ID=sp.PERIOD_ID AND sp.SCHOOL_ID='" . UserSchool() . "' AND sp.SYEAR='" . UserSyear() . "' AND ac.ID=ap.ATTENDANCE_CODE AND sp.ATTENDANCE='Y'"), array(), array('MON', 'DAY')); //echo '<pre>'; var_dump($calendar_RET); echo '</pre>'; echo '<TABLE class="width-100p">'; echo '<TR><TD class="width-100p center">'; echo '<TABLE style="width:96%">'; echo '<TR><TD class="width-100p center">'; echo '<span class="sizep2"><B>' . $student['FULL_NAME'] . '</B></span>'; echo '</TD><TR>'; echo '</TABLE>'; echo '<TABLE style="width:96%; border: solid 1px">'; echo '<TR class="center"><TD><B>' . _('Student Name') . '</B></TD><TD><B>ID#</B></TD><TD><B>' . _('School') . ' / ' . _('Year') . '</B></TD></TR>'; //modif Francois: school year over one/two calendar years format echo '<TR><TD class="center">' . $student['FULL_NAME'] . '</TD><TD class="center">' . $student['STUDENT_ID'] . '</TD><TD class="center">' . $school_RET[1]['TITLE'] . ' / ' . FormatSyear(UserSyear(), Config('SCHOOL_SYEAR_OVER_2_YEARS')) . '</TD></TR>';
<?php $sql = "SELECT a.attnum,a.attname AS field,t.typname AS type,\n\t\t\t\t\ta.attlen AS length,a.atttypmod AS lengthvar,\n\t\t\t\t\ta.attnotnull AS notnull,c.relname\n\t\t\t\tFROM pg_class c, pg_attribute a, pg_type t \n\t\t\t\tWHERE\n\t\t\t\t\ta.attnum > 0 and a.attrelid = c.oid \n\t\t\t\t\tand c.relkind='r' and c.relname not like 'pg\\_%' and a.attname not like '...%'\n\t\t\t\t\tand a.atttypid = t.oid ORDER BY c.relname"; $RET = DBGet(DBQuery($sql), array(), array('RELNAME')); $PDF = PDFStart(); echo '<TABLE>'; foreach ($RET as $table => $columns) { if ($i % 2 == 0) { echo '<TR><TD valign=top>'; } echo '<b>' . $table . '</b>'; echo '<TABLE>'; foreach ($columns as $column) { echo '<TR><TD width=15> </TD><TD>' . $column['FIELD'] . '</TD><TD>' . $column['TYPE'] . '</TD></TR>'; } echo '</TABLE>'; if ($i % 2 == 0) { echo '</TD><TD valign=top>'; } else { echo '</TD></TR>'; } $i++; } echo '</TABLE>'; PDFStop($PDF);
} echo '<TR class="center"><TD colspan="6"> </TD></TR>'; } } echo '</TABLE>'; PDFStop($handle); } else { //modif Francois: add Template $template_update = DBGet(DBQuery("SELECT 1 FROM TEMPLATES WHERE MODNAME = '" . $_REQUEST['modname'] . "' AND STAFF_ID = '" . User('STAFF_ID') . "'")); if (!$template_update) { DBQuery("INSERT INTO TEMPLATES (MODNAME, STAFF_ID, TEMPLATE) VALUES ('" . $_REQUEST['modname'] . "', '" . User('STAFF_ID') . "', '" . $REQUEST_honor_roll_text . "')"); } else { DBQuery("UPDATE TEMPLATES SET TEMPLATE = '" . $REQUEST_honor_roll_text . "' WHERE MODNAME = '" . $_REQUEST['modname'] . "' AND STAFF_ID = '" . User('STAFF_ID') . "'"); } $no_margins = array('top' => 0, 'bottom' => 0, 'left' => 0, 'right' => 0); $handle = PDFStart(false, $no_margins); //echo '<!-- MEDIA SIZE 8.5x11in -->'; $_SESSION['orientation'] = 'landscape'; foreach ($RET as $student) { //note Francois: bug: small white border at the bottom of page echo '<style type="text/css"> body {margin:0; padding:0;} div#background {background: width:1462px; height:1032px; position:relative;} div#background * {z-index:1; position:relative;}</style>'; echo '<div id="background">'; if (!empty($_REQUEST['frame'])) { echo '<img src="assets/Frames/' . $_REQUEST['frame'] . '" style="z-index:0; width:1462px; height:1032px; position:absolute;" />'; } echo '<TABLE style="margin:auto auto; height:77%;">'; $honor_roll_text = nl2br(str_replace("''", "'", str_replace(' ', ' ', $REQUEST_honor_roll_text))); $honor_roll_text = str_replace(array('__FULL_NAME__', '__FIRST_NAME__', '__LAST_NAME__', '__MIDDLE_NAME__', '__GRADE_ID__', '__SCHOOL_ID__', '__SUBJECT__'), array($student['FULL_NAME'], $student['FIRST_NAME'], $student['LAST_NAME'], $student['MIDDLE_NAME'], $student['GRADE_ID'], $school_info_RET[1]['TITLE'], $_REQUEST['subject']), $honor_roll_text); $honor_roll_text = $student['HIGH_HONOR'] == 'Y' ? str_replace(_('Honor Roll'), _('High Honor Roll'), $honor_roll_text) : $honor_roll_text; echo '<TR><TD>' . $honor_roll_text . '</TD></TR></TABLE>'; echo '<TABLE style="margin:0 auto; width:80%;">';
} else { $extra['SELECT'] .= ",(SELECT st.FIRST_NAME||' '||st.LAST_NAME FROM STAFF st,COURSE_PERIODS cp WHERE st.STAFF_ID=cp.TEACHER_ID AND cp.COURSE_PERIOD_ID='" . UserCoursePeriod() . "') AS TEACHER"; $extra['SELECT'] .= ",(SELECT cp.ROOM FROM COURSE_PERIODS cp WHERE cp.COURSE_PERIOD_ID='" . UserCoursePeriod() . "') AS ROOM"; } $RET = GetStuList($extra); if (count($RET)) { //modif Francois: add Template $template_update = DBGet(DBQuery("SELECT 1 FROM TEMPLATES WHERE MODNAME = '" . $_REQUEST['modname'] . "' AND STAFF_ID = '" . User('STAFF_ID') . "'")); if (!$template_update) { DBQuery("INSERT INTO TEMPLATES (MODNAME, STAFF_ID, TEMPLATE) VALUES ('" . $_REQUEST['modname'] . "', '" . User('STAFF_ID') . "', '" . $REQUEST_letter_text . "')"); } else { DBQuery("UPDATE TEMPLATES SET TEMPLATE = '" . $REQUEST_letter_text . "' WHERE MODNAME = '" . $_REQUEST['modname'] . "' AND STAFF_ID = '" . User('STAFF_ID') . "'"); } $REQUEST_letter_text = nl2br(str_replace("''", "'", str_replace(' ', ' ', $REQUEST_letter_text))); $css = true; $handle = PDFStart($css); foreach ($RET as $student) { $student_points = $total_points = 0; unset($_ROSARIO['DrawHeader']); if ($_REQUEST['mailing_labels'] == 'Y') { echo '<BR /><BR /><BR />'; } //DrawHeader(ParseMLField(Config('TITLE')).' Letter'); DrawHeader(' '); DrawHeader($student['FULL_NAME'], $student['STUDENT_ID']); DrawHeader($student['GRADE_ID'], GetSchool(UserSchool())); //DrawHeader('',GetMP(GetCurrentMP('QTR',DBDate(),false))); DrawHeader(ProperDate(DBDate())); if ($_REQUEST['mailing_labels'] == 'Y') { echo '<BR /><BR /><TABLE class="width-100p"><TR><TD style="width:50px;"> </TD><TD>' . $student['MAILING_LABEL'] . '</TD></TR></TABLE><BR />'; }
<?php error_reporting(1); include "./Warehouse.php"; if ($_REQUEST['modfunc'] == 'print') { //modif Francois: call PDFStart to generate Print PDF if ($_REQUEST['expanded_view']) { $_SESSION['orientation'] = 'landscape'; } $print_data = PDFStart(); $_REQUEST = $_SESSION['_REQUEST_vars']; $_REQUEST['_ROSARIO_PDF'] = true; //modif Francois: replaced ? with & in modname /*if(mb_strpos($_REQUEST['modname'],'?')!==false) $modname = mb_substr($_REQUEST['modname'],0,mb_strpos($_REQUEST['modname'],'?')); else*/ $modname = $_REQUEST['modname']; if (!$wkhtmltopdfPath) { $_ROSARIO['allow_edit'] = false; } //modif Francois: security fix, cf http://www.securiteam.com/securitynews/6S02U1P6BI.html if (mb_substr($modname, -4, 4) != '.php' || mb_strpos($modname, '..') !== false || !is_file('modules/' . $modname)) { HackingLog(); } else { include 'modules/' . $modname; } //modif Francois: call PDFStop to generate Print PDF PDFStop($print_data); } else { //modif Francois: fix bug Internet Explorer Quirks Mode, add DOCTYPE ?>