コード例 #1
0
function _makeColor($value, $column)
{
    global $THIS_RET, $RET, $attendance_codes;
    if ($_REQUEST['period_id']) {
        if (!$attendance_codes) {
            $attendance_codes = DBGet(DBQuery('SELECT ID,DEFAULT_CODE,STATE_CODE,SHORT_NAME FROM attendance_codes WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\' AND TABLE_NAME=\'0\''), array(), array('ID'));
        }
        if ($attendance_codes[$RET[$THIS_RET['STUDENT_ID']][$column][1]['ATTENDANCE_CODE']][1]['DEFAULT_CODE'] == 'Y') {
            return "<TABLE bgcolor=#00FF00 cellpadding=0 cellspacing=0 width=10 class=LO_field><TR><TD>" . makeCodePulldown($RET[$THIS_RET['STUDENT_ID']][$column][1]['ATTENDANCE_CODE'], $THIS_RET['STUDENT_ID'], $column) . "</TD></TR></TABLE>";
        } elseif ($attendance_codes[$RET[$THIS_RET['STUDENT_ID']][$column][1]['ATTENDANCE_CODE']][1]['STATE_CODE'] == 'P') {
            return "<TABLE bgcolor=#FFCC00 cellpadding=0 cellspacing=0 width=10 class=LO_field><TR><TD>" . makeCodePulldown($RET[$THIS_RET['STUDENT_ID']][$column][1]['ATTENDANCE_CODE'], $THIS_RET['STUDENT_ID'], $column) . "</TD></TR></TABLE>";
        } elseif ($attendance_codes[$RET[$THIS_RET['STUDENT_ID']][$column][1]['ATTENDANCE_CODE']][1]['STATE_CODE'] == 'A') {
            return "<TABLE bgcolor=#FF0000 cellpadding=0 cellspacing=0 width=10 class=LO_field><TR><TD>" . makeCodePulldown($RET[$THIS_RET['STUDENT_ID']][$column][1]['ATTENDANCE_CODE'], $THIS_RET['STUDENT_ID'], $column) . "</TD></TR></TABLE>";
        }
    } else {
        if ($RET[$THIS_RET['STUDENT_ID']][$column][1]['STATE_VALUE'] == '0.0') {
            return "<TABLE bgcolor=#FF0000 cellpadding=0 cellspacing=0 width=10 class=LO_field><TR><TD>A</TD></TR></TABLE>";
        } elseif ($RET[$THIS_RET['STUDENT_ID']][$column][1]['STATE_VALUE'] > 0 && $RET[$THIS_RET['STUDENT_ID']][$column][1]['STATE_VALUE'] < 1) {
            return "<TABLE bgcolor=#FFCC00 cellpadding=0 cellspacing=0 width=10 class=LO_field><TR><TD>H</TD></TR></TABLE>";
        } elseif ($RET[$THIS_RET['STUDENT_ID']][$column][1]['STATE_VALUE'] == 1) {
            return "<TABLE bgcolor=#00FF00 cellpadding=0 cellspacing=0 width=10 class=LO_field><TR><TD>P</TD></TR></TABLE>";
        }
    }
}
コード例 #2
0
function _makeColor($value, $column)
{
    global $THIS_RET, $att_RET, $att_sql, $attendance_codes;
    //modif Francois: add translation:
    $attendance_codes_locale = array('P' => _('Present'), 'A' => _('Absent'), 'H' => _('Half'));
    if (!$att_RET[$THIS_RET['STUDENT_ID']]) {
        $att_RET[$THIS_RET['STUDENT_ID']] = DBGet(DBQuery($att_sql . $THIS_RET['STUDENT_ID']), array(), array('SHORT_DATE'));
    }
    if ($_REQUEST['period_id']) {
        if (!$attendance_codes) {
            $attendance_codes = DBGet(DBQuery("SELECT ID,DEFAULT_CODE,STATE_CODE,SHORT_NAME FROM ATTENDANCE_CODES WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "' AND TABLE_NAME='0'"), array(), array('ID'));
        }
        $ac = $att_RET[$THIS_RET['STUDENT_ID']][$column][1]['ATTENDANCE_CODE'];
        if ($attendance_codes[$ac][1]['DEFAULT_CODE'] == 'Y') {
            //modif Francois: remove LO_field
            return '<TABLE class="cellpadding-0 cellspacing-0" style="width:10px;"><TR><TD style="background-color:#00FF00;">' . makeCodePulldown($ac, $THIS_RET['STUDENT_ID'], $column) . '</TD></TR></TABLE>';
        } elseif ($attendance_codes[$ac][1]['STATE_CODE'] == 'P') {
            return '<TABLE class="cellpadding-0 cellspacing-0" style="width:10px;"><TR><TD style="background-color:#0000FF;">' . makeCodePulldown($ac, $THIS_RET['STUDENT_ID'], $column) . '</TD></TR></TABLE>';
        } elseif ($attendance_codes[$ac][1]['STATE_CODE'] == 'A') {
            return '<TABLE class="cellpadding-0 cellspacing-0" style="width:10px;"><TR><TD style="background-color:#FF0000;">' . makeCodePulldown($ac, $THIS_RET['STUDENT_ID'], $column) . '</TD></TR></TABLE>';
        } elseif ($attendance_codes[$ac][1]['STATE_CODE'] == 'H') {
            return '<TABLE class="cellpadding-0 cellspacing-0" style="width:10px;"><TR><TD style="background-color:#FFCC00;">' . makeCodePulldown($ac, $THIS_RET['STUDENT_ID'], $column) . '</TD></TR></TABLE>';
        } elseif ($ac) {
            return '<TABLE class="cellpadding-0 cellspacing-0" style="width:10px;"><TR><TD style="background-color:#FFFF00;">' . makeCodePulldown($ac, $THIS_RET['STUDENT_ID'], $column) . '</TD></TR></TABLE>';
        }
    } else {
        $ac = $att_RET[$THIS_RET['STUDENT_ID']][$column][1]['STATE_VALUE'];
        if ($ac == '0.0') {
            return '<TABLE class="cellpadding-0 cellspacing-0" style="width:10px;"><TR><TD style="background-color:#FF0000;">' . mb_substr($attendance_codes_locale['A'], 0, 3) . '</TD></TR></TABLE>';
        } elseif ($ac > 0 && $ac < 1) {
            return '<TABLE class="cellpadding-0 cellspacing-0" style="width:10px;"><TR><TD style="background-color:#FFCC00;">' . mb_substr($attendance_codes_locale['H'], 0, 3) . '</TD></TR></TABLE>';
        } elseif ($ac == 1) {
            return '<TABLE class="cellpadding-0 cellspacing-0" style="width:10px;"><TR><TD style="background-color:#00FF00;">' . mb_substr($attendance_codes_locale['P'], 0, 3) . '</TD></TR></TABLE>';
        }
    }
}