<?php
/**
 * 单词列表
 * $Id: product_category_list.inc,v 1.1 2015/10/08 11:18:53 wanggb Exp $
 * @author zhouhj
 * @access public
 * @package manager.templates
 */

?>
<b>题目设置</b><br />
<br />
试卷 : <?=$examination_mst->title?><br />
题数 : <?=$examination_count?><br />
总分 : <?=$sum_point?>
<br />
<div id="result_list" style="width:40%;">
<?
	$x = 0;
	foreach($subject_category_list as $subject_category) {
		$x++;
		//已经登陆的该类型题目
		$param = array();
		$param["delete_flg"] = false;
		$param["category_id"] = $subject_category->id;
		$param["examination_mst_id"] = $examination_mst->id;
		$examination_dat_list = ExaminationDat::getList($param, "display_order", "asc");
		$subject_ids = array();
		foreach($examination_dat_list as $examination_dat) {
			$subject_ids[] = $examination_dat->subject_id;
		}
		
		//该类型所有题目
		$param = array();
		$param["delete_flg"] = false;
		$param["category_id"] = $subject_category->id;
		$param["id_NOT"] = $subject_ids;
		$subject_dat_list = SubjectDat::getList($param, "id", "desc");
?>
	<table widtg="60%">
		<tr>
			<th class="contents_title" width="70%"><?=$subject_category->title?></th>
			<th class="contents_title" width="15%">排序</th>
			<th class="contents_title">操作</th>
		</tr>
		<?
			$index = 0;
			foreach($examination_dat_list as $examination_dat) {
				$index++;
		?>
		<tr>
			<td><?=$index?>. <?=$examination_dat->title?></td>
			<td align="center">
				<a class="flatbutton" href="examination_dat_change_display_order.php?mst_id=<?=$examination_mst->id ?>&dat_id=<?=$examination_dat->id ?>&type=up">↑</a>
				<a class="flatbutton" href="examination_dat_change_display_order.php?mst_id=<?=$examination_mst->id ?>&dat_id=<?=$examination_dat->id ?>&type=down">↓</a>
			</td>
			<td align="center"><a class="flatbutton" href="examination_dat_operate.php?action=delete&mst_id=<?=$examination_mst->id ?>&dat_id=<?=$examination_dat->id ?>&subject_id=<?=$examination_dat->subject_id?>">―</a></td>
		</tr>
		<?
			}
		?>
		
		<tr>
			<td>
				<select name="subject_id<?=$x?>" id="subject_id<?=$x?>" style="width:80%;">
					<?
						foreach ($subject_dat_list as $subject_dat) {
					?>
						<option value="<?=$subject_dat->id ?>"><?=$subject_dat->title ?>[分值:<?=$subject_dat->point ?>]</option>
					<?
						}
					?>
				</select>
			</td>
			<td></td>
			<td align="center"><a class="flatbutton" onclick="addSubject2Mst(<?=$examination_mst->id ?>, <?=$x?>);">＋</a></td>
		</tr>
	</table><br/>
<?
	}
?>
</div>