<?php session_start(); if (!isset($_SESSION['auth'])) { header("location:index.php"); } if (!in_array("edit_agence_agents", $_SESSION['permissions']) && !in_array("edit_all_agents", $_SESSION['permissions'])) { header("location:dashboard.php"); } require_once("../inc/confNetisse.php"); $AID = 0; if (!isset($_GET["aid"])) { header("location:agcList.php"); } else { $AID = intval($_GET["aid"]); } $CID = 0; if (!isset($_GET["cid"])) { header("location:agcList.php"); } else { $CID = intval($_GET["cid"]); } // print_r($_SESSION); $receiveMailCol = $GLOBALS["BO_CONF"]["CONSEILLER"]["receive_email"] ? ", receive_email" : ""; // Get agences $qaglist = "SELECT c.id_conseiller,c.fonction, c.label_fonction, ca.id_profile, ca.id_entite, ca.id_orientation,ca.id_fonction , e.libelle, ca.id_agence, ca.temporaire, ca.receive_notifications, ca.status, a.nom_agence, c.id_agent, c.nom, c.prenom, c.photo, c.inactif, DATE_FORMAT(c.date_creation, '%d/%m/%Y') as date_creation_conseiller, DATE_FORMAT(ca.date_creation, '%d/%m/%Y') as date_creation, DATE_FORMAT(c.date_modification, '%d/%m/%Y') as date_modification, IF(c.id_agence != ca.id_agence,1,0) agence_affectation, IF(TIMESTAMPDIFF(SECOND,ca.last_active,now())<=15,1,0) AS online FROM ca_conseiller_agence as ca LEFT JOIN ca_agences as a ON ca.id_agence=a.id_agence LEFT JOIN ca_entites as e ON ca.id_entite=e.id_entite LEFT JOIN ca_conseillers c ON ca.id_conseiller=c.id_conseiller LEFT JOIN ca_orientations o ON ca.id_orientation=o.id_orientation WHERE c.supp=:supp1 AND a.supp=:supp2 AND c.id_conseiller = :id_conseiller AND ca.temporaire = 0"; $values_aglist = array(':supp1' => 0, ':supp2' => 0, ':id_conseiller' => $CID); $qaglistArray = $allAgencies = array(); $result = excuteQuery($qaglist, $values_aglist); $ra = $result['stmt']; while($ligne = $ra->fetchObject()) { $qaglistArray[] = $ligne; $allAgencies[] = $ligne->id_agence; if($ligne->id_agence == $AID){ $oa = $ligne; } } //////// $q = "SELECT id_orientation, texte FROM ca_orientations WHERE supp=0 AND id_agence IN (:id_agence)"; $values = array(':id_agence' => implode(",",$allAgencies)); $result = excuteQuery($q, $values); $r = $result['stmt']; while($ligne = $r->fetchObject()) { $orientationsArray["orientation-".$ligne->id_orientation] = str_replace("\\", "", $ligne->texte); } //////// $qprofil = "SELECT id_profil FROM ca_conseiller_profils WHERE id_conseiller=:id_conseiller ORDER BY ID DESC LIMIT 1"; $vprofil = array(':id_conseiller' => $CID); $result = excuteQuery($qprofil, $vprofil); $rprofil = $result['stmt']; $oprofil = $rprofil->fetchObject(); $gs3Col = $GLOBALS["BO_CONF"]["GS3"] ? ", gs3" : ""; $q = "SELECT fonction, label_fonction, id_profil, civ, nom, prenom, id_agent, email, pro, part, photo, inactif, orientation, groupe, id_agence" . $receiveMailCol . $gs3Col . " FROM ca_conseillers c LEFT JOIN ca_conseiller_profils cp ON cp.id_conseiller = c.id_conseiller WHERE c.id_conseiller=:id_conseiller"; $values = array(':id_conseiller' => $CID); $result = excuteQuery($q, $values); $r = $result['stmt']; $o = $r->fetchObject(); $LABELFONCTION = $o->label_fonction; $CIV = '<select name="civ" id="civ" size="1" tabindex="1" autofocus="true"><option value="">-- Sélectionner --</option>'; $CIV .= '<option value="M." ' . ($o->civ == "M." ? "selected" : "") . '>Monsieur</option><option value="Mme" ' . ($o->civ == "Mme" ? "selected" : "") . '>Madame</option></select>'; if ($AID == 0) $AID = $o->id_agence; $FONCTION = $o->fonction; $PROFIL = $o->id_profil; $FONCTIONS = ""; $GS3 = $GLOBALS["BO_CONF"]["GS3"] ? $o->gs3 : ""; $fonctionQ = "SELECT id_fonction,libelle FROM ca_fonctions WHERE supp=:supp ORDER BY libelle ASC"; $fonctionV = array(':supp' => 0); $result = excuteQuery($fonctionQ, $fonctionV); $fonctionR = $result['stmt']; $fonctionArray = array(); while ($f = $fonctionR->fetchObject()) { $fonctionArray[] = $f; $FONCTIONS .= "<option value='" . $f->id_fonction . "'"; if ($FONCTION == $f->id_fonction) $FONCTIONS .= " selected"; $FONCTIONS .= ">" . $f->libelle . "</option>"; } $PROFILS = "<option value=''>-- Sélectionnez un rôle --</option>"; $PCQ = "SELECT id_profil FROM ca_conseiller_profils WHERE id_conseiller=:id_conseiller ORDER BY id DESC LIMIT 1"; $PCV = array(':id_conseiller' => $CID); $result = excuteQuery($PCQ, $PCV); $PCR = $result['stmt']; $PCO = $PCR->fetchObject(); $profilQ = "SELECT id_profil,nom FROM ca_profils WHERE bo=:bo ORDER BY nom ASC"; $profilV = array(':bo' => 0); $result = excuteQuery($profilQ, $profilV); $profilR = $result['stmt']; while ($p = $profilR->fetchObject()) { $PROFILS .= "<option value='" . $p->id_profil . "'"; if ($PCO->id_profil == $p->id_profil) $PROFILS .= " selected"; $PROFILS .= ">" . $p->nom . "</option>"; } $NOM = $o->nom; $PRENOM = $o->prenom; $MATRICULE = $o->id_agent; $EMAIL = $o->email; $PART = $o->part; if ($PART == 1) $PART = "checked"; $PRO = $o->pro; if ($PRO == 1) $PRO = "checked"; $src_img = $o->photo; if (strpos($src_img, 'upload') == false) { $src_img = str_replace("admin/", "", $o->photo); } $PHOTO = $src_img; $GROUPE = $o->groupe; //$INACTIF = $o->inactif; //if($INACTIF==0) $INACTIF="checked"; $STATUT = $o->inactif; if ($STATUT == 0) { $STATUT1 = "checked"; $STATUT2 = ""; } else { $STATUT1 = ""; $STATUT2 = "checked"; } $RECEIVEEMAIL = $o->receive_email ? " checked" : ""; $MSGTYPE = $o->orientation; $MSG = ""; $texteA =""; $valuesBind = array(); $typesBind = ""; $q2 = "SELECT id_orientation, orientation, texte, orientation, label FROM ca_orientations WHERE supp=:supp "; $valuesBind[':supp'] = 0; $typesBind .= "i"; if ($GLOBALS["BO_CONF"]["ENTITIES"]) { $q2 .= "AND id_entite=:id_entite"; $valuesBind[':id_entite'] = $GROUPE; } if ($AID != 0) { $q2 .= " AND id_agence=:id_agence"; $valuesBind[':id_agence'] = $oa->id_agence; } $q2 .= " ORDER BY orientation ASC, id_orientation ASC"; $result = excuteQuery($q2, $valuesBind); if ($result['status']) { $r = $result['stmt']; if ($r->rowCount() > 0) { $NBSRDV = $NBRDV = 0; $j = 0; while ($o2 = $r->fetchObject()) { $TYPE = $o2->label; if ($o2->id_orientation == $o->orientation) { $texteA=str_replace("\\", "", $o2->texte); $MSG .= "<option selected value='" . $o2->id_orientation . "'>" . $TYPE . "</option>"; } else { $MSG .= "<option value='" . $o2->id_orientation . "'>" . $TYPE . "</option>"; } } } } $query = "SELECT nom_agence, code_agence, type_agence, initiales FROM ca_agences WHERE supp=:supp"; $values = array(':supp' => 0); if ($AID != 0) $query .= " AND id_agence=:id_agence"; $query .= " ORDER BY nom_agence"; if ($AID != 0) $values[':id_agence'] = $AID; $result = excuteQuery($query, $values); $r = $result['stmt']; $row = $r->fetchObject(); $AGENCE = $row->nom_agence; $AGENCECODE = $row->initiales; $options = ""; $q3 = "SELECT id_entite, libelle, borne_color from ca_entites WHERE id_agence=:id_agence AND supp=:supp AND enabled=:enabled "; $v3 = array(':id_agence' => $AID, ':supp' => 0, ':enabled' => 1); $result = excuteQuery($q3, $v3); $r3 = $result['stmt']; while ($o3 = $r3->fetchObject()) { $options .= '<option value="' . $o3->id_entite . '"'; if ($GROUPE == $o3->id_entite) { $options .= ' selected'; $photoBKg = $o3->borne_color; } $options .= '>' . $o3->libelle . '</option>'; } $MAXWIDTH = isset($GLOBALS["BO_CONF"]["CONSEILLER"]["photo"]["width"]) ? $GLOBALS["BO_CONF"]["CONSEILLER"]["photo"]["width"] : 174; $MAXHEIGHT = isset($GLOBALS["BO_CONF"]["CONSEILLER"]["photo"]["height"]) ? $GLOBALS["BO_CONF"]["CONSEILLER"]["photo"]["height"] : 149; //salle dimensions for siege agency if($GLOBALS["BO_CONF"]["AGENCE"]["SIEGE"] && $GLOBALS["BO_CONF"]["AGENCE"]["SIEGE"]["CHOICES"]){ $q_agency_siege = "SELECT siege FROM ca_agences WHERE id_agence = ".$AID." LIMIT 1"; $stmt_agency_siege = excuteQuery($q_agency_siege); $res_agency_siege = $stmt_agency_siege["stmt"]; $o_agency_siege = $res_agency_siege->fetchObject(); if($o_agency_siege->siege == 1){ $MAXWIDTH = isset($GLOBALS["BO_CONF"]["AGENCE"]["SIEGE"]["IMAGES"]["CONSEILLER"]["photo"]["width"]) ? $GLOBALS["BO_CONF"]["AGENCE"]["SIEGE"]["IMAGES"]["CONSEILLER"]["photo"]["width"] : 830; $MAXHEIGHT = isset($GLOBALS["BO_CONF"]["AGENCE"]["SIEGE"]["IMAGES"]["CONSEILLER"]["photo"]["height"]) ? $GLOBALS["BO_CONF"]["AGENCE"]["SIEGE"]["IMAGES"]["CONSEILLER"]["photo"]["height"] : 600; } } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title><?php echo $PROJECT_TITLE; ?> : Edition d'un conseiller</title> <link rel="stylesheet" type="text/css" href="css/cans/jquery-ui-1.8.17.custom.css" /> <link rel="stylesheet" href="css/font-awesome.min.css" /> <link rel="stylesheet" href="libs/bootstrap/css/bootstrap-2.3.0.css" /> <link rel="stylesheet" type="text/css" href="css/cadif.css" /> <link rel="stylesheet" type="text/css" href="css/dashboard.css" /> <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script> <script type="text/javascript" src="libs/bootstrap/js/bootstrap.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.22.custom.min.js"></script> <style> .tabs-left>li.active>a::after{ display: none !important; } #logo img{ height: 110px; } #panelsedit, #formCns { width: 98%; } .trumbowyg-box{ width: 99%; height: 150px; min-height: 150px; } .trumbowyg-editor{ min-height: 100px; } input[type="file"] { height: 23px; line-height: inherit; } .text-msg{ background-color: #e0e0e0; border: 2px solid #757575; padding: 15px; font-size: 12px; font-style: italic; width: 94%; text-align: left; } </style> <style> meter { /* Reset the default appearance */ -moz-appearance: none; appearance: none; display: block; margin: 0 auto 1em; width: 100%; height: 0.5em; /* Applicable only to Firefox */ background: none; background-color: rgba(0, 0, 0, 0.1); } meter::-webkit-meter-bar { background: none; background-color: rgba(0, 0, 0, 0.1); } meter:after { content: ''; display: block; position: relative; height: 0.5em; width: 0%; top: -.5em; } meter.score-1:after { width: 25%; background: red; } meter.score-2:after { width: 50%; background: yellow; } meter.score-3:after { width: 75%; background: orange; } meter.score-4:after { width: 100%; background: green; } input#password:focus + div.meter-container { display: block; } .meter-container { background-color: #FFF; position: absolute; left: 655px; width: 200px; margin-top: -95px; padding: 2em 1em; border: 1px solid #4d4d4d; margin-left: 2em; display: none; height: 100px; } .meter-container:after { top: 60px; left: -20px; width: 0; height: 0; border-style: solid; border-width: 10px 10px 10px 10px; border-color: transparent #4d4d4d transparent transparent; content: ""; position: absolute; display: block; } span#password-strength-text ul { padding: 0; } #panelsCns{ position: relative; } .cnsPhoto { border-top: 1px solid transparent; border-bottom: 1px solid transparent; } td { text-align: left; min-width: 50px !important; } tr > td:nth-child(2n) { text-align: center; } /* IE */ @media all and (-ms-high-contrast:none) { td { padding-right: 15px; } #photo{ width: 100%; } *::-ms-backdrop, td { padding-right: 15px; } #photo{ width: 100%; } @media all and (-ms-high-contrast:none) { meter:after { top: 0; } } </style> <script type="text/javascript"> var orientations = <?php echo json_encode($orientationsArray);?>; function delCns() { $.post("ajax/deleteCns.php", function(data) { var POP = $('<div></div>').html(data).dialog({ autoOpen: false, title: "Suppression d'un conseiller" }); POP.dialog({ autoOpen: false, modal: true, draggable: false, width: 'auto', height: 'auto', overflow: "auto", close: function(ev, ui) { $(this).empty().remove(); }, open: function() { $(this).parent().css('height', 'auto'); $(this).css('height', '100%'); } }); POP.dialog("open"); }); } function delCnsConfirmed(){ document.getElementById("supp").value = 1; document.formCnsUpd.submit(); } function checkEmail(e) { var new_string = new String(e); if (!new_string.match('^[-_\.0-9a-zA-Z]{1,}@[-_\.0-9a-zA-Z]{1,}[\.][0-9a-zA-Z]{2,}$')) { return false; } else { return true; } } function hasLowerCase(str) { return (/[a-z]/g.test(str)); } function hasUpperCase(str) { return (/[A-Z]/g.test(str)); } function hasNumbers(str) { return (/\d/.test(str)); } function checkPassword(){ if ( hasNumbers(document.getElementById("password").value) && hasUpperCase(document.getElementById("password").value) && hasLowerCase(document.getElementById("password").value) && document.getElementById("password").value.length >= 8){ return true; } return false; } function checkMax(obj, maxlength){ if (obj.value.length > maxlength) { obj.value = obj.value.substring(0, maxlength); var POP = $('<div></div>').html("<center>Votre message est trop long. Merci de le raccourcir.</center>").dialog({autoOpen: false, title: 'Erreur'}); POP.dialog({autoOpen:false, modal:true, draggable: false, width:360, close:function(ev, ui){document.getElementById(obj).focus(); } }); POP.dialog("open"); } } function sanitize(val){ return val.replace(/[\[\]\{\}]/g, "", val); } function checkForm() { //document.getElementById("nom").value = sanitize(document.getElementById("nom").value); //document.getElementById("prenom").value = sanitize(document.getElementById("prenom").value); //document.getElementById("matricule").value = sanitize(document.getElementById("matricule").value); if (document.getElementById("civ").value == "") { var POP = $('<div></div>').html("<center>Vous devez renseigner le champ 'Civilité'.</center>").dialog({autoOpen: false, title: 'Erreur'}); POP.dialog({autoOpen:false, modal:true, draggable: false, width:360, close:function(ev, ui){document.getElementById("civ").focus(); } }); POP.dialog("open"); } else if (document.getElementById("nom").value == "") { var POP = $('<div></div>').html("<center>Vous devez renseigner le champ 'Nom'.</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("nom").value.length > 25) { var POP = $('<div></div>').html("<center>Le nom est trop long. Merci de le raccourcir.</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("prenom").value == "") { var POP = $('<div></div>').html("<center>Vous devez renseigner le champ 'Prénom'.</center>").dialog({autoOpen: false, title: 'Erreur'}); POP.dialog({autoOpen:false, modal:true, draggable: false, width:360, close:function(ev, ui){document.getElementById("prenom").focus(); } }); POP.dialog("open"); } else if (document.getElementById("prenom").value.length > 25) { var POP = $('<div></div>').html("<center>Le prénom est trop long. Merci de le raccourcir.</center>").dialog({autoOpen: false, title: 'Erreur'}); POP.dialog({autoOpen:false, modal:true, draggable: false, width:360, close:function(ev, ui){document.getElementById("prenom").focus(); } }); POP.dialog("open"); } else if (document.getElementById("labelfonction").value != "" && document.getElementById("labelfonction").value.length > 35) { var POP = $('<div></div>').html("<center>Le label de fonction est trop long. Merci de le raccourcir.</center>").dialog({autoOpen: false, title: 'Erreur'}); POP.dialog({autoOpen:false, modal:true, draggable: false, width:360, close:function(ev, ui){document.getElementById("labelfonction").focus(); } }); POP.dialog("open"); } <?php if (!isset($GLOBALS["BO_CONF"]["CONSEILLER"]["email"]["required"]) || $GLOBALS["BO_CONF"]["CONSEILLER"]["email"]["required"]) { ?> else if (document.getElementById("email").value == "") { var POP = $('<div></div>').html("<center>Vous devez renseigner le champ 'Email'.</center>").dialog({autoOpen: false, title: 'Erreur'}); POP.dialog({autoOpen:false, modal:true, draggable: false, width:360, close:function(ev, ui){document.getElementById("email").focus(); } }); POP.dialog("open"); } else if (!checkEmail(document.getElementById("email").value)){ var POP = $('<div></div>').html("<center>L'adresse e-mail saisie n'a pas un format correct.</center>").dialog({autoOpen: false, title: 'Erreur'}); POP.dialog({autoOpen:false, modal:true, draggable: false, width:360, close:function(ev, ui){document.getElementById("email").focus(); } }); POP.dialog("open"); } <?php } if ($GLOBALS["BO_CONF"]["CONSEILLER"]["password"]) { if($GLOBALS["PILE_CONF"]["MAIL_GUICHET_AUTHENTICATION"]){ ?> else if (document.getElementById("password").value !== "" && checkPassword() == false) { var POP = $('<div></div>').html("<center>Veuillez choisir un mot de passe d'au moins 8 caractères alphanumériques contenant des nombres, des caractères miniscules et majuscules.</center>").dialog({autoOpen: false, title: 'Erreur'}); POP.dialog({autoOpen:false, modal:true, draggable: false, width:360, close:function(ev, ui){document.getElementById("password").focus(); } }); POP.dialog("open"); } <?php } }?> <?php if (!isset($GLOBALS["BO_CONF"]["CONSEILLER"]["matricule"]["required"]) || $GLOBALS["BO_CONF"]["CONSEILLER"]["matricule"]["required"]) { ?> else if (document.getElementById("matricule").value == "") { var POP = $('<div></div>').html("<center>Vous devez renseigner le champ 'Matricule'.</center>").dialog({autoOpen: false, title: 'Erreur'}); POP.dialog({autoOpen:false, modal:true, draggable: false, width:360, close:function(ev, ui){document.getElementById("matricule").focus(); } }); POP.dialog("open"); } <?php } ?> <?php if ($GLOBALS["BO_CONF"]["ENTITIES"]) { ?> else if (document.getElementById("groupe").value == 0) { var POP = $('<div></div>').html("<center>Vous devez renseigner le champ 'Entité'.</center>").dialog({autoOpen: false, title: 'Erreur'}); POP.dialog({autoOpen:false, modal:true, draggable: false, width:360, close:function(ev, ui){document.getElementById("groupe").focus(); } }); POP.dialog("open"); } <?php } ?>else { if (document.getElementById("nom").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("prenom").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("matricule").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.formCnsUpd.submit(); } } } function getOrientations(agence, entite){ $.get( "ajax/getList.php?type=getEntityOrientations&eid="+entite, function( data ) { $(".msgtype"+agence).html( data ); $(".msgtype"+agence).prop('disabled', false); $(".msgtype"+agence+" option:first").attr('selected','selected').trigger('change'); }) } function getOrientationsR(agence, entite){ $.get( "ajax/getList.php?type=getEntityOrientations&eid="+entite, function( data ) { $(".msgtype-"+agence).html( data ); $(".msgtype-"+agence).prop('disabled', false); $(".msgtype-"+agence+" option:first").attr('selected','selected').trigger('change'); }) } function loadAgenceOrientations(agence, selected){ var entite = $("#entites-"+agence).val(); var orientation = selected ? selected : 0; $.get( "ajax/getList.php?type=getEntityOrientations&eid="+entite+"&selected="+orientation, function( data ) { data = "<option value=''>-- Sélectionnez une orientation --</option>" + data; $("#orientations-"+agence).html( data ); }); } function showOrientationMessage(agence, orientation){ $.get( "ajax/getList.php?type=getOrientationMessage&oid="+orientation, function( data ) { $("#text-msg-"+agence).html(data); }); } function showOrientationMessageR(agence, orientation){ $.get( "ajax/getList.php?type=getOrientationMessage&oid="+orientation, function( data ) { $("#text-msg-r-"+agence).html(data); }); } function showOrientationMessageAP(agence){ var orientation = $("#msgtypee").val(); $("#text-msg-"+agence).html(orientations["orientation-"+orientation]); } function getAgencyOrientations(agence) { $.get("ajax/getList.php?type=getEntityOrientations&aid=" + agence, function(data) { $(".msgtype").html(data); $('.msgtype').prop('disabled', false); $(".msgtype option:nth-child(2)").attr('selected', 'selected').trigger('change'); }); } $(document).ready(function(){ <?php if(!$GLOBALS["BO_CONF"]["ENTITIES"] && isset($_GET["aid"])){?> getAgencyOrientations("<?php echo $_GET["aid"];?>"); <?php } ?> $("#nom").on("blur",function(){ $(this).val($("#nom").val().toUpperCase()); }); }); $(function(){ /*$('.nav-tabs.primary li').on("click",function(){ $('.nav-tabs.primary li').removeClass("active"); $(this).addClass("active"); if($(this)[0].id == "edit-tab"){ $("#supprimer").show(); } else{ $("#supprimer").hide(); } if($(this)[0].id == "add-scenario-btn"){ $("#add-new-scenario").show(); } else{ $("#add-new-scenario").hide(); } });*/ $('.nav-tabs li').click(function(){ $('li').removeClass('active'); $(this).addClass('active'); }); }) $(document).ready(function(){ $("#nom").on("blur", function(){ $(this).val($("#nom").val().toUpperCase()); }); }); <?php if($AID != $o->id_agence){ ?> var href = new URL(window.location.href); href.searchParams.set('aid', '<?php echo $o->id_agence; ?>'); window.location.replace(href); <?php } ?> </script> <style> .draggable { width: <?php echo 100/($GLOBALS["BO_CONF"]["MAXMOTIFS"]/$GLOBALS["BO_CONF"]["MOTIFSROWS"]) - 1;?>%; height: 40px; margin: 1px; float: left; text-align: center; line-height: 40px; color: #FFF; font-weight: bold; } #container{ width : 500px; height: 100px; margin: 10px auto; cursor: pointer; } form#formAgencyUpd { border: 1px solid #ddd; border-radius: 15px; padding-bottom: 30px; } #panelsedit { margin: 0; } .tabs-left { border-bottom: none; } .tabs-left>li { font-size: 14px; float: none; margin:0px; } .tabs-left>li>a.active, .tabs-left>li>a.active:hover, .tabs-left>li>a.active:focus { border-bottom-color: #ddd; border-right-color: transparent; background:#009898; border:none; border-radius:0px; color: #FFF; margin:0px; line-height: 25px; } .nav-tabs>li>a:hover { /* margin-right: 2px; */ line-height: 1.42857143; border: 1px solid transparent; /* border-radius: 4px 4px 0 0; */ } .tabs-left>li.active>a::after{content: ""; content: ""; position: relative; top: 3px; right: 0; left: 0; border-top: 10px solid transparent; border-bottom: 10px solid transparent; border-left: 10px solid #009898; display: inline-block; width: 0;} </style> </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"> Edition d'un conseiller pour l'agence de <span class="agcTitle"><?php echo $AGENCE; ?></span> </div> <div id="panelsedit"> <div id="formCns"> <form name="formCnsUpd" id="formCnsUpd" action="do.php" method="post" enctype="multipart/form-data"> <div class="row-fluid" style="margin-bottom: 20px;"> <div class="span5" style="width:37%"> <div style="border: 1px solid #b0bec5;border-radius: 15px;padding: 20px;"> <input type="hidden" name="act" value="cnsUpd"/> <input type="hidden" name="AID" value="<?php echo $AID; ?>"/> <input type="hidden" name="CID" value="<?php echo $CID; ?>"/> <input type="hidden" name="AGENCECODE" value="<?php echo $AGENCECODE; ?>"/> <input type="hidden" name="MAX_FILE_SIZE" value="1048576" /> <input type="hidden" name="supp" id="supp" value="0"/> <?php if (!$GLOBALS["BO_CONF"]["ENTITIES"]) { ?> <input type="hidden" name="groupe" value="<?php echo $GROUPE; ?>"/> <?php } ?> <table align="center" class="form" id="cnsform"> <tr> <td style="padding-bottom: 10px;">Civilité <span style="color: red;">*</span></td> <td><?php echo $CIV; ?></td> </tr> <tr> <td style="padding-bottom: 10px;">Nom <span style="color: red;">*</span></td> <td><input style="width: 222px;height: 24px;" type="text" name="nom" id="nom" size="30" tabindex="1" value="<?php echo $NOM; ?>" onkeyup="javascript:checkMax(this, 25);"/></td> </tr> <tr> <td style="padding-bottom: 10px;">Prénom <span style="color: red;">*</span></td> <td><input style="width: 222px;height: 24px;" type="text" name="prenom" id="prenom" size="30" tabindex="2" value="<?php echo $PRENOM; ?>" onkeyup="javascript:checkMax(this, 25);"/></td> </tr> <tr> <td style="padding-bottom: 10px;">Matricule <?php if($GLOBALS["BO_CONF"]["CONSEILLER"]["matricule"]["required"]){ ?><span style="color: red;">*</span><?php } ?></td> <td><input style="width: 222px;height: 24px;" type="text" name="matricule" id="matricule" size="30" tabindex="3" value="<?php echo $MATRICULE; ?>" maxlength="7"/></td> </tr> <?php if ($GLOBALS["BO_CONF"]["GS3"]) { ?> <tr> <td style="padding-bottom: 10px;">GS3</td> <td><input style="width: 222px;height: 24px;" readonly type="text" name="gs3" id="gs3" tabindex="4" value="<?php echo $GS3; ?>" disabled/></td> </tr> <?php } ?> <tr> <td style="padding-bottom: 10px;">Email <?php if($GLOBALS["BO_CONF"]["CONSEILLER"]["email"]["required"]){ ?><span style="color: red;">*</span><?php } ?></td> <td><input style="width: 222px;height: 24px;" type="text" name="email" id="email" size="30" tabindex="5" value="<?php echo $EMAIL; ?>"/></td> </tr> <?php if ($GLOBALS["BO_CONF"]["CONSEILLER"]["password"]) { if($GLOBALS["PILE_CONF"]["MAIL_GUICHET_AUTHENTICATION"]){ ?> <tr> <td style="padding-bottom: 10px;">Mot de passe</td> <td><input style="width: 222px;height: 24px;" type="password" name="password" id="password" tabindex="6"/> <div class="meter-container"><meter max="4" id="password-strength-meter"></meter><span id="password-strength-text"><ul><li>Minimum de 8 caractères</li><li>Au minimum un caractère miniscule</li><li>Au minimum un caractère majuscule</li><li>Au minimum un nombre</li></ul></span></div> </td> </tr> <?php }} ?> <?php if ($GLOBALS["BO_CONF"]["CONSEILLER"]["receive_email"]) { ?> <tr> <td>Notifications par mail</td> <td><input type="checkbox" name="receive_email" id="receive_email" tabindex="7" <?php echo $RECEIVEEMAIL; ?>/></td> </tr> <?php } ?> <tr> <td style="padding-top: 15px;">État</td> <td style="padding-top: 20px;">Actif <input type="radio" name="statut" id="statutactif" value="0" tabindex="12" <?php echo $STATUT1; ?>/> / Inactif <input type="radio" name="statut" id="statutinactif" value="1" tabindex="13" <?php echo $STATUT2; ?>/></td> </tr> <tr> <td class="cnsPhoto">Photo</td> <td class="cnsPhoto" style="padding-top: 30px;text-align:left"> <center><img src="<?php echo $SERVER . $PHOTO; ?>" <?php echo 'style="background-color: ' . $photoBKg . '";'; ?> width="117" border="0"/></center> <br/> <div id="cnsPhotoNew"> <span class="cnsPhotoText"> <b><u>Caractéristiques du fichier</u> :</b> <br/> Poids maximum : 1 Mo. <br/> Type de fichier : JPG. <br/> Dimensions attendues : <?php echo $MAXWIDTH . " x " . $MAXHEIGHT; ?> pixels. </span> <br/><br/> <input type="file" name="photo" id="photo" size="30" tabindex="14" accept="image/*"/> </div> </td> </tr> </table> </div> </div> <div class="span7"> <div style="border: 1px solid #b0bec5;border-radius: 15px;padding: 20px;"> <div class="row-fluid"> <div class="span12"> <div class="tabbable tabs-left" style="display: flex;"> <ul class="nav nav-tabs tabs-left sideways" style="flex: 0 0 31%;"> <li data-agence="<?php echo $oa->nom_agence ?>"> <a href="#agencePrincipale" data-toggle="tab" class="active"><?php echo $oa->nom_agence ?></a> </li> <?php foreach($qaglistArray as $row){ if($row->id_agence != $AID){ ?> <li data-agence="<?php echo $row->nom_agence; ?>"> <a href="#agenceRattachement<?php echo $row->id_agence; ?>" data-toggle="tab"><?php echo $row->nom_agence; ?></a> </li> <?php } } ?> </ul> <div class="tab-content" style="flex: 0 0 60%;"> <div id="agencePrincipale" class="tab-pane active"> <table class="form"> <tr> <td style="padding-bottom: 15px;">Agence</td> <td style="padding-bottom: 15px; text-align:left"><b style="font-size: 16px;"><?php echo $oa->nom_agence ?></b></td> </tr> <td style="padding-bottom: 10px;">Intitulé du poste</td> <td><select name="fonction" tabindex="9" id="fonction"><?php echo $FONCTIONS;?></select><br/> <input type="hidden" name="labelfonction" id="labelfonction" value="<?php echo $LABELFONCTION;?>" placeholder="Fonction telle qu'affichée sur la borne.." size="30" onkeyup="javascript:checkMax(this, 35);" /> </td> </tr> <tr> <td style="padding-bottom: 10px;">Rôle</td> <td><select name="profil" id="profil" tabindex="10"><?php echo $PROFILS;?></select><br/> </td> </tr> <tr <?php if(!$GLOBALS["BO_CONF"]["ENTITIES"]) echo 'style="display:none"';?>> <td style="padding-bottom: 10px;">Entité</td> <td> <?php $options = ""; $q3 = "SELECT id_entite, libelle, borne_color from ca_entites WHERE id_agence=:id_agence AND supp=:supp AND enabled=:enabled"; $v3 = array( ':id_agence' => $oa->id_agence, ':supp' => 0, ':enabled' => 1 ); $result = excuteQuery($q3, $v3); $r3 = $result['stmt']; while($o3 = $r3->fetchObject()) { $options .= '<option value="'.$o3->id_entite.'"'; if($GROUPE == $o3->id_entite){ $options .= ' selected'; $photoBKg = $o3->borne_color; } $options .= '>'.$o3->libelle.'</option>'; } ?> <select tabindex="11" id="groupe" name="groupe" style="width:220px;" onchange="getOrientations(<?php echo $oa->id_agence;?>, this.value)"> <?php print $options;?> </select> </td> </tr> <tr> <td style="padding-bottom: 10px;">Statut</td> <?php $STATUTOA = $oa->status; if($STATUTOA==0) { $STATUT1OA="selected"; $STATUT2OA=""; $STATUT3OA=""; } elseif($STATUTOA==-1) { $STATUT1OA=""; $STATUT2OA="selected"; $STATUT3OA=""; } else { $STATUT1OA=""; $STATUT2OA=""; $STATUT3OA="selected"; } ?> <td> <select name="statutap" tabindex="12"> <option value="0" <?php echo $STATUT1OA;?>>Toujours affiché</option> <option value="-1" <?php echo $STATUT2OA;?>>Affiché suivant connexion</option> <option value="1" <?php echo $STATUT3OA;?>>Jamais affiché</option> </select> </td> </tr> <tr> <td style="width: 160px;padding-bottom: 10px;">Message d'orientation</td> <td> <select name="msgtype" tabindex="13" class="msgtype<?php echo $oa->id_agence;?>" id="orientations-<?php echo $oa->id_agence;?>" onChange="showOrientationMessage(<?php echo $oa->id_agence;?>, this.value)"><?php echo $MSG;?></select> </td> </tr> <tr> <td></td> <td> <div style="width: 190px;" class="text-msg" id="text-msg-<?php echo $oa->id_agence;?>"><?php echo $texteA;?></div> </td> </tr> </table> </div> <?php foreach($qaglistArray as $ligne){ if($ligne->id_agence != $AID){ ?> <div id="agenceRattachement<?php echo $ligne->id_agence; ?>" class="tab-pane"> <table class="form"> <tr> <td style="padding-bottom: 15px;">Agence </td> <td style="padding-bottom: 15px; text-align:left;"><b style="font-size: 16px;"><?php echo $ligne->nom_agence ?></b></td> </tr> <tr> <td style="padding-bottom: 10px;">Intitulé du poste</td> <td> <?php $FONCTIONSS = ""; //$fonctionQQ = "SELECT id_fonction,libelle FROM ca_fonctions WHERE supp=0 ORDER BY libelle ASC"; foreach($fonctionArray as $f){ $FONCTIONSS .= "<option value='".$f->id_fonction."'"; if ($f->id_fonction == $ligne->id_fonction) {$FONCTIONSS .= " selected";} $FONCTIONSS .= ">".$f->libelle."</option>"; } ?> <select name="fonctionR[]" tabindex="14"><?php echo $FONCTIONSS;?></select><br/> <input type="hidden" name="labelfonction" id="labelfonction" value="<?php echo $LABELFONCTION;?>" placeholder="Fonction telle qu'affichée sur la borne.." size="30" onkeyup="javascript:checkMax(this, 35);" /> </td> </tr> <tr> <td style="padding-bottom: 10px;">Rôle</td> <td> <?php $PROFILSS = "<option value=''>-- Sélectionnez un rôle --</option>"; $PCQ = "SELECT id_profil FROM ca_conseiller_profils WHERE id_conseiller=:id_conseiller ORDER BY id DESC LIMIT 1"; $PCV = array(':id_conseiller' => $CID); $result = excuteQuery($PCQ, $PCV); $PCR = $result['stmt']; $PCO = $PCR->fetchObject(); $profilQ = "SELECT id_profil,nom FROM ca_profils WHERE bo=:bo ORDER BY nom ASC"; $profilV = array(':bo' => 0); $result = excuteQuery($profilQ, $profilV); $profilR = $result['stmt']; while ($p = $profilR->fetchObject()) { $PROFILSS .= "<option value='" . $p->id_profil . "'"; if ($ligne->id_profile == $p->id_profil) $PROFILSS .= " selected"; $PROFILSS .= ">" . $p->nom . "</option>"; } // $PROFILSS = "<option value=''>-- Sélectionnez un rôle --</option>"; // $profilQQ = "SELECT id_profil,nom FROM ca_conseiller_profils WHERE bo=:bo ORDER BY nom ASC"; // $profilVV = array(':bo'=>0); // $result = excuteQuery($profilQQ, $profilVV); // $profilRR = $result['stmt']; // while($p = $profilRR->fetchObject()){ // $PROFILSS .= "<option value='".$p->id_profil."'"; // if ($ligne->id_profile == $p->id_profil) $PROFILSS .= " selected"; // $PROFILSS .= ">".$p->nom."</option>"; // } ?> <select name="profileR[]" tabindex="15"><?php echo $PROFILSS;?></select><br/> </td> </tr> <tr <?php if(!$GLOBALS["BO_CONF"]["ENTITIES"]) echo 'style="display:none"';?>> <td style="padding-bottom: 10px;">Entité</td> <td> <?php $optionsr = ""; $q4 = "SELECT id_entite, libelle, borne_color from ca_entites WHERE id_agence=:id_agence AND supp=:supp AND enabled=:enabled "; $v4 = array( ':id_agence' => $ligne->id_agence, ':supp' => 0, ':enabled' => 1 ); $result = excuteQuery($q4, $v4); $r4 = $result['stmt']; while($o4 = $r4->fetchObject()) { $optionsr .= '<option value="'.$o4->id_entite.'"'; if($ligne->id_entite == $o4->id_entite){ $optionsr .= ' selected'; $photoBKg = $o4->borne_color; } $optionsr .= '>'.$o4->libelle.'</option>'; } ?> <select name="grouper<?php echo $ligne->id_agence; ?>" tabindex="16" id="entites-<?php echo $ligne->id_agence; ?>" style="width:220px;" onchange="getOrientationsR(<?php echo $ligne->id_agence;?>, this.value)"> <?php print $optionsr;?> </select> </td> </tr> <tr> <td style="padding-bottom: 10px;">Statut </td> <?php $STATUTOR = $ligne->status; if($STATUTOR==0) { $STATUT1OR="selected"; $STATUT2OR=""; $STATUT3OR=""; } elseif($STATUTOR==-1) { $STATUT1OR=""; $STATUT2OR="selected"; $STATUT3OR=""; } else { $STATUT1OR=""; $STATUT2OR=""; $STATUT3OR="selected"; } ?> <td> <select name="statutar<?php echo $ligne->id_agence; ?>" tabindex="17"> <option value="0" <?php echo $STATUT1OR;?>>Toujours affiché</option> <option value="-1" <?php echo $STATUT2OR;?>>Affiché suivant connexion</option> <option value="1" <?php echo $STATUT3OR;?>>Jamais affiché</option> </select> </td> </tr> <tr> <td style="padding-bottom: 10px;width: 160px;">Message d'orientation</td> <td> <?php $qcar = "SELECT id_orientation, id_entite FROM ca_conseiller_agence WHERE id_agence=:id_agence AND id_conseiller=:id_conseiller"; $vcar = array(':id_agence'=>$ligne->id_agence, ':id_conseiller' => $CID); $resultcar = excuteQuery($qcar, $vcar); $rcar = $resultcar['stmt']; $ocar = $rcar->fetchObject(); $MSGRATTACHEMENT = ''; $GROUPERATTACHEMENT = $ligne->groupe; $q2r = "SELECT id_orientation, orientation, texte, orientation, label FROM ca_orientations WHERE supp=:supp AND id_entite =:id_entite"; $valuesBindr = array(':supp' => 0, ':id_entite' => $ocar->id_entite); $q2r .= " ORDER BY orientation ASC, id_orientation ASC"; $resultr = excuteQuery($q2r, $valuesBindr); $TEXTEB=''; if ($resultr['status']) { $r = $resultr['stmt']; if ($r->rowCount() > 0) { while ($o2 = $r->fetchObject()) { $TYPE = $o2->label; if ($o2->id_orientation == $ocar->id_orientation) { $MSGRATTACHEMENT .= "<option value='" . $o2->id_orientation . "' selected>" . $TYPE . "</option>"; $TEXTEB .= str_replace("\\", "", $o2->texte); } else { $MSGRATTACHEMENT .= "<option value='" . $o2->id_orientation . "'>" . $TYPE . "</option>"; } } } } ?> <select name="msgtypeR[]" class="msgtype-<?php echo $ligne->id_agence;?>" id="orientations-<?php echo $ligne->id_agence;?>" onChange="showOrientationMessageR(<?php echo $ligne->id_agence; ?>, this.value)"><?php echo $MSGRATTACHEMENT;?></select> <input type="hidden" name="hidden_id[]" value="<?php echo $ligne->id_agence;?>" /> </td> </tr> <tr> <td></td> <td> <div style="width: 190px;" class="text-msg" id="text-msg-r-<?php echo $ligne->id_agence;?>"> <?php echo $TEXTEB;?> </div> </td> </tr> </table> </div> <?php } } ?> </div> </div> </div> </div> </div> </div> </div> <table align="center" class="form"> <tr> <td colspan="2" style="padding-bottom: 20px;"> <?php /* PCZ : 2015/07/22 : J'ENLEVE LE BOUTON SUPPRIMER - START */ if (isset($_SESSION['permissions']) && (isset($_SESSION['agences']) || isset($_SESSION['agence']))) { if ((in_array("delete_agence_agents", $_SESSION['permissions']) && (in_array($AID, $_SESSION['agences']) || ($AID == $_SESSION['agence']))) || in_array("delete_all_agents", $_SESSION['permissions'])) { ?> <input type="button" class="formAct" tabindex="15" name="supprimer" id="supprimer" value="Supprimer" onclick="delCns();" tabindex="7"/> <?php } } ?> <input type="button" class="formAct" tabindex="16" name="valider" id="valider" value="Mettre à jour" onclick="checkForm();" tabindex="8"/> </td> </tr> </table> </form> </div> </div> </div> </div> </div> <?php include 'footer.php'; ?> <script> // document.getElementById('nom').focus(); <?php if($GLOBALS["PILE_CONF"]["MAIL_GUICHET_AUTHENTICATION"]){ ?> var strength = { 0: "Pire", 1: "Mauvais", 2: "Faible", 3: "Bien", 4: "Fort" } var password = document.getElementById('password'); var meter = document.getElementById('password-strength-meter'); var text = document.getElementById('password-strength-text'); password.addEventListener('input', function() { var val = password.value; var score = 0; var messages = { 'length': "Minimum de 8 caractères", 'lower': "Au minimum un caractère miniscule", 'upper': "Au minimum un caractère majuscule", 'number': "Au minimum un nombre" } $("#password-strength-meter").removeClass('score-0 score-1 score-2 score-3 score-4'); if (val){ if (hasLowerCase(val)){ score++; delete messages['lower']; } if (hasUpperCase(val)){ score++; delete messages['upper']; } if (hasNumbers(val)){ score++; delete messages['number']; } if (val.length >= 8){ score++; delete messages['length']; } $("#password-strength-meter").addClass('score-' + score); // Update the password strength meter meter.value = score; // Update the text indicator if (val !== "") { text.innerHTML = "Mot de passe : " + strength[score] + "<ul><li>" + Object.keys(messages).map(function (key, index) {return messages[key]}).join('<li>') + "</ul>"; } else { text.innerHTML = ""; } } else{ $("#password-strength-meter").addClass('score-' + score); meter.value = score; text.innerHTML = "Mot de passe : " + strength[score] + "<ul><li>" + Object.keys(messages).map(function (key, index) {return messages[key]}).join('<li>') + "</ul>"; } }); <?php } ?> </script> </body> </html>