1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
| <h3>Plan de communication</h3>
<?php
writeErrors();
//affichage des contrôles d'admin selon le aff_status
if($_SESSION['user']['aff_status'] >= 5) {
try {
if(isset($_GET['add'])) {
echo '<div id="com_form"><form action="'.$pagecfg['name'].'.php?p=plan_de_communication&add" method="post" enctype="multipart/form-data"><fieldset><h5>Publier un plan de communication</h5>'."\n"
.'<div class="fill_field"><label for="com_title">Titre :</label> <input type="text" name="com_title" id="com_title" value="'.htmlspecialchars($_POST['com_title']).'" /></div>'."\n"
.'<div class="fill_field"><label for="com_text">Description :</label> <textarea class="mceEditor" name="com_text" id="com_text" cols="20" rows="10">'.htmlspecialchars($_POST['com_text']).'</textarea></div>'."\n"
.'<div class="fill_field"><label for="com_image">Envoyez une image :</label> <input type="file" name="com_image" id="com_image" /></div>'."\n"
.'<div class="fill_field"><label for="com_image2">Envoyez une seconde image image :</label> <input type="file" name="com_image2" id="com_image2" /></div>'."\n"
.'<div class="fill_field"><label for="com_file">Sélectionnez le plan de communication :</label> <input type="file" name="com_file" id="com_file" /></div>'."\n"
.'<div class="submit_field"><input type="button" value="Annuler" onclick="document.location.href=\'?p='.urlencode($_GET['p']).'\'" /> <input type="submit" value="Publier"/></div>'."\n"
.'</fieldset></form></div>'."\n";
} elseif(isset($_GET['edit'])) {
//récupération de l'com
$get_com_query = "SELECT a.com_id, a.com_date, a.com_author, a.com_title, a.com_text, a.com_image, a.com_image2, a.com_file, u.aff_name FROM ".$cfg['db_prefix']."com a LEFT JOIN ".$cfg['db_prefix']."affilies u ON a.com_author = u.aff_id WHERE com_id = ".$database->quote($_GET['id'])." LIMIT 1";
$get_com = $database->query($get_com_query)->fetch();
if($get_com['com_id'] != $_GET['id']) throw new Exception('Élément introuvable.');
echo '<div id="com_form"><form action="'.$pagecfg['name'].'.php?p=plan_de_communication&edit&id='.$get_com['com_id'].'" method="post" enctype="multipart/form-data"><fieldset><h5>Éditer un plan de communication</h5>'."\n"
.'<div class="fill_field"><label for="com_title">Titre :</label> <input type="text" name="com_title" id="com_title" value="'.(isset($_POST['com_title']) ? htmlspecialchars($_POST['com_title']) : $get_com['com_title']).'" /></div>'."\n"
.'<div class="fill_field"><label for="com_text">Description :</label> <textarea class="mceEditor" name="com_text" id="com_text" cols="20" rows="10">'.(isset($_POST['com_text']) ? htmlspecialchars($_POST['com_text']) : $get_com['com_text']).'</textarea></div>'."\n"
.'<div class="fill_field"><label for="com_image">Envoyez une image :</label> <input type="file" name="com_image" id="com_image" />'.(!empty($get_com['com_image']) ? ' <img src="images/com/thumb/'.$get_com['com_image'].'" alt="'.$get_com['com_title'].'" />' : '').'</div>'."\n"
.'<div class="fill_field"><label for="com_image2">Envoyez une seconde image :</label> <input type="file" name="com_image2" id="com_image2" />'.(!empty($get_com['com_image2']) ? ' <img src="images/com/thumb/'.$get_com['com_image2'].'" alt="'.$get_com['com_title'].'" />' : '').'</div>'."\n"
.(!empty($get_com['com_image']) || !empty($get_com['com_image2']) ? '<div class="fill_field"><label for="actu_del_image">Supprimer les images actuelles ?</label> <input type="checkbox" name="actu_del_image" id="actu_del_image" />'."\n" : '')
.'<div class="fill_field"><label for="com_file">Mettez à jour le plan de communication :</label> <input type="file" name="com_file" id="com_file" /></div>'."\n"
.'<div class="submit_field"><input type="button" value="Annuler" onclick="document.location.href=\'?p='.urlencode($_GET['p']).'\'" /> <input type="submit" value="Modifier"/></div>'."\n"
.'</fieldset></form></div>'."\n";
}
} catch(Exception $e) {
$_GLOBALS['error_message'][] = $e->getMessage();
writeErrors();
}
echo '<p class="com_admin"><a href="?p=plan_de_communication&add" class="ajax add_com" title="Publier un plan de communication">Ajouter</a></p>'."\n";
}
//récupération des éléments
$get_coms_query = "SELECT com_id, com_date, com_author, com_title, com_text, com_image, com_image2, com_file FROM ".$cfg['db_prefix']."com ORDER BY com_date DESC";
foreach($database->query($get_coms_query) as $com) {
echo '<div class="com" id="com_'.$com['com_id'].'">'."\n"
.'<h4>'.$com['com_title'].'</h4>'."\n"
.'<div class="com_info">'."\n"
.'<div class="date">'//.Le '.date('d/m/Y', $com['com_date'])."\n"
.($_SESSION['user']['aff_status'] >= 5 ? '<div class="admin_control"><a href="?p=plan_de_communication&edit&id='.$com['com_id'].'" class="ajax edit_com" title="Modifier ce plan de communication"><img src="images/EditNews.png" alt="Editer" /><span class="hide">Editer</span></a> <a href="?p=plan_de_communication&del&id='.$com['com_id'].'" class="ajax del_com" title="Supprimer ce plan de communication" onclick="if(confirm(\'Voulez-vous réellement supprimer ce plan de communication ?\')) return true; else return false;"><img src="images/DelNews.png" alt="Supprimer" /><span class="hide">Supprimer</span></a></div>' : '').'</div>'
.'</div>'."\n"
.'<div class="content_info">'.((!empty($com['com_image']) || !empty($com['com_image2'])) ? '<div class="content_info_img">'.((!empty($com['com_image']) ? '<a href="images/com/'.$com['com_image'].'" title="'.$com['com_title'].'" class="thickbox"><img src="images/com/thumb/'.$com['com_image'].'" alt="'.$com['com_title'].'" /></a>' : '').(!empty($com['com_image2']) ? '<a href="images/com/'.$com['com_image2'].'" title="'.$com['com_title'].'" class="thickbox"><img src="images/com/thumb/'.$com['com_image2'].'" alt="'.$com['com_title'].'" /></a>' : '').'</div>') : '').'<div class="content_info_text">'.$com['com_text'].'</div><div class="content_info_file"><a href="?p=plan_de_communication&d='.$com['com_id'].'" title="Télécharger ce plan de communication">Télécharger</a></div></div>'."\n"
.'</div>'."\n";
}
break;
case 'fiches_techniques':
?>
<h3>Bulletins trimestriels et fiches techniques</h3>
<?php
writeErrors();
//affichage des contrôles d'admin selon le aff_status
if($_SESSION['user']['aff_status'] >= 5) {
try {
if(isset($_GET['add'])) {
echo '<div id="fiche_form"><form action="'.$pagecfg['name'].'.php?p=fiches_techniques&add" method="post" enctype="multipart/form-data"><fieldset><h5>Publier une fiche technique</h5>'."\n"
.'<div class="fill_field"><label for="fiche_title">Titre :</label> <input type="text" name="fiche_title" id="fiche_title" value="'.htmlspecialchars($_POST['fiche_title']).'" /></div>'."\n"
.'<div class="fill_field"><label for="fiche_text">Description :</label> <textarea class="mceEditor" name="fiche_text" id="fiche_text" cols="20" rows="10">'.htmlspecialchars($_POST['fiche_text']).'</textarea></div>'."\n"
.'<div class="fill_field"><label for="fiche_image">Envoyez une image :</label> <input type="file" name="fiche_image" id="fiche_image" /></div>'."\n"
.'<div class="fill_field"><label for="fiche_image2">Envoyez une seconde image :</label> <input type="file" name="fiche_image2" id="fiche_image2" /></div>'."\n"
.'<div class="fill_field"><label for="fiche_file">Sélectionnez la fiche technique :</label> <input type="file" name="fiche_file" id="fiche_file" /></div>'."\n"
.'<div class="submit_field"><input type="button" value="Annuler" onclick="document.location.href=\'?p='.urlencode($_GET['p']).'\'" /> <input type="submit" value="Publier"/></div>'."\n"
.'</fieldset></form></div>'."\n";
} elseif(isset($_GET['edit'])) {
//récupération de l'affilié
$get_fiche_query = "SELECT a.fiche_id, a.fiche_date, a.fiche_author, a.fiche_title, a.fiche_text, a.fiche_image, a.fiche_image2, a.fiche_file, u.aff_name FROM ".$cfg['db_prefix']."fiches a LEFT JOIN ".$cfg['db_prefix']."affilies u ON a.fiche_author = u.aff_id WHERE fiche_id = ".$database->quote($_GET['id'])." LIMIT 1";
$get_fiche = $database->query($get_fiche_query)->fetch();
if($get_fiche['fiche_id'] != $_GET['id']) throw new Exception('Élément introuvable.');
echo '<div id="fiche_form"><form action="'.$pagecfg['name'].'.php?p=fiches_techniques&edit&id='.$get_fiche['fiche_id'].'" method="post" enctype="multipart/form-data"><fieldset><h5>Éditer une fiche technique</h5>'."\n"
.'<div class="fill_field"><label for="fiche_title">Titre :</label> <input type="text" name="fiche_title" id="fiche_title" value="'.(isset($_POST['fiche_title']) ? htmlspecialchars($_POST['fiche_title']) : $get_fiche['fiche_title']).'" /></div>'."\n"
.'<div class="fill_field"><label for="fiche_text">Description :</label> <textarea class="mceEditor" name="fiche_text" id="fiche_text" cols="20" rows="10">'.(isset($_POST['fiche_text']) ? htmlspecialchars($_POST['fiche_text']) : $get_fiche['fiche_text']).'</textarea></div>'."\n"
.'<div class="fill_field"><label for="fiche_image">Envoyez une image :</label> <input type="file" name="fiche_image" id="fiche_image" />'.(!empty($get_fiche['fiche_image']) ? ' <img src="images/fiche/thumb/'.$get_fiche['fiche_image'].'" alt="'.$get_fiche['fiche_title'].'" />' : '').'</div>'."\n"
.'<div class="fill_field"><label for="fiche_image2">Envoyez une seconde image :</label> <input type="file" name="fiche_image2" id="fiche_image2" />'.(!empty($get_fiche['fiche_image2']) ? ' <img src="images/fiche/thumb/'.$get_fiche['fiche_image2'].'" alt="'.$get_fiche['fiche_title'].'" />' : '').'</div>'."\n"
.(!empty($get_fiche['fiche_image']) || !empty($get_fiche['fiche_image2']) ? '<div class="fill_field"><label for="actu_del_image">Supprimer les images actuelles ?</label> <input type="checkbox" name="actu_del_image" id="actu_del_image" />'."\n" : '')
.'<div class="fill_field"><label for="fiche_file">Mettez à jour la fiche technique :</label> <input type="file" name="fiche_file" id="fiche_file" /></div>'."\n"
.'<div class="submit_field"><input type="button" value="Annuler" onclick="document.location.href=\'?p='.urlencode($_GET['p']).'\'" /> <input type="submit" value="Modifier"/></div>'."\n"
.'</fieldset></form></div>'."\n";
}
} catch(Exception $e) {
$_GLOBALS['error_message'][] = $e->getMessage();
writeErrors();
}
echo '<p class="fiche_admin"><a href="?p=fiches_techniques&add" class="ajax add_fiche" title="Publier une fiche technique">Ajouter</a></p>'."\n";
}
//récupération des éléments
$get_fiches_query = "SELECT fiche_id, fiche_date, fiche_author, fiche_title, fiche_text, fiche_image, fiche_image2, fiche_file FROM ".$cfg['db_prefix']."fiches ORDER BY fiche_date DESC";
foreach($database->query($get_fiches_query) as $fiche) {
echo '<div class="fiche" id="fiche_'.$fiche['fiche_id'].'">'."\n"
.'<h4>'.$fiche['fiche_title'].'</h4>'."\n"
.'<div class="fiche_info">'."\n"
.'<div class="date">'//.Le '.date('d/m/Y', $fiche['fiche_date'])."\n"
.($_SESSION['user']['aff_status'] >= 5 ? '<div class="admin_control"><a href="?p=fiches_techniques&edit&id='.$fiche['fiche_id'].'" class="ajax edit_fiche" title="Modifier cette fiche technique"><img src="images/EditNews.png" alt="Editer" /><span class="hide">Editer</span></a> <a href="?p=fiches_techniques&del&id='.$fiche['fiche_id'].'" class="ajax del_fiche" title="Supprimer cette fiche technique" onclick="if(confirm(\'Voulez-vous réellement supprimer cette fiche technique ?\')) return true; else return false;"><img src="images/DelNews.png" alt="Supprimer" /><span class="hide">Supprimer</span></a></div>' : '').'</div>'
.'</div>'."\n"
.'<div class="content_info">'.((!empty($fiche['fiche_image']) || !empty($fiche['fiche_image2'])) ? '<div class="content_info_img">'.((!empty($fiche['fiche_image']) ? '<a href="images/fiche/'.$fiche['fiche_image'].'" title="'.$fiche['fiche_title'].'" class="thickbox"><img src="images/fiche/thumb/'.$fiche['fiche_image'].'" alt="'.$fiche['fiche_title'].'" /></a>' : '').(!empty($fiche['fiche_image2']) ? '<a href="images/fiche/'.$fiche['fiche_image2'].'" title="'.$fiche['fiche_title'].'" class="thickbox"><img src="images/fiche/thumb/'.$fiche['fiche_image2'].'" alt="'.$fiche['fiche_title'].'" /></a>' : '').'</div>') : '').'<div class="content_info_text">'.$fiche['fiche_text'].'</div><div class="content_info_file"><a href="?p=fiches_techniques&d='.$fiche['fiche_id'].'" title="Télécharger cette fiche technique">Télécharger</a></div></div>'."\n"
.'</div>'."\n";
}
break;
case 'referencement':
echo '<h3>Référencement</h3>'."\n";
writeErrors();
$files = array('bons-commande-operations-en-cours' => 'Bons de commandes opérations en cours', 'animalerie' => 'Animalerie', 'decoration-plein_air' =>'Décoration & Plein Air', 'jardin-produits_manufactures' => 'Jardin - Produits manufacturés', 'vegetal' => 'Végétal');
if(isset($_GET['add'])) {
?>
<div id="ref_form">
<form action="?p=<?php echo urlencode($_GET['p']); ?>&add" method="post" enctype="multipart/form-data">
<fieldset>
<h5>Envoyer un fichier</h5>
<div class="fill_field"><label for="cat">Catégorie :</label> <select name="cat" id="cat"><?php
foreach($files as $cat => $catName) {
echo '<option value="'.$cat.'">'.$catName.'</option>'."\n";
}
?></select></div>
<div class="fill_field"><label for="file">Sélectionnez le fichier à envoyer :</label> <input type="file" name="file" id="file" /></div>
<div class="submit_field"><input type="button" value="Annuler" onclick="document.location.href='?p=<?php echo urlencode($_GET['p']); ?>'" /> <input type="submit" value="Envoyer" /></div>
</fieldset>
</form>
</div>
<?php
}
//listing des fichiers
if($_SESSION['user']['aff_status'] >= 5) echo '<p class="ref_admin"><a href="?p='.urlencode($_GET['p']).'&add" title="Ajouter un fichier" class="add_ref">Ajouter</a></p>';
echo '<div id="cat_buttons"><a href="?p='.urlencode($_GET['p']).'&d=*" title="Télécharger toutes les fiches">Tout télécharger</a></div>';
foreach($files as $cat => $title) {
$dir = scandir($cfg['site_dir'].'/files/ref/'.$cat);
echo '<h4 class="prod">'.$title.'</h4><div class="dl_links"><a href="?p='.urlencode($_GET['p']).'&d='.$cat.'" title="Télécharger toutes les fiches de cette catégorie">Télécharger cette catégorie</a></div>'."\n";
if(count($dir) > 0) echo '<ul class="ref_list">'."\n";
foreach($dir as $file) {
if(substr($file, 0, 1) != '.') {
$filename = ucwords(strtolower(htmlspecialchars(str_replace('_', '', substr($file, strpos($file, ' '), (strrpos($file, '.') - strpos($file, ' ')))))));
echo '<li><a href="?p='.urlencode($_GET['p']).'&c='.$cat.'&d='.urlencode($file).'" title="Télécharger ce fichier" class="dl_ref">'.$filename.'</a>'.($_SESSION['user']['aff_status'] >= 5 ? '<a href="?p='.urlencode($_GET['p']).'&c='.$cat.'&del='.urlencode($file).'" title="Supprimer ce fichier" onclick="if(confirm(\'Voulez-vous réellement supprimer ce fichier ?\')) return true; else return false;" class="del_ref"><img alt="Supprimer" src="images/DelNews.png" /><span class="hide">Supprimer</span></a>' : '').'</li>'."\n";
}
}
if(count($dir) > 0) echo '</ul><div class="clear"></div>'."\n";
}
break;
case 'contact_professionnel':
?> |
Partager