function ExportSelectResultByUserIDPaperID($userID, $paperID) { $letter = array('A', 'B', 'C', 'D', 'E', 'F', 'F', 'G'); $tableheader = array('选则结果编号', '用户编号', '试卷编号', '试题编号', '用户选项', '该题得分'); for ($i = 0; $i < count($tableheader); $i++) { $GLOBALS['excel']->getActiveSheet()->setCellValue("{$letter[$i]}1", "{$tableheader[$i]}"); } $datas = FindSelectResultByUserPaper($userID, $paperID); /*填充表格内部的信息 因为第一行被表头占用了 所以数据都从第二行开始 */ for ($i = 2; $i <= count($datas) + 1; $i++) { $j = 0; foreach ($datas[$i - 2] as $data) { $GLOBALS['excel']->getActiveSheet()->setCellValue("{$letter[$j]}{$i}", "{$data}"); $j++; } } //创建Excel输入对象 CreateExcel(); }
echo '<!-- MEDIA TOP 0.5in -->'; echo '<!-- MEDIA BOTTOM 0.25in -->'; echo '<!-- MEDIA LEFT 0.25in -->'; echo '<!-- MEDIA RIGHT 0.25in -->'; echo '<!-- FOOTER RIGHT "" -->'; echo '<!-- FOOTER LEFT "" -->'; echo '<!-- FOOTER CENTER "" -->'; echo '<!-- HEADER RIGHT "" -->'; echo '<!-- HEADER LEFT "" -->'; echo '<!-- HEADER CENTER "" -->'; echo CreateList($_REQUEST['degree_level_id'], $_REQUEST['prog_level_id'], $_REQUEST['subject_id'], $_REQUEST['course_id'], $_REQUEST['marking_period_id'], $_REQUEST['mp_name']); PDFStop($handle, 'sis.pdf'); exit; } if (clean_param($_REQUEST['create_excel'], PARAM_ALPHAMOD) == 'true') { echo CreateExcel($_REQUEST['degree_level_id'], $_REQUEST['prog_level_id'], $_REQUEST['subject_id'], $_REQUEST['course_id'], $_REQUEST['marking_period_id'], $_REQUEST['mp_name']); } if (clean_param($_REQUEST['modfunc'], PARAM_ALPHAMOD) == 'choose_course') { DrawBC("Courses -> " . $_REQUEST['draw_header']); $sql = "SELECT PARENT_ID,TITLE,SHORT_NAME,PERIOD_ID,DAYS,\r\n MP,MARKING_PERIOD_ID,TEACHER_ID,CALENDAR_ID,\r\n ROOM,TOTAL_SEATS,DOES_ATTENDANCE,\r\n GRADE_SCALE_ID,DOES_HONOR_ROLL,DOES_CLASS_RANK,\r\n GENDER_RESTRICTION,HOUSE_RESTRICTION,CREDITS,\r\n HALF_DAY,DOES_BREAKOFF\r\n FROM COURSE_PERIODS\r\n WHERE COURSE_PERIOD_ID='{$_REQUEST['course_period_id']}'"; $QI = DBQuery($sql); $RET = DBGet($QI); $RET = $RET[1]; $title = $RET['TITLE'] . " , <b>Course:</b> " . $C_RET[1]['TITLE'] . ", <b>Number of Credits:</b> " . $C_RET[1]['NUMBER_OF_CREDITS']; $new = false; //print_r($RET); if (count($RET)) { $header .= '<TABLE cellpadding=3 width=100%>'; $header .= '<TR>'; $header .= '<TD><b>' . $RET['SHORT_NAME'] . '</b><br>Short Name</TD>'; $teachers_RET = DBGet(DBQuery("SELECT concat((COALESCE(LAST_NAME,' '), ', ', COALESCE(FIRST_NAME,' '), ' ', COALESCE(MIDDLE_NAME,' '))) as Teacher FROM STAFF WHERE (SCHOOLS IS NULL OR strpos(SCHOOLS,'," . UserSchool() . ",')>0) AND SYEAR='" . UserSyear() . "' AND PROFILE='teacher' and STAFF_ID='" . $RET['TEACHER_ID'] . "' ORDER BY LAST_NAME,FIRST_NAME"));