ÿØÿà JFIF ` ` ÿþxØ
| Server IP : 109.234.164.53 / Your IP : 216.73.216.110 Web Server : Apache System : Linux cervelle.o2switch.net 4.18.0-553.32.1.lve.el8.x86_64 #1 SMP Thu Dec 19 13:14:03 UTC 2024 x86_64 User : computer3 ( 1098) PHP Version : 7.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/computer3/litsolide.com/ODLDDD_2/cp-admin/ |
Upload File : |
<?php
if (isset($_GET['online'])) {
$id = $_GET['online'];
$bdd->exec("UPDATE " . $GLOBALS['db_table']['categories'] . " SET status = 1 WHERE id = $id");
echo '<script>';
echo 'window.location = "./category.php"';
echo '</script>';
}
if (isset($_GET['offline'])) {
$id = $_GET['offline'];
$bdd->exec("UPDATE " . $GLOBALS['db_table']['categories'] . " SET status = 0 WHERE id = $id");
echo '<script>';
echo 'window.location = "./category.php"';
echo '</script>';
}
// Suppression de la cat.
if (isset($_GET['del']))
{
$id = $_GET['del'];
$bdd->exec("DELETE FROM " . $GLOBALS['db_table']['categories'] . " WHERE id = $id");
// Suppression de l'image
$content_dir = '../uploadfiles/categories/'; // dossier
unlink($content_dir . $_GET['pic']);
echo '<script>';
echo 'window.location = "./category.php"';
echo '</script>';
}
?>
<script type="text/javascript">
$(document).ready(function() {
$("#sortlist").Sortable({
accept: 'dragDrop',
opacity: 0.6,
axis : 'vertically',
onchange : function ( sorted ) {
serial = $.SortSerialize ('sortlist');
// requète Ajax pour l'enregistrement des positions
$.ajax ( {
url : "includes/set_position.php?table=categories&field=position",
type : "post",
data : serial.hash
});
}
});
});
</script>
<div class="container">
<div class="row">
<div class="span12">
<div class="page-header">
<h1>Gérer vos Catégories
<div class="pull-right">
<a href="products.php" class="btn btn-primary"><i class="icon-arrow-left"></i> Produits</a>
<a href="add_category.php" class="btn btn-primary" id="form"><i class="icon-plus"></i> Ajouter Catégorie(s)</a>
</div>
</h1>
</div>
</div>
</div>
<table id="sortlist" class="table table-bordered table-striped">
<thead>
<tr>
<th class="span3 center">Catégorie</th>
<th class="span1 center">Nombre de produits</th>
<th class="span2 center">Opérations</th>
</tr>
</thead>
<tbody>
<?php
$requete = $bdd->query("SELECT COUNT(pc.id_category) as total, c.* FROM " . $GLOBALS['db_table']['categories'] . " c LEFT JOIN " . $GLOBALS['db_table']['products_categories'] . " pc ON c.id = pc.id_category GROUP BY c.id ORDER BY c.position");
if ($row = $requete->fetch()) {
do {
$id = $row['id'];
?>
<tr class="dragDrop" id="adv_<?php echo $id; ?>" style="cursor: ns-resize;">
<td class="span1 font12 center">
<?php
$parent_id = $row['parent_id'];
if($parent_id > 0) {
$requet = $bdd->query("SELECT * FROM " . $GLOBALS['db_table']['categories'] . " WHERE id = " . $parent_id);
$catt = $requet->fetch();
echo '<font color="#CC0000">'.$catt['name'].'</font> --> '; }
?>
<b><?php echo stripcslashes($row['name']) ?></b>
</td>
<td class="span1 font12 center">
<b><?php echo stripcslashes($row['total']) ?></b>
</td>
<td class="center">
<?php
if($row['status'] == 0)
echo '<a href="./category.php?online='.$row['id'].'"><img src="assets/img/offline.png" title="Activer"></a>';
else
echo '<a href="./category.php?offline='.$row['id'].'"><img src="assets/img/online.png" title="Désactiver"></a>';
?>
<a href="./edit_category.php?id=<?php echo $row['id']; ?>">
<img src="assets/img/edit.png" title="Editer la catégorie" />
</a>
<!-- <a href="./edit_category.php?id=<?php echo $row['id']; ?>">
<img src="assets/img/edit.png" title="Editer la catégorie">
</a>
-->
<a href="#" id="<?php echo $row['id']; ?>" class="display_edit_category" title="<?php echo $row['name']; ?>" caption="<?php echo $row['caption']; ?>"
<img src="assets/img/edit.png" title="Editer la catégorie">
</a>
<a href="./details_category.php?id=<?php echo $row['id']; ?>">
<img src="assets/img/details.png" title="Gérer le contenu de la catégorie">
</a>
<?php
$stopd = '0';
$requetedd= $bdd->query("SELECT * FROM " . $GLOBALS['db_table']['categories'] . " WHERE parent_id = " . $id);
if ($rowdd = $requetedd->fetch()) {
do {
$stopd = $stopd + 1;
}while ($rowdd = $requetedd->fetch());
} else {
}
$stop = 0;
if($stopd > 0) { $stop = $stop + 1;}
if($row['total'] > 0) { $stop = $stop + 1;}
if ($stop < 1) { ?>
<a href="./category.php?del=<?php echo $row['id']; ?>&pic=<?php echo $row['picture']; ?>" id="<?php echo $row['id']; ?>" onclick="return confirm('Êtes vous sur de vouloir supprimer cet élément ?')">
<img src="assets/img/delete.png" title="Supprimer la catégorie">
</a>
<?php } else { ?>
<a href="" id="" onclick="return confirm('Impossible... Il y a soit des produits ou sous-catégories dans cette catégorie !!')">
<img src="assets/img/delete.png" title="Supprimer la catégorie">
</a>
<?php } ?>
</td>
</tr>
<?php
}while ($row = $requete->fetch());
} else {
echo 'Aucune page à afficher !!!';
}
?>
</tbody>
</table>
</div>
<div class="modal hide fade" id="category_box" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" wi>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3 id="category_title_box_box_header">Editer la catégorie</h3>
</div>
<div class="modal-body" id="category_box_content">
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Fermer</button>
<button class="btn btn-primary" id="update_category">Enregistrer</button>
</div>
</div>
<script type="text/javascript">
$('.display_edit_category').live('click', function(event) {
event.preventDefault();
var id = $(this).attr('id');
var name = $(this).attr('title');
var caption = $(this).attr('caption');
$('#category_box').modal();
$('#category_box_content').html('<input type="hidden" id="id" value="'+id+'"> <div style="display: inline;"><label for="name">Nom :</label> <input type="text" id="name" value="'+name+'" style="width:95%;"></div> <label for="caption">Description :</label> <textarea id="caption" style="width:95%; height:60px;">'+caption+'</textarea>');
});
$('#update_category').live('click', function(event) {
event.preventDefault();
var id = $('#id').val();
var name = $('#name').val();
var caption = $('#caption').val();
$.ajax({
type: 'POST',
data: 'id='+id+'&name='+name+'&caption='+caption,
url: 'includes/listeners/updateCategory.php',
success: function(msg) {
if(msg!='') alert(msg);
else window.location.reload();
}
});
});
</script>
<?
include_once('includes/footer.php');
?>