<?php defined('KOBLOG') or die('Koblog CMS.');

echo "<div class='d-flex justify-content-between align-content-center'>";

echo Bootstrap::pageTitle(array('title'=>$L->g('Categories'), 'icon'=>'tags'));

echo "<div>";
echo Bootstrap::link(array(
	'title'=>$L->g('New category'),
	'href'=>HTML_PATH_ADMIN_ROOT.'new-category',
	'icon'=>'plus',
	'class'=>'btn btn-outline-success'
));
echo "</div></div>";

echo '
<div class="card  mt-3">
<table class="table m-0">
	<thead>
		<tr class="card-header">
			<th class="border-bottom-0" scope="col">'.$L->g('Name').'</th>
			<th class="border-bottom-0" scope="col">'.$L->g('URL').'</th>
		</tr>
	</thead>
	<tbody>
';

foreach ($categories->keys() as $key) {
	$category = new Category($key);
	echo '<tr class="card-tablebody">';
	echo '<td><a href="'.HTML_PATH_ADMIN_ROOT.'edit-category/'.$key.'">'.$category->name().'</a></td>';
	echo '<td><a href="'.$category->permalink().'">'.$url->filters('category', false).$key.'</a></td>';
	echo '</tr>';
}

echo '
	</tbody>
</table>
</div>
';
