}
    echo "<FORM action=Modules.php?modname={$_REQUEST['modname']} method=POST>";
    DrawHeader(ProgramTitle(), '<INPUT type=submit value=' . _('Update') . '>');
    if ($REQ_codes) {
        foreach ($REQ_codes as $code) {
            $code_pulldowns .= _makeCodeSearch($code);
        }
    } elseif ($abs) {
        $code_pulldowns = _makeCodeSearch('A');
    } else {
        $code_pulldowns = _makeCodeSearch();
    }
    if (UserStudentID()) {
        $current_student_link = "<A HREF=Modules.php?modname={$_REQUEST['modname']}&modfunc=student&month_date={$_REQUEST['month_date']}&day_date={$_REQUEST['day_date']}&year_date={$_REQUEST['year_date']}&student_id=" . UserStudentID() . ">Current Student</A></TD><TD>";
    }
    DrawHeader(PrepareDate($date, '_date'), '<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>');
    $_REQUEST['search_modfunc'] = 'list';
    Search('student_id', $extra);
    echo "</FORM>";
}
function _makePhone($value, $column)
{
    global $THIS_RET, $contacts_RET;
    if (count($contacts_RET[$THIS_RET['STUDENT_ID']])) {
        foreach ($contacts_RET[$THIS_RET['STUDENT_ID']] as $person) {
            if ($person[1]['FIRST_NAME'] || $person[1]['LAST_NAME']) {
                $tipmessage .= '<B>' . $person[1]['STUDENT_RELATION'] . ': ' . $person[1]['FIRST_NAME'] . ' ' . $person[1]['LAST_NAME'] . '</B><BR>';
            }
            $tipmessage .= '<TABLE>';
            if ($person[1]['PHONE']) {
                $tipmessage .= '<TR><TD align=right><font color=gray size=1 face=Verdana,Arial,Helvetica>' . _('Home Phone') . '</font> </TD><TD><font size=1 face=Verdana,Arial,Helvetica>' . $person[1]['PHONE'] . '</font></TD></TR>';
    }
    if ($REQ_codes) {
        foreach ($REQ_codes as $code) {
            $code_pulldowns .= _makeCodeSearch($code);
        }
    } elseif ($abs) {
        $code_pulldowns = _makeCodeSearch('A');
    } else {
        $code_pulldowns = _makeCodeSearch();
    }
    echo '<FORM action="' . PreparePHP_SELF($_REQUEST, array('day_date', 'month_date', 'year_date', 'codes')) . '" method="POST">';
    DrawHeader(PrepareDate($date, '_date', false, array('submit' => true)), SubmitButton(_('Update')));
    if (UserStudentID()) {
        $current_student_link = '<A HREF="Modules.php?modname=' . $_REQUEST['modname'] . '&modfunc=student&month_date=' . $_REQUEST['month_date'] . '&day_date=' . $_REQUEST['day_date'] . '&year_date=' . $_REQUEST['year_date'] . '&student_id=' . UserStudentID() . '&table=' . $_REQUEST['table'] . '">' . _('Current Student') . '</A></TD><TD>';
    }
    $headerr = '<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>';
    echo '<TABLE class="width-100p cellspacing-0 cellpadding-0"><TR><TD style="text-align:left; background-color: #fff">' . $headerl . '</TD><TD style="text-align:right; background-color: #fff">' . $headerr . '</TD></TR></TABLE>';
    $_REQUEST['search_modfunc'] = 'list';
    Search('student_id', $extra);
    echo '<BR /><span class="center">' . SubmitButton(_('Update')) . '</span>';
    echo "</FORM>";
}
function _makePhone($value, $column)
{
    global $contacts_RET;
    if (count($contacts_RET[$value])) {
        foreach ($contacts_RET[$value] as $person) {
            if ($person[1]['FIRST_NAME'] || $person[1]['LAST_NAME']) {
                $tipmessage .= $person[1]['STUDENT_RELATION'] . ': ' . $person[1]['FIRST_NAME'] . ' ' . $person[1]['LAST_NAME'] . '<BR />';
            }
            $tipmessage .= '<TABLE>';
     } elseif ($month == 'SEP') {
         $month = '09';
     } elseif ($month == 'OCT') {
         $month = '10';
     } elseif ($month == 'NOV') {
         $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';
         $month = '08';
     } elseif ($month == 'SEP') {
         $month = '09';
     } elseif ($month == 'OCT') {
         $month = '10';
     } elseif ($month == 'NOV') {
         $month = '11';
     } elseif ($month == 'DEC') {
         $month = '12';
     }
     $final_date = $year . "-" . $month . "-" . $day;
     $date = $final_date;
 }
 //--------- if end --------------//
 //------------------------------ Date Edit End -------------------------------------------//
 DrawHeader('<TABLE><TR><TD>' . DateInputAY($date, 'date', 1) . '</TD><TD>&nbsp;&nbsp;&nbsp;&nbsp;</TD><TD>' . SubmitButton('Go', '', 'class=btn_medium') . '</TD><TR></TABLE>', '<TABLE><TR><TD>' . (count($codes_RET) > 0 ? " <a href=# onclick=toggle_attendance_code()><IMG SRC='assets/add_button.gif'border=0 vspace=0 ></a><a id=click_plus href=# onclick='javascript:addHTML(\"" . str_replace('"', '\\"', _makeCodeSearch()) . "\",\"code_pulldowns\");'></a>" : '') . '</TD><TD><DIV id=code_pulldowns>' . $code_pulldowns . '</DIV></TD></TR></TABLE>');
 echo "<input type='hidden' name='p_c' value='" . (isset($_REQUEST['p_c']) ? $_REQUEST['p_c'] : 0) . "' id='p_c'>";
 echo "<input type='hidden' value='" . count($codes_RET) . "' id='base'>";
 $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 {