backoffice/application/views/gestion_publicite.php

166 lines
7.5 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $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>
<?= $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>
<?= $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" style="overflow-x:auto;">
<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><?= $row->pays ?></td>
<td><?= $row->partenariat ?></td>
<td><?= $row->maj ?></td>
<?php
if($row->etat==1){
?>
<td><span class="label label-success"><?= $this->lang->line('Actif'); ?></span></td>
<td><button type="button" data-countryid="<?= $row->id_country; ?>" data-etat="<?= $row->etat; ?>" data-idpub="<?= $row->id; ?>" class="btn btn-danger changeStatePub"><?= $this->lang->line('Désactiver'); ?></button></td>
<?php
}else{
?>
<td><span class="label label-danger"><?= $this->lang->line('Inactif'); ?></span></td>
<td><button type="button" data-countryid="<?= $row->id_country; ?>" data-etat="<?= $row->etat; ?>" data-idpub="<?= $row->id; ?>" class="btn btn-primary changeStatePub"><?= $this->lang->line('Activer'); ?></button></td>
<?php
}
?>
</tr>
<?php
}
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- jQuery 3 -->
<script src="<?= base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
<!-- Bootstrap 3.3.7 -->
<script src="<?= base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
<!-- DataTables -->
<script src="<?= base_url('bower_components/datatables.net/js/jquery.dataTables.min.js') ?>"></script>
<script src="<?= base_url('bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js') ?>"></script>
<!-- Slimscroll -->
<script src="<?= base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
<!-- FastClick -->
<script src="<?= base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
<!-- AdminLTE App -->
<script src="<?= base_url('dist/js/adminlte.min.js') ?>"></script>
<!-- AdminLTE for demo purposes -->
<script src="<?= base_url('dist/js/demo.js') ?>"></script>
<script src="<?= base_url('dist/js/demo.js') ?>"></script>
<script src="<?= base_url('bower_components/moment/min/moment.min.js') ?>"></script>
<script src="<?= base_url('bower_components/bootstrap-daterangepicker/daterangepicker.js') ?>"></script>
<script src="<?= 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 : '<?= base_url('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 : '<?= base_url('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>