$courseTypeTotalPeriodArray[$type] += $courseListArray[$i][$type]; } //ADD into adtabase $courseTypeInfoArray[$THIS_TABLE_KEY_NAMES_ARRAY['COURSE_TYPE']] = $type; $courseTypeInfoArray[$THIS_TABLE_KEY_NAMES_ARRAY['COURSE_TOTAL_PERIOD']] = $courseTypeTotalPeriodArray[$type]; table_data_add($TABLE_NAME, $THIS_TABLE_KEY_NAMES_ARRAY, $courseTypeInfoArray); } } //ADD the information to database if POST if ($_POST["courseTypeInfoAdd"]) { //Load the POST info array foreach ($THIS_TABLE_KEY_NAMES_ARRAY as $value) { $courseTypeInfoArray[$value] = $_POST[$THIS_TABLE_KEY_NAMES_ARRAY[$value]]; } unset($value); table_data_add($TABLE_NAME, $THIS_TABLE_KEY_NAMES_ARRAY, $courseTypeInfoArray); } //DELETE the information to database if POST if ($_POST["courseTypeListDelete"]) { table_data_delete_by_id($TABLE_NAME, $targetId); } //CHANGE the information to database if POST if ($_POST["courseTypeInfoChanged"]) { foreach ($THIS_TABLE_KEY_NAMES_ARRAY as $value) { $courseTypeInfoChangeArray[$value] = $_POST[$THIS_TABLE_KEY_NAMES_ARRAY[$value]]; } unset($value); table_data_change($TABLE_NAME, $THIS_TABLE_KEY_NAMES_ARRAY, $targetId, $courseTypeInfoChangeArray); } //REQUERY the $courseTypeListArray for display $courseTypeListArray = table_data_query($TABLE_NAME, $THIS_TABLE_KEY_NAMES_ARRAY);
$targetId = $teacherListArray[$teacherTargetArray][$TEACHER_TABLE_KEY_NAMES_ARRAY['ID']]; //TODO : rewrite the database_table_create "if" phrase //CREATE the TABLE if not avaliable if ($semesterTargetArray != "") { database_table_create($TEACHER_TABLE_NAME, $TEACHER_TABLE_KEY_NAMES_ARRAY, $TEACHER_TABLE_KEY_TYPES_ARRAY); } //ADD the information to database if POST print $_POST['TEACHER_NAME']; if ($_POST["teacherInfoAdd"]) { //Load the POST info array foreach ($TEACHER_TABLE_KEY_NAMES_ARRAY as $value) { $teacherInfoArray[$value] = $_POST[$value]; } var_dump($teacherInfoArray); unset($value); table_data_add($TEACHER_TABLE_NAME, $TEACHER_TABLE_KEY_NAMES_ARRAY, $teacherInfoArray); } //DELETE the information from database if POST if ($_POST["teacherListDelete"]) { table_data_delete_by_id($TEACHER_TABLE_NAME, $targetId); } //CHANGE the information to database if POST if ($_POST["teacherInfoChanged"]) { foreach ($TEACHER_TABLE_KEY_NAMES_ARRAY as $value) { $teacherInfoChangeArray[$value] = $_POST[$value]; } unset($value); table_data_change($TEACHER_TABLE_NAME, $TEACHER_TABLE_KEY_NAMES_ARRAY, $targetId, $teacherInfoChangeArray); } //REQUERY the $teacherListArray for display $teacherListArray = table_data_query($TEACHER_TABLE_NAME, $TEACHER_TABLE_KEY_NAMES_ARRAY);
//Load the target array ID number $targetId = $classroomListArray[$classroomTargetArray][$CLASSROOM_TABLE_KEY_NAMES_ARRAY['ID']]; //TODO : rewrite the database_table_create "if" phrase //CREATE the TABLE if not avaliable if ($semesterTargetArray != "") { database_table_create($CLASSROOM_TABLE_NAME, $CLASSROOM_TABLE_KEY_NAMES_ARRAY, $CLASSROOM_TABLE_KEY_TYPES_ARRAY); } //ADD the information to database if POST print $_POST['CLASSROOM_NAME']; if ($_POST["classroomInfoAdd"]) { //Load the POST info array foreach ($CLASSROOM_TABLE_KEY_NAMES_ARRAY as $value) { $classroomInfoArray[$value] = $_POST[$value]; } unset($value); table_data_add($CLASSROOM_TABLE_NAME, $CLASSROOM_TABLE_KEY_NAMES_ARRAY, $classroomInfoArray); } //DELETE the information from database if POST if ($_POST["classroomListDelete"]) { table_data_delete_by_id($CLASSROOM_TABLE_NAME, $targetId); } //CHANGE the information to database if POST if ($_POST["classroomInfoChanged"]) { foreach ($CLASSROOM_TABLE_KEY_NAMES_ARRAY as $value) { $classroomInfoChangeArray[$value] = $_POST[$CLASSROOM_TABLE_KEY_NAMES_ARRAY[$value]]; } unset($value); table_data_change($CLASSROOM_TABLE_NAME, $CLASSROOM_TABLE_KEY_NAMES_ARRAY, $targetId, $classroomInfoChangeArray); } //REQUERY the $classroomListArray for display $classroomListArray = table_data_query($CLASSROOM_TABLE_NAME, $CLASSROOM_TABLE_KEY_NAMES_ARRAY);
//Load the target array ID number $targetId = $semesterListArray[$targetArray][$THIS_TABLE_KEY_NAMES_ARRAY['id']]; //Reunion the semester name $_POST[$THIS_TABLE_KEY_NAMES_ARRAY['SEMESTER']] = $_POST["semesterPartA"] . "_" . $_POST["semesterPartB"]; //CREATE the TABLE if query result not avaliable if (!$semesterListArray) { database_table_create($TABLE_NAME, $THIS_TABLE_KEY_NAMES_ARRAY, $THIS_TABLE_KEY_TYPES_ARRAY); } //ADD the semester information to database if POST if ($_POST["semesterInfoAdd"]) { //Load the POST info array foreach ($THIS_TABLE_KEY_NAMES_ARRAY as $value) { $semesterInfoArray[$value] = $_POST[$THIS_TABLE_KEY_NAMES_ARRAY[$value]]; } unset($value); table_data_add($TABLE_NAME, $THIS_TABLE_KEY_NAMES_ARRAY, $semesterInfoArray); } //DELETE the semester information to database if POST if ($_POST["semesterListDelete"]) { table_data_delete_by_id($TABLE_NAME, $targetId); } //CHANGE the semester information to database if POST if ($_POST["semesterInfoChange"]) { foreach ($THIS_TABLE_KEY_NAMES_ARRAY as $value) { $semesterInfoChangeArray[$value] = $_POST[$THIS_TABLE_KEY_NAMES_ARRAY[$value]]; } unset($value); table_data_change($TABLE_NAME, $THIS_TABLE_KEY_NAMES_ARRAY, $targetId, $semesterInfoChangeArray); } //REQUERY the $semesterListArray for display $semesterListArray = table_data_query($TABLE_NAME, $THIS_TABLE_KEY_NAMES_ARRAY);
//COURSE_LEFT TABLE structure create $courseListArrayCount0 = count($courseListArray); for ($i = 0; $i < $courseListArrayCount0; $i++) { $CLASS_TABLE_KEY_NAMES_ARRAY = array_key_insert($CLASS_TABLE_KEY_NAMES_ARRAY, $courseListArray[$i]['COURSE_KEY_NAME'], $courseListArray[$i]['COURSE_KEY_NAME']); $CLASS_TABLE_KEY_TYPES_ARRAY = array_key_insert($CLASS_TABLE_KEY_TYPES_ARRAY, $courseListArray[$i]['COURSE_KEY_NAME'], "varchar(15)"); } database_table_create($CLASS_TABLE_NAME, $CLASS_TABLE_KEY_NAMES_ARRAY, $CLASS_TABLE_KEY_TYPES_ARRAY); $tableKeyNumbersCount = count($classInsertInfoArray); for ($i = 0; $i < $tableKeyNumbersCount; $i++) { //COURSE_LEFT auto fill method $courseListArrayCount0 = count($courseListArray); $classType = $classInsertInfoArray[$i]['CLASS_TYPE']; for ($j = 0; $j < $courseListArrayCount0; $j++) { $classInsertInfoArray[$i][$courseListArray[$j]['COURSE_KEY_NAME']] = $courseListArray[$j][$classType]; } table_data_add($CLASS_TABLE_NAME, $CLASS_TABLE_KEY_NAMES_ARRAY, $classInsertInfoArray[$i]); } } //Reload $CLASS_TABLE_KEY_NAMES_ARRAY. $CLASS_TABLE_KEY_NAMES_ARRAY = table_key_names_array_get($CLASS_TABLE_NAME); //QUERY the $courseListArray $classListArray = table_data_query($CLASS_TABLE_NAME, $CLASS_TABLE_KEY_NAMES_ARRAY); //------ -[ Views Functions ]- ------ div_head_output_with_class_option("mainMiddle"); //Print Main Title main_title_output($PAGE_INFO_ARRAY, $PAGE_SWITCH); //Print main form div_head_output_with_class_option("form"); //Print form Block form_head_output($FILE_NAME, "post"); //Print semesterList Block
//ADD the COURSE data $COURSE_TABLE_KEY_NAMES_ARRAY = array_picker($courseImportInfoArray, 0); //Pick the table key names from import array. $COURSE_TABLE_KEY_NAMES_ARRAY = array_key_insert($COURSE_TABLE_KEY_NAMES_ARRAY, "id", "id"); //The import data not include ID key, so add it. $COURSE_TABLE_KEY_NAMES_ARRAY = array_key_insert($COURSE_TABLE_KEY_NAMES_ARRAY, "COURSE_KEY_NAME", "COURSE_KEY_NAME"); //The import data not include COURSE_KEY_NAME key, so add it. $COURSE_TABLE_KEY_TYPES_ARRAY = table_key_types_auto_fill($COURSE_TABLE_KEY_TYPES_ARRAY, $COURSE_TABLE_KEY_NAMES_ARRAY, 0, "varchar(15)", 1); $COURSE_TABLE_KEY_TYPES_ARRAY = array_key_insert($COURSE_TABLE_KEY_TYPES_ARRAY, "id", "int NOT NULL AUTO_INCREMENT, PRIMARY KEY(id)"); $COURSE_TABLE_KEY_TYPES_ARRAY = array_key_insert($COURSE_TABLE_KEY_TYPES_ARRAY, "COURSE_KEY_NAME", "varchar(15)"); database_table_create($COURSE_TABLE_NAME, $COURSE_TABLE_KEY_NAMES_ARRAY, $COURSE_TABLE_KEY_TYPES_ARRAY); unset($COURSE_TABLE_KEY_NAMES_ARRAY['id']); //Drop the table key id for data insert by key names array. for ($i = 0; $i < $courseInsertInfoArrayCount0 - 1; $i++) { //Import file have a title line, so that "-1". table_data_add($COURSE_TABLE_NAME, $COURSE_TABLE_KEY_NAMES_ARRAY, $courseInsertInfoArray[$i]); } } //Reload $COURSE_TABLE_KEY_NAMES_ARRAY. $COURSE_TABLE_KEY_NAMES_ARRAY = table_key_names_array_get($COURSE_TABLE_NAME); //QUERY the $courseListArray $courseListArray = table_data_query($COURSE_TABLE_NAME, $COURSE_TABLE_KEY_NAMES_ARRAY); //------ -[ Views Functions ]- ------ div_head_output_with_class_option("mainMiddle"); //Print Main Title main_title_output($PAGE_INFO_ARRAY, $PAGE_SWITCH); //Print main form div_head_output_with_class_option("form"); //Print form Block form_head_output($FILE_NAME, "post"); //Print semesterList Block
} } ///// } } //Write $teacherListArray into database $teacherListArrayCount0 = count($teacherListArray); for ($i = 0; $i < $teacherListArrayCount0; $i++) { $targetId = $teacherListArray[$i]['ID']; table_data_change($TEACHER_TABLE_NAME, $TEACHER_TABLE_KEY_NAMES_ARRAY, $targetId, $teacherListArray[$i]); } //Write $classroomScheduleArray into database $classroomScheduleArrayCount0 = count($classroomScheduleArray); vars_checkout($classroomScheduleArrayCount0, "classroomScheduleArrayCount0"); for ($i = 0; $i < $classroomScheduleArrayCount0; $i++) { table_data_add($CLASSROOM_SCHEDULE_TABLE_NAME, $CLASSROOM_SCHEDULE_TABLE_KEY_NAMES_ARRAY, $classroomScheduleArray[$i]); } } //Bracket for reschedule determinative syntax //Load in session for global table name load. $_SESSION['targetTableName'] = $CLASSROOM_SCHEDULE_TABLE_NAME; $_SESSION['targetPageSwitch'] = $PAGE_SWITCH; //Load the course key-name union array $courseKeyNameUnionArray = course_key_name_union_array_get($courseListArray); //Reunion the classroom array for classroom schedule output $classroomScheduleArrayReunion = classroom_schedule_array_reunion($classroomScheduleArray, $courseKeyNameUnionArray); //------ -[ Views Functions ]- ------ div_head_output_with_class_option("mainMiddle"); //Print Main Title main_title_output($PAGE_INFO_ARRAY, $PAGE_SWITCH); //Print main form
$targetClassroomName = $classAllClassroomArray[$weekCounter][$allClassroomCounterForTeacher]['CLASSROOM_NAME']; if ($courseInClassroomArray == $classInClassroomScheduleCourseKeyName && $progressTeacherName && $progressClassroomName == $targetClassroomName) { $targetTeacherName = $progressTeacherName; } } //Load in $sudetnsScheduleArray. $studentsScheduleArray[$studentsScheduleCounter][$coursePartKeyNameInStudentsSchedule] .= "." . $progressClassroomName . "." . $targetTeacherName; } } } } } } //Update $studentsScheduleArray. for ($i = 0; $i < $studentsScheduleCounter; $i++) { table_data_add($STUDENTS_SCHEDULE_TABLE_NAME, $STUDENTS_SCHEDULE_TABLE_KEY_NAMES_ARRAY, $studentsScheduleArray[$i]); } } //Bracket for reschedule determinative syntax //Load in session for global table name load. $_SESSION['targetTableName'] = $STUDENTS_SCHEDULE_TABLE_NAME; $_SESSION['targetPageSwitch'] = $PAGE_SWITCH; //------ -[ Views Functions ]- ------ div_head_output_with_class_option("mainMiddle"); //Print Main Title main_title_output($PAGE_INFO_ARRAY, $PAGE_SWITCH); //Print main form div_head_output_with_class_option("form"); //Print form Block form_head_output($FILE_NAME, "post"); //Print semesterList Block
$totalScheduleArray[$serial]['WEEK'] = $week; $totalScheduleArray[$serial][$key] = $value; } } } } //将$appointedClassArray写入数据库 $appointedClassArrayCount0 = count($appointedClassArray); for ($i = 0; $i < $appointedClassArrayCount0; $i++) { $targetId = $appointedClassArray[$i]['ID']; table_data_change($CLASS_TABLE_NAME, $CLASS_TABLE_KEY_NAMES_ARRAY, $targetId, $appointedClassArray[$i]); } //将$totalScheduleArray写入数据库 $totalScheduleArrayCount0 = count($totalScheduleArray); for ($i = 0; $i < $totalScheduleArrayCount0; $i++) { table_data_add($TOTAL_SCHEDULE_TABLE_NAME, $TOTAL_SCHEDULE_TABLE_KEY_NAMES_ARRAY, $totalScheduleArray[$i]); } //var_dump($totalScheduleArray); } //Bracket for reschedule determinative syntax //Load in session for global table name load. $_SESSION['targetTableName'] = $TOTAL_SCHEDULE_TABLE_NAME; $_SESSION['targetPageSwitch'] = $PAGE_SWITCH; $_SESSION['targetSemesterWeek'] = $SEMESTER_WEEK_SET; //Export the Excel $semesterName = $semesterListArray[$semesterTargetArray]['SEMESTER'] . "_" . $semesterListArray[$semesterTargetArray]['PART']; total_schedule_excel_export($totalScheduleArray, $semesterName, $SEMESTER_WEEK_SET, $courseKeyNameUnionArray); //------ -[ Views Functions ]- ------ div_head_output_with_class_option("mainMiddle"); //Print Main Title main_title_output($PAGE_INFO_ARRAY, $PAGE_SWITCH);