<?php
/**
 * 文章列表
 * $Id: article_dat_list.inc,v 1.1 2016-9-22 09:58:31 cuixl Exp $
 * @author cuixl
 * @access public
 * @package manager.templates
 */

?>
<br />
<b>文章列表</b><br />
<form name="search_input" method="post" action="?">
	<table>
		<tr>
			<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="searchArticle()" /></td>
		</tr>
	</table>
	<input type="button" value="添加文章" class="button_width_normal" onClick="articleDatEdit()"/>
</form>
<br />
<?
require_once("page_common.inc");
?>
<div id="result_list">
	<table>
		<tr>
			<th class="contents_title" width="5%" nowrap>ID</th>
			<th class="contents_title" width="10%">标题</th>
			<th class="contents_title" width="15%">系列</th>
			<th class="contents_title" width="10%">地址</th>
			<th class="contents_title" width="10%">操作</th>
		</tr>

		<?
		if (!empty($article_dat_list)) {
			foreach($article_dat_list as $article_dat) {
				$category_title = "[未指定]";
				$category_mst = ArticleCategoryMst::getById($article_dat->category_id);
				if(!empty($category_mst)) {
					$category_title = $category_mst->title;
				}
		?>
				<tr>
					<td align="center" nowrap><?=htmlspecialchars($article_dat->id) ?></td>
					<td align="center" nowrap><?=htmlspecialchars($article_dat->title) ?></td>
					<td align="center" nowrap><?=htmlspecialchars($category_title) ?></td>
					<td align="center" nowrap><?=htmlspecialchars($article_dat->title) ?></td>
					<td align="center">
						<a class="flatbutton" href="article_data_edit.php?id=<?=$article_dat->id ?>&action_type=edit">编集</a>
					</td>
				</tr>
				<?
			}
		}
		?>
	</table>
</div>