<?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><?php echo $this->crumb['last']['name']; ?></h3>
			<ul class="content-box-tabs">
				<li><a href="#tab1" class="default-tab current">Topic list</a></li>
				<li><a class="" href="#tab2">Add Feature</a></li>
			</ul>
			<div class="clear"></div>
		</div>
		<div class="content-box-content">
			<div class="tab-content default-tab" id="tab1">
				<?php if($this->list){ ?>
				<table class="list">
					<thead>
						<tr>
							<th style="width:40px;" align="center">ID</th>
							<th>Feature title</th>
							<th>Description</th>
							<th align="center">Manage topic</th>
							<th>Operation</th>
						</tr>
					</thead>
					<tfoot>
						<tr>
							<td colspan="6"><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->list AS $key => $val) { ?>
						<tr style="vertical-align:middle;">
							<td align="center"><?php echo $val['id']; ?></td>
							<td><a href="feature/<?php echo $val['id']; ?>" target="_blank"><?php echo $val['title']; ?></a></td>
							<td><?php echo $val['description']; ?></td>
							<td align="center"><a href="admin/feature/topic_list/feature_id-<?php echo $val['id']; ?>" title="Manage topic">
								<?php if($val['topic_count']){ ?>
								<?php echo $val['topic_count']; ?> By Subject
								<?php }else{ ?>
								Add topic
								<?php } ?>
								</a></td>
							<td><a href="admin/feature/edit/feature_id-<?php echo $val['id']; ?>" title="Edit Feature"><img src="<?php echo GET_STATIC_URL;?>/admin/images/icons/pencil.png"/></a> &nbsp; <a href="javascript:void(0);" onClick="ajax_request(GET_BASE_URL + '/admin/feature/delete_feature_ajax/feature_id-<?php echo $val['id']; ?>');" name="remove" title="Topics lift"><img src="<?php echo GET_STATIC_URL;?>/admin/images/icons/cross.png" /></a></td>
						</tr>
						<?php } ?>
					</tbody>
				</table>
				<?php } ?>
			</div>
			<div class="tab-content" id="tab2" style="display: none;">
				<div id="notification_box" class="notification success png_bg" style="display:none;"> <a class="close" href="javascript:;"></a>
					<div name="notification_content"></div>
				</div>
				<h3>Add Feature</h3>
				<form id="_save_form" action="admin/feature/save_ajax/" method="post">
					<p>
						<label>Feature title:</label>
						<input type="text" value="" class="text-input medium-input" name="title">
					</p>
					<p>
						<label>Alias:</label>
						<?php echo get_js_url('/'); ?>feature/ <input type="text" name="url_token" class="text-input" style="width:120px;" value="<?php echo $this->feature['url_token']; ?>">
					</p>
					<p>
						<label>Feature description:</label>
						<input id="description" type="text" value="" class="text-input medium-input" name="description">
					</p>
					<p>
						<label>Special icon (Guidelines: 900x240px):
					<input name="icon" class="upload-input" type="file" style="margin-top:10px;">
					<br />
					<small>(Supported picture format: jpg,jpeg,gif,png)</small>
					</p>
					<p>
						<label>Customized page layout(CSS):</label>
						<textarea id="css" rows="3" cols="100" name="css"><?php echo $this->feature['css']; ?></textarea>
						<br />
						<small> No need to write &lt;style&gt;Tags </small>
					</p>
					<p>
						<label><input name="add_nav_menu" type="checkbox" checked="true">Add to navigation menu</label>
					</p>
					<p>
						<input class="button" type="button" onClick="ajax_post($('#_save_form'), _form_process);" value="Add a new topic" />
					</p>
				</form>
			</div>
		</div>
	</div>
	<!-- footer -->
	<?php TPL::output('admin/global/footer.tpl.htm'); ?>
	<!-- footer -->
</div>
<!-- main -->
</div>
</body></html>