<? $this->load->view( $this->aSystemVar['template_viewer_root'] . 'admin/_header') ?>
	<div class="bigCaption">Posts <span>( <?= anchor('post/add/' . $Post_list['Category'], 'add new' ) ?> )</span> </div>
		<?
			$aPagination['Pagination'] = $Post_list['Pagination'];
			$this->load->view( $this->aSystemVar['template_viewer_root'] . 'design_items/pagination', $aPagination );
		?>
		<div class="filter">
			<?= form_open('admin/post_list/', array( 'id' => 'filter_post_form') ) ?>
			<table cellpadding="4" cellspacing="1" border="0">
				<!--<tr>
					<td>
						status
					</td>
					<td>
						type
					</td>
					<td>
						category
					</td>
					<td>&nbsp;</td>
				</tr>-->
				<tr>
					<td>
						<select name="Status">
							<option value=""<?= empty($Post_list['Status']) ? ' selected="selected" ' : ''; ?>>-= status =-</option>
							<option value="inactive"<?= 'inactive' == $Post_list['Status'] ? ' selected="selected" ' : ''; ?>>inactive</option>
							<option value="active"<?= 'active' == $Post_list['Status'] ? ' selected="selected" ' : ''; ?>>active</option>
						</select>
					</td>
					<td>
						<select name="SubType">
							<option value=""<?= empty($Post_list['SubType']) ? ' selected="selected" ' : ''; ?>>-= type =-</option>
							<option value="regular"<?= 'regular' == $Post_list['SubType'] ? ' selected="selected" ' : ''; ?>>regular</option>
							<option value="featured"<?= 'featured' == $Post_list['SubType'] ? ' selected="selected" ' : ''; ?>>featured</option>
							<option value="news"<?= 'news' == $Post_list['SubType'] ? ' selected="selected" ' : ''; ?>>news</option>
						</select>
					</td>
					<td>
						<select name="Category">
							<option value=""<? empty($Post_list['Category']) ? ' selected="selected" ' : '' ?>>-= category =-</option>
							<? foreach($Post_list['category_list'] as $aCategory): ?>
								<option value="<?= $aCategory['Id'] ?>"<?= $aCategory['Id'] == $Post_list['Category'] ? ' selected="selected" ' : ''  ?>><?= $aCategory['Title'] ?></option>
							<? endforeach; ?>
						</select>
					</td>
					<td>
						<input type="submit" value="filter" class="submit" />
					</td>
				</tr>
			</table>

			<?= form_close() ?>
		</div>
	<?= form_open('admin/post_list/' . $Post_list['Status'] . '/' . $Post_list['SubType'], array( 'id' => 'approve_post_form') ) ?>
		<div><input type="hidden" id="action" name="action" value="" /></div>
		<table cellpadding="0" cellspacing="1" width="100%" class="contentList">
			<tr class="head">
				<td class="id">id</td>
				<td class="checkbox"><input type="checkbox" disabled="disabled" /></td>
				<td>image</td>
				<td>author</td>
				<td class="title">title</td>
				<td class="desc">snipet</td>
				<td class="keywords">keywords</td>

				<td colspan="4" class="action">action</td>
			</tr>
			<? $i = 0; ?>
		<? foreach( $Post_list['PostList'] as $aPost ): ?>
			<?
				if( ($i%2) == 0 )
				{
					$sClassName = 'odd';
				}
				else
				{
					$sClassName = 'even';
				}
			?>

			<tr class="<?= $sClassName ?>" style="<?=(!$aPost['Lang']?'background-color:#ffeeee;"':'')?>">
				<td class="id"><?= $aPost['Id'] ?></td>
				<td class="checkbox"><input type="checkbox" name="PostId[]" value="<?= $aPost['Id'] ?>" id="p<?= $aPost['Id'] ?>" class="checkbox" /></td>
				<td><img src="<?= $aPost['PicUrl'] ?>" title="<?= $aPost['Title'] ?>" alt="<?= $aPost['Title'] ?>" /></td>
				<td><?= $aPost['Name'] ?></td>
				<td class="title"><?= $aPost['Title'] ?></td>
				<td class="desc"><?= $aPost['Snipet'] ?></td>
				<td class="keywords"><?= $aPost['Keywords'] ?></td>
				<td class="view textCenter">
						<?= anchor( 'post/review/' . $aPost['Id'], 'view') ?>
					</td>
					<td class="textCenter edit">
						<?= anchor('post/edit/' . $aPost['Id'], 'edit') ?>
					</td>

						<? if( $aPost['Status'] == 'inactive' ): ?>
							<td class="textCenter activate">
								<a href="#" onclick="javascript: document.getElementById('action').value='active'; document.getElementById('p<?= $aPost['Id'] ?>').checked = true; document.getElementById('approve_post_form').submit(); return false;">activate</a>
							</td>
						<? else: ?>
							<td class="textCenter deactivate">
								<a href="#" onclick="javascript: document.getElementById('action').value='inactive'; document.getElementById('p<?= $aPost['Id'] ?>').checked = true; document.getElementById('approve_post_form').submit(); return false;">deactivate</a>
							</td>
						<? endif; ?>
					<td class="textCenter delete">
						<a href="#" onclick="javascript: document.getElementById('action').value='deleted'; document.getElementById('p<?= $aPost['Id'] ?>').checked = true; document.getElementById('approve_post_form').submit(); return false;">delete</a>
					</td>
			</tr>
			<? $i++; ?>
		<? endforeach; ?>
		</table>

			<?
				$aPagination['Pagination'] = $Post_list['Pagination'];
				$this->load->view( $this->aSystemVar['template_viewer_root'] . 'design_items/pagination', $aPagination );
			?>
	<?= form_close(); ?>
<? $this->load->view( $this->aSystemVar['template_viewer_root'] . 'admin/_footer') ?>