<?php TPL::output('admin/global/header.tpl.htm'); ?>

<!--left-->
<?php TPL::output('admin/global/left.tpl.htm'); ?>
<!--left-->

<!-- main -->
<div id="main-content">
	<div class="clear"></div>
	<div class="content-box">
		<div class="content-box-header">
			<h3>Content Review</h3>
			<ul class="content-box-tabs">
				<li><a href="admin/question/approval_list/" class="<?php if ($_GET['type'] == 'question') { ?>default-tab current<?php } ?>">Question (<?php echo $this->question_count; ?>)</a></li>
				<li><a href="admin/question/approval_list/type-answer" class="<?php if ($_GET['type'] == 'answer') { ?>default-tab current<?php } ?>">Answers (<?php echo $this->answer_count; ?>)</a></li>
			</ul>
			<div class="clear"></div>
		</div>
		<div class="content-box-content">
			<div class="tab-content default-tab" id="tab1">				
				<?php if ($this->approval_list) { ?>
				<form id="batchs_form" action="admin/question/approval_batch/" method="post">
				<input type="hidden" id="batch_type" name="batch_type" value="approval" />
					<table class="list">
						<?php if ($_GET['type'] == 'answer') { ?>
						<thead>
							<tr>
								<th style="width:20px;"><input type="checkbox" class="check-all"></th>
								<th style="width:100px;">User</th>
								<th>Content</th>
							</tr>
						</thead>
						<?php } else { ?>
						<thead>
							<tr>
								<th style="width:20px;"><input type="checkbox" class="check-all"></th>
								<th>User</th>
								<th style="width:280px;">Title</th>
								<?php if (get_setting('category_enable') == 'Y') { ?>
								<th>Classification</th>
								<?php } ?>
								<th>Content</th>
							</tr>
						</thead>
						<?php } ?>
						<tfoot>
							<tr>
								<td colspan="11">
									<div class="bulk-actions align-left"><a class="button" onClick="$('#batch_type').val('approval'); ajax_post($('#batchs_form'), _ajax_post_alert_processer);" href="javascript:;" id="batch_approval">Approved</a> &nbsp; <a class="button" onClick="$('#batch_type').val('decline'); ajax_post($('#batchs_form'), _ajax_post_alert_processer);" href="javascript:;" id="batch_decline">Review denied</a></div>
									<div class="pagination"><?php echo $this->pagination; ?></div>
									<div class="clear"></div>
								</td>
							</tr>
						</tfoot>
						<tbody style="border-bottom: 1px solid #ddd;">
							<?php foreach ($this->approval_list AS $key => $val) { ?>
							<tr>
								<td><input type="checkbox" class="approval_ids" name="approval_ids[]" value="<?php echo $val['id']; ?>"></td>
								<td><a href="people/<?php echo $this->users_info[$val['uid']]['url_token']; ?>"><?php echo $this->users_info[$val['uid']]['user_name']; ?></a></td>
								
								<?php if ($_GET['type'] != 'answer') { ?>
								<td><a href="admin/question/approval_preview/<?php echo $val['id']; ?>" class="fancybox" data-fancybox-type="ajax"><?php echo htmlspecialchars($val['data']['question_content']); ?> <img src="<?php echo GET_STATIC_URL;?>/admin/images/icons/information.png" style="vertical-align:middle" alt="" /></a></td>
								<?php if (get_setting('category_enable') == 'Y') { ?>
								<td><?php echo $this->category[$val['data']['category_id']]['title']; ?></td>
								<?php } ?>
								<?php } ?>
								
								<td><a href="admin/question/approval_preview/<?php echo $val['id']; ?>" class="fancybox" data-fancybox-type="ajax"><?php if ($_GET['type'] == 'answer') { echo utf8_substr(htmlspecialchars($val['data']['answer_content']), 0, 128, 'UTF-8', '...'); } else { echo utf8_substr(htmlspecialchars($val['data']['question_detail']), 0, 128, 'UTF-8', '...'); } ?></a></td>
							</tr>
							<?php } ?>
						</tbody>
					</table>
				</form>
				<?php } ?>
			</div>
			
	</div>

<!-- footer -->
<?php TPL::output('admin/global/footer.tpl.htm'); ?>
<!-- footer -->

</div>
<!-- main -->

</div>

</body>
</html>