Salut Micka,
J'ai un problème au niveau de "edit", je veux qu'il affiche les données de deux table différentes et les données ne s'affiche pas. Il y a la table "datevc" et la table "inscriptionespenf". Pourrais tu m'aider en me disant ou est le problème et en me donnant un exemple pour comprendre d'où viens mon erreur.
Voici mon code :
Mon main.php ( "process save" et "edit")
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 public function _edit(){ $tMessage=$this->processSave(); $oInscriptionespenf=model_inscriptionespenf::getInstance()->findById( _root::getParam('id') ); $oInscriptionespenfdate=model_datevc::getInstance()->findAllDate( $oInscriptionespenf->ref_ins ); $oView=new _view('inscriptionespenf::edit'); $oView->oInscriptionespenf=$oInscriptionespenf; $oView->oInscriptionespenfdate=$oInscriptionespenfdate; $oView->tId=model_inscriptionespenf::getInstance()->getIdTab(); $oView->tJoinmodel_espaceecoleenf=model_espaceecoleenf::getInstance()->getSelect(); $oView->tJoinmodel_classe=model_classe::getInstance()->getSelect(); $oPluginXsrf=new plugin_xsrf(); $oView->token=$oPluginXsrf->getToken(); $oView->tMessage=$tMessage; $this->oLayout->add('main',$oView); }Voici edit.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 private function processSave(){ if(!_root::getRequest()->isPost() ){ //si ce n'est pas une requete POST on ne soumet pas return null; } $oPluginXsrf = new plugin_xsrf(); if(!$oPluginXsrf->checkToken( _root::getParam('token') ) ){ //on verifie que le token est valide return array('token' => $oPluginXsrf->getMessage() ); } $iId = _root::getParam('id', null); if($iId==null){ $oInscriptionespenf=new row_inscriptionespenf; }else{ $oInscriptionespenf=model_inscriptionespenf::getInstance()->findById( _root::getParam('id',null) ); } $tColumn = array('id','nomenf','prenom','datenaissance','ecole','classe','sieste'); foreach($tColumn as $sColumn){ $oInscriptionespenf->$sColumn=_root::getParam($sColumn,null); } $oInscriptionespenf->nmparentlg=_root::getAuth()->getAccount()->nomrplegal; $oInscriptionespenf->pmparentlg=_root::getAuth()->getAccount()->prenomrplegal; $oInscriptionespenf->id_accueil=_root::getAuth()->getAccount()->accueil; $oInscriptionespenf->ref_ins=rand(1, 9999); //var_dump($oInscriptionespenf->ref_ins.rand(1, 1000));die; $oAccount=_root::getAuth()->getAccount()->boutondate; if ($oAccount == 'desactiver'){ model_inscriptionespenf::getInstance()->DateVc($oInscriptionespenf->ref_ins, $oInscriptionespenf->id_accueil, _root::getParam('date1'), _root::getParam('date2'), _root::getParam('date3'), _root::getParam('date4'), _root::getParam('date5'), _root::getParam('date6'), _root::getParam('date7'), _root::getParam('date8'), _root::getParam('date9'), _root::getParam('date10')); }else{ model_inscriptionespenf::getInstance()->DateEte($oInscriptionespenf->ref_ins, $oInscriptionespenf->id_accueil, _root::getParam('datepeco1'), _root::getParam('datepeco2'), _root::getParam('datepeco3'), _root::getParam('datepeco4'), _root::getParam('datepeco5'), _root::getParam('datepeco6'), _root::getParam('datepeco7'), _root::getParam('datepeco8'), _root::getParam('datepeco9'), _root::getParam('datepeco10'), _root::getParam('datepeco11'), _root::getParam('datepeco12'), _root::getParam('datepeco13'), _root::getParam('datepeco14'), _root::getParam('datepeco15'), _root::getParam('datepeco16'), _root::getParam('datepeco17'), _root::getParam('datepeco18'), _root::getParam('datepeco19'), _root::getParam('datepeco20')); } $oCountMa = model_inscriptionespenf::getInstance()->findCountClasseMa(); $oCountPri = model_inscriptionespenf::getInstance()->findCountClassePri(); if ($oInscriptionespenf->classe == 1 && $oCountMa < 32){ $oInscriptionespenf->statue ='Accepter'; }elseif ($oInscriptionespenf->classe == 2 && $oCountPri < 40){ $oInscriptionespenf->statue ='Accepter'; }else{ $oInscriptionespenf->statue ='En Attente'; } if($oInscriptionespenf->save()){ //une fois enregistre on redirige (vers la page liste) _root::redirect('inscriptionespenf::list'); }else{ return $oInscriptionespenf->getListError(); } }
Modele datevc :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <?php $oForm=new plugin_form($this->oInscriptionespenf); $oFormDate=new plugin_form($this->oInscriptionespenfdate); $oForm->setMessage($this->tMessage); ?> <form class="form-horizontal" action="" method="POST" > <center><h2><u>Modification des Inscriptions pour les vacances scolaires et d'été</u><b><FONT size="4pt"></FONT></b></h2></center><br> <br> <div class="table-responsive"> <table class="table table-striped"> <tr> <th><center>Nom des Enfants</center></th> <th><center>Prenom</center></th> <th><center>Date de Naissance</center></th> <th><center>Ecole</center></th> <th><center>Classe</center></th> <th><center>Font-ils la sieste ?</center></th> </tr> <td><center><div class="col-sm-10"><?php echo $oForm->getInputText('nomenf',array('class'=>'form-control')) ?></div></center></td> <td><center><div class="col-sm-10"><?php echo $oForm->getInputText('prenom',array('class'=>'form-control')) ?></div></center></td> <td><center><div class="col-sm-10" id="sandbox-container"><?php echo $oForm->getInputText('datenaissance',array('class'=>'form-control')) ?></div></center></td> <td><center><div class="col-sm-50"><?php echo $oForm->getSelect('ecole',$this->tJoinmodel_espaceecoleenf,array('class'=>'form-control','id'=>'name')) ?></div></center></td> <td><center><div class="col-sm-50"><?php echo $oForm->getSelect('classe',$this->tJoinmodel_classe,array('class'=>'form-control','id'=>'name')) ?></div></center></td> <td><center><div class="col-lg-30">Oui <?php echo $oForm->getInputRadio('sieste','Oui',array('class'=>'form-check-input')) ?><br> Non <?php echo $oForm->getInputRadio('sieste','Non',array('class'=>'form-check-input')) ?> </div></center></td> </table> </div> <ul class="nav nav-tabs nav-justified"> <li class="active"><a data-toggle="tab" href="#home">Date Vacance en Période Scolaire</a></li> <li><a data-toggle="tab" href="#menu1">Date Vacance d'été</a></li> </ul> <div class="tab-content"> <div id="home" class="tab-pane fade in active"> <?php $oAccount=_root::getAuth()->getAccount(); ?> <?php if($oAccount->boutondate == 'desactiver'){ ?> <div class="form-group"> <div class="form-row"> <div class="col-sm-6" id="sandbox-container"><label>Date1</label><?php echo $oForm->getInputText('date1',array('class'=>'form-control')) ?></div> <div class="col-sm-6" id="sandbox-container"><label>Date2</label><?php echo $oForm->getInputText('date2',array('class'=>'form-control')) ?></div> </div> </div> <div class="form-group"> <div class="form-row"> <div class="col-sm-6" id="sandbox-container"><label>Date3</label><?php echo $oForm->getInputText('date3',array('class'=>'form-control')) ?></div> <div class="col-sm-6" id="sandbox-container"><label>Date4</label><?php echo $oForm->getInputText('date4',array('class'=>'form-control')) ?></div> </div> </div> <div class="form-group"> <div class="form-row"> <div class="col-sm-6" id="sandbox-container"><label>Date5</label><?php echo $oForm->getInputText('date5',array('class'=>'form-control')) ?></div> <div class="col-sm-6" id="sandbox-container"><label>Date6</label><?php echo $oForm->getInputText('date6',array('class'=>'form-control')) ?></div> </div> </div> <div class="form-group"> <div class="form-row"> <div class="col-sm-6" id="sandbox-container"><label>Date7</label><?php echo $oForm->getInputText('date7',array('class'=>'form-control')) ?></div> <div class="col-sm-6" id="sandbox-container"><label>Date8</label><?php echo $oForm->getInputText('date8',array('class'=>'form-control')) ?></div> </div> </div> <div class="form-group"> <div class="form-row"> <div class="col-sm-6" id="sandbox-container"><label>Date9</label><?php echo $oForm->getInputText('date9',array('class'=>'form-control')) ?></div> <div class="col-sm-6" id="sandbox-container"><label>Date10</label><?php echo $oForm->getInputText('date10',array('class'=>'form-control')) ?></div> </div> </div> <?php } ?> </div>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 public function findAllDate($uId){ return $this->findMany('SELECT * FROM '.$this->sTable.' INNER JOIN inscriptionespenf ON datevc.ref_ins = inscriptionespenf.ref_ins WHERE inscriptionespenf.ref_ins=?',$uId ); }
Partager