<?php include_once "include/db.php"; include_once "include/func_category.php"; $conn_ategory = new Category(); $result = $conn_ategory->getCategoryList(''); $subject_result = $conn_ategory->getSubjectList('', ''); $chapter_result = $conn_ategory->getChapterList(''); $section_result = $conn_ategory->getSectionList(''); $part_result = $conn_ategory->getPartList(''); $item_result = $conn_ategory->getItemList(''); //print_r($part_result); //exit; $arr_subject = array(); foreach ($subject_result as $key => $val) { $id = $val["subject_id"] . "-" . $val["sub_id"]; $arr_subject[$val["category_id"]][$id] = $val["subject_name"]; } $arr_chapter = array(); foreach ($chapter_result as $key => $val) { $subject_id = $val["subject_id"] . "-" . $val["sub_id"]; $arr_chapter[$subject_id][$val["chapter_id"]] = $val["chapter_name"]; } $arr_section = array(); foreach ($section_result as $key => $val) { $arr_section[$val["chapter_id"]][$val["section_id"]] = $val["section_name"]; } $arr_part = array(); foreach ($part_result as $key => $val) { $arr_part[$val["section_id"]][$val["part_id"]] = $val["part_name"]; }
} if (!empty($_POST["jchapter"])) { $jchapter = $_POST["jchapter"]; $chapter_result = $conn_ategory->getChapterList($jchapter); $submit_name = "節"; $page_title = "新增節"; } if (!empty($_POST["jsection"])) { $jsection = $_POST["jsection"]; $section_result = $conn_ategory->getSectionList($jsection); $submit_name = "小節"; $page_title = "新增小節"; } if (!empty($_POST["jpart"])) { $jpart = $_POST["jpart"]; $part_result = $conn_ategory->getPartList($jpart); $submit_name = "項目"; $page_title = "新增項目"; } if (!empty($_POST["jitem"])) { $jitem = $_POST["jitem"]; $item_result = $conn_ategory->getItemList($jitem); } if ($_POST["submitType"] == "addQuestion") { $submitType = $_POST["submitType"]; $question = $_POST["question"]; $answer = $_POST["answer"]; $resolution = $_POST["resolution"]; $keyword = $_POST["keyword"]; $year = $_POST["year"]; $exam_id = $_POST["jexam"];