<table class="table table-bordered table-striped table-mailcard">
	<thead>
		<tr>
			<th class="w-1 text-center">No</th>
			<th>Nama File</th>
			<th>Tanggal</th>
			<th class="text-right">Size</th>
			<th class="text-right">Aksi</th>
		</tr>
	</thead>
	<tbody>
		<?php if(!empty($posts)){
			$no=$this->uri->segment(3)+1;
			foreach($posts as $row){ 
				$aksi = '<button class="btn btn-danger btn-sm flat" data-toggle="modal" data-target="#confirm-delete" data-id="'.encrypt_url($row->id).'">Hapus</button>';
				$file_path = FCPATH . 'backup_db/'.$row->nama_file;
				if(is_file($file_path)){
					$size      = filesize($file_path);
					$disabled  = '';
					}else{
					$size      = 0;
					$disabled  = 'disabled';
				}
				
				
				if($row->type_file=='zip')
				{
					$archive = '<button type="button" class="btn btn-info btn-sm unzipdb" data-toggle="tooltip" title="Unzip DB" data-id="' . encrypt_url($row->id) . '" '.$disabled.'><i class="fa fa-archive "></i> Extract</button>';
					$btn = '<button type="button" class="btn btn-success btn-sm downloaddb text-right" data-toggle="tooltip" title="Download DB" data-file="' . $row->nama_file . '"><i class="fa fa-download"></i></a></button>';
					}else{
					$archive = '<button type="button" class="btn btn-primary btn-sm restoredb" data-toggle="tooltip" title="Restore DB" data-id="'.encrypt_url($row->nama_file).'" '.$disabled.'><i class="fa fa-retweet"></i> Restore</button>';
					$btn = '<button type="button" class="btn btn-primary btn-sm downloaddb" data-toggle="tooltip" title="Download DB" data-file="' . $row->nama_file . '"><i class="fa fa-download"></i></a></button>';
				}
				if($demo=='N'){
					$btn = $btn;
					}else{
					$btn = '';
				}
			?>
			<tr>
				<td><?php echo $no; ?></td>
				<td><?=$row->title; ?></td>
				<td class="text-left"><?=dtimes_backup($row->create_date);?></td>
				<td class="text-right"><?=format_size($size);?></td>
				<td class="text-right">
					<div class="btn-group btn-group-sm flat" role="group" aria-label="Basic example">
						<?=$btn.$archive.$aksi;?>
					</div>
					
				</td>
			</tr>
		<?php $no++;} }else{ ?>
		<tr>
			<td colspan="10">Data belum ada</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<nav aria-label="Page navigation" class="mt-2">
	<?php 
		echo $this->ajax_pagination->create_links(); 
		?>
		</nav>
		