function makeCheckInput($value, $name)
{
    global $THIS_RET;
    if ($THIS_RET['ID']) {
        $id = $THIS_RET['ID'];
    } else {
        $id = 'new';
    }
    if ($id == 'new') {
        return CheckboxInputWithID('Y', "values[{$id}][{$name}]", $name . $id, '', '', $new = false, 'Yes', 'No', '', $extra = '');
    } else {
        return CheckboxInputWithID($value, "values[{$id}][{$name}]", $name . $id, '', '', $new = false, 'Yes', 'No', '', $extra = '');
    }
}
Beispiel #2
0
 }
 $header .= '<TD>';
 if ($new == false) {
     $header .= '<DIV id=days><div onclick=\'addHTML("';
 }
 $header .= '<TABLE><TR>';
 $days = array('U', 'M', 'T', 'W', 'H', 'F', 'S');
 $day_id = 1;
 foreach ($days as $day) {
     if (strpos($RET['DAYS'], $day) !== false || $new && $day != 'S' && $day != 'U') {
         $value = 'Y';
     } else {
         $value = '';
     }
     //$header .= '<TD>'.str_replace('"','\"',CheckboxInput($value,'tables[course_periods]['.$_REQUEST['course_period_id'].'][DAYS]['.$day.']',($day=='U'?'S':$day),$checked,false,'','',false)).'</TD>';
     $header .= '<TD>' . str_replace('"', '\\"', CheckboxInputWithID($value, 'tables[course_periods][' . $_REQUEST['course_period_id'] . '][DAYS][' . $day . ']', 'DAYS' . $day_id, $day == 'U' ? 'S' : $day, $checked, false, '', '', false)) . '</TD>';
     //CheckboxInputWithID($value,$name,$id,$title='',$checked='',$new=false,$yes='Yes',$no='No',$div=true,$extra='')
     $day_id++;
 }
 $header .= '</TR></TABLE>';
 if ($new == false) {
     //$header .= '","days",true);\'>'.$RET['DAYS'].'</div></DIV><small><FONT color='._(Preferences('TITLES')).'>'._('Meeting Days').'</FONT></small>';
     $header .= '","days",true);\'>' . $RET['DAYS'] . '</div></DIV><small><FONT color=' . Preferences('TITLES') . '>' . _('Meeting Days') . '</FONT></small>';
 }
 $header .= '</TD>';
 $options_RET = DBGet(DBQuery('SELECT TITLE,CALENDAR_ID FROM attendance_calendars WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\' ORDER BY DEFAULT_CALENDAR'));
 $options = array();
 foreach ($options_RET as $option) {
     $options[$option['CALENDAR_ID']] = $option['TITLE'];
 }
 $check_schedule = DBGet(DBQuery('SELECT COUNT(1) as TOTAL FROM schedule WHERE COURSE_PERIOD_ID=\'' . $_REQUEST['course_period_id'] . '\' AND (END_DATE IS NULL OR END_DATE>=\'' . Date('Y-m-d') . '\') AND SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\' '));
 echo '</TD>';
 echo '<TD>';
 $sql = "SELECT ID,TITLE FROM SCHOOLS";
 $QI = DBQuery($sql);
 $schools_RET = DBGet($QI);
 unset($options);
 if (count($schools_RET) && User('PROFILE') == 'admin') {
     $i = 0;
     $staff_school_chkbox_id = 0;
     echo '<TABLE><TR>';
     foreach ($schools_RET as $value) {
         $staff_school_chkbox_id++;
         if ($i % 3 == 0) {
             echo '</TR><TR>';
         }
         echo '<TD>' . CheckboxInputWithID(strpos($staff['SCHOOLS'], ',' . $value['ID'] . ',') !== false ? 'Y' : '', 'staff[SCHOOLS][' . $value['ID'] . ']', 'staff_SCHOOLS' . $staff_school_chkbox_id, '', '', true, '<IMG SRC=assets/check.gif width=15>', '<IMG SRC=assets/x.gif width=15>') . $value['TITLE'] . '</TD>';
         $i++;
     }
     echo '</TR></TABLE>';
     if (!$staff['PROFILE']) {
         echo '<FONT color=red>Schools</FONT>';
     } else {
         echo '<FONT color=' . Preferences('TITLES') . '>Schools</FONT>';
     }
 } elseif (User('PROFILE') != 'admin') {
     $i = 0;
     echo '<TABLE><TR><TD>Schools : </TD>';
     foreach ($schools_RET as $value) {
         if ($i % 3 == 0) {
             echo '</TR><TR>';
         }