<?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 />
<form action="subject_dat_list.php" method="post" name="subject_dat_list">
	<input type="hidden" name="search_flg" value="true" />
	<table>
		<tr>
			<td>级别</td>
			<td class="begin_blank">
					<select name="level">
						<?
							$level_list = array("N5", "N4", "N3", "N2", "N1");
							foreach ($level_list as $level_txt) {
						?>
							<option value="<?=$level_txt ?>"<?=$level == $level_txt ? " selected " : "" ?>><?=$level_txt ?></option>
						<?
							}
						?>
					</select>
			</td>
			<td>类型</td>
			<td>
				<select name="category_id">
					<?
						foreach ($category_list as $category_obj) {
					?>
						<option value="<?=$category_obj->id ?>"<?=$category_obj->id == $category_id ? " selected " : "" ?>><?=$category_obj->title ?></option>
					<?
						}
					?>
				</select>
			</td>
			<td><input type="button" value="搜索" onclick="searchSubject()" /></td>
		</tr>
	</table>
	
</form>
<div style="text-align:center;float: right;font-size:18px;">共<?=$total_count ?>件记录</div>
<div style="clear:both"></div>
<a class="flatbutton" href="subject_dat_edit.php">逐题添加</a>
<!--<a class="flatbutton" href="subject_dat_batch.php">批量上传</a>-->
<br /><br />
<div id="result_list">
	<table>
		<tr>
			<th class="contents_title" width="4%">项目</th>
			<th class="contents_title" width="22%">题目</th>
			<th class="contents_title" width="18%">MP3</th>
			<th class="contents_title" width="12%">选择项1</th>
			<th class="contents_title" width="12%">选择项2</th>
			<th class="contents_title" width="12%">选择项3</th>
			<th class="contents_title" width="12%">选择项4</th>
			<th class="contents_title" width="4%">答案</th>
			<th class="contents_title">操作</th>
		</tr>

		<?
		if (count($subject_dat_list) > 0) {
			foreach ($subject_dat_list as $subject_dat) {
				$category_title = SubjectCategory::getTitleById($subject_dat->category_id);
		?>
				<tr>
					<td align="center"><?=$category_title ?></td>
					<td align="left"><?=htmlspecialchars($subject_dat->title) ?></td>
					<td align="center">
					<?
						if(!empty($subject_dat->mp3)) {
					?>
					<audio controls="controls">
						<source src="subject_mp3.php?file_name=<?=urlencode($subject_dat->mp3) ?>" type="audio/mpeg">
						您的浏览器不支持该音频格式。
					</audio>
					<?
						}
					?>
					</td>
					<td align="left"><?=htmlspecialchars($subject_dat->selection1) ?></td>
					<td align="left"><?=htmlspecialchars($subject_dat->selection2) ?></td>
					<td align="left"><?=htmlspecialchars($subject_dat->selection3) ?></td>
					<td align="left"><?=htmlspecialchars($subject_dat->selection4) ?></td>
					<td align="center"><?=htmlspecialchars($subject_dat->right_answer) ?></td>
					<td align="center">
						<a class="flatbutton" href="subject_dat_edit.php?id=<?=$subject_dat->id ?>">编集</a>
					</td>
				</tr>
				<?
			}
		}
		?>
	</table>
</div>