<?php session_start(); if(!isset($_SESSION['auth'])) { header("location:index.php"); } require_once("../inc/confNetisse.php"); $AID = 0; if(isset($_GET["aid"])) { $AID = intval($_GET["aid"]); } $multilang = (isset($GLOBALS["BORNE_CONF"]["LANGUAGES"]) && count($GLOBALS["BORNE_CONF"]["LANGUAGES"])>1) ? true : false; $AGENCES = ""; $q = "SELECT id_agence, nom_agence, code_agence, initiales FROM ca_agences WHERE supp=:supp"; $values = array(':supp' => 0); $result = excuteQuery($q, $values); $r = $result['stmt']; while($o = $r->fetchObject()){ $AGENCES .= "<option value='".$o->id_agence."'"; if($AID > 0 && $o->id_agence == $AID) $AGENCES .= " selected"; $AGENCES .= ">".$o->nom_agence."</option>"; } $ENTITES = "<option value='0'>-- Sélectionnez une entité --</option>"; if($AID > 0){ $q = "SELECT id_entite, libelle FROM ca_entites WHERE supp=:supp AND enabled=:enabled AND id_agence=:id_agence"; $values = array(':supp' => 0, ':enabled' => 1, ':id_agence' => $AID); $result = excuteQuery($q, $values); $r = $result['stmt']; while($o = $r->fetchObject()){ $ENTITES .= "<option value='".$o->id_entite."'>".$o->libelle."</option>"; } } $langs = ""; if($multilang){ foreach($GLOBALS["BORNE_CONF"]["LANGUAGES"] as $lang){ $langs .= "<option value='".strtolower($lang)."'>".$lang."</option>"; } } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title><?php echo $PROJECT_TITLE;?> : Création d'un nouveau motif</title> <link rel="stylesheet" href="css/font-awesome.min.css" /> <link rel="stylesheet" type="text/css" href="css/cadif.css" /> <link rel="stylesheet" type="text/css" href="css/dashboard.css" /> <link rel="stylesheet" type="text/css" href="css/cans/jquery-ui-1.8.17.custom.css" /> <!--<link rel="stylesheet" type="text/css" href="css/tableTools_jui.css" />--> <link rel="stylesheet" type="text/css" href="css/datatable_jui.css" /> <link rel="stylesheet" media="screen" type="text/css" href="css/spectrum.css" /> <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.22.custom.min.js"></script> <script type="text/javascript" src="js/jquery.dataTables.js"></script> <script type="text/javascript" src="js/spectrum.js"></script> <script type="text/javascript"> function sanitize(val){ return val.replace(/[\[\]\{\}]/g, "", val); } function checkForm() { //document.getElementById("motif").value = sanitize(document.getElementById("motif").value); if (document.getElementById("motif").value == "") { var POP = $('<div></div>').html("<center>Vous devez renseigner le champ 'Motif'.</center>").dialog({autoOpen: false,title: 'Erreur'}); POP.dialog({autoOpen:false, modal:true, draggable: false, width:360,close:function(ev, ui){document.getElementById("motif").focus();} }); POP.dialog("open"); } else { if(document.getElementById("motif").value.match(/[\[\]\{\}]/g)){ var POP = $('<div></div>').html("<center>Le format du champ n’est pas valide.<br>Le champ ne doit pas contenir un de ces caractères non autorisés : des accolades { } ou des crochets [ ].</center>").dialog({autoOpen: false,title: 'Erreur'}); POP.dialog({autoOpen:false, modal:true, draggable: false, width:360,close:function(ev, ui){document.getElementById("nom").focus();} }); POP.dialog("open"); }else if(document.getElementById("code").value.match(/[\[\]\{\}]/g)){ var POP = $('<div></div>').html("<center>Le format du champ n’est pas valide.<br>Le champ ne doit pas contenir un de ces caractères non autorisés : des accolades { } ou des crochets [ ].</center>").dialog({autoOpen: false,title: 'Erreur'}); POP.dialog({autoOpen:false, modal:true, draggable: false, width:360,close:function(ev, ui){document.getElementById("nom").focus();} }); POP.dialog("open"); }else{ document.formMotifNew.submit(); } } } function getOrientations(entite){ $.get( "ajax/getList.php?type=getEntityOrientations&eid="+entite, function( data ) { $("#orientation").html( data ); }); } $(document).ready(function(){ $('#textcolor').spectrum({ color: "<?php echo $GLOBALS["PILE_CONF"]["COLORS"]["SRDV"];?>", showInput: true, className: "full-spectrum", showInitial: true, showSelectionPalette: true, preferredFormat: "hex", }); }); </script> </head> <body> <div id="global"> <div id="home"> <div id="logo"><a href="dashboard.php"><img src="<?php echo $SERVER; ?>assets/img/logo.png" height="110" border="0"/></a></div> <div id="username"> <b><?php echo isset($_SESSION["nom"]) ? $_SESSION["nom"] : $_SESSION["matricule"];?></b> | <a href="close.php" class="link" title="Fermer et clore votre session">Déconnexion</a> <br/> </div> </div> <div id="panels"> <?php include "menu.php";?> <div class="main-content"> <div id="title"> Création d'un nouveau motif</span> </div> <div id="panelsCns"> <div id="formEnt"> <form name="formMotifNew" id="formMotifNew" action="do.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="act" value="motifNew"/> <input type="hidden" name="MAX_FILE_SIZE" value="1048576" /> <?php if(!$multilang){ ?><input type="hidden" name="lang" value="fr"/><?php } ?> <table align="center" class="form"> <?php if($multilang){ ?> <tr> <td>Langue</td> <td><select name="lang" id="lang" disabled><?php echo $langs;?></select></td> </tr> <?php } ?> <tr> <td><h3>Motif</h3></td> <td><input type="text" name="motif" id="motif" size="30" tabindex="1" value=""/></td> </tr> <tr> <td>Code</td> <td><input type="text" name="code" id="code" value="" style="width: 229px;" tabindex="2"/></td> </tr> <tr> <td>Couleur Pile</td> <td><input tabindex="3" type="text" name="textcolor" id="textcolor" value="<?php echo $GLOBALS["PILE_CONF"]["COLORS"]["SRDV"];?>" style="width: 229px;"/></td> </tr> <tr> <td>Actif</td> <td><input type="checkbox" name="enabled" id="enabled"></td> </tr> <tr> <td class="cnsPhoto">Picto</td> <td class="cnsPhoto"> <span class="cnsPhotoText"> <b><u>Caractéristiques du fichier</u> :</b> <br/> Poids maximum : 1 Mo. <br/> Type de fichier : JPG / PNG. <br/> Dimensions attendues : Largeur : 120 pixels. | Hauteur : 120 pixels. </span> <br/><br/> <input type="file" name="picto" id="picto" size="30" tabindex="4" accept="image/*"/> </td> </tr> <tr> <td> </td> <td align="center"><input type="button" class="formAct" name="valider" id="valider" value="Valider" onclick="checkForm();" tabindex="5"/></td> </tr> </table> </form> </div> </div> <div id="nav"> <a href='motifList.php<?php if($AID>0) echo "?aid=".$AID; if($EID>0) echo "&eid=".$EID;?>' class='formNav'>Retour à la liste des motifs</a> </div> </div> </div> </div> <?php include 'footer.php';?> <script> document.getElementById('motif').focus(); </script> </body> </html>