BBnepal-Accounts/application/views/admin/database-backups.php
Sampanna Rimal 9cd05ef3cb commitall
2024-07-10 18:28:19 +05:45

162 lines
8.2 KiB
PHP

<div class="wraper responsive-width">
<main class="" id="main">
<div class="from-group adding-class form-group_lng">
<a href="<?= base_url(); ?>admin/create-db-backups">
<button type="button" class="btn btn-success btn-sm">Create New Backup</button>
</a>
</div>
<div class="admin_tempblock">
<div class="admin_tempsec">
<div class="admin_sec">
<div class="subsec_sec">
<div class="subject_r subject_r_lng">
<div class="subject_lsec">
<div class="subject_lhead">Database Backup Files <p id="success" style="color:green;"></p>
</div>
<?php if ($this->session->flashdata('success')) { ?>
<div class="alert alert-success alert-dismissible fade show" role="alert">
<p><?php echo $this->session->flashdata('success') ?></p>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php } ?>
<?php if ($this->session->flashdata('danger')) { ?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<p><?php echo $this->session->flashdata('danger') ?></p>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php } ?>
<table id="tbl" class="display table-responsive">
<thead>
<tr>
<th width='50px' class="textCenter">Sl No</th>
<th class="textCenter">File Name</th>
<th class="textCenter">Backup Date</th>
<th class="textCenter">Action</th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
if(isset($dbBackupFiles) && !empty($dbBackupFiles))
{
foreach ($dbBackupFiles as $key=>$value)
{
$dateandtime = substr($value,0,-4);
$dtArr = explode('_', $dateandtime);
$dat = strtotime($dtArr[0].' '.str_replace("-", ":", $dtArr[1]));
?>
<tr>
<td class="textCenter"> <?php echo $i; ?></td>
<td class="textCenter"><div class="name_width"><?php echo $value; ?></div></td>
<td class="textCenter">
<div class="width_control">
<?php echo date(MY_DATE_FORMAT, strtotime($dtArr[0])).' , '.date("h:i:s A", $dat); ?>
</div>
</td>
<td>
<div class="sub_tabbtnsec">
<!--<a data-toggle="modal" href="<?php echo base_url();?>database_backups/<?php echo $value;?>" download='<?php echo $dateandtime;?>'>-->
<a href="javascript:download('<?php echo base_url();?>database_backups/<?php echo $value;?>')" >
<div class="sub_delbtn" style='color:#28a745;' data-toggle="tooltip" title="Download">
<i class="fa fa-download" aria-hidden="true"></i>
</div>
</a>
<?php if($i >5){?>
&nbsp;&nbsp;
<a data-toggle="modal" onclick="confirm_delete_backup('<?php echo $value;?>')">
<div class="sub_delbtn" data-toggle="tooltip" title="Delete">
<i class="fa fa-trash" aria-hidden="true"></i>
</div>
</a>
<?php } ?>
</div>
</td>
</tr>
<?php
$i++;
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
<div class="viewDoc delete-modal-wrap">
<div class="modal fade" id="confirmDeleteBatchModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<div class="delete-modal">
<i class="far fa-times-circle"></i>
<input type="hidden" id="del_backup_id" id="del_backup_id" />
<h4>Are you sure?</h4>
<p>you want to delete this database backup?</p>
<div class="delete-modal-btn">
<button type="button" class="subject_addbtn subject_addbtn_red" onclick="delete_delete_backup($('#del_backup_id').val());">Delete</button>
<button type="button" class="subject_addbtn subject_addbtn_cancel" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
//table js
$('#tbl').DataTable({
"lengthMenu": [
[25, 50, 100, 150, -1],
[25, 50, 100, 150, "All"]
]
});
//table js end
});
</script>
<script type="text/javascript">
function confirm_delete_backup(delBackupName) {
$('#del_backup_id').val(delBackupName);
$('#confirmDeleteBatchModal').modal('show');
}
function delete_delete_backup(delId) {
window.location.replace('<?php echo base_url() ?>' + 'admin/delete-db-backup/' + delId);
}
function download(path) {
window.location.href = path;
};
$(document).ready(function() {
// show the alert
setTimeout(function() {
$(".alert").alert('close');
<?php unset($_SESSION['success']); ?>
<?php unset($_SESSION['danger']); ?>
}, 15000);
});
</script>