backoffice/application/views/gestion_publicite.php

166 lines
7.7 KiB
PHP
Raw Normal View History

<div class="content-wrapper">
<section class="content-header">
<h1>
<?php echo $this->lang->line('Gestion de la publicité'); ?>
</h1>
<?php
$site_url = base_url();
if($alert=="ok") {
if(!$success=="ok"){
?>
<div class='alert alert-danger alert-dismissible col-xs-6'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<h4><i class='icon fa fa-ban'></i> Erreur!</h4>
<?php echo $message; ?>
</div>
<?php
} else {
?>
<div class="alert alert-success alert-dismissible col-xs-6">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<h4><i class="icon fa fa-check"></i> Success!</h4>
<?php echo $message; ?>
</div>
<?php
}
}
?>
</section>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title">Publicité interstitielle</h3>
</div>
<div class="box-body table-responsive no-padding">
<table class="table table-hover">
<tbody>
<tr>
<th>Pays</th>
<th>Opérateur</th>
<th>Date de mise à jour</th>
<th>Statut</th>
<th>Activer/Desactiver</th>
</tr>
<?php $countries = $countries_list;
if($countries!=false){
$numrows= $countries->num_rows();
$num = 0;
if ($numrows > 0) {
foreach($countries->result() as $row) {
$num ++;
?>
<tr>
<td><?php echo $row->pays ?></td>
<td><?php echo $row->partenariat ?></td>
<td><?php echo $row->maj ?></td>
<?php
if($row->etat==1){
?>
<td><span class="label label-success"><?php echo $this->lang->line('Actif'); ?></span></td>
<td><button type="button" data-countryid="<?php echo $row->id_country; ?>" data-etat="<?php echo $row->etat; ?>" data-idpub="<?php echo $row->id; ?>" class="btn btn-danger changeStatePub"><?php echo $this->lang->line('Désactiver'); ?></button></td>
<?php
}else{
?>
<td><span class="label label-danger"><?php echo $this->lang->line('Inactif'); ?></span></td>
<td><button type="button" data-countryid="<?php echo $row->id_country; ?>" data-etat="<?php echo $row->etat; ?>" data-idpub="<?php echo $row->id; ?>" class="btn btn-primary changeStatePub"><?php echo $this->lang->line('Activer'); ?></button></td>
<?php
}
?>
</tr>
<?php
}
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- jQuery 3 -->
<script src="<?php echo base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
<!-- Bootstrap 3.3.7 -->
<script src="<?php echo base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
<!-- DataTables -->
<script src="<?php echo base_url('bower_components/datatables.net/js/jquery.dataTables.min.js') ?>"></script>
<script src="<?php echo base_url('bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js') ?>"></script>
<!-- Slimscroll -->
<script src="<?php echo base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
<!-- FastClick -->
<script src="<?php echo base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
<!-- AdminLTE App -->
<script src="<?php echo base_url('dist/js/adminlte.min.js') ?>"></script>
<!-- AdminLTE for demo purposes -->
<script src="<?php echo base_url('dist/js/demo.js') ?>"></script>
<script src="<?php echo base_url('dist/js/demo.js') ?>"></script>
<script src="<?php echo base_url('bower_components/moment/min/moment.min.js') ?>"></script>
<script src="<?php echo base_url('bower_components/bootstrap-daterangepicker/daterangepicker.js') ?>"></script>
<script src="<?php echo base_url('bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js') ?>"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
<script>
$('.changeStatePub').click(function(){
var pub_id = $(this).data('idpub');
var etat = $(this).data('etat');
var country_id = $(this).data('countryid');
//alert(etat);
if(etat === ''){
$.ajax({
url : '<?php echo base_url('index.php/Gestion/addPubRow')?>',
type : 'POST',
dataType : 'json',
data: {"country_id": country_id},
success : function(data, statut){
if(data=='200'){
alert("Les informations ont été mises à jour.") ? "" : location.reload(true);
}else{
alert("Une erreur s'est produite.");
}
},
error : function(resultat, statut, erreur){
console.log(resultat+" "+erreur);
}
});
}else{
$.ajax({
url : '<?php echo base_url('index.php/Gestion/changePubState')?>',
type : 'POST',
dataType : 'json',
data: {"pub_id": pub_id,"etat": etat},
success : function(data, statut){
if(data=='200'){
alert("Les informations ont été mises à jour.") ? "" : location.reload(true);
}else{
alert("Une erreur s'est produite.");
}
},
error : function(resultat, statut, erreur){
console.log(resultat+" "+erreur);
}
});
}
});
</script>