<!DOCTYPE html>
<html>
    
	<?php require_once('head' . cfg('template', 'template_extension')); ?>
    
	<body class="skin-black">
        
		<?php require_once('header' . cfg('template', 'template_extension')); ?>
		
        <div class="wrapper row-offcanvas row-offcanvas-left">
            <!-- Left side column. contains the logo and sidebar -->
            <aside class="left-side sidebar-offcanvas">
                
			    <?php require_once('sidebar' . cfg('template', 'template_extension')); ?>	
				
            </aside>

            <!-- Right side column. Contains the navbar and content of the page -->
            <aside class="right-side">
                <!-- Content Header (Page header) -->
                <section class="content-header">
                    <h1>
                        Articles Categories
                    </h1>
                    <ol class="breadcrumb">
                        <li><a href="index.php"><i class="fa fa-dashboard"></i> Home</a></li>
                        <li class="active">Articles Categories</li>
                    </ol>
                </section>

                <!-- Main content -->
                <section class="content">
                    <div class="row">
                        
                        <div class="col-md-12">
							
							<!-- form start -->
                            <form role="form" action="" method="post" enctype="multipart/form-data">
                                 
								<div class="box box-primary">
									<div class="box-header white">
										<h3 class="box-title"><a href="add_articles_category.php" class="btn btn-sm btn-success pull-left"><i class="fa fa-plus"></i> Add category</a></h3>
										<div class="box-tools">
											<div class="input-group">
												<input type="text" name="filter_category_name" class="form-control input-sm pull-right" style="width: 150px;" placeholder="Search"/>
												<div class="input-group-btn">
													<button type="submit" class="btn btn-sm btn-default" name="search"><i class="fa fa-search"></i></button>
												</div>
											</div>
										</div>
									</div><!-- /.box-header -->
									<?php if ($rowCount > 0): ?>
									
									<div class="box-body table-responsive no-padding">
										<table class="table table-hover">
											<tbody>
											<tr>
												<th class="table-checkbox">
													<input type="checkbox" class="icheckbox_minimal" value="cb_category" data-checkall=".toCheck"/> <button type="submit" class="btn btn-sm btn-danger" name="delete"><i class="fa fa-trash-o"></i> Delete</button>
												</th>
												<th>
													Category name
												</th>
												<th>
											        Status
												</th>
												<th>
													Action
												</th>
											</tr>
											<?php foreach ($articles_categories as $row): ?>
											<tr>
												<td>
							                        <input type="checkbox" class="toCheck icheckbox_minimal" name="cb_category[]" value="<?php echo $row['language_code']; ?>"/>
						                        </td>
												<td>
													<?php echo $row['category_name']; ?>
												</td>
												<td class="center">	 
													<?php if($row['category_status']):?>
														<span class="label label-success">
															Active
														</span>
													<?php else:?>
														<span class="label label-danger">
															Inactive
														</span>
													<?php endif;?>															
												</td>
												<td class="action-bar">
							                        <a href="edit_articles_category.php?category_id=<?php echo $row['category_id']; ?>" class="btn btn-xs btn-primary" title="Edit: <?php echo $row['category_name']; ?>"><i class="fa fa-edit"></i></a>
						                        </td>
											</tr>
											<?php endforeach; ?>
											</tbody>
										</table>
									</div><!-- /.box-body -->
									
									<?php else: ?>
										<div class="alert alert-info alert-dismissable">
											<i class="fa fa-info"></i>
											<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
											<p>Category not found.</p>
										</div>
									<?php endif; ?>
								
									<?php if($pages>1) { ?>
										<div class="box-footer">
										<ul class="pagination pull-right">
											<?php if ($current_page>1) {?>
												<li>
													<a href="<?php  echo cfg('base', 'site_url'); ?>admin/articles_categories.php?page=1" data-page="1">
														<i class="fa fa-angle-double-left"></i>
													</a>
												</li>
												<li>
													<a href="<?php  echo cfg('base', 'site_url'); ?>admin/articles_categories.php?page=<?php echo ($current_page-1); ?>" data-page="<?php echo $current_page-1; ?>">
														<i class="fa fa-angle-left"></i>
													</a>
												</li>
											<?php } ?>

											<?php 
											if($current_page-2<=4)
											{	for($i=1;$i<=$current_page;$i++)
												{	if($i!=$current_page)
														echo '<li><a href="'. cfg('base', 'site_url') .'admin/articles_categories.php?page='.$i.'" data-page="'.$i.'">'.$i.'</a></li>';
													else
														echo '<li class="active"><a  href="#" data-page="'.$i.'">'.$i.'</a></li>';
												}
											}
											else
											{	for($i=1;$i<=3;$i++)
												{	if($i!=$current_page)
														echo '<li><a href="'. cfg('base', 'site_url') .'admin/articles_categories.php?page='.$i.'" data-page="'.$i.'">'.$i.'</a></li>';
													else
														echo '<li class="active"><a  href="#" data-page="'.$i.'">'.$i.'</a></li>';
												}
												echo '<li><a class="inactive" title="">...</a></li>';
												for($i=$current_page-2;$i<=$current_page;$i++)
												{	if($i!=$current_page)
														echo '<li><a href="'. cfg('base', 'site_url') .'admin/articles_categories.php?page='.$i.'" data-page="'.$i.'">'.$i.'</a></li>';
													else
														echo '<li class="active"><a  href="#" data-page="'.$i.'">'.$i.'</a></li>';
												}
											}
											?>

											<?php 
											if ($current_page<$pages) 
											{	if($current_page+2>=$pages-3)
												{	for($i=$current_page+1;$i<=$pages;$i++)
													{	if($i!=$current_page)
															echo '<li><a href="'. cfg('base', 'site_url') .'admin/articles_categories.php?page='.$i.'" data-page="'.$i.'">'.$i.'</a></li>';
														else
															echo '<li class="active"><a  href="#" data-page="'.$i.'">'.$i.'</a></li>';
													}
												}
												else
												{	for($i=$current_page+1;$i<=$current_page+2;$i++)
													{	if($i!=$current_page)
															echo '<li><a href="'. cfg('base', 'site_url') .'admin/articles_categories.php?page='.$i.'" data-page="'.$i.'">'.$i.'</a></li>';
														else
															echo '<li class="active"><a href="#" data-page="'.$i.'">'.$i.'</a></li>';
													}
													echo '<li><a class="inactive" title="">...</a></li>';
													for($i=$pages-2;$i<=$pages;$i++)
													{	if($i!=$current_page)
															echo '<li><a href="'. cfg('base', 'site_url') .'admin/articles_categories.php?page='.$i.'" data-page="'.$i.'">'.$i.'</a></li>';
														else
															echo '<li class="active"><a  href="#" data-page="'.$i.'">'.$i.'</a></li>';
													}
												}
											?>
												<li>
													<a href="<?php  echo cfg('base', 'site_url'); ?>admin/articles_categories.php?page=<?php echo ($current_page+1);?>" data-page="<?php  echo $current_page+1; ?>">
														<i class="fa fa-angle-right"></i>
													</a>
												</li>
												<li>
													<a href="<?php  echo cfg('base', 'site_url'); ?>admin/articles_categories.php?page=<?php echo $pages;?>" data-page="<?php echo $pages; ?>">
														<i class="fa fa-angle-double-right"></i>
													</a>
												</li>
											<?php } ?>
										</ul>
										</div><!-- /.box-footer -->
								<?php } ?>
								
								
								
								<div class="clearfix"></div>
								
								</div><!-- /.box -->
							
							</form><!-- /.form -->
							
                        </div><!--/.col -->
                    </div>   <!-- /.row -->
                </section><!-- /.content -->
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->
        
    <?php require_once('footer' . cfg('template', 'template_extension')); ?>

    </body>
</html>
