<!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>
                        Mixes
                    </h1>
                    <ol class="breadcrumb">
                        <li><a href="index.php"><i class="fa fa-dashboard"></i> Home</a></li>
                        <li class="active">Mixes</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_mix.php" class="btn btn-sm btn-success pull-left"><i class="fa fa-plus"></i> Add mix</a></h3>
										<div class="box-tools">
											<div class="input-group">
												<input type="text" name="filter_mix_title" 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_mix" 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>
													Mix Cover
												</th>
												<th>
													Mix title
												</th>
												<th>
													Author
												</th>
												<th>
													Date Added
												</th>
												<th>
													Status
												</th>
												<th>
													Action
												</th>
											</tr>
											<?php foreach ($mixes as $row): ?>
											<tr>
												<td>
							                        <input type="checkbox" class="toCheck icheckbox_minimal" name="cb_mix[]" value="<?php echo $row['mix_id']; ?>"/>
						                        </td>
												<td> 
													<?php if (is_null($row['cover'])): ?>
													  <img src="<?php echo cfg('base', 'site_url'); ?>templates/admin/assets/img/no_image.png" alt="<?php echo $row['mix_title']; ?>" width="45"/> 
													<?php else: ?>
													<a href="#user<?php echo $row['mix_id']; ?>" data-toggle="modal" class="config">
													   <img src="<?php echo cfg('base', 'site_url'); ?>uploads/images/<?php echo $row['cover']; ?>" alt="<?php echo $row['mix_title']; ?>" title="<?php echo $row['mix_title']; ?>" width="45"/>
													</a>
													
													<div class="modal fade" id="user<?php echo $row['mix_id']; ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
													<div class="modal-dialog">
														<div class="modal-content">
															<div class="modal-header">
																<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
																<h4 class="modal-title"><?php echo $row['mix_title']; ?></h4>
															</div>
															<div class="modal-body" style="text-align:center;">
																   <img src="<?php echo cfg('base', 'site_url'); ?>uploads/images/<?php echo $row['cover']; ?>" alt="<?php echo $row['mix_title']; ?>" title="<?php echo $row['mix_title']; ?>" width="100%"/>
															</div>
															<div class="modal-footer">
																<!--<button type="button" class="btn blue">Save changes</button>-->
																<button type="button" class="btn default" data-dismiss="modal">Close</button>
															</div>
														</div>
														<!-- /.modal-content -->
													</div>
													<!-- /.modal-dialog -->
												</div>
												<?php endif; ?> 
												</td>
												<td>
													<?php echo $row['mix_title']; ?>
												</td>
												<td>
													<?php echo $row['author']; ?>
												</td>
												<td>
													<?php echo $row['date_added']; ?>
												</td>
												<td class="center">	 
													<?php if($row['mix_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_mix.php?mix_id=<?php echo $row['mix_id']; ?>" class="btn btn-xs btn-primary" title="Edit: <?php echo $row['mix_title']; ?>"><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>Mixes 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/mixes.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/mixes.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/mixes.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/mixes.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/mixes.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/mixes.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/mixes.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/mixes.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/mixes.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/mixes.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>
