%PDF- %PDF-
Direktori : /home/alliance/domains/sedl.alnetis.fr/public_html/ |
Current File : /home/alliance/domains/sedl.alnetis.fr/public_html/a-ajouter_section.php |
<?php include_once("inc/config.php"); include_once("inc/functions.php"); include_once("inc/session.php"); include_once("inc/init.php"); verif_co_admin(); if(isset($_POST['post']) && $_POST['post'] == 1) { $erreur = $db->verif($_POST['titre_fr'], "Le titre français"); if($erreur == "ok") $erreur = $db->verif($_POST['titre_en'], "Le titre anglais"); if($erreur == "ok") { // section $next_ordre = $db->next_ordre("section", "categorie = ".$_POST['categorie']); $next_id = $db->next_id("section"); $values = array( "id" => $next_id, "categorie" => $_POST['categorie'], "type" => $_POST['type'], "ordre" => $next_ordre, "site" => $_POST['site'], "email" => $_POST['email'] ); $db->insert("section", $values); //section_fr $values = array ( "section" => $next_id, "lang" => 1, "titre" => $_POST['titre_fr'], "permalien" => cleanUrl($_POST['titre_fr']) ); $db->insert("section_lang", $values); //section_en $values = array ( "section" => $next_id, "lang" => 2, "titre" => $_POST['titre_en'], "permalien" => cleanUrl($_POST['titre_en']) ); $db->insert("section_lang", $values); header("Location:liste_cat.php?msg=yes"); } else { $err = true; } } //affichage du html include("theme/html.php"); //affichage des metas include("theme/meta.php"); echo "\n<title>Ajouter une section - ".$info_titresite."</title>\n"; //affichage du header include("theme/header_admin.php"); ?> <div class="text_admin"> <h2>Ajouter une section</h2> <p>Pour une section sans catégorie, créez une catégorie d'abord</p> <?php if(isset($err) && $err) { echo "<p class=\"erreurbloc\">".$erreur."</p>"; } if(isset($yes) && $yes) { echo "<p class=\"infobloc\">Opération effectuée</p>"; } ?> <form action="admin/ajouter_section.php<?php if (isset($_GET['cat'])) echo "?cat=".$_GET['cat']; ?>" method="post" class="form"> <table> <tr> <td class="label"></td> <td class="field head">Français</td> <td class="field head">Anglais</td> </tr> <tr> <td class="label">Titre de la section <span class="etoile">*</span></td> <td class="field"><input type="text" name="titre_fr" value="<?php echo $_POST['titre_fr']; ?>" /></td> <td class="field"><input type="text" name="titre_en" value="<?php echo $_POST['titre_en']; ?>" /></td> </tr> <?php if (isset($_GET['cat'])) { ?> <input type="hidden" name="categorie" value="<?php echo $_GET['cat']; ?>" /> <?php } else { ?> <tr> <td class="label">Categorie <span class="etoile">*</span></td> <td class="field"> <select name="categorie"> <?php $result = $section->liste_categories(); if($result != null) { foreach($result as $cat) { if($cat['id'] == $_POST['categorie']) echo "<option value=\"".$cat['id']."\" selected=\"selected\">".$cat['ptititre']."</option>\n"; else echo "<option value=\"".$cat['id']."\">".$cat['ptititre']."</option>\n"; } } ?> </select> </td> <td class="field"></td> </tr> <?php } ?> <tr> <td class="label top">Type <span class="etoile">*</span></td> <td class="field"> <p><input type="radio" class="radio" id="type1" <?php if($_POST['type'] == 1) echo 'checked="checked"' ?> name="type" value="1"> <label for="type1">Section avec des pages et actualités</label></p> <p><input type="radio" class="radio" id="type0" <?php if($_POST['type'] == 0) echo 'checked="checked"' ?> name="type" value="0"> <label for="type0">Section avec uniquement un lien et des actualités</label></p> </td> <td class="field"></td> </tr> <tr> <td class="label">Site web</td> <td class="field"><input type="text" name="site" value="<?php echo $_POST['site']; ?>" /></td> <td class="field"></td> </tr> <tr> <td class="label">E-Mail</td> <td class="field"><input type="text" name="email" value="<?php echo $_POST['email']; ?>" /></td> <td class="field"></td> </tr> </table> <div class="form_bouton"> <input type="hidden" name="post" value="1" /> <input type="submit" class="bouton" id="maj_bouton" value="Créer une catégorie" /> </div> </form> </div> <? //affichage du footer include("theme/footer.php"); ?>