function PromptX($title = _('Confirm'), $question = '', $message = '', $pdf = '')
{
    $PHP_tmp_SELF = PreparePHP_SELF($_REQUEST, array('delete_ok'), $pdf == true ? array('_CENTRE_PDF' => true) : array());
    if (!$_REQUEST['delete_ok'] && !$_REQUEST['delete_cancel']) {
        echo '<BR>';
        PopTable('header', $title);
        echo "<CENTER><h4>{$question}</h4><FORM action={$PHP_tmp_SELF}&delete_ok=1 METHOD=POST>{$message}<BR><BR><INPUT type=submit value=\"" . _('OK') . "\"><INPUT type=button name=delete_cancel value=\"" . _('Cancel') . "\" onClick='javascript:history.back()'></FORM></CENTER>";
        PopTable('footer');
        return false;
    } else {
        return true;
    }
}
function PromptX($title = 'Confirm', $question = '', $message = '', $pdf = '')
{
    $PHP_tmp_SELF = PreparePHP_SELF($_REQUEST, array('delete_ok'), $pdf == true ? array('_ROSARIO_PDF' => true) : array());
    if (!$_REQUEST['delete_ok'] && !$_REQUEST['delete_cancel']) {
        echo '<BR />';
        PopTable('header', $title);
        echo '<span class="center"><h4>' . $question . '</h4><FORM action="' . $PHP_tmp_SELF . '&delete_ok=1" METHOD="POST">' . $message . '<BR /><BR /><INPUT type="submit" value="' . _('OK') . '"><INPUT type="button" name="delete_cancel" value="' . _('Cancel') . '" onClick="javascript:history.back()"></FORM></span>';
        PopTable('footer');
        return false;
    } else {
        return true;
    }
}
function Prompt($title = 'Confirm', $question = '', $message = '', $pdf = '')
{
    $tmp_REQUEST = $_REQUEST;
    unset($tmp_REQUEST['delete_ok']);
    if ($pdf == true) {
        $tmp_REQUEST['_CENTRE_PDF'] = true;
    }
    $PHP_tmp_SELF = PreparePHP_SELF($tmp_REQUEST);
    if (!$_REQUEST['delete_ok'] && !$_REQUEST['delete_cancel']) {
        echo '<BR>';
        PopTable('header', $title);
        echo "<CENTER><h4>{$question}</h4><FORM action={$PHP_tmp_SELF}&delete_ok=1 METHOD=POST>{$message}<BR><BR><INPUT type=submit class=btn_medium value=OK>&nbsp;<INPUT type=button class=btn_medium name=delete_cancel value=Cancel onclick='javascript:history.go(-1);'></FORM></CENTER>";
        PopTable('footer');
        return false;
    } else {
        return true;
    }
}
function UnableDeletePromptX($title)
{
    $tmp_REQUEST = $_REQUEST;
    $PHP_tmp_SELF = PreparePHP_SELF($tmp_REQUEST);
    if (!$_REQUEST['delete_ok'] && !$_REQUEST['delete_cancel']) {
        echo '<BR>';
        PopTable('header', 'Unable to Delete');
        echo "<CENTER><h4>{$title}</h4><br><FORM action={$PHP_tmp_SELF} METHOD=POST><INPUT type=submit class=btn_medium name=delete_cancel value=Cancel></FORM></CENTER>";
        PopTable('footer');
        return '';
    }
    if ($_REQUEST['delete_ok']) {
        unset($_REQUEST['delete_ok']);
        unset($_REQUEST['modfunc']);
        return true;
    }
    unset($_REQUEST['delete_cancel']);
    unset($_REQUEST['modfunc']);
    return false;
}
function DeletePromptX($title, $action = 'Delete')
{
    $PHP_tmp_SELF = PreparePHP_SELF($_REQUEST, array('delete_ok', 'delete_cancel'));
    if (!$_REQUEST['delete_ok'] && !$_REQUEST['delete_cancel']) {
        echo '<BR />';
        //modif Francois: add translation
        PopTable('header', _('Confirm') . (mb_strpos($action, ' ') === false ? ' ' . ($action == 'Delete' ? _('Delete') : $action) : ''));
        echo '<span class="center"><h4>' . sprintf(_('Are you sure you want to %s that %s?'), $action == 'Delete' ? _('Delete') : $action, $title) . '</h4><FORM action="' . $PHP_tmp_SELF . '" METHOD="POST"><INPUT type="submit" name="delete_ok" value="' . _('OK') . '"><INPUT type="submit" name="delete_cancel" value="' . _('Cancel') . '"></FORM></span>';
        PopTable('footer');
        return '';
    }
    if ($_REQUEST['delete_ok']) {
        unset($_REQUEST['delete_ok']);
        unset($_REQUEST['modfunc']);
        return true;
    }
    unset($_REQUEST['delete_cancel']);
    unset($_REQUEST['modfunc']);
    return false;
}
function DeletePromptX($title, $action = 'Delete')
{
    $tmp_REQUEST = $_REQUEST;
    unset($tmp_REQUEST['delete_ok']);
    unset($tmp_REQUEST['delete_cancel']);
    $PHP_tmp_SELF = PreparePHP_SELF($tmp_REQUEST);
    if (!$_REQUEST['delete_ok'] && !$_REQUEST['delete_cancel']) {
        echo '<BR>';
        PopTable('header', 'Confirm' . (!substr(' ', ' ' . $action) ? $action : ''));
        echo "<CENTER><h4>Are You Sure You Want to {$action} that {$title}?</h4><br><FORM action={$PHP_tmp_SELF} METHOD=POST><INPUT type=submit name=delete_ok class=btn_medium value=OK> <INPUT type=submit class=btn_medium name=delete_cancel value=Cancel></FORM></CENTER>";
        PopTable('footer');
        return '';
    }
    if ($_REQUEST['delete_ok']) {
        unset($_REQUEST['delete_ok']);
        unset($_REQUEST['modfunc']);
        return true;
    }
    unset($_REQUEST['delete_cancel']);
    unset($_REQUEST['modfunc']);
    return false;
}
function DeletePromptX($title, $action = null)
{
    if (empty($action)) {
        $action = _('delete');
    }
    $PHP_tmp_SELF = PreparePHP_SELF($_REQUEST, array('delete_ok', 'delete_cancel'));
    if (!$_REQUEST['delete_ok'] && !$_REQUEST['delete_cancel']) {
        echo '<BR>';
        PopTable('header', _('Confirm') . (!substr(' ', ' ' . $action) ? $action : ''));
        echo "<CENTER><h4>" . _('Are You Sure You Want to') . " {$action} " . _('that') . " {$title}?</h4><FORM action={$PHP_tmp_SELF} METHOD=POST><INPUT type=submit name=delete_ok value=" . _('OK') . "><INPUT type=submit name=delete_cancel value=" . _('Cancel') . "></FORM></CENTER>";
        PopTable('footer');
        return '';
    }
    if ($_REQUEST['delete_ok']) {
        unset($_REQUEST['delete_ok']);
        unset($_REQUEST['modfunc']);
        return true;
    }
    unset($_REQUEST['delete_cancel']);
    unset($_REQUEST['modfunc']);
    return false;
}
function WrapTabs($tabs, $selected = '', &$selected_key = '')
{
    $row = 0;
    $characters = 0;
    //modif Francois: css WPadmin
    if (count($tabs)) {
        $rows[0] = '<div class="h3multi">';
        foreach ($tabs as $key => $tab) {
            if (mb_substr($tab['title'], 0, 1) != '<') {
                $tab_len = mb_strlen($tab['title']);
            } else {
                $tab_len = 0;
            }
            if ($tab['link'] == PreparePHP_SELF() || $tab['link'] == $selected) {
                $rows[$row] .= '<!--BOTTOM-->' . '<span class="h3selected">' . DrawTab($tab['title'], $tab['link']) . '</span>';
                $selected_key = $key;
            } else {
                $rows[$row] .= DrawTab($tab['title'], $tab['link']);
            }
            $characters += $tab_len + 6;
        }
    }
    $rows[$row] .= "\n\n";
    $i = 0;
    $row_count = count($rows) - 1;
    for ($key = $row_count; $key >= 0; $key--) {
        //modif Francois: remove ereg
        //		if(!ereg("<!--BOTTOM-->",$rows[$key]))
        if (mb_strpos($rows[$key], "<!--BOTTOM-->") === FALSE) {
            $table .= $rows[$key];
            $i++;
        } else {
            $bottom = $key;
        }
    }
    $table .= $rows[$bottom] . '</div>';
    return $table;
}
    foreach ($_REQUEST['attendance'] as $student_id => $values) {
        foreach ($values as $school_date => $columns) {
            $sql = 'UPDATE attendance_period SET ADMIN=\'Y\',';
            foreach ($columns as $column => $value) {
                $sql .= $column . '=\'' . str_replace("\\'", "''", $value) . '\',';
            }
            $sql = substr($sql, 0, -1) . ' WHERE SCHOOL_DATE=\'' . $school_date . '\' AND PERIOD_ID=\'' . $_REQUEST['period_id'] . '\' AND STUDENT_ID=\'' . $student_id . '\'';
            DBQuery($sql);
            UpdateAttendanceDaily($student_id, $school_date);
        }
    }
    $current_RET = DBGet(DBQuery('SELECT ATTENDANCE_TEACHER_CODE,ATTENDANCE_CODE,ATTENDANCE_REASON,STUDENT_ID,ADMIN,COURSE_PERIOD_ID FROM attendance_period WHERE SCHOOL_DATE=\'' . $date . '\''), array(), array('STUDENT_ID', 'COURSE_PERIOD_ID'));
    unset($_REQUEST['attendance']);
}
if ($_REQUEST['search_modfunc'] || $_REQUEST['student_id'] || UserStudentID() || User('PROFILE') == 'parent' || User('PROFILE') == 'student') {
    $PHP_tmp_SELF = PreparePHP_SELF();
    $extraM .= "";
    $period_select = "<SELECT name=period_id onchange='this.form.submit();'><OPTION value=\"\">Daily</OPTION>";
    if (!UserStudentID() && !$_REQUEST['student_id']) {
        $periods_RET = DBGet(DBQuery('SELECT PERIOD_ID,TITLE FROM school_periods WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\' ORDER BY SORT_ORDER'));
        if (count($periods_RET) > 1) {
            foreach ($periods_RET as $period) {
                $period_select .= "<OPTION value=" . $period['PERIOD_ID'] . ($_REQUEST['period_id'] == $period['PERIOD_ID'] ? ' SELECTED' : '') . ">" . $period['TITLE'] . '</OPTION>';
            }
        } elseif (count($periods_RET) == 1) {
            foreach ($periods_RET as $period) {
                $period_select .= "<OPTION value=" . $period['PERIOD_ID'] . ($_REQUEST['period_id'] == $period['PERIOD_ID'] || !isset($_REQUEST['period_id']) ? ' SELECTED' : '') . ">" . $period['TITLE'] . '</OPTION>';
            }
            if (!isset($_REQUEST['period_id'])) {
                $_REQUEST['period_id'] = $period['PERIOD_ID'];
            }
Exemple #10
0
#
#  This program is released under the terms of the GNU General Public License as
#  published by the Free Software Foundation, version 2 of the License.
#  See license.txt.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#***************************************************************************************
include '../../Redirect_modules.php';
echo "<FORM name=scheaddr id=scheaddr action=" . PreparePHP_SELF() . " method=POST>";
DrawBC("Scheduling > " . ProgramTitle());
if ($_REQUEST['day_start'] && $_REQUEST['month_start'] && $_REQUEST['year_start']) {
    $_REQUEST['placed_From'] = $_REQUEST['day_start'] . '-' . $_REQUEST['month_start'] . '-' . $_REQUEST['year_start'];
    $start_date = date('Y-m-d', strtotime($_REQUEST['placed_From']));
} else {
    $start_date = date("Y-m") . '-01';
}
if ($_REQUEST['day_end'] && $_REQUEST['month_end'] && $_REQUEST['year_end']) {
    $_REQUEST['placed_End'] = $_REQUEST['day_end'] . '-' . $_REQUEST['month_end'] . '-' . $_REQUEST['year_end'];
    $end_date = date('Y-m-d', strtotime($_REQUEST['placed_End']));
} else {
    $end_date = date("Y-m-d");
}
if ($_REQUEST['flag'] != 'list') {
    DrawHeaderHome(PrepareDateSchedule($start_date, '_start') . '<div style="padding:0px 6px; float:left;">-</div>' . PrepareDateSchedule($end_date, '_end'), '<INPUT type=submit class=btn_medium value=Go >');
Exemple #11
0
                            $grades_RET[$i]['COMMENT'] .= $sep . $comments_RET[$comment['REPORT_CARD_COMMENT_ID']][1]['SORT_ORDER'];
                            if ($comment['COMMENT']) {
                                $grades_RET[$i]['COMMENT'] .= '(' . ($comment['COMMENT'] != ' ' ? $comment['COMMENT'] : '&middot;') . ')';
                            }
                            $sep = ', ';
                        }
                        if ($mps[$last_mp][1]['COMMENT_TITLE']) {
                            $grades_RET[$i]['COMMENT'] .= $sep . $mps[$last_mp][1]['COMMENT_TITLE'];
                        }
                    }
                }
            }
            if (count($_REQUEST['mp_arr']) == 1) {
                $tmp_REQUEST = $_REQUEST;
                unset($tmp_REQUEST['modfunc']);
                $link['remove']['link'] = PreparePHP_SELF($tmp_REQUEST) . "&modfunc=delete";
                //$link['remove']['link'] = "Modules.php?modname=$_REQUEST[modname]&modfunc=delete";
                $link['remove']['variables'] = array('student_id' => 'STUDENT_ID', 'course_period_id' => 'COURSE_PERIOD_ID', 'marking_period_id' => 'MARKING_PERIOD_ID');
            }
            ListOutput($grades_RET, $columns, '', '', $link);
        } else {
            //	BackPrompt('No Students were found.');
            ShowErr('No Students were found.');
            for_error();
        }
    } else {
        //	BackPrompt('You must choose at least one student and marking period');
        ShowErr('You must choose at least one student and marking period');
        for_error();
    }
}
Exemple #12
0
function WrapTabs($tabs, $selected = '', $title = '', $use_blue = false, $type = '')
{
    if ($color == '' || $color == '#FFFFFF') {
        $color = "#FFFFCC";
    }
    $row = 0;
    $characters = 0;
    $rows[0] = "<TABLE border=0 cellpadding=0 cellspacing=0 class=><TR>";
    if (count($tabs)) {
        foreach ($tabs as $tab) {
            if (substr($tab['title'], 0, 1) != '<') {
                $tab_len = strlen($tab['title']);
            } else {
                $tab_len = 0;
            }
            if ($characters + $tab_len >= 180) {
                $rows[$row] .= "</TR>\n</TABLE>\n\n";
                $row++;
                $rows[$row] .= "<TABLE border=0 cellpadding=0 cellspacing=0 >\n\t<TR>";
                $characters = 0;
            }
            if ($tab['link'] == PreparePHP_SELF() || $tab['link'] == $selected) {
                $rows[$row] .= "<!--BOTTOM-->\n\t\t<TD>" . DrawTab($tab['title'], $tab['link'], '#333366', '#436477', $type) . "</TD>";
            } elseif ($use_blue !== true) {
                $rows[$row] .= "\n\t\t<TD >" . DrawinactiveTab($tab['title'], $tab['link'], '#DDDDDD', '#000000', $type) . "</TD>";
            } else {
                $rows[$row] .= "\n\t\t<TD >" . DrawinactiveTab($tab['title'], $tab['link'], '#333366', '#f2a30b', $type) . "</TD>";
            }
            $characters += $tab_len + 6;
        }
    }
    $rows[$row] .= "</TR>\n</TABLE>\n\n";
    $i = 0;
    $row_count = count($rows) - 1;
    if ($use_blue === true) {
        $table .= "<TABLE border=0 width=100% cellpadding=0 cellspacing=0 ><TR><TD width=100%></TD><TD align=right>";
    } elseif ($use_blue == 'center') {
        $table .= "<TABLE border=0 width=100% cellpadding=0 cellspacing=0  align=center><TR><TD align=center>";
    }
    for ($key = $row_count; $key >= 0; $key--) {
        if (!ereg("<!--BOTTOM-->", $rows[$key])) {
            $table .= "<TABLE border=0 width=0 cellpadding=0 cellspacing=0 ><TR><TD>";
            $table .= "<IMG SRC=assets/pixel_trans.gif width=" . ($row_count - $i) * 6 . " height=1>";
            if ($key != 0 || $bottom) {
                $table .= "</TD><TD>{$rows[$key]}</TD><TD rowspan=2>&nbsp;</TD></TR><TR><TD height=1></TD><TD height=5 valign=top></TD></TR></TABLE>";
            } else {
                $table .= "</TD><TD>{$rows[$key]}</TD><TD rowspan=2></TD></TR><TR><TD height=0></TD><TD height=0 valign=top></TD></TR></TABLE>";
            }
            $i++;
        } else {
            $bottom = $key;
        }
    }
    $table .= "<TABLE border=0 cellpadding=0 cellspacing=0 ><TR><TD></TD><TD>" . $rows[$bottom] . "</TD><TD></TD></TR></TABLE>";
    if ($use_blue) {
        $table .= "</TD></TR><TR><TD colspan=2>";
    }
    if ($title != '') {
        $table .= "<TABLE width=100% bgcolor={$color} border=0 cellpadding=0 cellspacing=0><TR><TD bgcolor={$color} width=100%> &nbsp;<font class=FontBox>{$title}</font></TD></TR></TABLE>";
    }
    if ($use_blue) {
        $table .= "</TD></TR></TABLE>";
    }
    return $table;
}
function ListOutputFloat($result, $column_names, $singular = '', $plural = '', $link = false, $group = false, $options = false)
{
    if (!isset($options['save'])) {
        $options['save'] = true;
    }
    if (!isset($options['print'])) {
        $options['print'] = true;
    }
    if (!isset($options['search'])) {
        $options['search'] = true;
    }
    if (!isset($options['center'])) {
        $options['center'] = true;
    }
    if (!isset($options['count'])) {
        $options['count'] = true;
    }
    if (!isset($options['sort'])) {
        $options['sort'] = true;
    }
    if (!$link) {
        $link = array();
    }
    if (!isset($options['add'])) {
        if (!AllowEdit() || $_REQUEST['_openSIS_PDF']) {
            if ($link) {
                unset($link['add']);
                unset($link['remove']);
            }
        }
    }
    // PREPARE LINKS ---
    $result_count = $display_count = count($result);
    $num_displayed = 100000;
    $extra = "page={$_REQUEST['page']}&LO_sort={$_REQUEST['LO_sort']}&LO_direction={$_REQUEST['LO_direction']}&LO_search=" . urlencode($_REQUEST['LO_search']);
    $tmp_REQUEST = $_REQUEST;
    unset($tmp_REQUEST['page']);
    unset($tmp_REQUEST['LO_sort']);
    unset($tmp_REQUEST['LO_direction']);
    unset($tmp_REQUEST['LO_search']);
    unset($tmp_REQUEST['remove_prompt']);
    unset($tmp_REQUEST['remove_name']);
    unset($tmp_REQUEST['LO_save']);
    unset($tmp_REQUEST['PHPSESSID']);
    $PHP_tmp_SELF = PreparePHP_SELF($tmp_REQUEST);
    // END PREPARE LINKS ---
    // UN-GROUPING
    $group_count = count($group);
    if (!is_array($group)) {
        $group_count = false;
    }
    //$side_color = Preferences('COLOR');
    $side_color = '#dfe8ee';
    if ($group_count && $result_count) {
        $color = '#f5f5f5';
        $group_result = $result;
        unset($result);
        $result[0] = '';
        foreach ($group_result as $item1) {
            if ($group_count == 1) {
                if ($color == '#F8F8F9') {
                    $color = $side_color;
                } else {
                    $color = '#F8F8F9';
                }
            }
            foreach ($item1 as $item2) {
                if ($group_count == 1) {
                    $i++;
                    if (count($group[0]) && $i != 1) {
                        foreach ($group[0] as $column) {
                            $item2[$column] = str_replace('<!-- <!--', '<!--', '<!-- ' . str_replace('-->', '--><!--', $item2[$column])) . ' -->';
                        }
                    }
                    $item2['row_color'] = $color;
                    $result[] = $item2;
                } else {
                    if ($group_count == 2) {
                        if ($color == '#F8F8F9') {
                            $color = $side_color;
                        } else {
                            $color = '#F8F8F9';
                        }
                    }
                    foreach ($item2 as $item3) {
                        if ($group_count == 2) {
                            $i++;
                            if (count($group[0]) && $i != 1) {
                                foreach ($group[0] as $column) {
                                    $item3[$column] = '<!-- ' . $item3[$column] . ' -->';
                                }
                            }
                            if (count($group[1]) && $i != 1) {
                                foreach ($group[1] as $column) {
                                    $item3[$column] = '<!-- ' . $item3[$column] . ' -->';
                                }
                            }
                            $item3['row_color'] = $color;
                            $result[] = $item3;
                        } else {
                            if ($group_count == 3) {
                                if ($color == '#F8F8F9') {
                                    $color = $side_color;
                                } else {
                                    $color = '#F8F8F9';
                                }
                            }
                            foreach ($item3 as $item4) {
                                if ($group_count == 3) {
                                    $i++;
                                    if (count($group[2]) && $i != 1) {
                                        foreach ($group[2] as $column) {
                                            unset($item4[$column]);
                                        }
                                    }
                                    $item4['row_color'] = $color;
                                    $result[] = $item4;
                                }
                            }
                        }
                    }
                }
            }
            $i = 0;
        }
        unset($result[0]);
        $result_count = count($result);
        unset($_REQUEST['LO_sort']);
    }
    // END UN-GROUPING
    $_LIST['output'] = true;
    // PRINT HEADINGS, PREPARE PDF, AND SORT THE LIST ---
    if ($_LIST['output'] != false) {
        if ($result_count != 0) {
            $count = 0;
            $remove = count($link['remove']['variables']);
            $cols = count($column_names);
            // HANDLE SEARCHES ---
            if ($result_count && $_REQUEST['LO_search'] && $_REQUEST['LO_search'] != 'Search') {
                $_REQUEST['LO_search'] = $search_term = str_replace('\\\\"', '"', $_REQUEST['LO_search']);
                $_REQUEST['LO_search'] = $search_term = ereg_replace('[^a-zA-Z0-9 _"]*', '', strtolower($search_term));
                if (substr($search_term, 0, 0) != '"' && substr($search_term, -1) != '"') {
                    $search_term = ereg_replace('"', '', $search_term);
                    while ($space_pos = strpos($search_term, ' ')) {
                        $terms[strtolower(substr($search_term, 0, $space_pos))] = 1;
                        $search_term = substr($search_term, $space_pos + 1);
                    }
                    $terms[trim($search_term)] = 1;
                } else {
                    $search_term = ereg_replace('"', '', $search_term);
                    $terms[trim($search_term)] = 1;
                }
                unset($terms['of']);
                unset($terms['the']);
                unset($terms['a']);
                unset($terms['an']);
                unset($terms['in']);
                foreach ($result as $key => $value) {
                    $values[$key] = 0;
                    foreach ($value as $name => $val) {
                        $val = ereg_replace('[^a-zA-Z0-9 _]+', '', strtolower($val));
                        if (strtolower($_REQUEST['LO_search']) == $val) {
                            $values[$key] += 25;
                        }
                        foreach ($terms as $term => $one) {
                            if (ereg($term, $val)) {
                                $values[$key] += 3;
                            }
                        }
                    }
                    if ($values[$key] == 0) {
                        unset($values[$key]);
                        unset($result[$key]);
                        $result_count--;
                        $display_count--;
                    }
                }
                if ($result_count) {
                    array_multisort($values, SORT_DESC, $result);
                    $result = ReindexResults($result);
                    $values = ReindexResults($values);
                    $last_value = 1;
                    $scale = 100 / $values[$last_value];
                    for ($i = $last_value; $i <= $result_count; $i++) {
                        $result[$i]['RELEVANCE'] = '<!--' . (int) ($values[$i] * $scale) . '--><IMG SRC="assets/pixel_grey.gif" width=' . (int) ($values[$i] * $scale) . ' height=10>';
                    }
                }
                $column_names['RELEVANCE'] = "Relevance";
                if (is_array($group) && count($group)) {
                    $options['count'] == false;
                    $display_zero = true;
                }
            }
            // END SEARCHES ---
            if ($_REQUEST['LO_sort']) {
                foreach ($result as $sort) {
                    if (substr($sort[$_REQUEST['LO_sort']], 0, 4) != '<!--') {
                        $sort_array[] = $sort[$_REQUEST['LO_sort']];
                    } else {
                        $sort_array[] = substr($sort[$_REQUEST['LO_sort']], 4, strpos($sort[$_REQUEST['LO_sort']], '-->') - 5);
                    }
                }
                if ($_REQUEST['LO_direction'] == -1) {
                    $dir = SORT_DESC;
                } else {
                    $dir = SORT_ASC;
                }
                if ($result_count > 1) {
                    if (is_int($sort_array[1]) || is_double($sort_array[1])) {
                        array_multisort($sort_array, $dir, SORT_NUMERIC, $result);
                    } else {
                        array_multisort($sort_array, $dir, $result);
                    }
                    for ($i = $result_count - 1; $i >= 0; $i--) {
                        $result[$i + 1] = $result[$i];
                    }
                    unset($result[0]);
                }
            }
        }
        // HANDLE SAVING THE LIST ---
        if ($_REQUEST['LO_save'] == '1') {
            if (!$options['save_delimiter'] && Preferences('DELIMITER') == 'CSV') {
                $options['save_delimiter'] = 'comma';
            }
            switch ($options['save_delimiter']) {
                case 'comma':
                    $extension = 'csv';
                    break;
                case 'xml':
                    $extension = 'xml';
                    break;
                default:
                    $extension = 'xls';
                    break;
            }
            ob_end_clean();
            if ($options['save_delimiter'] != 'xml') {
                foreach ($column_names as $key => $value) {
                    $output .= str_replace('&nbsp;', ' ', eregi_replace('<BR>', ' ', ereg_replace('<!--.*-->', '', $value))) . ($options['save_delimiter'] == 'comma' ? ',' : "\t");
                }
                $output .= "\n";
            }
            foreach ($result as $item) {
                foreach ($column_names as $key => $value) {
                    if ($options['save_delimiter'] == 'comma' && !$options['save_quotes']) {
                        $item[$key] = str_replace(',', ';', $item[$key]);
                    }
                    $item[$key] = eregi_replace('<SELECT.*SELECTED\\>([^<]+)<.*</SELECT\\>', '\\1', $item[$key]);
                    $item[$key] = eregi_replace('<SELECT.*</SELECT\\>', '', $item[$key]);
                    $output .= ($options['save_quotes'] ? '"' : '') . ($options['save_delimiter'] == 'xml' ? '<' . str_replace(' ', '', $value) . '>' : '') . ereg_replace('<[^>]+>', '', ereg_replace("<div onclick='[^']+'>", '', ereg_replace(' +', ' ', ereg_replace('&[^;]+;', '', str_replace('<BR>&middot;', ' : ', str_replace('&nbsp;', ' ', $item[$key])))))) . ($options['save_delimiter'] == 'xml' ? '</' . str_replace(' ', '', $value) . '>' . "\n" : '') . ($options['save_quotes'] ? '"' : '') . ($options['save_delimiter'] == 'comma' ? ',' : "\t");
                }
                $output .= "\n";
            }
            header("Cache-Control: public");
            header("Pragma: ");
            header("Content-Type: application/{$extension}");
            header("Content-Disposition: inline; filename=\"" . ProgramTitle() . ".{$extension}\"\n");
            if ($options['save_eval']) {
                eval($options['save_eval']);
            }
            echo $output;
            exit;
        }
        // END SAVING THE LIST ---
        if ($options['center']) {
            echo '<CENTER>';
        }
        if ($result_count > $num_displayed || ($options['count'] || $display_zero) && (($result_count == 0 || $display_count == 0) && $plural || ($result_count == 0 || $display_count == 0))) {
            echo "<TABLE width=100% border=0 cellspacing=1";
            if (isset($_REQUEST['_openSIS_PDF'])) {
                //	echo " width=100%";
                echo "><TR><TD align=center>";
            }
        }
        if ($options['count'] || $display_zero) {
            if (($result_count == 0 || $display_count == 0) && $plural) {
                echo "<table class=alert_center><tr><td class=alert_center_padding><b>No {$plural} were found.</b></td></tr></table>";
            } elseif ($result_count == 0 || $display_count == 0) {
                echo '<table class=alert_center><tr><td class=alert_center_padding><b>None were found.</b></td></tr></table>';
            }
        }
        if ($result_count != 0 || $_REQUEST['LO_search'] && $_REQUEST['LO_search'] != 'Search') {
            if (!isset($_REQUEST['_openSIS_PDF'])) {
                if (!$_REQUEST['page']) {
                    $_REQUEST['page'] = 1;
                }
                if (!$_REQUEST['LO_direction']) {
                    $_REQUEST['LO_direction'] = 1;
                }
                $start = ($_REQUEST['page'] - 1) * $num_displayed + 1;
                $stop = $start + ($num_displayed - 1);
                if ($stop > $result_count) {
                    $stop = $result_count;
                }
                if ($result_count > $num_displayed) {
                    $where_message = "<SMALL>Displaying {$start} through {$stop}</SMALL>";
                    echo "Go to Page ";
                    if (ceil($result_count / $num_displayed) <= 10) {
                        for ($i = 1; $i <= ceil($result_count / $num_displayed); $i++) {
                            if ($i != $_REQUEST['page']) {
                                $pages .= "<A HREF={$PHP_tmp_SELF}&LO_sort={$_REQUEST['LO_sort']}&LO_direction={$_REQUEST['LO_direction']}&LO_search=" . urlencode($_REQUEST['LO_search']) . "&page={$i}>{$i}</A>, ";
                            } else {
                                $pages .= "{$i}, ";
                            }
                        }
                        $pages = substr($pages, 0, -2) . "<BR>";
                    } else {
                        for ($i = 1; $i <= 7; $i++) {
                            if ($i != $_REQUEST['page']) {
                                $pages .= "<A HREF={$PHP_tmp_SELF}&LO_sort={$_REQUEST['LO_sort']}&LO_direction={$_REQUEST['LO_direction']}&LO_search=" . urlencode($_REQUEST['LO_search']) . "&page={$i}>{$i}</A>, ";
                            } else {
                                $pages .= "{$i}, ";
                            }
                        }
                        $pages = substr($pages, 0, -2) . " ... ";
                        for ($i = ceil($result_count / $num_displayed) - 2; $i <= ceil($result_count / $num_displayed); $i++) {
                            if ($i != $_REQUEST['page']) {
                                $pages .= "<A HREF={$PHP_tmp_SELF}&LO_sort={$_REQUEST['LO_sort']}&LO_direction={$_REQUEST['LO_direction']}&LO_search=" . urlencode($_REQUEST['LO_search']) . "&page={$i}>{$i}</A>, ";
                            } else {
                                $pages .= "{$i}, ";
                            }
                        }
                        $pages = substr($pages, 0, -2) . " &nbsp;<A HREF={$PHP_tmp_SELF}&LO_sort={$_REQUEST['LO_sort']}&LO_direction={$_REQUEST['LO_direction']}&LO_search=" . urlencode($_REQUEST['LO_search']) . "&page=" . ($_REQUEST['page'] + 1) . ">Next Page</A><BR>";
                    }
                    echo $pages;
                    echo '</TD></TR></TABLE>';
                    echo '<BR>';
                }
            } else {
                $start = 1;
                $stop = $result_count;
                if ($cols > 8 || $_REQUEST['expanded_view']) {
                    $_SESSION['orientation'] = 'landscape';
                    $repeat_headers = 17;
                } else {
                    $repeat_headers = 28;
                }
                if ($options['print']) {
                    $html = explode('<!-- new page -->', strtolower(ob_get_contents()));
                    $html = $html[count($html) - 1];
                    echo '</TD></TR></TABLE>';
                    $br = substr_count($html, '<br>') + substr_count($html, '</p>') + substr_count($html, '</tr>') + substr_count($html, '</h1>') + substr_count($html, '</h2>') + substr_count($html, '</h3>') + substr_count($html, '</h4>') + substr_count($html, '</h5>');
                    if ($br % 2 != 0) {
                        $br++;
                        echo '<BR>';
                    }
                } else {
                    echo '</TD></TR></TABLE>';
                }
            }
            // END MISC ---
            // WIDTH = 100%
            echo '<TABLE class=grid cellspacing=0 cellpadding=0  style="border-left:1px solid #787878; border-top:1px solid #787878;">';
            // SEARCH BOX & MORE HEADERS
            if ($where_message || $singular && $plural || !isset($_REQUEST['_openSIS_PDF']) && $options['search']) {
                /*
                echo '<TD width=100% >';
                echo '<TABLE class=\"grid\" cellpadding=1 >';
                echo "<TR><TD align=left>";
                if($singular && $plural && $options['count'])
                {
                	if($display_count > 1)
                		echo "<b>$display_count $plural were found.</b> &nbsp; &nbsp;";
                	elseif($display_count==1)
                		echo "<b>1 $singular was found.</b> &nbsp; &nbsp;";
                	if($where_message)
                		echo '<BR>'.$where_message;
                		
                }
                if($options['save'] && !isset($_REQUEST['_openSIS_PDF']) && $result_count > 0)
                	echo "<A HREF=$PHP_tmp_SELF&$extra&LO_save=1&_openSIS_PDF=true><IMG SRC=assets/download.gif border=0 vspace=0 hspace=0></A>";
                echo '</TD>';
                $colspan = 1;
                if(!isset($_REQUEST['_openSIS_PDF']) && $options['search'])
                {
                	$tmp_REQUEST = $_REQUEST;
                	unset($tmp_REQUEST['LO_search']);
                	unset($tmp_REQUEST['page']);
                	echo '<TD align=right>';
                	echo "<INPUT type=text id=LO_search name=LO_search value='".(($_REQUEST['LO_search'] && $_REQUEST['LO_search']!='Search')?$_REQUEST['LO_search']:'Search\' style=\'color:BBBBBB\''),"' onfocus='if(this.value==\"Search\") this.value=\"\"; this.style.color=\"000000\";' onblur='if(this.value==\"\") {this.value=\"Search\"; this.style.color=\"BBBBBB\";}' onkeypress='if(event.keyCode==13){document.location.href=\"".PreparePHP_SELF($tmp_REQUEST)."&LO_search=\"+this.value; return false;} '><INPUT type=button value=Go class=btn_go onclick='document.location.href=\"".PreparePHP_SELF($tmp_REQUEST)."&LO_search=\"+document.getElementById(\"LO_search\").value;'></TD>";
                	$colspan++;
                	
                }
                echo "</TR>";
                echo '<TR style="height:0;"><TD width=100% style="height:0;" height=0 align=right colspan='.$colspan.'><DIV id=LOx'.(count($column_names)+(($result_count!=0 && $cols && !isset($_REQUEST['_openSIS_PDF']))?1:0)+(($remove && !isset($_REQUEST['_openSIS_PDF']))?1:0)).' style="width:0; position: relative; height:0;"></DIV></TD></TR></TABLE>';
                */
            } else {
                echo '<TR><TD width=100% align=right><DIV id=LOx' . (count($column_names) + ($result_count != 0 && $cols && !isset($_REQUEST['_openSIS_PDF']) ? 1 : 0) + ($remove && !isset($_REQUEST['_openSIS_PDF']) ? 1 : 0)) . ' style="width:0; position: relative; height:0;"></DIV></TD></TR>';
            }
            // END SEARCH BOX ----
            echo '<TR><TD>';
            // SHADOW
            if (!isset($_REQUEST['_openSIS_PDF'])) {
                echo '<TABLE cellpadding=0 cellspacing=0 width=100%><TR><TD>';
            }
            echo "<TABLE class=\"grid\" cellpadding=6 cellspacing=0 width=100%>";
            if (!isset($_REQUEST['_openSIS_PDF']) && $stop - $start > 10) {
                echo '<THEAD>';
            }
            if (!isset($_REQUEST['_openSIS_PDF'])) {
                echo '<TR>';
            }
            $i = 1;
            if ($remove && !isset($_REQUEST['_openSIS_PDF']) && $result_count != 0) {
                echo "<TD class=\"subtabs\"><DIV id=LOx{$i} style='position: relative;'></DIV></TD>";
                $i++;
            }
            if ($result_count != 0 && $cols && !isset($_REQUEST['_openSIS_PDF'])) {
                foreach ($column_names as $key => $value) {
                    if ($_REQUEST['LO_sort'] == $key) {
                        $direction = -1 * $_REQUEST['LO_direction'];
                    } else {
                        $direction = 1;
                    }
                    echo "<TD class=\"subtabs\"><DIV id=LOx{$i} style='position: relative;'></DIV>";
                    echo "<A ";
                    if ($options['sort']) {
                        echo "HREF={$PHP_tmp_SELF}&page={$_REQUEST['page']}&LO_sort={$key}&LO_direction={$direction}&LO_search=" . urlencode($_REQUEST['LO_search']);
                    }
                    echo " class=column_heading><b>{$value}</b></A>";
                    if ($i == 1) {
                        echo "<DIV id=LOy0 style='position: relative;'></DIV>";
                    }
                    echo "</TD>";
                    $i++;
                }
                //echo '<TD width=0><DIV id=LO'.$i.'></DIV></TD>';
                echo "</TR>";
            }
            $color = '#F8F8F9';
            //style="height: 300px; overflow: auto; padding-right: 16px;"
            if (!isset($_REQUEST['_openSIS_PDF']) && $stop - $start > 10) {
                echo '</THEAD><TBODY>';
            }
            // mab - enable add link as first or last
            if ($result_count != 0 && $link['add']['first'] && $stop - $start >= $link['add']['first']) {
                //if($remove && !isset($_REQUEST['_openSIS_PDF']))
                //	$cols++;
                if ($link['add']['link'] && !isset($_REQUEST['_openSIS_PDF'])) {
                    echo "<TR><TD colspan=" . ($remove ? $cols + 1 : $cols) . " align=left >" . button('add', $link['add']['title'], $link['add']['link']) . "</TD></TR>";
                } elseif ($link['add']['span'] && !isset($_REQUEST['_openSIS_PDF'])) {
                    echo "<TR><TD colspan=" . ($remove ? $cols + 1 : $cols) . " align=left >" . button('add') . $link['add']['span'] . "</TD></TR>";
                } elseif ($link['add']['html'] && $cols) {
                    echo "<TR bgcolor={$color}>";
                    if ($remove && !isset($_REQUEST['_openSIS_PDF']) && $link['add']['html']['remove']) {
                        echo "<TD >" . $link['add']['html']['remove'] . "</TD>";
                    } elseif ($remove && !isset($_REQUEST['_openSIS_PDF'])) {
                        echo "<TD >" . button('add') . "</TD>";
                    }
                    foreach ($column_names as $key => $value) {
                        echo "<TD >" . $link['add']['html'][$key] . "</TD>";
                    }
                    echo "</TR>";
                    $count++;
                }
            }
            for ($i = $start; $i <= $stop; $i++) {
                $item = $result[$i];
                if (isset($_REQUEST['_openSIS_PDF']) && $options['print'] && count($item)) {
                    foreach ($item as $key => $value) {
                        $value = eregi_replace('<SELECT.*SELECTED\\>([^<]+)<.*</SELECT\\>', '\\1', $value);
                        $value = eregi_replace('<SELECT.*</SELECT\\>', '', $value);
                        if (strpos($value, 'LO_field') === false) {
                            $item[$key] = str_replace(' ', '&nbsp;', ereg_replace("<div onclick='[^']+'>", '', $value));
                        } else {
                            $item[$key] = ereg_replace("<div onclick='[^']+'>", '', $value);
                        }
                    }
                }
                if ($item['row_color']) {
                    $color = $item['row_color'];
                } elseif ($color == '#F8F8F9') {
                    $color = $side_color;
                } else {
                    $color = '#F8F8F9';
                }
                //$color = '#EDF3FE';
                if (isset($_REQUEST['_openSIS_PDF']) && $count % $repeat_headers == 0) {
                    if ($count != 0) {
                        echo '</TABLE><TABLE class=\\"grid\\" cellspacing=1 cellpadding=6 >';
                        echo '<!-- NEW PAGE -->';
                    }
                    echo "<TR>";
                    if ($remove && !isset($_REQUEST['_openSIS_PDF'])) {
                        echo "<TD class=\"subtabs\"></TD>";
                    }
                    if ($cols) {
                        foreach ($column_names as $key => $value) {
                            echo "<TD class=\"subtabs\" class=LO_field><b>" . str_replace(' ', '&nbsp;', $value) . "</b></FONT></TD>";
                        }
                    }
                    echo "</TR>";
                }
                if ($count == 0) {
                    $count = $br;
                }
                echo "<TR bgcolor={$color}>";
                $count++;
                if ($remove && !isset($_REQUEST['_openSIS_PDF'])) {
                    $button_title = $link['remove']['title'];
                    //if(!$button_title)
                    //$button_title = 'Remove';
                    $button_link = $link['remove']['link'];
                    if (count($link['remove']['variables'])) {
                        foreach ($link['remove']['variables'] as $var => $val) {
                            $button_link .= "&{$var}=" . urlencode($item[$val]);
                        }
                    }
                    echo "<TD bgcolor={$color}>" . button('remove', $button_title, $button_link) . "</TD>";
                }
                if ($cols) {
                    foreach ($column_names as $key => $value) {
                        if ($link[$key] && !isset($_REQUEST['_openSIS_PDF'])) {
                            echo "<TD bgcolor={$color} class=LO_field>";
                            if ($key == 'FULL_NAME') {
                                echo '<DIV id=LOy' . ($count - $br) . ' height=20 style="height: 20; min-height: 20; position: relative;">';
                            }
                            if ($link[$key]['js'] === true) {
                                echo "<A HREF=# onclick='window.open(\"{$link[$key][link]}";
                                if (count($link[$key]['variables'])) {
                                    foreach ($link[$key]['variables'] as $var => $val) {
                                        echo "&{$var}=" . urlencode($item[$val]);
                                    }
                                }
                                echo "\",\"\",\"scrollbars=yes,resizable=yes,width=800,height=400\");'";
                                if ($link[$key]['extra']) {
                                    echo ' ' . $link[$key]['extra'];
                                }
                                echo ">";
                            } else {
                                echo "<A HREF={$link[$key][link]}";
                                if (count($link[$key]['variables'])) {
                                    foreach ($link[$key]['variables'] as $var => $val) {
                                        echo "&{$var}=" . urlencode($item[$val]);
                                    }
                                }
                                if ($link[$key]['extra']) {
                                    echo ' ' . $link[$key]['extra'];
                                }
                                echo ">";
                            }
                            if ($color == Preferences('HIGHLIGHT')) {
                                echo '';
                            } else {
                                echo '';
                            }
                            echo $item[$key];
                            echo '';
                            if (!$item[$key]) {
                                echo '***';
                            }
                            echo "</A>";
                            if ($key == 'FULL_NAME') {
                                echo '</DIV>';
                            }
                            echo "</TD>";
                        } else {
                            echo "<TD bgcolor={$color} class=LO_field>";
                            if ($key == 'FULL_NAME') {
                                echo '<DIV id=LOy' . ($count - $br) . ' height=20 style="position: relative;">';
                            }
                            if ($color == Preferences('HIGHLIGHT')) {
                                echo '';
                            }
                            echo $item[$key];
                            if (!$item[$key]) {
                                echo '&nbsp;';
                            }
                            if ($key == 'FULL_NAME') {
                                echo '<DIV>';
                            }
                            echo "</TD>";
                        }
                    }
                }
                echo "</TR>";
            }
            if ($result_count != 0 && (!$link['add']['first'] || $link['add']['first'] && $stop - $start < $link['add']['first'])) {
                //if($remove && !isset($_REQUEST['_openSIS_PDF']))
                //	$cols++;
                if ($link['add']['link'] && !isset($_REQUEST['_openSIS_PDF'])) {
                    echo "<TR><TD colspan=" . ($remove ? $cols + 1 : $cols) . " align=left bgcolor=#FFFFFF>" . button('add', $link['add']['title'], $link['add']['link']) . "</TD></TR>";
                } elseif ($link['add']['span'] && !isset($_REQUEST['_openSIS_PDF'])) {
                    echo "<TR><TD colspan=" . ($remove ? $cols + 1 : $cols) . " align=left bgcolor=#FFFFFF>" . button('add') . $link['add']['span'] . "</TD></TR>";
                } elseif ($link['add']['html'] && $cols) {
                    if ($count % 2) {
                        $color = '#F8F8F9';
                    } else {
                        $color = $side_color;
                    }
                    echo "<TR bgcolor={$color}>";
                    if ($remove && !isset($_REQUEST['_openSIS_PDF']) && $link['add']['html']['remove']) {
                        echo "<TD bgcolor={$color}>" . $link['add']['html']['remove'] . "</TD>";
                    } elseif ($remove && !isset($_REQUEST['_openSIS_PDF'])) {
                        echo "<TD bgcolor={$color}>" . button('add') . "</TD>";
                    }
                    foreach ($column_names as $key => $value) {
                        echo "<TD bgcolor={$color} class=LO_field>" . $link['add']['html'][$key] . "</TD>";
                    }
                    echo "</TR>";
                }
            }
            if ($result_count != 0) {
                if (!isset($_REQUEST['_openSIS_PDF']) && $stop - $start > 10) {
                    echo '</TBODY>';
                }
                echo "</TABLE>";
                // SHADOW
                if (!isset($_REQUEST['_openSIS_PDF'])) {
                    echo '</TD></TR></TABLE>';
                }
                echo "</TD></TR>";
                echo "</TABLE>";
                if ($options['center']) {
                    echo '</CENTER>';
                }
            }
            // END PRINT THE LIST ---
        }
        if ($result_count == 0) {
            // mab - problem with table closing if not opened above - do same conditional?
            if ($result_count > $num_displayed || ($options['count'] || $display_zero) && (($result_count == 0 || $display_count == 0) && $plural || ($result_count == 0 || $display_count == 0))) {
                echo '</TD></TR></TABLE>';
            }
            if ($link['add']['link'] && !isset($_REQUEST['_openSIS_PDF'])) {
                echo '<div class=break style=width:300px></div><center>' . button('add', $link['add']['title'], $link['add']['link']) . '</center>';
            } elseif (($link['add']['html'] || $link['add']['span']) && count($column_names) && !isset($_REQUEST['_openSIS_PDF'])) {
                $color = $side_color;
                if ($options['center']) {
                    echo '<CENTER>';
                }
                // WIDTH=100%
                //echo "<TABLE cellpadding=1 bgcolor=#f8f8f9 width=100%><TR><TD>";
                // SHADOW
                echo '<TABLE class=\\"grid\\" cellpadding=0 cellspacing=0><TR><TD>';
                if ($link['add']['html']) {
                    /*Here also change the colour for left corner*/
                    echo "<TABLE class=\"grid\" cellspacing=1 cellpadding=6 ><TR>";
                    foreach ($column_names as $key => $value) {
                        //Here to change the ListOutput Header Colour
                        echo "<TD ><A><b>" . str_replace(' ', '&nbsp;', $value) . "</b></A></TD>";
                    }
                    echo "</TR>";
                    echo "<TR bgcolor={$color}>";
                    if ($link['add']['html']['remove']) {
                        echo "<TD bgcolor={$color}>" . $link['add']['html']['remove'] . "</TD>";
                    } else {
                        echo "<TD bgcolor=#F5F5F5>" . button('add') . "</TD>";
                    }
                    foreach ($column_names as $key => $value) {
                        echo "<TD bgcolor=#F5F5F5 class=LO_field>" . $link['add']['html'][$key] . "</TD>";
                    }
                    echo "</TR>";
                    echo "</TABLE>";
                } elseif ($link['add']['span'] && !isset($_REQUEST['_openSIS_PDF'])) {
                    echo "<TABLE class=\"grid\" cellspacing=1><TR><TD align=left>" . button('add') . $link['add']['span'] . "</TD></TR></TABLE>";
                }
                // SHADOW
                //echo '</TD></TR></TABLE>';
                echo "</TD></TR></TABLE>";
                if ($options['center']) {
                    echo '</CENTER>';
                }
            }
        }
        if ($result_count != 0) {
            if ($options['yscroll']) {
                echo '<div id="LOy_layer" style="position: absolute; top: 0; left: 0; visibility:hidden;">';
                echo '<TABLE class=\\"grid\\" cellspacing=1 cellpadding=6 id=LOy_table>';
                $i = 1;
                if ($cols && !isset($_REQUEST['_openSIS_PDF'])) {
                    $color = $side_color;
                    foreach ($result as $item) {
                        echo "<TR><TD bgcolor={$color} class=LO_field id=LO_row{$i}>";
                        if ($color == Preferences('HIGHLIGHT')) {
                            echo '';
                        }
                        echo $item['FULL_NAME'];
                        if (!$item['FULL_NAME']) {
                            echo '&nbsp;';
                        }
                        if ($color == Preferences('HIGHLIGHT')) {
                            echo '';
                        }
                        echo "</TD></TR>";
                        $i++;
                        if ($item['row_color']) {
                            $color = $item['row_color'];
                        } elseif ($color == '#F8F8F9') {
                            $color = $side_color;
                        } else {
                            $color = '#F8F8F9';
                        }
                    }
                }
                echo '</TABLE>';
                echo '</div>';
            }
            echo '<div id="LOx_layer" style="position: absolute; top: 0; left: 0; visibility:hidden;">';
            echo '<TABLE class=\\"grid\\" cellspacing=1 cellpadding=6 id=LOx_table><TR>';
            $i = 1;
            if ($remove && !isset($_REQUEST['_openSIS_PDF']) && $result_count != 0) {
                echo "<TD class=\"subtabs\" id=LO_col{$i}></TD>";
                $i++;
            }
            if ($cols && !isset($_REQUEST['_openSIS_PDF'])) {
                foreach ($column_names as $key => $value) {
                    echo '<TD class=\\"subtabs\\" id=LO_col' . $i . '><A class=column_heading><b>' . str_replace('controller', '', $value) . '</b></A></TD>';
                    $i++;
                }
            }
            echo '</TR></TABLE>';
            echo '</div>';
        }
    }
}
Exemple #14
0
if (optional_param('school_id', '', PARAM_ALPHANUM) == 'new') {
    unset($_SESSION['UserSchool']);
    echo "<script language=javascript>parent.body.location='" . str_replace('&amp;', '&', PreparePHP_SELF($_SESSION['_REQUEST_vars'])) . "';</script>";
    /*
    unset($_SESSION['student_id']);
    unset($_SESSION['_REQUEST_vars']['student_id']);
    unset($_SESSION['_REQUEST_vars']['search_modfunc']);
    */
}
//if($_REQUEST['staff_id']=='new')
if (optional_param('staff_id', '', PARAM_ALPHANUM) == 'new') {
    unset($_SESSION['miss_attn']);
    unset($_SESSION['staff_id']);
    unset($_SESSION['_REQUEST_vars']['staff_id']);
    unset($_SESSION['_REQUEST_vars']['search_modfunc']);
    echo "<script language=javascript>parent.body.location='" . str_replace('&amp;', '&', PreparePHP_SELF($_SESSION['_REQUEST_vars'])) . "';</script>";
}
unset($_REQUEST['modfunc']);
echo "\n<HTML>\n\t<head>\n\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n\t\t<meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />\n\t\t<link rel=stylesheet type=\"text/css\" href=\"assets/stylesheet.css\">\n\t\t<script language=\"JavaScript\" type=\"text/javascript\">\n\t\t\n\t\t</script>\n\t\t<title>" . Config('TITLE') . "</title>\n\t</head>\n\t<BODY background=assets/themes/" . Preferences('THEME') . "/bg.jpg leftmargin=6 marginwidth=4 topmargin=0 " . (clean_param($_REQUEST['modcat'], PARAM_NOTAGS) ? "onload=openMenu('" . clean_param($_REQUEST['modcat'], PARAM_NOTAGS) . "');" : '') . ">";
// User Information
echo "<TABLE border=0 cellpadding=0 cellspacing=0 width=100%><TR><TD height=30>";
echo '<A HREF=index.php target=_top>' . DrawPNG('themes/' . Preferences('THEME') . '/logo.png', 'border=0 width=160') . '</A>';
echo "</TD></TR><TR>";
echo "<TD class=BoxContents style='border: inset #C9C9C9 2px; background-image:url(\"assets/bg.gif\")' width=100% valign=top>\n\t<FORM action=Side.php?modfunc=update method=POST>\n\t<INPUT type=hidden name=modcat value='' id=modcat_input>\n\t<b>" . User('NAME') . "</b>\n\t<BR>" . date('l F j, Y') . "\n\t<BR>";
if (User('PROFILE') == 'admin') {
    $schools = substr(str_replace(",", "','", User('SCHOOLS')), 2, -2);
    $QI = DBQuery("SELECT ID,TITLE FROM schools" . ($schools ? " WHERE ID IN ({$schools})" : ''));
    $RET = DBGet($QI);
    //	if(!UserSchool())
    //	{
    //		$_SESSION['UserSchool'] = $RET[1]['ID'];
Exemple #15
0
 }
 if (!$extra['columns_before'] && !$extra['columns_after']) {
     $columns = $LO_columns;
 }
 if (count($students_RET) > 1 || $link['add'] || !$link['FULL_NAME'] || $extra['columns_before'] || $extra['columns_after'] || $extra['BackPrompt'] == false && count($students_RET) == 0 || $extra['Redirect'] === false && count($students_RET) == 1) {
     $tmp_REQUEST = $_REQUEST;
     unset($tmp_REQUEST['expanded_view']);
     if ($_REQUEST['expanded_view'] != 'true' && !UserStudentID() && count($students_RET) != 0) {
         DrawHeader("<div><A HREF=" . PreparePHP_SELF($tmp_REQUEST) . "&expanded_view=true class=big_font ><img src=\"themes/Blue/expanded_view.png\" />Expanded View</A></div><div class=break ></div>", $extra['header_right']);
     } elseif (!UserStudentID() && count($students_RET) != 0) {
         DrawHeader("<div><A HREF=" . PreparePHP_SELF($tmp_REQUEST) . "&expanded_view=false class=big_font><img src=\"themes/Blue/expanded_view.png\" />Original View</A></div><div class=break ></div>", $extra['header_right']);
     }
     DrawHeader($extra['extra_header_left'], $extra['extra_header_right']);
     DrawHeader(str_replace('<BR>', '<BR> &nbsp;', substr($_CENTRE['SearchTerms'], 0, -4)));
     if ($_REQUEST['LO_save'] != '1' && !$extra['suppress_save']) {
         $_SESSION['List_PHP_SELF'] = PreparePHP_SELF($_SESSION['_REQUEST_vars']);
         echo '<script language=JavaScript>parent.help.location.reload();</script>';
     }
     if (!$extra['singular'] || !$extra['plural']) {
         if ($_REQUEST['address_group']) {
             $extra['singular'] = 'Family';
             $extra['plural'] = 'Families';
         } else {
             $extra['singular'] = 'Student';
             $extra['plural'] = 'Students';
         }
     }
     echo "<div id='students' >";
     ListOutput($students_RET, $columns, $extra['singular'], $extra['plural'], $link, $extra['LO_group'], $extra['options']);
     echo "</div>";
 } elseif (count($students_RET) == 1) {
Exemple #16
0
DrawHeader(ProgramTitle());
if (!$_REQUEST['modfunc']) {
    $extra['link'] = array('FULL_NAME' => false);
    $extra['SELECT'] = ",CAST (NULL AS CHAR(1)) AS CHECKBOX";
    if ($_REQUEST['search_modfunc'] == 'list') {
        echo "<FORM action=Modules.php?modname={$_REQUEST['modname']}&modfunc=save METHOD=POST>";
        DrawHeader('', SubmitButton(_('Save')));
        echo '<BR>';
        if ($_REQUEST['category_id']) {
            $fields_RET = DBGet(DBQuery("SELECT ID,TITLE,TYPE,SELECT_OPTIONS FROM CUSTOM_FIELDS WHERE CATEGORY_ID='{$_REQUEST['category_id']}'"), array(), array('TYPE'));
        } else {
            $fields_RET = DBGet(DBQuery("SELECT ID,TITLE,TYPE,SELECT_OPTIONS FROM CUSTOM_FIELDS"), array(), array('TYPE'));
        }
        $categories_RET = DBGet(DBQuery("SELECT ID,TITLE FROM STUDENT_FIELD_CATEGORIES"));
        echo '<CENTER><TABLE bgcolor=#FFFFCC><TR><TD>';
        echo '<CENTER><SELECT name=category_id onchange="document.location.href=\'' . PreparePHP_SELF($_REQUEST, array('category_id')) . '&amp;category_id=\'+this.form.category_id.value;"><OPTION value="">' . _('All Categories') . '</OPTION>';
        foreach ($categories_RET as $category) {
            echo '<OPTION value=' . $category['ID'] . ($_REQUEST['category_id'] == $category['ID'] ? ' SELECTED' : '') . '>' . ParseMLField($category['TITLE']) . '</OPTION>';
        }
        echo '</SELECT>';
        echo '<TABLE></CENTER><HR>';
        if (count($fields_RET['text'])) {
            foreach ($fields_RET['text'] as $field) {
                echo '<TR><TD align=right><small><b>' . ParseMLField($field['TITLE']) . '</b></small></TD><TD>' . _makeTextInput('CUSTOM_' . $field['ID']) . '</TD></TR>';
            }
        }
        if (count($fields_RET['numeric'])) {
            foreach ($fields_RET['numeric'] as $field) {
                echo '<TR><TD align=right><small><b>' . ParseMLField($field['TITLE']) . '</b></small></TD><TD>' . _makeTextInput('CUSTOM_' . $field['ID'], true) . '</TD></TR>';
            }
        }
Exemple #17
0
 }
 $staff_select .= '</SELECT>';
 $PHP_tmp_SELF = PreparePHP_SELF();
 echo "<FORM action={$PHP_tmp_SELF} method=POST>";
 DrawHeader(PrepareDate($date, '_date') . ' : ' . $type_select . ' : ' . $staff_select . ' : <INPUT type=submit value=' . _('Go') . '>', CheckBoxOnclick('by_name') . _('Sort by Name'));
 echo '</FORM>';
 if ($_REQUEST['type_select']) {
     $where = "AND fst.SHORT_NAME='" . $_REQUEST['type_select'] . "' ";
 }
 if ($_REQUEST['staff_select']) {
     $where = "AND fst.SELLER_ID='" . $_REQUEST['staff_select'] . "' ";
 }
 if ($_REQUEST['detailed_view'] != 'true') {
     DrawHeader("<A HREF=" . PreparePHP_SELF($_REQUEST, array(), array('detailed_view' => 'true')) . '>' . _('Detailed View') . '</A>');
 } else {
     DrawHeader("<A HREF=" . PreparePHP_SELF($_REQUEST, array(), array('detailed_view' => 'false')) . '>' . _('Original View') . '</A>');
 }
 include 'modules/Food_Service/' . ($_REQUEST['type'] == 'staff' ? 'Users' : 'Students') . '/ActivityReport.php';
 //echo '<pre>'; var_dump($RET); echo '</pre>';
 //echo '<pre>'; var_dump($types); echo '</pre>';
 if ($_REQUEST['detailed_view'] == 'true') {
     $LO_types = array(array(array()));
     foreach ($types as $type) {
         if ($type['COUNT']) {
             $LO_types[] = array(array('DESCRIPTION' => $type['DESCRIPTION'], 'DETAIL' => '', 'COUNT' => $type['COUNT'], 'AMOUNT' => number_format($type['AMOUNT'], 2)));
             foreach ($type['ITEMS'] as $item) {
                 if ($item[1]['COUNT']) {
                     $LO_types[last($LO_types)][] = array('DESCRIPTION' => $type['DESCRIPTION'], 'DETAIL' => $item[1]['DESCRIPTION'], 'COUNT' => $item[1]['COUNT'], 'AMOUNT' => number_format($item[1]['AMOUNT'], 2));
                 }
             }
         }
Exemple #18
0
         }
     }
     $calendar_RET = DBGet(DBQuery("SELECT DATE_FORMAT(SCHOOL_DATE,'%d-%b-%y') as SCHOOL_DATE,MINUTES,BLOCK FROM ATTENDANCE_CALENDAR WHERE SCHOOL_DATE BETWEEN '" . date('Y-m-d', $time) . "' AND '" . date('Y-m-d', mktime(0, 0, 0, $_REQUEST['month'], $last, $_REQUEST['year'])) . "' AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "' AND CALENDAR_ID='" . $_REQUEST['calendar_id'] . "'"), array(), array('SCHOOL_DATE'));
     unset($_REQUEST['blocks']);
     unset($_SESSION['_REQUEST_vars']['blocks']);
 }
 echo "<FORM action=Modules.php?modname={$_REQUEST['modname']} METHOD=POST>";
 $link = '';
 $title_RET = DBGet(DBQuery("SELECT CALENDAR_ID,TITLE FROM ATTENDANCE_CALENDARS WHERE SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "' ORDER BY DEFAULT_CALENDAR ASC"));
 foreach ($title_RET as $title) {
     $options[$title['CALENDAR_ID']] = $title['TITLE'];
 }
 if (AllowEdit()) {
     $tmp_REQUEST = $_REQUEST;
     unset($tmp_REQUEST['calendar_id']);
     $link = "<table><tr><td>" . SelectInput($_REQUEST['calendar_id'], 'calendar_id', '', $options, false, " onchange='document.location.href=\"" . PreparePHP_SELF($tmp_REQUEST) . '&amp;calendar_id="+this.form.calendar_id.value;\' ', false) . " </td><td><a href='#' onclick='load_link(\"Modules.php?modname={$_REQUEST['modname']}&modfunc=create\");'>" . button('add') . "</a></td><td><a href='#' onclick='load_link(\"Modules.php?modname={$_REQUEST['modname']}&modfunc=create\");'>Create a new calendar</a> </td><td>&nbsp;&nbsp;|&nbsp;&nbsp;</td><td><a href='#' onclick='load_link(\"Modules.php?modname={$_REQUEST['modname']}&modfunc=delete_calendar&calendar_id={$_REQUEST['calendar_id']}\");'>" . button('remove') . "</a></td><td><a href='#' onclick='load_link(\"Modules.php?modname={$_REQUEST['modname']}&modfunc=delete_calendar&calendar_id={$_REQUEST['calendar_id']}\");'>Delete this calendar</a></td></tr></table>";
 }
 DrawHeaderHome(PrepareDate(strtoupper(date("d-M-y", $time)), '', false, array('M' => 1, 'Y' => 1, 'submit' => true)) . ' <A HREF=Modules.php?modname=' . $_REQUEST['modname'] . '&modfunc=list_events&month=' . $_REQUEST['month'] . '&year=' . $_REQUEST['year'] . '>List Events</A>', SubmitButton('Save', '', 'class=btn_medium'));
 DrawHeaderHome($link);
 // <A HREF=Modules.php?modname='.$_REQUEST['modname'].'&modfunc=list_events&month='.$_REQUEST['month'].'&year='.$_REQUEST['year'].'>List Events</A>
 if (count($error)) {
     if ($isajax != "ajax") {
         echo ErrorMessage($error, 'fatal');
     } else {
         echo ErrorMessage1($error, 'fatal');
     }
 }
 echo '<BR>';
 $events_RET = DBGet(DBQuery("SELECT ID,DATE_FORMAT(SCHOOL_DATE,'%d-%b-%y') AS SCHOOL_DATE,TITLE FROM CALENDAR_EVENTS WHERE SCHOOL_DATE BETWEEN '" . date('Y-m-d', $time) . "' AND '" . date('Y-m-d', mktime(0, 0, 0, $_REQUEST['month'], $last, $_REQUEST['year'])) . "' AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"), array(), array('SCHOOL_DATE'));
 if (User('PROFILE') == 'parent' || User('PROFILE') == 'student') {
     $assignments_RET = DBGet(DBQuery("SELECT ASSIGNMENT_ID AS ID,DATE_FORMAT(a.DUE_DATE,'%d-%b-%y') AS SCHOOL_DATE,a.TITLE,'Y' AS ASSIGNED FROM GRADEBOOK_ASSIGNMENTS a,SCHEDULE s WHERE (a.COURSE_PERIOD_ID=s.COURSE_PERIOD_ID OR a.COURSE_ID=s.COURSE_ID) AND s.STUDENT_ID='" . UserStudentID() . "' AND (a.DUE_DATE BETWEEN s.START_DATE AND s.END_DATE OR s.END_DATE IS NULL) AND (a.ASSIGNED_DATE<=CURRENT_DATE OR a.ASSIGNED_DATE IS NULL) AND a.DUE_DATE BETWEEN '" . date('Y-m-d', $time) . "' AND '" . date('Y-m-d', mktime(0, 0, 0, $_REQUEST['month'], $last, $_REQUEST['year'])) . "'"), array(), array('SCHOOL_DATE'));
Exemple #19
0
DrawBC("Students > " . ProgramTitle());
if (!$_REQUEST['modfunc']) {
    $extra['link'] = array('FULL_NAME' => false);
    $extra['SELECT'] = ',CAST(NULL AS CHAR(1)) AS CHECKBOX';
    if ($_REQUEST['search_modfunc'] == 'list') {
        echo "<FORM action=Modules.php?modname={$_REQUEST['modname']}&modfunc=save METHOD=POST>";
        if ($_REQUEST['category_id']) {
            $fields_RET = DBGet(DBQuery('SELECT ID,TITLE,TYPE,SELECT_OPTIONS FROM custom_fields WHERE CATEGORY_ID=\'' . $_REQUEST[category_id] . '\''), array(), array('TYPE'));
        } else {
            $fields_RET = DBGet(DBQuery('SELECT ID,TITLE,TYPE,SELECT_OPTIONS FROM custom_fields'), array(), array('TYPE'));
        }
        $categories_RET = DBGet(DBQuery('SELECT ID,TITLE FROM student_field_categories WHERE ID=1 OR ID=2'));
        $tmp_REQUEST = $_REQUEST;
        unset($tmp_REQUEST['category_id']);
        echo '<CENTER><TABLE align=center ><TR><TD align=center>';
        echo '<CENTER><SELECT name=category_id onchange="document.location.href=\'' . PreparePHP_SELF($tmp_REQUEST) . '&amp;category_id=\'+this.form.category_id.value;"><OPTION value="">All Categories</OPTION>';
        foreach ($categories_RET as $category) {
            echo '<OPTION value=' . $category['ID'] . ($_REQUEST['category_id'] == $category['ID'] ? ' SELECTED' : '') . '>' . $category['TITLE'] . '</OPTION>';
        }
        echo '</SELECT><div class=clear ></div>';
        PopTable_wo_header('header', '');
        echo '<TABLE align=center>';
        if (count($fields_RET['text'])) {
            foreach ($fields_RET['text'] as $field) {
                $title = strtolower(trim($field['TITLE']));
                if (strpos(trim($field['TITLE']), ' ') != 0) {
                    $p1 = substr(trim($field['TITLE']), 0, strpos(trim($field['TITLE']), ' '));
                    $p2 = substr(trim($field['TITLE']), strpos(trim($field['TITLE']), ' ') + 1);
                    $title = strtolower($p1 . '_' . $p2);
                }
                $query = mysql_query('SELECT * FROM students');
 $categories_RET = DBGet(DBQuery("SELECT f.ID,u.TITLE,u.SELECT_OPTIONS,f.DATA_TYPE FROM DISCIPLINE_FIELDS f,DISCIPLINE_FIELD_USAGE u WHERE u.DISCIPLINE_FIELD_ID=f.ID AND f.DATA_TYPE NOT IN ('textarea','text','date') AND u.SYEAR='" . UserSyear() . "' AND u.SCHOOL_ID='" . UserSchool() . "' ORDER BY u.SORT_ORDER"));
 $select = '<SELECT name=category_id onchange="this.form.submit();"><OPTION value="">' . _('Please choose a category') . '</OPTION>';
 if (count($categories_RET)) {
     foreach ($categories_RET as $category) {
         $select .= '<OPTION value="' . $category['ID'] . '"' . ($_REQUEST['category_id'] == $category['ID'] ? ' SELECTED="SELECTED"' : '') . '>' . $category['TITLE'] . '</OPTION>';
     }
 }
 $select .= '</SELECT>';
 $advanced_link = ' <A HREF="#" onclick=\'remote = window.open("Modules.php?modname=' . $_REQUEST['modname'] . '&modfunc=search&category_id=' . $_REQUEST['category_id'] . '&chart_type=' . $_REQUEST['chart_type'] . '&day_start=' . $_REQUEST['day_start'] . '&day_end=' . $_REQUEST['day_end'] . '&month_start=' . $_REQUEST['month_start'] . '&month_end=' . $_REQUEST['month_end'] . '&year_start=' . $_REQUEST['year_start'] . '&year_end=' . $_REQUEST['year_end'] . '&include_top=false","","scrollbars=yes,resizable=yes,width=700,height=600"); remote.opener = window;\'>' . _('Advanced') . '</A>';
 DrawHeader($select, _('Timeframe') . ': <label><INPUT type="radio" name=timeframe value=month' . ($_REQUEST['timeframe'] == 'month' ? ' checked' : '') . '>&nbsp;' . _('Month') . '</label> &nbsp;<label><INPUT type="radio" name=timeframe value=SYEAR' . ($_REQUEST['timeframe'] == 'SYEAR' ? ' checked' : '') . '>&nbsp;' . _('School Year') . '</label>');
 DrawHeader(' &nbsp; &nbsp; <B>' . _('Report Timeframe') . ': </B>' . PrepareDate($start_date, '_start') . ' - ' . PrepareDate($end_date, '_end') . $advanced_link, SubmitButton(_('Go')));
 echo '<BR />';
 if ($_REQUEST['category_id']) {
     $tmp_REQUEST = $_REQUEST;
     unset($tmp_REQUEST['chart_type']);
     $link = PreparePHP_SELF($tmp_REQUEST);
     $tabs = array(array('title' => _('Column'), 'link' => str_replace($_REQUEST['modname'], $_REQUEST['modname'] . '&amp;chart_type=column', $link)), array('title' => _('List'), 'link' => str_replace($_REQUEST['modname'], $_REQUEST['modname'] . '&amp;chart_type=list', $link)));
     $_ROSARIO['selected_tab'] = str_replace($_REQUEST['modname'], $_REQUEST['modname'] . '&amp;chart_type=' . str_replace(' ', '+', $_REQUEST['chart_type']), $link);
     PopTable('header', $tabs, '', 0);
     if ($_REQUEST['chart_type'] == 'list') {
         // IGNORE THE 'Series' RECORD
         $columns = array('TITLE' => _('Option'));
         foreach ($chart['chart_data'] as $timeframe => $values) {
             if ($timeframe != 0) {
                 $columns += array($timeframe => $values[0]);
                 unset($values[0]);
                 foreach ($values as $key => $value) {
                     $chart_data[$key] += array($timeframe => $value);
                 }
             } else {
                 unset($values[0]);
Exemple #21
0
function DeletePromptBigString($title, $queryString)
{
    $tmp_REQUEST = $_REQUEST;
    unset($tmp_REQUEST['delete_ok']);
    $PHP_tmp_SELF = PreparePHP_SELF($tmp_REQUEST);
    if (!$_REQUEST['delete_ok'] && !$_REQUEST['delete_cancel']) {
        echo '<BR>' . $queryString;
        PopTable('header', 'Confirm Delete');
        echo "<CENTER><h4>Are you sure you want to {$action} that " . (strpos($title, ' ') === false ? ucwords($title) : $title) . "?</h4><br><FORM action={$PHP_tmp_SELF}&delete_ok=1 METHOD=POST><INPUT type=submit class=btn_medium value=OK>&nbsp;<INPUT type=button class=btn_medium name=delete_cancel value=Cancel onclick='load_link(\"Modules.php?modname={$_REQUEST['modname']}&{$queryString}\");'></FORM></CENTER>";
        PopTable('footer');
        return false;
    } else {
        return true;
    }
}
         $month = '11';
     } elseif ($month == 'DEC') {
         $month = '12';
     }
     $final_date = $year . "-" . $month . "-" . $day;
     $date = $final_date;
 }
 //echo $date;
 //--------- if end --------------//
 //------------------------------ Date Edit End -------------------------------------------//
 DrawHeader('<TABLE><TR><TD>' . PrepareDate($date, '_date', false, array('submit' => true)) . '</TD><TD>&nbsp;&nbsp;&nbsp;&nbsp;</TD><TD>' . SubmitButton('Go', '', 'class=btn_medium') . '</TD><TR></TABLE>', '<TABLE><TR><TD>' . $current_student_link . button('add', '', "# onclick='javascript:addHTML(\"" . str_replace('"', '\\"', _makeCodeSearch()) . "\",\"code_pulldowns\"); return false;'") . '</TD><TD><DIV id=code_pulldowns>' . $code_pulldowns . '</DIV></TD></TR></TABLE>');
 $categories_RET = DBGet(DBQuery("SELECT ID,TITLE FROM ATTENDANCE_CODE_CATEGORIES WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"));
 $tmp_REQUEST = $_REQUEST;
 unset($tmp_REQUEST['table']);
 unset($tmp_REQUEST['codes']);
 $tmp_PHP_SELF = PreparePHP_SELF($tmp_REQUEST);
 if (count($categories_RET)) {
     echo '<center><div style="margin-bottom:-25px;"><TABLE border=0 cellpadding=0 cellspacing=0 style="border:1;border-style: none none solid none;"><TR><TD>';
     echo '<TABLE height=1><TR><TD height=1></TD></TR></TABLE>';
     $header = '<TABLE border=0 cellpadding=0 cellspacing=0 height=14><TR>';
     if ($_REQUEST['table'] !== '0') {
         $tabcolor = '#DFDFDF';
         $textcolor = '#999999';
     } else {
         $tabcolor = Preferences('HIGHLIGHT');
         $textcolor = '#000000';
     }
     $header .= '<TD width=10></TD><TD>' . DrawTab('Attendance', $tmp_PHP_SELF . '&amp;table=0', $tabcolor, $textcolor, '_circle', array('textcolor' => '#000000')) . '</TD>';
     foreach ($categories_RET as $category) {
         if ($_REQUEST['table'] !== $category['ID']) {
             $tabcolor = '#DFDFDF';
Exemple #23
0
if ($_REQUEST['student_id']) {
    $assignment_select .= '<OPTION value=' . $_REQUEST['assignment_id'] . ' SELECTED>' . $stu_RET[1]['FULL_NAME'] . '</OPTION>';
}
foreach ($assignments_RET as $id => $assignment) {
    $assignment_select .= '<OPTION value=' . $id . ($_REQUEST['assignment_id'] == $id && !$_REQUEST['student_id'] ? ' SELECTED' : '') . '>' . $assignment[1]['TYPE_TITLE'] . ' - ' . $assignment[1]['TITLE'] . '</OPTION>';
}
$assignment_select .= '</SELECT>';
echo "<FORM action=Modules.php?modname={$_REQUEST['modname']}&student_id={$_REQUEST['student_id']} method=POST>";
$tmp_REQUEST = $_REQUEST;
unset($tmp_REQUEST['include_inactive']);
//-----------------------------------
//if(($_REQUEST['assignment_id'] == "all") && count($assignments_RET) == '0')
if (count($stu_RET) == 0) {
    DrawHeaderHome($assignment_select, '', '<INPUT type=checkbox name=include_inactive value=Y' . ($_REQUEST['include_inactive'] == 'Y' ? " CHECKED onclick='document.location.href=\"" . PreparePHP_SELF($tmp_REQUEST) . "&include_inactive=\";'" : " onclick='document.location.href=\"" . PreparePHP_SELF($tmp_REQUEST) . "&include_inactive=Y\";'") . '>Include Inactive Students');
} else {
    DrawHeaderHome($assignment_select, $_REQUEST['assignment_id'] ? SubmitButton('Save', '', 'class=btn_medium') : '', '<INPUT type=checkbox name=include_inactive value=Y' . ($_REQUEST['include_inactive'] == 'Y' ? " CHECKED onclick='document.location.href=\"" . PreparePHP_SELF($tmp_REQUEST) . "&include_inactive=\";'" : " onclick='document.location.href=\"" . PreparePHP_SELF($tmp_REQUEST) . "&include_inactive=Y\";'") . '>Include Inactive Students');
}
if (!$_REQUEST['student_id'] && $_REQUEST['assignment_id'] == 'all') {
    $options = array('yscroll' => true);
}
echo '<div style="overflow:auto; width:850px;">';
ListOutput($stu_RET, $LO_columns, $item, $items, $link, array(), $options);
echo '</div>';
if (count($assignments_RET) != 0) {
    echo $_REQUEST['assignment_id'] ? '<CENTER>' . SubmitButton('Save', '', 'class=btn_medium') . '</CENTER>' : '';
}
echo '</FORM>';
function _makeExtraAssnCols($assignment_id, $column)
{
    global $THIS_RET, $total_points, $current_RET, $points_RET, $tabindex, $max_allowed;
    $rounding = DBGet(DBQuery('SELECT VALUE FROM program_user_config WHERE USER_ID=\'' . User('STAFF_ID') . '\' AND TITLE=\'ROUNDING\' AND PROGRAM=\'Gradebook\' '));
Exemple #24
0
#
#  This program is released under the terms of the GNU General Public License as
#  published by the Free Software Foundation, version 2 of the License.
#  See license.txt.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#***************************************************************************************
include '../../Redirect_modules.php';
echo "<FORM name=add id=add action=" . PreparePHP_SELF() . " method=POST>";
DrawBC("Students > " . ProgramTitle());
if ($_REQUEST['day_start'] && $_REQUEST['month_start'] && $_REQUEST['year_start']) {
    while (!VerifyDate($start_date = $_REQUEST['day_start'] . '-' . $_REQUEST['month_start'] . '-' . $_REQUEST['year_start'])) {
        $_REQUEST['day_start']--;
    }
} else {
    $start_date = '01-' . strtoupper(date('M-y'));
}
if ($_REQUEST['day_end'] && $_REQUEST['month_end'] && $_REQUEST['year_end']) {
    while (!VerifyDate($end_date = $_REQUEST['day_end'] . '-' . $_REQUEST['month_end'] . '-' . $_REQUEST['year_end'])) {
        $_REQUEST['day_end']--;
    }
} else {
    $end_date = DBDate();
}
Exemple #25
0
function ListOutputGrade($result, $column_names, $singular = '', $plural = '', $link = false, $group = false, $options = false, $for_window = '')
{
    if (!isset($options['save'])) {
        $options['save'] = true;
    }
    if (!isset($options['print'])) {
        $options['print'] = true;
    }
    if (!isset($options['search'])) {
        $options['search'] = true;
    }
    if (!isset($options['center'])) {
        $options['center'] = true;
    }
    if (!isset($options['count'])) {
        $options['count'] = true;
    }
    if (!isset($options['sort'])) {
        $options['sort'] = true;
    }
    if (!$link) {
        $link = array();
    }
    if (isset($_REQUEST['page'])) {
        if ($_REQUEST['list_type'] == $singular) {
            $Request_page = $_REQUEST['page'];
        }
    }
    if (!isset($options['add'])) {
        if (!AllowEdit() || $_REQUEST['_openSIS_PDF']) {
            if ($link) {
                unset($link['add']);
                unset($link['remove']);
            }
        }
    }
    // PREPARE LINKS ---
    $result_count = $display_count = count($result);
    $num_displayed = 100000;
    $extra = "page={$_REQUEST['page']}&LO_sort={$_REQUEST['LO_sort']}&LO_direction={$_REQUEST['LO_direction']}&LO_search=" . urlencode($_REQUEST['LO_search']);
    $tmp_REQUEST = $_REQUEST;
    unset($tmp_REQUEST['page']);
    unset($tmp_REQUEST['LO_sort']);
    unset($tmp_REQUEST['LO_direction']);
    unset($tmp_REQUEST['LO_search']);
    unset($tmp_REQUEST['remove_prompt']);
    unset($tmp_REQUEST['remove_name']);
    unset($tmp_REQUEST['LO_save']);
    unset($tmp_REQUEST['PHPSESSID']);
    //$PHP_tmp_SELF = PreparePHP_SELF($tmp_REQUEST);
    $PHP_tmp_SELF = str_replace('>', '', PreparePHP_SELF($tmp_REQUEST));
    // END PREPARE LINKS ---
    // UN-GROUPING
    $group_count = count($group);
    if (!is_array($group)) {
        $group_count = false;
    }
    //$side_color = Preferences('COLOR');
    $side_color = 'class=odd';
    if ($group_count && $result_count) {
        $color = 'class=even';
        $group_result = $result;
        unset($result);
        $result[0] = '';
        foreach ($group_result as $item1) {
            if ($group_count == 1) {
                if ($color == 'class=even') {
                    $color = $side_color;
                } else {
                    $color = 'class=even';
                }
            }
            foreach ($item1 as $item2) {
                if ($group_count == 1) {
                    $i++;
                    if (count($group[0]) && $i != 1) {
                        foreach ($group[0] as $column) {
                            $item2[$column] = str_replace('<!-- <!--', '<!--', '<!-- ' . str_replace('-->', '--><!--', $item2[$column])) . ' -->';
                        }
                    }
                    $item2['row_color'] = $color;
                    $result[] = $item2;
                } else {
                    if ($group_count == 2) {
                        if ($color == 'class=even') {
                            $color = $side_color;
                        } else {
                            $color = 'class=even';
                        }
                    }
                    foreach ($item2 as $item3) {
                        if ($group_count == 2) {
                            $i++;
                            if (count($group[0]) && $i != 1) {
                                foreach ($group[0] as $column) {
                                    $item3[$column] = '<!-- ' . $item3[$column] . ' -->';
                                }
                            }
                            if (count($group[1]) && $i != 1) {
                                foreach ($group[1] as $column) {
                                    $item3[$column] = '<!-- ' . $item3[$column] . ' -->';
                                }
                            }
                            $item3['row_color'] = $color;
                            $result[] = $item3;
                        } else {
                            if ($group_count == 3) {
                                if ($color == 'class=even') {
                                    $color = $side_color;
                                } else {
                                    $color = 'class=even';
                                }
                            }
                            foreach ($item3 as $item4) {
                                if ($group_count == 3) {
                                    $i++;
                                    if (count($group[2]) && $i != 1) {
                                        foreach ($group[2] as $column) {
                                            unset($item4[$column]);
                                        }
                                    }
                                    $item4['row_color'] = $color;
                                    $result[] = $item4;
                                }
                            }
                        }
                    }
                }
            }
            $i = 0;
        }
        unset($result[0]);
        $result_count = count($result);
        unset($_REQUEST['LO_sort']);
    }
    // END UN-GROUPING
    $_LIST['output'] = true;
    // PRINT HEADINGS, PREPARE PDF, AND SORT THE LIST ---
    if ($_LIST['output'] != false) {
        if ($result_count != 0) {
            $count = 0;
            $remove = count($link['remove']['variables']);
            $cols = count($column_names);
            // HANDLE SEARCHES ---
            if ($result_count && $_REQUEST['LO_search'] && $_REQUEST['LO_search'] != 'Search') {
                $_REQUEST['LO_search'] = $search_term = str_replace('\\\\"', '"', $_REQUEST['LO_search']);
                $_REQUEST['LO_search'] = $search_term = ereg_replace('[^a-zA-Z0-9 _"]*', '', strtolower($search_term));
                if (substr($search_term, 0, 0) != '"' && substr($search_term, -1) != '"') {
                    $search_term = ereg_replace('"', '', $search_term);
                    while ($space_pos = strpos($search_term, ' ')) {
                        $terms[strtolower(substr($search_term, 0, $space_pos))] = 1;
                        $search_term = substr($search_term, $space_pos + 1);
                    }
                    $terms[trim($search_term)] = 1;
                } else {
                    $search_term = ereg_replace('"', '', $search_term);
                    $terms[trim($search_term)] = 1;
                }
                unset($terms['of']);
                unset($terms['the']);
                unset($terms['a']);
                unset($terms['an']);
                unset($terms['in']);
                foreach ($result as $key => $value) {
                    $values[$key] = 0;
                    foreach ($value as $name => $val) {
                        $val = ereg_replace('[^a-zA-Z0-9 _]+', '', strtolower($val));
                        if (strtolower($_REQUEST['LO_search']) == $val) {
                            $values[$key] += 25;
                        }
                        foreach ($terms as $term => $one) {
                            if (ereg($term, $val)) {
                                $values[$key] += 3;
                            }
                        }
                    }
                    if ($values[$key] == 0) {
                        unset($values[$key]);
                        unset($result[$key]);
                        $result_count--;
                        $display_count--;
                    }
                }
                if ($result_count) {
                    array_multisort($values, SORT_DESC, $result);
                    $result = ReindexResults($result);
                    $values = ReindexResults($values);
                    $last_value = 1;
                    $scale = 100 / $values[$last_value];
                    for ($i = $last_value; $i <= $result_count; $i++) {
                        $result[$i]['RELEVANCE'] = '<!--' . (int) ($values[$i] * $scale) . '--><IMG SRC="assets/pixel_grey.gif" width=' . (int) ($values[$i] * $scale) . ' height=10>';
                    }
                }
                $column_names['RELEVANCE'] = "" . _('Relevance') . "";
                if (is_array($group) && count($group)) {
                    $options['count'] == false;
                    $display_zero = true;
                }
            }
            // END SEARCHES ---
            if ($_REQUEST['LO_sort']) {
                $r = array();
                $a = array();
                $t = array();
                $c = 0;
                for ($i = 1; $i <= count($result); $i++) {
                    if (array_key_exists("FULL_NAME", $result[$i])) {
                        array_push($a, $i);
                    }
                }
                $l = 0;
                $k = 0;
                foreach ($result as $column => $value) {
                    for ($n = 0; $n < count($a); $n++) {
                        if ($column == $a[$n]) {
                            $k = $k + 1;
                        }
                    }
                    $t[$k][$l] = $value;
                    $l++;
                }
                for ($h = 1; $h <= count($a); $h++) {
                    foreach ($t[$h] as $sort) {
                        if (substr($sort[$_REQUEST['LO_sort']], 0, 4) != '<!--') {
                            $sort_array[] = $sort[$_REQUEST['LO_sort']];
                        } else {
                            $sort_array[] = substr($sort[$_REQUEST['LO_sort']], 4, strpos($sort[$_REQUEST['LO_sort']], '-->') - 5);
                        }
                    }
                    if ($_REQUEST['LO_direction'] == -1) {
                        $dir = SORT_DESC;
                    } else {
                        $dir = SORT_ASC;
                    }
                    if (count($t) > 1) {
                        if (is_int($sort_array[1]) || is_double($sort_array[1])) {
                            array_multisort($sort_array, $dir, SORT_NUMERIC, $t[$h]);
                        } else {
                            array_multisort($sort_array, $dir, $t[$h]);
                        }
                        // print_r($t[$h]);
                        $inc = 0;
                        $pos = 0;
                        $flag = true;
                        $inc = 0;
                        $select = $_REQUEST['LO_sort'];
                        for ($c = 0; $c < count($t[$h]); $c++) {
                            if (array_key_exists($_REQUEST['LO_sort'], $t[$h][$c])) {
                                $temp = $t[$h][$c];
                                if ($temp[$select]) {
                                    $inc++;
                                    if ($flag) {
                                        $pos = $c;
                                        $flag = false;
                                    }
                                }
                            }
                        }
                        $abc = array_slice($t[$h], $pos, $inc);
                        if ($pos == 0) {
                            $cde = array_slice($t[$h], $inc, count($t[$h]) - 1);
                        } else {
                            $cde = array_slice($t[$h], 0, $pos);
                        }
                        if ($inc != 0) {
                            $t[$h] = array_merge($abc, $cde);
                        }
                        echo "<br/>";
                        array_push($result, $t[$h]);
                    }
                    for ($i = $result_count - 1; $i >= 0; $i--) {
                        $result[$i + 1] = $result[$i];
                    }
                    unset($result[0]);
                    $sort_array = "";
                }
                // $name_sort=array();
                $bgcolor_sort = array();
                for ($h = 1; $h <= count($t); $h++) {
                    for ($n = 0; $n < count($t[$h]); $n++) {
                        if ($_REQUEST['LO_sort'] == "FULL_NAME") {
                            if (array_key_exists("FULL_NAME", $t[$h][$n])) {
                                $name_sort[] = array_shift($t[$h][$n]);
                            }
                            if (array_key_exists("bgcolor", $t[$h][$n])) {
                                $bgcolor_sort[] = array_shift($t[$h][$n]);
                            }
                        } else {
                            if (array_key_exists("FULL_NAME", $t[$h][$n])) {
                                $FULL_NAME = array_shift($t[$h][$n]);
                            }
                            if (array_key_exists("bgcolor", $t[$h][$n])) {
                                $bgcolor = array_shift($t[$h][$n]);
                            }
                            $t[$h][0][FULL_NAME] = $FULL_NAME;
                            $t[$h][0][bgcolor] = $bgcolor;
                        }
                    }
                }
                for ($h = 1; $h <= count($t); $h++) {
                    for ($n = 0; $n < count($t[$h]); $n++) {
                        if (array_key_exists("0", $t[$h][$n])) {
                            $mkperiod = $t[$h][$n]['MARKING_PERIOD_ID'];
                            $t[$h][$n][$mkperiod] = $t[$h][$n][0];
                        }
                    }
                }
                //print_r($name_sort);
                if ($_REQUEST['LO_sort'] == "FULL_NAME") {
                    array_multisort($name_sort, $dir);
                    for ($h = 1; $h <= count($t); $h++) {
                        $t[$h][0][FULL_NAME] = $name_sort[$h - 1];
                    }
                }
                $result = "";
                for ($n = 1; $n <= count($a); $n++) {
                    $result = array_merge((array) $result, $t[$n]);
                }
            }
        }
        // HANDLE SAVING THE LIST ---
        if ($_REQUEST['LO_save'] == '1') {
            if (!$options['save_delimiter'] && Preferences('DELIMITER') == 'CSV') {
                $options['save_delimiter'] = 'comma';
            }
            switch ($options['save_delimiter']) {
                case 'comma':
                    $extension = 'csv';
                    break;
                case 'xml':
                    $extension = 'xml';
                    break;
                default:
                    $extension = 'xls';
                    break;
            }
            ob_end_clean();
            if ($options['save_delimiter'] != 'xml') {
                foreach ($column_names as $key => $value) {
                    $output .= str_replace('&nbsp;', ' ', eregi_replace('<BR>', ' ', ereg_replace('<!--.*-->', '', $value))) . ($options['save_delimiter'] == 'comma' ? ',' : "\t");
                }
                $output .= "\n";
            }
            foreach ($result as $item) {
                foreach ($column_names as $key => $value) {
                    if ($options['save_delimiter'] == 'comma' && !$options['save_quotes']) {
                        $item[$key] = str_replace(',', ';', $item[$key]);
                    }
                    $item[$key] = eregi_replace('<SELECT.*SELECTED\\>([^<]+)<.*</SELECT\\>', '\\1', $item[$key]);
                    $item[$key] = eregi_replace('<SELECT.*</SELECT\\>', '', $item[$key]);
                    $output .= ($options['save_quotes'] ? '"' : '') . ($options['save_delimiter'] == 'xml' ? '<' . str_replace(' ', '', $value) . '>' : '') . ereg_replace('<[^>]+>', '', ereg_replace("<div onclick='[^']+'>", '', ereg_replace(' +', ' ', ereg_replace('&[^;]+;', '', str_replace('<BR>&middot;', ' : ', str_replace('&nbsp;', ' ', $item[$key])))))) . ($options['save_delimiter'] == 'xml' ? '</' . str_replace(' ', '', $value) . '>' . "\n" : '') . ($options['save_quotes'] ? '"' : '') . ($options['save_delimiter'] == 'comma' ? ',' : "\t");
                }
                $output .= "\n";
            }
            header("Cache-Control: public");
            header("Pragma: ");
            header("Content-Type: application/{$extension}");
            header("Content-Disposition: inline; filename=\"" . ProgramTitle() . ".{$extension}\"\n");
            if ($options['save_eval']) {
                eval($options['save_eval']);
            }
            echo $output;
            exit;
        }
        // END SAVING THE LIST ---
        if ($options['center']) {
            #echo '<CENTER>';
            if ($result_count > $num_displayed || ($options['count'] || $display_zero) && (($result_count == 0 || $display_count == 0) && $plural || ($result_count == 0 || $display_count == 0))) {
                #echo "<TABLE border=0 cellspacing=3 cellpadding=6>" ;
                if (isset($_REQUEST['_openSIS_PDF'])) {
                    #echo " width=98%";
                    echo " <TR><TD align=center>";
                }
            }
        }
        if ($options['count'] || $display_zero) {
            if (($result_count == 0 || $display_count == 0) && $plural) {
                echo "<div style=text-align:left><table cellpadding=5 cellspacing=5 class=alert_box ><tr><td class=alert></td><td class=alert_msg ><b>" . _('No') . " {$plural} " . _('were found.') . "</b></td></tr><tr><td colspan=2 class=clear></td></tr></table></div>";
            } elseif ($result_count == 0 || $display_count == 0) {
                echo '<div style=text-align:left><table cellpadding=5 cellspacing=5 class=alert_box ><tr><td class=alert></td><td class=alert_msg ><b>' . _('None were found.') . '</b></td></tr><tr><td colspan=2 class=clear></td></tr></table></div>';
            }
        }
        if ($result_count != 0 || $_REQUEST['LO_search'] && $_REQUEST['LO_search'] != 'Search') {
            if (!isset($_REQUEST['_openSIS_PDF'])) {
                if (!$Request_page) {
                    $Request_page = 1;
                }
                if (!$_REQUEST['LO_direction']) {
                    $_REQUEST['LO_direction'] = 1;
                }
                $start = ($Request_page - 1) * $num_displayed + 1;
                $stop = $start + ($num_displayed - 1);
                if ($stop > $result_count) {
                    $stop = $result_count;
                }
                if ($result_count > $num_displayed) {
                    echo $where_message = "<strong><br>\n\t\t\t\t\t\t\t\t\t    {$start} " . _('through') . " {$stop}</strong>";
                    echo "<div style=text-align:right;margin-top:-14px;padding-right:15px><strong>" . _('Go to Page') . " ";
                    if (ceil($result_count / $num_displayed) <= 10) {
                        for ($i = 1; $i <= ceil($result_count / $num_displayed); $i++) {
                            if ($i != $Request_page) {
                                if ($for_window == 'for_window') {
                                    $pages .= "<A HREF=" . str_replace('Modules.php', 'for_window.php', $PHP_tmp_SELF) . "&LO_sort={$_REQUEST['LO_sort']}&LO_direction={$_REQUEST['LO_direction']}&LO_search=" . urlencode($_REQUEST['LO_search']) . "&page={$i}&list_type={$singular}>{$i}</A>, ";
                                } else {
                                    $pages .= "<A HREF={$PHP_tmp_SELF}&LO_sort={$_REQUEST['LO_sort']}&LO_direction={$_REQUEST['LO_direction']}&LO_search=" . urlencode($_REQUEST['LO_search']) . "&page={$i}&list_type={$singular}>{$i}</A>, ";
                                }
                            } else {
                                $pages .= "{$i}, ";
                            }
                        }
                        $pages = substr($pages, 0, -2);
                    } else {
                        for ($i = 1; $i <= 7; $i++) {
                            if ($i != $Request_page) {
                                $pages .= "<A HREF={$PHP_tmp_SELF}&LO_sort={$_REQUEST['LO_sort']}&LO_direction={$_REQUEST['LO_direction']}&LO_search=" . urlencode($_REQUEST['LO_search']) . "&page={$i}>{$i}</A>, ";
                            } else {
                                $pages .= "{$i}, ";
                            }
                        }
                        $pages = substr($pages, 0, -2) . " ... ";
                        for ($i = ceil($result_count / $num_displayed) - 2; $i <= ceil($result_count / $num_displayed); $i++) {
                            if ($i != $Request_page) {
                                $pages .= "<A HREF={$PHP_tmp_SELF}&LO_sort={$_REQUEST['LO_sort']}&LO_direction={$_REQUEST['LO_direction']}&LO_search=" . urlencode($_REQUEST['LO_search']) . "&page={$i}>{$i}</A>, ";
                            } else {
                                $pages .= "{$i}, ";
                            }
                        }
                        $pages = substr($pages, 0, -2) . " &nbsp;<A HREF={$PHP_tmp_SELF}&LO_sort={$_REQUEST['LO_sort']}&LO_direction={$_REQUEST['LO_direction']}&LO_search=" . urlencode($_REQUEST['LO_search']) . "&page=" . ($Request_page + 1) . ">" . _('Next Page') . "</A><BR>";
                    }
                    echo $pages;
                    //echo '</td></tr></table></div>';
                    echo '</strong></div>';
                    //echo '<BR>';
                }
            } else {
                $start = 1;
                $stop = $result_count;
                if ($cols > 8 || $_REQUEST['expanded_view']) {
                    $_SESSION['orientation'] = 'landscape';
                    $repeat_headers = 16;
                } else {
                    $repeat_headers = 27;
                }
                if ($options['print']) {
                    $html = explode('<!-- new page -->', strtolower(ob_get_contents()));
                    $html = $html[count($html) - 1];
                    echo '</TD></TR></TABLE>';
                    $br = substr_count($html, '<br>') + substr_count($html, '</p>') + substr_count($html, '</tr>') + substr_count($html, '</h1>') + substr_count($html, '</h2>') + substr_count($html, '</h3>') + substr_count($html, '</h4>') + substr_count($html, '</h5>');
                    if ($br % 2 != 0) {
                        $br++;
                        echo '<BR>';
                    }
                } else {
                    echo '</TD></TR></TABLE>';
                }
            }
            // END MISC ---
            // WIDTH = 100%
            echo '<TABLE width=98% border=0 cellspacing=0 cellpadding=0><TR>';
            // SEARCH BOX & MORE HEADERS
            if ($where_message || $singular && $plural || !isset($_REQUEST['_openSIS_PDF']) && $options['search']) {
                echo '<TD align=center>';
                echo '<TABLE cellpadding=1 width=100% border=0 class=\\"grid\\">';
                echo "<TR><TD align=left valign=middle>";
                if ($singular && $plural && $options['count']) {
                    if ($display_count > 1) {
                        echo "<table cellpadding=5 cellspacing=5 class=alert_box align=left ><tr><td class=notice></td><td class=notice_msg ><b>{$display_count} {$plural} " . _('were found.') . "</b></td></tr></table>";
                    } elseif ($display_count == 1) {
                        echo "<table cellpadding=5 cellspacing=5 class=alert_box align=left ><tr><td class=notice></td><td class=notice_msg ><b>" . _('1') . " {$singular} " . _('was found.') . "</b></td></tr></table>";
                    }
                    #if($where_message)
                    #	echo '<br>'.$where_message;
                }
                if ($options['save'] && !isset($_REQUEST['_openSIS_PDF']) && $result_count > 0) {
                    //echo str_replace("Modules.php", "for_export.php", $PHP_tmp_SELF);
                    echo "<table cellpadding=0 cellspacing=0 class=download align=left ><tr><td><A HREF=" . str_replace('Modules.php', 'for_export.php', $PHP_tmp_SELF) . "&{$extra}&LO_save=1&_openSIS_PDF=true ><IMG SRC=assets/download.png border=0 alt=\"Download\" title=\"" . _('Download') . "\"></a></td></tr></table>";
                }
                //echo "<br><br><table class=download ><tr><td><A HREF=".str_replace('Modules.php', 'for_export.php', $PHP_tmp_SELF)."&$extra&_openSIS_PDF=true ><IMG SRC=assets/download.png border=0></a></td><td><A HREF=".str_replace('Modules.php', 'for_export.php', $PHP_tmp_SELF)."&$extra&_openSIS_PDF=true >Download</A></td></tr></table>";
                echo '</TD>';
                $colspan = 1;
                if (!isset($_REQUEST['_openSIS_PDF']) && $options['search']) {
                    $_REQUEST['portal_search'] = 'true';
                    $tmp_REQUEST = $_REQUEST;
                    unset($tmp_REQUEST['LO_search']);
                    unset($tmp_REQUEST['page']);
                    echo '<TD height="50" align=right valign=middle style="white-space:nowrap;">&nbsp;&nbsp;';
                    echo "<INPUT type=text class='cell_medium'  id=LO_search name=LO_search value='" . ($_REQUEST['LO_search'] && $_REQUEST['LO_search'] != 'Search' ? $_REQUEST['LO_search'] : 'Search\' style=\'color:BBBBBB\''), "' onfocus='if(this.value==\"Search\") this.value=\"\"; this.style.color=\"000000\";' onblur='if(this.value==\"\") {this.value=\"Search\"; this.style.color=\"BBBBBB\";}' onkeypress='if(event.keyCode==13){document.location.href=\"" . PreparePHP_SELF($tmp_REQUEST) . "&LO_search=\"+this.value; return false;} '>&nbsp;&nbsp;<INPUT type=button class='btn_go' value=" . _('Go') . " onclick='document.location.href=\"" . PreparePHP_SELF($tmp_REQUEST) . "&LO_search=\"+document.getElementById(\"LO_search\").value;'></TD>";
                    $colspan++;
                }
                echo "</TR>";
                echo '<TR style="height:0;"><TD width=100% align=center colspan=' . $colspan . '><DIV id=LOx' . (count($column_names) + ($result_count != 0 && $cols && !isset($_REQUEST['_openSIS_PDF']) ? 1 : 0) + ($remove && !isset($_REQUEST['_openSIS_PDF']) ? 1 : 0)) . ' style="width:0; position: relative; height:0;"></DIV></TD></TR></TABLE>';
            } else {
                echo '<TD width=100% align=right><DIV id=LOx' . (count($column_names) + ($result_count != 0 && $cols && !isset($_REQUEST['_openSIS_PDF']) ? 1 : 0) + ($remove && !isset($_REQUEST['_openSIS_PDF']) ? 1 : 0)) . ' style="width:0; position: relative; height:0;"></DIV>';
            }
            // END SEARCH BOX ----
            echo '</TD></TR><TR><TD>';
            // SHADOW
            if (!isset($_REQUEST['_openSIS_PDF'])) {
                //echo "<link rel='stylesheet' type='text/css' href='styles/paging.css' />\n";
                echo '<div id="pagerNavPosition"></div>';
                echo '<TABLE width=100% cellpadding=0 cellspacing=0><TR><TD align=center>';
            }
            echo "<TABLE id='results' cellpadding=6 width=96% cellspacing=1 class=\"grid\" align=center>";
            if (!isset($_REQUEST['_openSIS_PDF']) && $stop - $start > 10) {
                echo '<THEAD>';
            }
            if (!isset($_REQUEST['_openSIS_PDF'])) {
                echo '<TR>';
            }
            $i = 1;
            if ($remove && !isset($_REQUEST['_openSIS_PDF']) && $result_count != 0) {
                //THIS LINE IS FOR COLUMN HEADING
                echo "<TD class=subtabs><DIV id=LOx{$i} style='position: relative;'></DIV></TD>";
                $i++;
            }
            if ($result_count != 0 && $cols && !isset($_REQUEST['_openSIS_PDF'])) {
                foreach ($column_names as $key => $value) {
                    if ($_REQUEST['LO_sort'] == $key) {
                        $direction = -1 * $_REQUEST['LO_direction'];
                    } else {
                        $direction = 1;
                    }
                    //THIS LINE IS FOR COLUMN HEADING
                    echo "<TD class=subtabs><DIV id=LOx{$i} style='position: relative;'></DIV>";
                    echo "<A ";
                    if ($options['sort']) {
                        if ($for_window == 'for_window') {
                            echo "HREF=#";
                        } else {
                            echo "HREF={$PHP_tmp_SELF}&page={$_REQUEST['page']}&LO_sort={$key}&LO_direction={$direction}&LO_search=" . urlencode($_REQUEST['LO_search']);
                        }
                    }
                    echo " class=column_heading><b>{$value}</b></A>";
                    if ($i == 1) {
                        echo "<DIV id=LOy0 style='position: relative;'></DIV>";
                    }
                    echo "</TD>";
                    $i++;
                }
                //echo '<TD width=0><DIV id=LO'.$i.'></DIV></TD>';
                echo "</TR>";
            }
            $color = 'class=even';
            //style="height: 300px; overflow: auto; padding-right: 16px;"
            if (!isset($_REQUEST['_openSIS_PDF']) && $stop - $start > 10) {
                echo '</THEAD><TBODY>';
            }
            // mab - enable add link as first or last
            if ($result_count != 0 && $link['add']['first'] && $stop - $start >= $link['add']['first']) {
                //if($remove && !isset($_REQUEST['_openSIS_PDF']))
                //	$cols++;
                if ($link['add']['link'] && !isset($_REQUEST['_openSIS_PDF'])) {
                    echo "<TR><TD colspan=" . ($remove ? $cols + 1 : $cols) . " align=left class=even>" . button('add', $link['add']['title'], $link['add']['link']) . "</TD></TR>";
                } elseif ($link['add']['span'] && !isset($_REQUEST['_openSIS_PDF'])) {
                    echo "<TR><TD colspan=" . ($remove ? $cols + 1 : $cols) . " align=left class=even>" . button('add') . $link['add']['span'] . "</TD></TR>";
                } elseif ($link['add']['html'] && $cols) {
                    echo "<TR {$color}>";
                    if ($remove && !isset($_REQUEST['_openSIS_PDF']) && $link['add']['html']['remove']) {
                        echo "<TD class=even align=left>" . $link['add']['html']['remove'] . "</TD>";
                    } elseif ($remove && !isset($_REQUEST['_openSIS_PDF'])) {
                        echo "<TD class=even align=left>" . button('add') . "</TD>";
                    }
                    foreach ($column_names as $key => $value) {
                        echo "<TD class=even align=left >" . $link['add']['html'][$key] . "</TD>";
                    }
                    echo "</TR>";
                    $count++;
                }
            }
            for ($i = $start; $i <= $stop; $i++) {
                $item = $result[$i];
                if (isset($_REQUEST['_openSIS_PDF']) && $options['print'] && count($item)) {
                    foreach ($item as $key => $value) {
                        $value = eregi_replace('<SELECT.*SELECTED\\>([^<]+)<.*</SELECT\\>', '\\1', $value);
                        $value = eregi_replace('<SELECT.*</SELECT\\>', '', $value);
                        if (strpos($value, 'LO_field') === false) {
                            $item[$key] = str_replace(' ', '&nbsp;', ereg_replace("<div onclick='[^']+'>", '', $value));
                        } else {
                            $item[$key] = ereg_replace("<div onclick='[^']+'>", '', $value);
                        }
                    }
                }
                if ($item['row_color']) {
                    $color = $item['row_color'];
                } elseif ($color == 'class=even') {
                    $color = $side_color;
                } else {
                    $color = 'class=even';
                }
                //$color = '#EDF3FE';
                if (isset($_REQUEST['_openSIS_PDF']) && $count % $repeat_headers == 0) {
                    if ($count != 0) {
                        echo '</TABLE><TABLE cellpadding=6 width=820 class=\\"grid\\">';
                        echo '<!-- NEW PAGE -->';
                    }
                    echo "<TR>";
                    if ($remove && !isset($_REQUEST['_openSIS_PDF'])) {
                        echo "<TD class=grid></TD>";
                    }
                    if ($cols) {
                        foreach ($column_names as $key => $value) {
                            echo "<TD class=grid >" . str_replace(' ', '&nbsp;', $value) . "</TD>";
                        }
                    }
                    echo "</TR>";
                }
                if ($count == 0) {
                    $count = $br;
                }
                echo "<TR {$color}>";
                $count++;
                if ($remove && !isset($_REQUEST['_openSIS_PDF'])) {
                    $button_title = $link['remove']['title'];
                    //if(!$button_title)
                    //$button_title = 'Remove';
                    $button_link = $link['remove']['link'];
                    if (count($link['remove']['variables'])) {
                        foreach ($link['remove']['variables'] as $var => $val) {
                            $button_link .= "&{$var}=" . $item[$val];
                        }
                    }
                    echo "<TD {$color}>" . button('remove', $button_title, $button_link) . "</TD>";
                }
                if ($cols) {
                    foreach ($column_names as $key => $value) {
                        if ($link[$key] && !isset($_REQUEST['_openSIS_PDF'])) {
                            echo "<TD {$color} >";
                            if ($key == 'FULL_NAME') {
                                echo '<DIV id=LOy' . ($count - $br) . ' style="height: 100%; min-height: 100%; position: relative;">';
                            }
                            if ($link[$key]['js'] === true) {
                                echo "<A HREF=# onclick='window.open(\"{$link[$key][link]}";
                                if (count($link[$key]['variables'])) {
                                    foreach ($link[$key]['variables'] as $var => $val) {
                                        echo "&{$var}=" . urlencode($item[$val]);
                                    }
                                }
                                echo "\",\"\",\"scrollbars=yes,resizable=yes,width=800,height=400\");'";
                                if ($link[$key]['extra']) {
                                    echo ' ' . $link[$key]['extra'];
                                }
                                echo ">";
                            } else {
                                echo "<A HREF={$link[$key][link]}";
                                if (count($link[$key]['variables'])) {
                                    foreach ($link[$key]['variables'] as $var => $val) {
                                        echo "&{$var}=" . urlencode($item[$val]);
                                    }
                                }
                                if ($link[$key]['extra']) {
                                    echo ' ' . $link[$key]['extra'];
                                }
                                echo " onclick='grabA(this); return false;'>";
                            }
                            if ($color == Preferences('HIGHLIGHT')) {
                                echo '';
                            } else {
                                echo '<b>';
                            }
                            echo $item[$key];
                            echo '</b>';
                            if (!$item[$key]) {
                                echo '***';
                            }
                            echo "</A>";
                            if ($key == 'FULL_NAME') {
                                echo '</DIV>';
                            }
                            echo "</TD>";
                        } else {
                            echo "<TD {$color} >";
                            if ($key == 'FULL_NAME') {
                                echo '<DIV id=LOy' . ($count - $br) . '  style="position: relative;">';
                            }
                            if ($color == Preferences('HIGHLIGHT')) {
                                echo '';
                            }
                            echo $item[$key];
                            if (!$item[$key]) {
                                echo '&nbsp;';
                            }
                            if ($key == 'FULL_NAME') {
                                echo '<DIV>';
                            }
                            echo "</TD>";
                        }
                    }
                }
                echo "</TR>";
            }
            if ($result_count != 0 && (!$link['add']['first'] || $link['add']['first'] && $stop - $start < $link['add']['first'])) {
                //if($remove && !isset($_REQUEST['_openSIS_PDF']))
                //	$cols++;
                if ($link['add']['link'] && !isset($_REQUEST['_openSIS_PDF'])) {
                    echo "<TR><TD colspan=" . ($remove ? $cols + 1 : $cols) . " align=left class=even>" . button('add', $link['add']['title'], $link['add']['link']) . "</TD></TR>";
                } elseif ($link['add']['span'] && !isset($_REQUEST['_openSIS_PDF'])) {
                    echo "<TR><TD colspan=" . ($remove ? $cols + 1 : $cols) . " align=left class=even>" . button('add') . $link['add']['span'] . "</TD></TR>";
                } elseif ($link['add']['html'] && $cols) {
                    if ($count % 2) {
                        $color = 'class=even';
                    } else {
                        $color = $side_color;
                    }
                    echo "<TR {$color}>";
                    if ($remove && !isset($_REQUEST['_openSIS_PDF']) && $link['add']['html']['remove']) {
                        echo "<TD class=even align=left>" . $link['add']['html']['remove'] . "</TD>";
                    } elseif ($remove && !isset($_REQUEST['_openSIS_PDF'])) {
                        echo "<TD class=even align=left class=grid_button>" . button('add') . "</TD>";
                    }
                    foreach ($column_names as $key => $value) {
                        echo "<TD class=even align=left  valign=top>" . $link['add']['html'][$key] . "</TD>";
                    }
                    echo "</TR>";
                }
            }
            if ($result_count != 0) {
                if (!isset($_REQUEST['_openSIS_PDF']) && $stop - $start > 10) {
                    echo '</TBODY>';
                }
                echo "</TABLE>";
                // SHADOW
                if (!isset($_REQUEST['_openSIS_PDF'])) {
                    echo '</TD ></TR></TABLE>';
                    echo "<script language='javascript' type='text/javascript'>\n";
                    #echo "alert('calling pager');\n";
                    $number_rec = 100;
                    echo "var pager = new Pager('results',{$number_rec});\n";
                    echo "pager.init();\n";
                    echo "pager.showPageNav('pager', 'pagerNavPosition');\n";
                    echo "pager.showPage(1);\n";
                    echo "</script>\n";
                }
                echo "</TD ></TR>";
                echo "</TABLE>";
                if ($options['center']) {
                    echo '';
                }
            }
            // END PRINT THE LIST ---
        }
        if ($result_count == 0) {
            // mab - problem with table closing if not opened above - do same conditional?
            if ($result_count > $num_displayed || ($options['count'] || $display_zero) && (($result_count == 0 || $display_count == 0) && $plural || ($result_count == 0 || $display_count == 0))) {
                #echo '<td>'; //edited for Search in parents (user>> associate student with parents)
                if ($link['add']['link'] && !isset($_REQUEST['_openSIS_PDF'])) {
                    echo '<table width=120px cellspacing=8 cellpadding=6 ><tr><TD align=left class=lone_add >' . button('add', $link['add']['title'], $link['add']['link']) . '</td></tr></table>';
                } elseif (($link['add']['html'] || $link['add']['span']) && count($column_names) && !isset($_REQUEST['_openSIS_PDF'])) {
                    $color = $side_color;
                    if ($options['center']) {
                        #echo '<CENTER>';
                        // WIDTH=100%
                        //echo "<TABLE cellpadding=1 bgcolor=#f8f8f9 width=100%><TR><TD>";
                        // SHADOW
                        echo '<TABLE width=100% cellpadding=0 cellspacing=0><TR><TD align=center>';
                    }
                    if ($link['add']['html']) {
                        /*Here also change the colour for left corner*/
                        echo "<TABLE cellpadding=6 cellspacing=1 width=96% class=\"grid\"><TR><TD class=subtabs></TD>";
                        foreach ($column_names as $key => $value) {
                            //Here to change the ListOutput Header Colour
                            echo "<TD class=subtabs><A><b>" . str_replace(' ', '&nbsp;', $value) . "</b></A></TD>";
                        }
                        echo "</TR>";
                        echo "<TR class=odd>";
                        if ($link['add']['html']['remove']) {
                            echo "<TD >" . $link['add']['html']['remove'] . "</TD>";
                        } else {
                            echo "<TD>" . button('add') . "</TD>";
                        }
                        foreach ($column_names as $key => $value) {
                            echo "<TD >" . $link['add']['html'][$key] . "</TD>";
                        }
                        echo "</TR>";
                        echo "</TABLE>";
                    } elseif ($link['add']['span'] && !isset($_REQUEST['_openSIS_PDF'])) {
                        echo "<TABLE><TR><TD align=center>" . button('add') . $link['add']['span'] . "</TD></TR></TABLE>";
                    }
                    // SHADOW
                    //echo '</TD></TR></TABLE>';
                    echo "</TD></TR></TABLE>";
                    if ($options['center']) {
                        echo '</CENTER>';
                    }
                }
            }
        }
        if ($result_count != 0) {
            if ($options['yscroll']) {
                echo '<div id="LOy_layer" style="position: absolute; top: 0; left: 0; visibility:hidden;">';
                echo '<TABLE cellpadding=6 id=LOy_table>';
                $i = 1;
                if ($cols && !isset($_REQUEST['_openSIS_PDF'])) {
                    $color = $side_color;
                    foreach ($result as $item) {
                        echo "<TR><TD {$color}  id=LO_row{$i}>";
                        if ($color == Preferences('HIGHLIGHT')) {
                            echo '';
                        }
                        echo $item['FULL_NAME'];
                        if (!$item['FULL_NAME']) {
                            echo '&nbsp;';
                        }
                        if ($color == Preferences('HIGHLIGHT')) {
                            echo '';
                        }
                        echo "</TD></TR>";
                        $i++;
                        if ($item['row_color']) {
                            $color = $item['row_color'];
                        } elseif ($color == 'class=even') {
                            $color = $side_color;
                        } else {
                            $color = 'class=even';
                        }
                    }
                }
                echo '</TABLE>';
                echo '</div>';
            }
            echo '<div id="LOx_layer" style="position: absolute; top: 0; left: 0; visibility:hidden;">';
            echo '<TABLE cellpadding=6 id=LOx_table><TR>';
            $i = 1;
            if ($remove && !isset($_REQUEST['_openSIS_PDF']) && $result_count != 0) {
                echo "<TD class=grid id=LO_col{$i}></TD>";
                $i++;
            }
            if ($cols && !isset($_REQUEST['_openSIS_PDF'])) {
                foreach ($column_names as $key => $value) {
                    echo '<TD class=grid id=LO_col' . $i . '><A class=column_heading><b>' . str_replace('controller', '', $value) . '</b></A></TD>';
                    $i++;
                }
            }
            echo '</TR></TABLE>';
            echo '</div>';
        }
    }
}
        break;
}
$start = time() - ($today - $START_DAY) * 60 * 60 * 24;
$end = time();
if (!$_REQUEST['start_date']) {
    $start_time = $start;
    $start_date = mb_strtoupper(date('d-M-y', $start_time));
    $end_date = mb_strtoupper(date('d-M-y', $end));
} else {
    $start_time = $_REQUEST['start_date'];
    $start_date = mb_strtoupper(date('d-M-y', $start_time));
    $end_date = mb_strtoupper(date('d-M-y', $start_time + 60 * 60 * 24 * 7));
}
DrawHeader(ProgramTitle());
if ($_REQUEST['search_modfunc'] || User('PROFILE') == 'parent' || User('PROFILE') == 'student') {
    $tmp_PHP_SELF = PreparePHP_SELF();
    echo '<FORM action="' . $tmp_PHP_SELF . '" method="POST">';
    $begin_year = DBGet(DBQuery("SELECT min(date_part('epoch',SCHOOL_DATE)) as SCHOOL_DATE FROM ATTENDANCE_CALENDAR WHERE SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "'"));
    $begin_year = $begin_year[1]['SCHOOL_DATE'];
    if (is_null($begin_year)) {
        ErrorMessage(array(_('There are no calendars yet setup.')), 'fatal');
    }
    $date_select = '<OPTION value="' . $start . '">' . date('M d, Y', $start) . ' - ' . date('M d, Y', $end) . '</OPTION>';
    for ($i = $start - 60 * 60 * 24 * 7; $i >= $begin_year; $i -= 60 * 60 * 24 * 7) {
        $date_select .= '<OPTION value="' . $i . '"' . ($i + 86400 >= $start_time && $i - 86400 <= $start_time ? ' SELECTED="SELECTED"' : '') . '>' . date('M d, Y', $i) . ' - ' . date('M d, Y', $i + 1 + ($END_DAY - $START_DAY) * 60 * 60 * 24) . '</OPTION>';
    }
    DrawHeader('<SELECT name="start_date">' . $date_select . '</SELECT>' . $period_select, SubmitButton(_('Go')));
    echo '</FORM>';
}
$extra['SELECT'] = ",e.ELIGIBILITY_CODE,c.TITLE as COURSE_TITLE";
$extra['FROM'] = ",ELIGIBILITY e,COURSES c,COURSE_PERIODS cp";
                 $sep = '';
                 foreach ($mps[$last_mp][1]['COMMENTS_RET'] as $comment) {
                     $grades_RET[$i]['COMMENT'] .= $sep . $comments_RET[$comment['REPORT_CARD_COMMENT_ID']][1]['SORT_ORDER'];
                     if ($comment['COMMENT']) {
                         $grades_RET[$i]['COMMENT'] .= '(' . ($comment['COMMENT'] != ' ' ? $comment['COMMENT'] : '&middot;') . ')';
                     }
                     $sep = ', ';
                 }
                 if ($mps[$last_mp][1]['COMMENT_TITLE']) {
                     $grades_RET[$i]['COMMENT'] .= $sep . $mps[$last_mp][1]['COMMENT_TITLE'];
                 }
             }
         }
     }
     if (count($_REQUEST['mp_arr']) == 1 && AllowEdit()) {
         $link['remove']['link'] = PreparePHP_SELF($_REQUEST, array(), array('modfunc' => 'delete'));
         $link['remove']['variables'] = array('student_id' => 'STUDENT_ID', 'course_period_id' => 'COURSE_PERIOD_ID', 'marking_period_id' => 'MARKING_PERIOD_ID');
     }
     if (!isset($_REQUEST['_ROSARIO_PDF'])) {
         $commentsB_RET = DBGet(DBQuery("SELECT ID,TITLE,SORT_ORDER FROM REPORT_CARD_COMMENTS WHERE SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "' AND COURSE_ID IS NULL ORDER BY SORT_ORDER"), array(), array('ID'));
         if (count($commentsB_RET)) {
             foreach ($commentsB_RET as $comment) {
                 $tipmessage .= $comment[1]['SORT_ORDER'] . ' - ' . str_replace("'", '&acute;', $comment[1]['TITLE']) . '<BR />';
             }
             $tipmessage = button('comment', _('Comment Codes'), '"#" onmouseover=\'stm(["' . _('Report Card Comments') . '","' . str_replace('"', '\\"', str_replace("'", '&#39;', $tipmessage)) . '"],tipmessageStyle);\' onmouseout=\'htm()\'', 24);
             DrawHeader('', $tipmessage);
         }
     }
     ListOutput($grades_RET, $columns, '.', '.', $link);
 } else {
     $error[] = _('No Students were found.');
 if (is_array($extra['columns_before'])) {
     $columns = $extra['columns_before'] + $columns;
 }
 if (is_array($extra['columns_after'])) {
     $columns += $extra['columns_after'];
 }
 if (count($staff_RET) > 1 || $link['add'] || !$link['FULL_NAME'] || $extra['columns_before'] || $extra['columns_after'] || $extra['BackPrompt'] == false && count($staff_RET) == 0 || $extra['Redirect'] === false && count($staff_RET) == 1) {
     if ($_REQUEST['expanded_view'] != 'true') {
         DrawHeader('<A HREF="' . PreparePHP_SELF($_REQUEST, array(), array('expanded_view' => 'true')) . '">' . _('Expanded View') . '</A>', $extra['header_right']);
     } else {
         DrawHeader('<A HREF="' . PreparePHP_SELF($_REQUEST, array(), array('expanded_view' => 'false')) . '">' . _('Original View') . '</A>', $extra['header_right']);
     }
     DrawHeader($extra['extra_header_left'], $extra['extra_header_right']);
     DrawHeader(str_replace('<BR />', '<BR /> &nbsp;', mb_substr($_ROSARIO['SearchTerms'], 0, -6)));
     if (!$_REQUEST['LO_save'] && !$extra['suppress_save']) {
         $_SESSION['List_PHP_SELF'] = PreparePHP_SELF($_SESSION['_REQUEST_vars'], array('bottom_back'));
         if ($_SESSION['Back_PHP_SELF'] != 'staff') {
             $_SESSION['Back_PHP_SELF'] = 'staff';
             unset($_SESSION['Search_PHP_SELF']);
         }
         echo '<script type="text/javascript">parent.help.location.reload();</script>';
     }
     if ($extra['profile']) {
         ListOutput($staff_RET, $columns, $singular, $plural, $link, false, $extra['options']);
     } else {
         //modif Francois: add translation
         ListOutput($staff_RET, $columns, 'User', 'Users', $link, false, $extra['options']);
     }
 } elseif (count($staff_RET) == 1) {
     if (count($link['FULL_NAME']['variables'])) {
         foreach ($link['FULL_NAME']['variables'] as $var => $val) {
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#***************************************************************************************
#DrawHeader('Gradebook - '.ProgramTitle());
include '../../Redirect_modules.php';
$tmp_REQUEST = $_REQUEST;
unset($tmp_REQUEST['include_inactive']);
echo "<FORM action=Modules.php?modname={$_REQUEST['modname']} method=POST>";
DrawHeaderHome('<INPUT type=checkbox name=include_inactive value=Y' . ($_REQUEST['include_inactive'] == 'Y' ? " CHECKED onclick='document.location.href=\"" . PreparePHP_SELF($tmp_REQUEST) . "&include_inactive=\";'" : " onclick='document.location.href=\"" . PreparePHP_SELF($tmp_REQUEST) . "&include_inactive=Y\";'") . '>Include Inactive Students');
echo '</FORM>';
$course_period_id = UserCoursePeriod();
$course_id = DBGet(DBQuery("SELECT COURSE_ID FROM COURSE_PERIODS WHERE COURSE_PERIOD_ID='{$course_period_id}'"));
$course_id = $course_id[1]['COURSE_ID'];
$max_allowed = Preferences('ANOMALOUS_MAX', 'Gradebook') / 100;
$extra['SELECT'] = ",ga.ASSIGNMENT_ID,gt.TITLE AS TYPE_TITLE,ga.TITLE,ga.POINTS AS TOTAL_POINTS,'' AS LETTER_GRADE";
$extra['SELECT'] .= ',(SELECT POINTS FROM GRADEBOOK_GRADES WHERE STUDENT_ID=s.STUDENT_ID AND ASSIGNMENT_ID=ga.ASSIGNMENT_ID) AS POINTS';
$extra['SELECT'] .= ',(SELECT COMMENT FROM GRADEBOOK_GRADES WHERE STUDENT_ID=s.STUDENT_ID AND ASSIGNMENT_ID=ga.ASSIGNMENT_ID) AS COMMENT';
$extra['FROM'] = ",GRADEBOOK_ASSIGNMENTS ga,GRADEBOOK_ASSIGNMENT_TYPES gt";
$extra['WHERE'] = 'AND ((SELECT POINTS FROM GRADEBOOK_GRADES WHERE STUDENT_ID=s.STUDENT_ID AND ASSIGNMENT_ID=ga.ASSIGNMENT_ID) IS NULL AND (ga.ASSIGNED_DATE IS NULL OR CURRENT_DATE>=ga.ASSIGNED_DATE) AND (ga.DUE_DATE IS NULL OR CURRENT_DATE>=ga.DUE_DATE) OR (SELECT POINTS FROM GRADEBOOK_GRADES WHERE STUDENT_ID=s.STUDENT_ID AND ASSIGNMENT_ID=ga.ASSIGNMENT_ID)<0 OR (SELECT POINTS FROM GRADEBOOK_GRADES WHERE STUDENT_ID=s.STUDENT_ID AND ASSIGNMENT_ID=ga.ASSIGNMENT_ID)>ga.POINTS*' . $max_allowed . ') AND ((ga.COURSE_ID=\'' . $course_id . '\' AND ga.STAFF_ID=\'' . User('STAFF_ID') . '\') OR ga.COURSE_PERIOD_ID=\'' . $course_period_id . '\') AND ga.MARKING_PERIOD_ID=\'' . UserMP() . '\' AND gt.ASSIGNMENT_TYPE_ID=ga.ASSIGNMENT_TYPE_ID';
$extra['functions'] = array('POINTS' => '_makePoints');
$students_RET = GetStuList($extra);
//echo '<pre>'; var_dump($students_RET); echo '</pre>';
if (AllowUse('Grades/Grades.php')) {
    $link = array('FULL_NAME' => array('link' => "Modules.php?modname=Grades/Grades.php&include_ianctive={$_REQUEST['include_inactive']}&assignment_id=all", 'variables' => array('student_id' => 'STUDENT_ID')), 'TITLE' => array('link' => "Modules.php?modname=Grades/Grades.php&include_inactive={$_REQUEST['include_inactive']}", 'variables' => array('assignment_id' => 'ASSIGNMENT_ID', 'student_id' => 'STUDENT_ID')));
Exemple #30
0
        DBQuery("CALL SEAT_FILL()");
        unset($_SESSION['_REQUEST_vars']['schedule']);
        unset($_REQUEST['schedule']);
    }
    if (UserStudentID() && $_REQUEST['modfunc'] != 'choose_course' && $_REQUEST['modfunc'] != 'more_info') {
        echo "<FORM name=modify id=modify action=Modules.php?modname=" . strip_tags(trim($_REQUEST[modname])) . "&modfunc=modify METHOD=POST>";
        $tmp_REQUEST = $_REQUEST;
        unset($tmp_REQUEST['include_inactive']);
        ##################################################################
        $years_RET = DBGet(DBQuery('SELECT MARKING_PERIOD_ID,TITLE,NULL AS SEMESTER_ID FROM school_years WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . "'"));
        $semesters_RET = DBGet(DBQuery('SELECT MARKING_PERIOD_ID,TITLE,NULL AS SEMESTER_ID FROM school_semesters WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\' ORDER BY SORT_ORDER'));
        $uarters_RET = DBGet(DBQuery('SELECT MARKING_PERIOD_ID,TITLE,SEMESTER_ID FROM school_quarters WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\' ORDER BY SORT_ORDER'));
        $mp_RET = DBGet(DBQuery('SELECT MARKING_PERIOD_ID,TITLE,SORT_ORDER,1 AS TBL FROM school_years WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\' UNION SELECT MARKING_PERIOD_ID,TITLE,SORT_ORDER,2 AS TBL FROM school_semesters WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\' UNION SELECT MARKING_PERIOD_ID,TITLE,SORT_ORDER,3 AS TBL FROM school_quarters WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\' ORDER BY TBL,SORT_ORDER'));
        $mp = CreateSelect($mp_RET, 'marking_period_id', 'Modules.php?modname=' . $_REQUEST['modname'] . '&marking_period_id=', $_REQUEST['marking_period_id']);
        ###################################################################3
        DrawHeaderHome(PrepareDateSchedule($date, '_date', false, array('submit' => true)) . ' <INPUT type=checkbox name=include_inactive value=Y' . ($_REQUEST['include_inactive'] == 'Y' ? " CHECKED onclick='document.location.href=\"" . PreparePHP_SELF($tmp_REQUEST) . "&include_inactive=\";'" : " onclick='document.location.href=\"" . PreparePHP_SELF($tmp_REQUEST) . "&include_inactive=Y\";'") . '>Include Inactive Courses : &nbsp;  Marking Period :  ' . $mp . ' &nbsp;', SubmitButton('Save', '', 'class=btn_medium onclick=\'formload_ajax("modify");\''));
        $fy_id = DBGet(DBQuery('SELECT MARKING_PERIOD_ID FROM school_years WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\''));
        $fy_id = $fy_id[1]['MARKING_PERIOD_ID'];
        $sql = 'SELECT          
                              s.COURSE_ID as ACTION,
				s.COURSE_ID,s.COURSE_PERIOD_ID,s.ID AS SCHEDULE_ID,
				s.MARKING_PERIOD_ID,s.START_DATE,s.END_DATE,s.MODIFIED_DATE,s.MODIFIED_BY,
				UNIX_TIMESTAMP(s.START_DATE) AS START_EPOCH,UNIX_TIMESTAMP(s.END_DATE) AS END_EPOCH,sp.PERIOD_ID,
				cpv.PERIOD_ID,cp.MARKING_PERIOD_ID as COURSE_MARKING_PERIOD_ID,cp.MP,sp.SORT_ORDER,
				c.TITLE,cp.COURSE_PERIOD_ID AS PERIOD_PULLDOWN,
				s.STUDENT_ID,r.TITLE AS ROOM,(SELECT GROUP_CONCAT(cpv.DAYS) FROM course_period_var cpv WHERE cpv.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID) as DAYS,SCHEDULER_LOCK,CONCAT(st.LAST_NAME, \'' . ' ' . '\' ,st.FIRST_NAME) AS MODIFIED_NAME
			FROM courses c,course_periods cp,course_period_var cpv,school_periods sp,rooms r,schedule s
                        LEFT JOIN staff st ON s.MODIFIED_BY = st.STAFF_ID
			WHERE
			 s.COURSE_ID = c.COURSE_ID AND s.COURSE_ID = cp.COURSE_ID
				AND s.COURSE_PERIOD_ID = cp.COURSE_PERIOD_ID