465 lines
8.7 KiB
PHP
465 lines
8.7 KiB
PHP
<?php
|
|
|
|
include_once(realpath(dirname(__FILE__)) . "/../../../fonctions/authplugins.php");
|
|
|
|
autorisation("logosite");
|
|
|
|
?>
|
|
|
|
<?php
|
|
|
|
/*******************************************************************************
|
|
|
|
* Plugin LogoSite pour Thélia.
|
|
|
|
* -----------------------------------------------------------------------------
|
|
|
|
* Date de création : Mars 2008
|
|
|
|
* Version : 1.0
|
|
|
|
* -----------------------------------------------------------------------------
|
|
|
|
* Auteur : Guillaume RAYNAUD
|
|
|
|
* Mail : guillaume.raynaud@gmail.com
|
|
|
|
* Pseudo sur les sites de Thélia : Guillaume
|
|
|
|
* Site web : http://guillaume.raynaud.cv.free.fr
|
|
|
|
* Mon profil viadeo : http://www.viadeo.com/fr/profile/guillaume.raynaud4
|
|
|
|
* -----------------------------------------------------------------------------
|
|
|
|
* Site Thélia utilisant ce plugin : http://www.oenoschool.com
|
|
|
|
******************************************************************************/
|
|
|
|
?>
|
|
|
|
<?php
|
|
|
|
include_once(realpath(dirname(__FILE__)) . "/Logosite.class.php");
|
|
|
|
$logo = new LogoSite();
|
|
|
|
if(!isset($action)){
|
|
|
|
$action="";
|
|
|
|
}
|
|
|
|
// Les actions possibles pour la page d'administration des logos sont :
|
|
|
|
// - ajouter un logo
|
|
|
|
// - supprimer un logo
|
|
|
|
// - sélectionner un logo
|
|
|
|
|
|
|
|
// Pour la sélection il s'agit simplement d'un radio bouton auquel l'id du logo est associé
|
|
|
|
?>
|
|
|
|
<div id="contenu_int">
|
|
|
|
<p class="titre_rubrique">Gestion du logo du site</p>
|
|
|
|
<p align="right" class="geneva11Reg_3B4B5B">
|
|
|
|
<a href="accueil.php" class="lien04">Accueil </a><img src="gfx/suivant.gif" border="0" height="9" width="12"><a href="module_liste.php" class="lien04">Liste des modules</a>
|
|
|
|
<img src="gfx/suivant.gif" width="12" height="9" border="0" /><a href="<?php echo $_SERVER['PHP_SELF'] ?>?nom=logosite" class="lien04">Gestion du logo</a>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<table width="710" border="0" cellpadding="5" cellspacing="0">
|
|
|
|
<tr>
|
|
|
|
<td width="600" height="30" class="titre_cellule_tres_sombre">LISTE DES LOGOS</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
/*print ($_GET['action']);
|
|
|
|
print ($_GET['logo']);*/
|
|
|
|
if (isset($_GET['action']) && ($_GET['action'] == "selection")){
|
|
|
|
$query = "UPDATE $logo->table SET `actif` = '0'"; // on met tout à 0 avant de sélectionner celui qui nous intéresse
|
|
|
|
$resul = mysql_query($query, $logo->link);
|
|
|
|
|
|
|
|
$query = "UPDATE $logo->table SET `actif` = '1' WHERE `id` = '".$_GET['logo']."'";
|
|
|
|
$resul = mysql_query($query, $logo->link);
|
|
|
|
$action = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($_POST['action'])){
|
|
|
|
if($_POST['action'] == "ajouter")
|
|
|
|
$query = "INSERT INTO $logo->table (id, nom, chemin, actif, date) VALUES ( '', '".$_POST['nom']."', '".$_POST['chemin']."', ".$_POST['actif'].", '".$_POST['date']."')";
|
|
|
|
if($_POST['action'] == "modifier")
|
|
|
|
$query = "UPDATE $logo->table SET `nom` = '".$_POST['nom']."', `chemin` = '".$_POST['chemin']."', `actif` = '".$_POST['actif']."', `date` = '".$_POST['date']."' WHERE `id` = '".$_POST['id']."'";
|
|
|
|
if($_POST['action'] == "selection")
|
|
|
|
$query = "UPDATE $logo->table SET `actif` = '1' WHERE `id` = '".$_POST['logo']."'; UPDATE $logo->table SET `actif` = '0' WHERE `id` <> '".$_POST['logo']."'";
|
|
|
|
|
|
|
|
$resul = mysql_query($query, $logo->link);
|
|
|
|
$action = "";
|
|
|
|
unset($_POST['action']);
|
|
|
|
unset($_POST['nom']);
|
|
|
|
unset($_POST['chemin']);
|
|
|
|
unset($_POST['actif']);
|
|
|
|
unset($_POST['date']);
|
|
|
|
?>
|
|
|
|
|
|
|
|
<script type='text/javascript'>
|
|
|
|
<!--
|
|
|
|
window.location.replace('<?php echo $_SERVER['PHP_SELF'] ?>?nom=logosite');
|
|
|
|
-->
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
|
|
|
|
if($action == "supprimer"){
|
|
|
|
// on pourrait améliorer en vérifiant si celui qui doit être supprimé est actif et dans ce cas en activer un autre.
|
|
|
|
// pour l'instant on supprime sans même demander de vérification.
|
|
|
|
$logo->charger($id);
|
|
|
|
$logo->delete();
|
|
|
|
|
|
|
|
$cache = new Cache();
|
|
|
|
$cache->vider("LOGOSITE", "%");
|
|
|
|
}
|
|
|
|
|
|
|
|
// if($action == "" || $action == "supprimer"){
|
|
|
|
if($action != "ajouter" && $action != "modifier"){
|
|
|
|
// Dans tous les cas sauf ajout ou modification : on fait la liste des logos
|
|
|
|
|
|
|
|
$query = "select * from $logo->table order by date desc";
|
|
|
|
$resul = mysql_query($query, $logo->link);
|
|
|
|
$i = 0;
|
|
|
|
|
|
|
|
?>
|
|
|
|
<form id="formulaire" method="get" action="">
|
|
|
|
<table width="710" border="0" cellpadding="5" cellspacing="0">
|
|
|
|
<tr>
|
|
|
|
<td height="30" class="titre_cellule">ACTIF</td>
|
|
|
|
<td height="30" class="titre_cellule">DATE</td>
|
|
|
|
<td height="30" class="titre_cellule">NOM</td>
|
|
|
|
<td height="30" class="titre_cellule">CHEMIN</td>
|
|
|
|
<td height="30" class="titre_cellule">VIGNETTE</td>
|
|
|
|
<td height="30" class="titre_cellule" colspan="2"></td>
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
|
|
|
|
while($row = mysql_fetch_object($resul)){
|
|
|
|
if($i%2) $fond="sombre";
|
|
|
|
else $fond="claire";
|
|
|
|
|
|
|
|
?>
|
|
|
|
<tr class="cellule_<?php echo $fond; ?>">
|
|
|
|
<td><input type="radio" name="logo" value="<?php echo($row->id); ?>" <?php if($row->actif){echo ("checked");} ?> /></td>
|
|
|
|
<td><?php echo($row->date); ?></td>
|
|
|
|
<td><?php echo($row->nom); ?> </td>
|
|
|
|
<td><?php echo($row->chemin); ?></td>
|
|
|
|
<td><img src="<?php echo("../".$row->chemin."/".$row->nom); ?>" alt="logo numero <?php echo($row->id); ?>" height="60" /></td>
|
|
|
|
<td>
|
|
|
|
<a href="<?php echo $_SERVER['PHP_SELF'] ?>?nom=logosite&action=modifier&id=<?php echo $row->id; ?>" class="txt_vert_11">Modifier</a>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<a href="<?php echo $_SERVER['PHP_SELF'] ?>?nom=logosite&action=supprimer&id=<?php echo $row->id; ?>" class="txt_vert_11">Supprimer X</a>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
$i++;
|
|
|
|
} // fin While
|
|
|
|
?>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<br>
|
|
|
|
<table border="0" cellpadding="5" cellspacing="0" width="710">
|
|
|
|
<tr>
|
|
|
|
<td class="cellule_sombre2" height="30">
|
|
|
|
<input name="nom" value="logosite" type="hidden">
|
|
|
|
<input name="action" value="selection" type="hidden">
|
|
|
|
<span class="geneva11Reg_3B4B5B"><a href="#" class="txt_vert_11" onclick="document.getElementById('formulaire').submit();">Valider la sélection</a></span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<table width="710" border="0" cellpadding="5" cellspacing="0">
|
|
|
|
<tr>
|
|
|
|
<td height="5"></td>
|
|
|
|
</tr>
|
|
|
|
<tr class="cellule_claire">
|
|
|
|
<td height="30" class="titre_cellule_tres_sombre2"><a href="<?php echo $_SERVER['PHP_SELF'] ?>?nom=logosite&action=ajouter" class="lien_titre_cellule">Ajouter un logo</a></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<?php
|
|
|
|
} // fin if (action != ajouter && action != modifier)
|
|
|
|
else {
|
|
|
|
|
|
|
|
//--------------------------------
|
|
|
|
// action == ajouter ou modifier
|
|
|
|
//--------------------------------
|
|
|
|
$id = "";
|
|
|
|
$chemin = "";
|
|
|
|
$nom = "";
|
|
|
|
$date = "";
|
|
|
|
$actif = 0;
|
|
|
|
if($action == "modifier"){
|
|
|
|
$id = $_GET['id'];
|
|
|
|
$query = "select * from $logo->table where id=".$id;
|
|
|
|
$resul = mysql_query($query, $logo->link);
|
|
|
|
$row = mysql_fetch_object($resul);
|
|
|
|
$chemin = $row->chemin;
|
|
|
|
$nom = $row->nom;
|
|
|
|
$date = $row->date;
|
|
|
|
$actif = $row->actif;
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
<form action="" id="formulaire" method="post">
|
|
|
|
|
|
|
|
<input name="action" value="<?php echo($action); ?>" type="hidden">
|
|
|
|
<input name="id" value="<?php echo $id; ?>" type="hidden">
|
|
|
|
<input name="actif" value="<?php echo $actif; ?>" type="hidden">
|
|
|
|
<input name="date" value="<?php echo(date('Y-m-d H:i:s'));?>" type="hidden" >
|
|
|
|
|
|
|
|
<table border="0" cellpadding="5" cellspacing="0" width="710">
|
|
|
|
<tr>
|
|
|
|
|
|
|
|
<td class="titre_cellule" height="30">CHEMIN du fichier (ne doit pas se terminer par /)</td>
|
|
|
|
<td class="cellule_sombre">
|
|
|
|
<input name="chemin" value="<?php echo $chemin; ?>" size="30" type="text">
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="titre_cellule" height="30">NOM du fichier avec son extension</td>
|
|
|
|
<td class="cellule_claire">
|
|
|
|
<input name="nom" value="<?php echo $nom; ?>" size="30" type="text">
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="titre_cellule" height="30">ACTIF</td>
|
|
|
|
<td class="cellule_claire">
|
|
|
|
Oui <input value="1" type="radio" disabled <?php if($actif){echo "checked";}?> > Non <input value="0" <?php if(!$actif){echo "checked";}?> type="radio" disabled>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="titre_cellule" height="30">DATE</td>
|
|
|
|
<td class="cellule_sombre">
|
|
|
|
<input value="<?php echo(date('Y-m-d H:i:s'));?>" size="20" type="text" disabled></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<br>
|
|
|
|
<table border="0" cellpadding="5" cellspacing="0" width="710">
|
|
|
|
<tr>
|
|
|
|
<td class="cellule_sombre2" height="30"><span class="geneva11Reg_3B4B5B"><a href="#" class="txt_vert_11" onclick="document.getElementById('formulaire').submit()">Valider les informations </a></span></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|