if (strpos($title, "年级排名") === false) { $subjects_score[$title] = intval($line_list[$i++]); //科目=》成绩 } else { break; } } $arr['subjects'] = $subjects_score; $arr['grade_rank'] = intval($line_list[$i++]); $arr['up_down'] = intval($line_list[$i++]); $arr['class_code'] = $class_code; $scores_list[] = $arr; } // print_r($scores_list); delete_datas($class_code, $prj_id); insert_datas($scores_list); //考试名称 $prjs = get_exam_prjs($_SESSION["class_code"]); $smarty->assign("prjs", $prjs); $smarty->assign("select_prj", $prj_id); $smarty->display('score_summary_list.htm'); exit; } elseif ($_REQUEST['act'] == 'export') { //考试名称 $prj_id = empty($_REQUEST['prj_id']) ? '' : trim($_REQUEST['prj_id']); //考试名称 $prj_name = get_exam_prj_name($prj_id); $subjects = get_subjects($class_code, $prj_id); $content = '您选择的《' . $prj_name . '》还没有进行考试安排!'; if (count($subjects) > 0) { $content = "学号,姓名,";
$line_number++; } continue; } $i = 1; $arr['exam_subject'] = replace_quote($line_list[$i++]); //考试编号 $arr['student_code'] = replace_quote($line_list[$i++]); $grade_rank = replace_quote($line_list[$i++]); $arr['grade_rank'] = $grade_rank ? intval($grade_rank) : 0; $add_grade_rank = replace_quote($line_list[$i++]); $arr['add_grade_rank'] = $add_grade_rank ? intval($add_grade_rank) : 0; $arr['class_code'] = $class_code; $grade_ranks_list[] = $arr; } insert_datas($grade_ranks_list); set_params(); $smarty->display('grade_rank_list.htm'); exit; } elseif ($_REQUEST['act'] == 'ajax_save') { $id = !empty($_REQUEST['grank_id']) ? intval($_REQUEST['grank_id']) : 0; $exam_prj = !empty($_REQUEST['exam_prj']) ? intval($_REQUEST['exam_prj']) : 0; $student = !empty($_REQUEST['student_code']) ? trim($_REQUEST['student_code']) : ""; //检查是否重复录入成绩 $sql = "select * from " . $ecs->table("grade_rank") . " where prj_id={$exam_prj} and student_code='{$student}' and class_code='{$class_code}' and grank_id!=" . $id; $oldScore = $db->getRow($sql); if ($oldScore) { make_json_error("学号:“" . $student . "”,在《" . get_exam_prj_name($exam_prj) . "》中的年级排名和年级进退于" . $oldScore["created"] . "已经录入到了系统,录入的年级排名为“" . $oldScore["grade_rank"] . "”,年级进退为“" . $oldScore["up_down"] . "”,请勿重复录入!"); exit; } if ($id == 0) {
$line_number++; } continue; } $i = 0; $arr['code'] = replace_quote($line_list[$i++]); //学号 $arr['name'] = trim($line_list[$i++]); //学生信息 $arr['guardian_name'] = trim($line_list[$i++]); //家长信息 $arr['guardian_phone'] = replace_quote($line_list[$i++]); $arr['class_code'] = $class_code; $students_list[] = $arr; } insert_datas($students_list); $smarty->display('student_list.htm'); exit; } elseif ($_REQUEST['act'] == 'ajax_save') { $id = !empty($_REQUEST['student_id']) ? intval($_REQUEST['student_id']) : 0; if ($id == 0) { //insert $sql = "select * from " . $ecs->table("student") . " where code='" . $_REQUEST["code"] . "' and class_code='" . $_SESSION["class_code"] . "'"; $s = $db->getRow($sql); if ($s) { make_json_result("添加失败!学号“" . $_REQUEST["code"] . "”已被“" . $s["name"] . "”同学占用!"); exit; } $sql = "insert into " . $GLOBALS['ecs']->table("guardian") . " (name,phone,class_code,student_code,student_name,created)\r\n\t\t\t\t\t\t\tvalues\r\n\t\t\t ('" . $_REQUEST["guardian_name"] . "','" . $_REQUEST["guardian_phone"] . "','" . $_SESSION["class_code"] . "','" . $_REQUEST["code"] . "','" . $_REQUEST["name"] . "',\r\n\t\t\t\tnow()\r\n\t\t\t\t) "; $db->query($sql); $guardian_id = $db->insert_id();
} continue; } $i = 1; $arr['prj_id'] = trim($line_list[$i++]); $arr['subject'] = trim($line_list[$i++]); $arr['teacher'] = trim($line_list[$i++]); $arr['examdate'] = trim($line_list[$i++]); $arr['stime'] = trim($line_list[$i++]); $arr['etime'] = trim($line_list[$i++]); $arr['classroom'] = trim($line_list[$i++]); $arr['class_code'] = $class_code; $exams_list[] = $arr; } // print_r($exams_list); insert_datas($exams_list); set_params(); $smarty->display('exam_list.htm'); exit; } if ($_REQUEST['act'] == 'ajax_list') { $list = exam_list(); make_json($list); } elseif ($_REQUEST['act'] == 'ajax_add') { $exam_prj = empty($_REQUEST['exam_prj']) ? "" : trim($_REQUEST['exam_prj']); $exam_subjects = empty($_REQUEST['exam_subjects']) ? "" : trim($_REQUEST['exam_subjects']); $exam_subjects = explode("###SPLIT_V1###", $exam_subjects); $total = 0; foreach ($exam_subjects as $subject) { $item_attr = explode("###SPLIT_V2###", $subject); if (!$item_attr[0] || count($item_attr) < 6) {