echo $HTML; $SCION->status = STATE::CHANGE; break 2; case STATE::CHANGE: if (isset($_GET["reset"])) { $_STATE->goback(1); //go back to log_list break 3; } if (isset($_POST["actupd"])) { update_activity($SCION); } else { new_hours($SCION); //msgStatus='-' says to "reset", ie. goback(1), so set that state's totals: $temp = STATE_pull($_STATE->thread, 1); total_hours($temp); //re-calculate for all projects $temp->replace(); } echo $SCION->msgStatus; break 2; default: throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): error"); } } //while & switch $SCION->push(); break 2; default: throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): Invalid state=" . $_STATE->status); }
case BUTTON_DISP: button_send($SCION, $HTML); echo $HTML; $SCION->status = STATE::CHANGE; break 2; case STATE::CHANGE: if (isset($_GET["reset"])) { $_STATE->goback(1); //go back to log_list break 3; } if (isset($_POST["actupd"])) { update_activity($SCION); } else { new_hours($SCION); total_hours(); //re-calculate for all projects } echo $SCION->msgStatus; break 2; default: throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): error"); } } //while & switch $SCION->push(); break 2; default: throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): Invalid state=" . $_STATE->status); } }
</script> <tr class="color<?php echo $i; ?> "> <td ><?php echo $subject; ?> </td> <td><?php echo $teacher; ?> </td> <td><?php printf("%.2f/%.2f", total_hours($class_id), unit_to_time($units)); ?> <!--<input value="#FFFFFF" style="padding:0; width:20px; height:20px; line-height:100%; " type="color"> --> </td> </tr> <?php } ?> </tbody> </table> </div> </div>
$units = $row_subject['credit_unit']; if ($teacher_id != NULL) { $query_teacher = mysql_query("SELECT * FROM employee_t WHERE emp_id={$teacher_id}"); $row_teacher = mysql_fetch_assoc($query_teacher); $teacher = $row_teacher['f_name']; } else { $teacher = ""; } $query_room = mysql_query("SELECT * FROM class_room_t WHERE section_assigned='{$_GET['section_id']}'"); $row_room = mysql_fetch_assoc($query_room); $room_no = $row_room['room_no']; $class[$i]['subject'] = $subject; $class[$i]['teacher'] = $teacher; $class[$i]['units'] = $units; $class[$i]['room'] = $room_no; $class_time = total_hours($class_id); $class_units = unit_to_time($units); $class_units = round($class_units * 4) / 4; $total_time += $class_time; $total_units += $class_units; //==============================fractionalizing $whole2 = (int) $class_units; $frac2 = $class_units * 100 % 100 * 0.6; $whole1 = (int) $class_time; $frac1 = $class_time * 100 % 100 * 0.6; $class_color[$class_id] = $i % 7 + 1; ?> <script type="text/javascript"> var classes = <?php echo json_encode($class); ?>
function is_subj_max_e($class_id, $add_hours, $schedule_id) { $query = mysql_query("SELECT subject_t.credit_unit AS credit_unit FROM subject_t, class_t WHERE subject_t.subject_code=class_t.subject_code\n\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t AND class_t.class_id={$class_id}") or die("error selecting subject"); $row = mysql_fetch_assoc($query); $credit_unit = $row['credit_unit']; $total_hours = unit_to_time($credit_unit); //insert codes for getting the current school year $query_sched = mysql_query("SELECT * FROM class_schedule_temp_t WHERE schedule_id='{$schedule_id}'") or die("subj_func " . mysql_error()); $row_sched = mysql_fetch_assoc($query_sched); $start = $row_sched['time_start']; $end = $row_sched['time_end']; $deduction = get_duration($start, $end); $curr_hours = total_hours($class_id) - $deduction; $curr_hours += $add_hours; if ($total_hours < $curr_hours) { return "Section has exceeded the maximum no. of load for the subject ({$curr_hours}/{$total_hours})"; } else { return NULL; } }