Application avec PHP 5 et Doctrine

Résolu
sarittat Messages postés 7 Date d'inscription mardi 2 juin 2009 Statut Membre Dernière intervention 15 janvier 2013 - 12 nov. 2012 à 11:19
sarittat Messages postés 7 Date d'inscription mardi 2 juin 2009 Statut Membre Dernière intervention 15 janvier 2013 - 28 nov. 2012 à 09:52
Bonjour;
je developpe une application avec php5 en utilisant Doctrine et j'ai fait un formulaire où ya des liste deroulante pour recupére les données de la base de données mais ça marche pas tjrs la liste et vide . est ce que vous avez une idée . Merci d'avance .

3 réponses

Bonjour sarittat,

Il nous serait plus simple de t'aider avec le code que tu as déjà fait.


Cordialement,

JéjéScript.

Si on ne réussi pas du premier coup, il faut se rappeler que le grand chêne aussi au début était un gland !
3
sarittat Messages postés 7 Date d'inscription mardi 2 juin 2009 Statut Membre Dernière intervention 15 janvier 2013
13 nov. 2012 à 10:20
Bonjour ;
Merci pour ta réponse mais je peux pas envoyer le code parceque c'est long mais est ce que tu peux m'envoyer un exemple où il travaille avec doctrine ; Cordialement Sara
0
sarittat Messages postés 7 Date d'inscription mardi 2 juin 2009 Statut Membre Dernière intervention 15 janvier 2013
28 nov. 2012 à 09:52
Bonjour;
sur ma page index.html j'ai un formulaire avec des liste deroulante le probelem c'est que je récupére tous les liste sauf la liste des demandes et j'ai essayé le code dans un autre pc mais il marche pas sur le mien peut etre à cause du WinSCP . Aidez moi SVP.



voila le code du fichier index.html
<html>
<head>
<meta http-equiv= "Content-Type" content="text/html; charset=utf-8">


<script type='text/JavaScript' src="src/js/jquery.js" ></script>
<script src="../include/src/js/fonctions.js"></script>
<script src="../include/src/js/jscal2.js"></script>
<script src="../include/src/js/unicode-letter.js"></script>
<script src="../include/src/js/lang/fr.js"></script>
<script language="javascript" src="../include/src/js/modal.popup.js"></script>
<script language="javascript">

$(function() {
$('input#addSession').click(function() {
$('div#ajouterSession').show().css('top',150)
.css('left', 550)
.appendTo('body');
getDemandeDetails();

});
});



</script>

</head>







Fiche Navette




<FORM >


Code stage :,
<script type ='text/JavaScript'>afficherListeStages(); </script>,
----

Date Début,
...,

----

Session :,
,
----

Formateur :,
<script type='text/JavaScript'>afficherListeFormateurs(1); </script>,
----

Lieu Formation :,
<script type='text/JavaScript'>afficherListeLieux(1); </script>,
----

Capacité mini,
,
----

Capacité optimale,
,
----

Capacité maximale,
,
----

horaire debut,
,
----

horaire fin,
,
----

horaire midi debut,
,
----

horaire midi fin,
,
----

Société/Ecole,
,
----

salle,
,
----

Avertissement,
<TEXTAREA rows="3" name="avertissement" id="avertissement" disabled>
</TEXTAREA>,

----

Contrainte légale,
,
----

Deroulement sans horaire,
,
----

Observations,
<TEXTAREA rows="3" name="observation" id="observation">
</TEXTAREA>,

----

 



<form id='forAjout'>
     
----

Demande :,
<script type='text/JavaScript'>afficherListeDemande(2); </script>

,

----

Formateur :,
<script type='text/JavaScript'>afficherListeFormateurs(2); </script>,

----

Lieu Formation :,
<script type='text/JavaScript'>afficherListeLieux(2); </script>,
----

horaire_debut,
,
----

horaire_fin,
,
----

horaire_midi_debut,
,
----

horaire_midi_fin,
,
----

salle,
,

----

Observations,
<TEXTAREA rows="3" name="observation" id="observation2">
</TEXTAREA>,

----

   

</form>


<script type="text/javascript">
chargerInterfaceDate();

</script>











</html>


le code deu fichier fonction.js:

///General
$().ready(function() {
// $('#dialog').jqm();
});
function getXhr(){
//on cree une variable xhr qui va permettre la recuperation de la donnee en arriere plan

var xhr = null;
//test navigateurs
if(window.XMLHttpRequest) // Firefox et autres
xhr = new XMLHttpRequest();
else if(window.ActiveXObject){ // Internet Explorer
try {
xhr = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
}
else { // XMLHttpRequest non supporté par le navigateur
alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
xhr = false;
}
return xhr;
}






function afficherListeStages(){
var xhr=getXhr();

xhr.onreadystatechange function(){ if(xhr.readyState 4 && xhr.status == 200){
$('#listeStages').empty();
$('#listeStages').prepend(xhr.responseText);
AfficherStageSession();
}
}
xhr.open("GET","controleurs/stage.php?getAll",true);
xhr.send(null);
}

function afficherListeFormateurs(nb){
var xhr=getXhr();

xhr.onreadystatechange function(){ if(xhr.readyState 4 && xhr.status == 200){
if(nb==1){ $('#listeFormateurs').empty();
$('#listeFormateurs').prepend(xhr.responseText);}
else {
$('#listeFormateurs2').empty();
$('#listeFormateurs2').prepend(xhr.responseText);}
}
}
xhr.open("GET","controleurs/formateur.php?getAll&nb="+nb,true);
xhr.send(null);
}


function afficherListeDemande(nb){
var xhr=getXhr();

xhr.onreadystatechange function(){ if(xhr.readyState 4 && xhr.status == 200){
if(nb==1){ $('#listeDemandes').empty();
$('#listeDemandes').prepend(xhr.responseText);}
else {
var data =xhr.responseText;
$('#listeDemandes2').empty();
$('#listeDemandes2').prepend(data);


}
}
}
xhr.open("GET","controleurs/Demande.php?getListeDemande",true);
xhr.send(null);
}


/**
*
* @access public
* @return void
**/
function getDemandeDetails(){

$("#details").val('');

var data = $("#demande").val();
var bool = data || 0;
if (bool) {
data = data.split('$');
$("#details").val('Demandeur : ' +data[1] + '- Societe : ' +data[2]);
}
//data[1] + ' societe : ' +data[1];

}

function afficherListeSessions(code_stage){
/*
$.ajax({
type: "GET",
url: "controleurs/session.php",
data: "getSessionStage&stage="+code_stage,
success: function(data, textStatus, jqXHR){

$('#listeSessions').empty();
$('#listeSessions').prepend(data);
}
}).done(function(){afficherSession();});*/
}



//----------------------------------------------------------/
function afficherListeLieux(nb){
var xhr=getXhr();

xhr.onreadystatechange function(){ if(xhr.readyState 4 && xhr.status == 200){
if(nb==1) { $('#listeLieux').empty();
$('#listeLieux').prepend(xhr.responseText);}
else {
$('#listeLieux2').empty();
$('#listeLieux2').prepend(xhr.responseText);
afficherListeSalle("",2,"");}
}
}
xhr.open("GET","controleurs/lieu.php?getAll&nb="+nb,true);
xhr.send(null);
}

//----------------------------------------------------------/

function afficherListeSalle(lieu,nb,selection){
if(nb==2) lieu =$('#lieu2').val();
if(lieu=='') lieu ==$('#lieu1').val();
var xhr=getXhr();

xhr.onreadystatechange function(){ if(xhr.readyState 4 && xhr.status == 200){
if(nb==1) { $('#listeSalles').empty();
$('#listeSalles').prepend(xhr.responseText);
$('#salle1').val(selection);}
else {

$('#listeSalles2').empty();
$('#listeSalles2').prepend(xhr.responseText);}

}
}
xhr.open("GET","controleurs/salle.php?getSalleLieu&lieu="+lieu+"&nb="+nb,true);
xhr.send(null);
}

//----------------------------------------------------------/
function transHeure(h){

if(h!=null){

var k =h.split(':');
return k[0]+'.'+k[1];
}
}

function transHeure2(h){

if(h!=null){
var reg=new RegExp("[ .:;-]+", "g");
var k =h.split(reg);
return k[0]+':'+k[1];
}
}


function afficherSession(){

/* var code_session = $("#session").val();
$.ajax({
type: "GET",
url: "controleurs/session.php",
data: "getSession&num="+code_session,
success: function(data, textStatus, jqXHR){
var tab = data.split('$');
//alert(tab[26]);
$('#matricule1').val(tab[26]);
$('#lieu').val(tab[13]);
afficherListeSalle(tab[13],1,tab[12]);

$('#heure_debut').val(transHeure(tab[7]));
$('#heure_fin').val(transHeure(tab[8]));
$('#heure_midi_deb').val(transHeure(tab[9]));
$('#heure_midi_fin').val(transHeure(tab[10]));
$('#observation').val(tab[21]);


}
});*/
}


//----------------------------------------------------------/

function modifierSession(){

var code_stage = $("#code_stage").val();
var code_session = $("#session").val();
var formateur = $("#matricule1").val();
var lieu = $("#lieu1").val();
var h_debut = transHeure2($('#heure_debut').val());
var h_fin = transHeure2($('#heure_fin').val());
var h_midi_deb =transHeure2($('#heure_midi_deb').val());
var h_midi_fin =transHeure2($('#heure_midi_fin').val());
var cap_min =$("#capacite_mini").val();
var cap_opt = $("#capacite_opt").val();
var cap_max = $("#capacite_max").val();

if((verif_date(h_debut,'heure_debut',h_fin,'heure_fin',h_midi_deb,'heure_midi_deb',h_midi_fin,'heure_midi_fin')==true) && (verif_cap(cap_min,'capacite_mini',cap_opt,'capacite_opt',cap_max,'capacite_max')==true)) {
var salle =$('#salle1').val();



var observation = $("#observation").val();
$.ajax({
type: "GET",
url: "controleurs/session.php",
data: "upDate&num="+code_session+"&formateur="+formateur+"&lieu="+lieu+"&h_debut="+h_debut+"&h_fin="+h_fin+"&h_midi_deb="+h_midi_deb+"&h_midi_fin="+h_midi_fin+"&salle="+salle+"&observation="+observation+"&stage="+code_stage+"&cap_min="+cap_min+"&cap_opt="+cap_opt+"&cap_max="+cap_max,
success: function(data, textStatus, jqXHR){
//document.write(data);
}
});
}
}


//----------------------------------------------------------/

function ajouterSession(){
/*if($("#demande").val() == null)
alert ('Pas de demande traitée!');
else{*/

var num_demande = $("#demande").val().split('$');
var code_stage =$("#code_stage").val();
var code_session = '';
var formateur = $("#matricule2").val();
$("#matricule2").val('');
var lieu = $("#lieu2").val();
$("#lieu2").val('');
var h_debut = transHeure2($('#heure_debut2').val());
$('#heure_debut2').val('');
var h_fin = transHeure2($('#heure_fin2').val());
$('#heure_fin2').val('');
var h_midi_deb =transHeure2($('#heure_midi_deb2').val());
$('#heure_midi_deb2').val('');
var h_midi_fin =transHeure2($('#heure_midi_fin2').val());
$('#heure_midi_fin2').val('');
dateD = $('#dateDebut').val();
dateD = dateD.split('.');
dateD = dateD[2]+'-'+dateD[1]+'-'+dateD[0];
if(verif_date(h_debut,'heure_debut2',h_fin,'heure_fin2',h_midi_deb,'heure_midi_deb2',h_midi_fin,'heure_midi_fin2')==true) {
alert('Session ajoutée avec succés');

var salle =$('#salle2').val();
$('#salle2').val('');
var observation = $("#observation2").val();
//prompt("pp","add&stage="+code_stage+"&num="+code_session+"&formateur="+formateur+"&lieu="+lieu+"&h_debut="+h_debut+"&h_fin="+h_fin+"&h_midi_deb="+h_midi_deb+"&h_midi_fin="+h_midi_fin+"&salle="+salle+"&observation="+observation+"&demande="+num_demande[0]+"&dateD="+dateD);
$("#observation2").val('');
$.ajax({
type: "GET",
url: "controleurs/session.php",
data: "add&stage="+code_stage+"&num="+code_session+"&formateur="+formateur+"&lieu="+lieu+"&h_debut="+h_debut+"&h_fin="+h_fin+"&h_midi_deb="+h_midi_deb+"&h_midi_fin="+h_midi_fin+"&salle="+salle+"&observation="+observation+"&demande="+num_demande[0]+"&dateD="+dateD,
success: function(data, textStatus, jqXHR){
// document.write(data);
$('div#ajouterSession').hide();
$(':input','#forAjout').val('');
//afficherListeSessions(code_stage);
afficherListeDemande(2);

}
});}}
//}


//----------------------------------------------------------/
function AfficherStageSession(){
var code_stage =afficherStage();
//var session = afficherListeSessions(code_stage);
}




//----------------------------------------------------------/
function afficherStage(){
var code_stage = $('#code_stage').val();
/*
var temp = date_debut.split('-');
date_debut = temp[2]+'-'+ temp[1]+'-' +temp[0];

*/
var xhr=getXhr();

xhr.onreadystatechange function(){ if(xhr.readyState 4 && xhr.status == 200){
var tab = xhr.responseText;
tab = tab.split('$');
var date = tab[3];

date = date.split('-');
//date = date[2]+'-'+date[1]+'-'+date[0];
date = date[2]+'.'+date[1]+'.'+date[0];

$('#dateDebut').val(date);
$('#duree').val(tab[9]);
$('#capacite_mini').val(tab[12]);
$('#capacite_opt').val(tab[13]);
$('#capacite_max').val(tab[14]);
$('#contrainte_legale').val(tab[15]);
$('#deroulement_sans_horaire').val(tab[23]);
$('#avertissement').val(tab[25]);
$('#ecole').val(tab[27]);
$('#deroulement_sans_horaire').val(tab[23]);
$('#heure_debut').val(transHeure(tab[55]));
$('#heure_fin').val(transHeure(tab[56]));
$('#heure_midi_deb').val(transHeure(tab[57]));
$('#heure_midi_fin').val(transHeure(tab[58]));

$('#heure_debut2').val(transHeure(tab[55]));
$('#heure_fin2').val(transHeure(tab[56]));
$('#heure_midi_deb2').val(transHeure(tab[57]));
$('#heure_midi_fin2').val(transHeure(tab[58]));
afficherListeSalle($('#lieu1').val(),1);

}
}
xhr.open("GET","controleurs/stage.php?getStage&code="+code_stage,true);
xhr.send(null);

return code_stage;
}



//----------------------------------------------------------/
function chargerInterfaceDate(){

CAL = new Calendar({
inputField: "dateDebut",
dateFormat: "%d.%m.%Y",
trigger: "f_rangeStart_trigger",
bottomBar: true,
onSelect: function() {
var date = Calendar.intToDate(this.selection.get());
CAL.args.min = date;
CAL.redraw();
this.hide();

}
});
function clearRangeStart() {
document.getElementById("f_rangeStart").value = "";
CAL.args.min = null;
CAL.redraw();
};
}



/**
*
* @access public
* @return void
**/function verif_date(h_debut,h_debut_id,h_fin,h_fin_id,h_m_debut,h_m_debut_id,h_m_fin,h_m_fin_id){
var verif = true;
/*
var reg=new RegExp("[ .:;-]+", "g");
var h_debut =h_debut.split(reg);
var h_m_debut =h_m_debut.split(reg);
var h_fin =h_fin.split(reg);
var h_m_fin =h_m_fin.split(reg);

h_debut[0] = parseInt(h_debut[0]);
h_fin[0] = parseInt(h_fin[0]);
h_m_debut[0] = parseInt(h_m_debut[0]);
h_m_fin[0] = parseInt(h_m_fin[0]);
h_debut[1] = parseInt(h_debut[1]);
h_fin[1] = parseInt(h_fin[1]);
h_m_debut[1] = parseInt(h_m_debut[1]);
h_m_fin[1] = parseInt(h_m_fin[1]);


//alert(h_debut[0]+'---'+h_debut[1]+'---'+(h_debut[0].toString().search(/^-?[0-23]+$/) != 0));
if( (h_debut[0].toString().search(/^-?[0-23]+$/) != 0) & (h_debut[1].toString().search(/^-?[0-59]+$/) != 0)) {
$('#'+h_debut_id).css("backgroundColor", "#ff123f");
verif = false;
}
else $('#'+h_debut_id).css("backgroundColor", "");


if( (h_fin[0].toString().search(/^-?[0-23]+$/) != 0) & (h_fin[1].toString().search(/^-?[0-59]+$/) != 0)) {
$('#'+h_fin_id).css("backgroundColor", "#ff123f");
verif = false;
}


if( (h_m_debut[0].toString().search(/^-?[0-23]+$/) != 0) & (h_m_debut[1].toString().search(/^-?[0-59]+$/) != 0)) {
$('#'+h_m_debut_id).css("backgroundColor", "#ff123f");
verif = false;
}
else $('#'+h_m_debut_id).css("backgroundColor", "");


if( (h_m_fin[0].toString().search(/^-?[0-23]+$/) != 0) & (h_m_fin[1].toString().search(/^-?[0-59]+$/) != 0)) {
$('#'+h_m_fin_id).css("backgroundColor", "#ff123f");
verif = false;
}
else $('#'+h_m_fin_id).css("backgroundColor", "");






if((h_debut[0] < h_fin[0]) & (h_debut[0] < h_m_debut[0]) & (h_debut[0] < h_m_fin[0]) & (h_fin[0] < h_m_debut[0]) & (h_fin[0] < h_m_fin[0]) & (h_m_debut[0] < h_m_fin[0])){
}
else{
verif = false ;
alert('Veuillez vérifier les horaires');


}

*/

return verif;
}

/**
*
* @access public
* @return void
**/

function verif_cap(cap_min,id_cap_min,cap_opt,id_cap_opt,cap_max,id_cap_max){
verif = true;
if(cap_min.toString().search(/^-?[0-9]+$/) != 0) {
$('#'+id_cap_min).css("backgroundColor", "#ff123f");
verif = false;
}
else $('#'+id_cap_min).css("backgroundColor", "");

if(cap_opt.toString().search(/^-?[0-9]+$/) != 0) {
$('#'+id_cap_opt).css("backgroundColor", "#ff123f");
verif = false;
}
else $('#'+id_cap_opt).css("backgroundColor", "");

if(cap_max.toString().search(/^-?[0-9]+$/) != 0) {
$('#'+id_cap_max).css("backgroundColor", "#ff123f");
verif = false;
}
else $('#'+id_cap_max).css("backgroundColor", "");
cap_min = parseInt(cap_min);
cap_opt = parseInt(cap_opt);
cap_max = parseInt(cap_max);
//comparaison
if((cap_min <= cap_opt) & (cap_min <= cap_max) & (cap_opt <= cap_max)) {
/*
$('#'+id_cap_max).css("backgroundColor", "");
$('#'+id_cap_opt).css("backgroundColor", "");
$('#'+id_cap_min).css("backgroundColor", "");
*/
}

else{
verif = false ;

//alert('Veuillez vérifier les capacités \n Capacité minimale <= Capacité Optimale <= Capacité maximale');
/*
pour colorier les champs
$('#'+id_cap_max).css("backgroundColor", "#ff123f");
$('#'+id_cap_opt).css("backgroundColor", "#ff123f");
$('#'+id_cap_min).css("backgroundColor", "#ff123f");
*/
}








return verif;

}


function effacer () {
$('#heure_debut2').val( $('#heure_debut').val());
$('#heure_fin2').val($('#heure_fin').val());
$('#heure_midi_deb2').val($('#heure_midi_deb').val());
$('#heure_midi_fin2').val($('#heure_midi_fin').val());
$('#observation2').val('');
$('#salle2').attr("selectedIndex",0);
$('#lieu2').attr("selectedIndex",0);
$('#matricule2').attr("selectedIndex",0);
$('#demande').attr("selectedIndex",0);
getDemandeDetails();
afficherListeSalle($('#lieu2').val(),2);
}
0
Rejoignez-nous