IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

MkFramework Discussion :

probleme avec le plugin_date et datetime


Sujet :

MkFramework

  1. #1
    Membre habitué
    Homme Profil pro
    Assistant statisticien
    Inscrit en
    Juillet 2009
    Messages
    132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Réunion

    Informations professionnelles :
    Activité : Assistant statisticien
    Secteur : Santé

    Informations forums :
    Inscription : Juillet 2009
    Messages : 132
    Points : 168
    Points
    168
    Par défaut probleme avec le plugin_date et datetime
    Voila ma vue NEW
    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
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
     
    <?php 
    $oForm=new plugin_form($this->oReservations);
    $oForm->setMessage($this->tMessage);
    plugin_debug::addSpy('$oForm',$oForm);
    plugin_debug::addSpy('$this->oReservations',$this->oReservations);
    ?>
     
    <form  action="" method="POST" >
     
    	<div class="row">
        <div class="form-group">
          <h2 class="page-header text-center">Demande de réservation <label class="control-label">créée le</label></h2>
        </div>
      </div>
     
    	<div class="row">
        <div class="col-md-4">
    			<div class="form-group">
    				<label class=" control-label">Centre</label>
    				<div ><input type="text" name="centres" value="<?php echo $this->tCentres_id->name?>" class="form-control" disabled></div>
    				<input type="hidden" name="centres_id" value="<?php echo $this->tCentres_id->name?>"/>
    			</div>
        </div>
        <div class="col-md-4">
          <div class="form-group">
    				<label class=" control-label">Service</label>
    				<div ><input type="text" name="services" value="<?php echo $this->tServices_id->name ?>" 
    				class="form-control" disabled></div>
    				<input type="hidden" name="services_id" value="<?php echo $this->tServices_id->id ?>"/>
    			</div>
        </div>
        <div class="col-md-4">
         	<div class="form-group">
    				<label class="control-label">Voiture</label>
    				<div ><?php echo $oForm->getSelect('voitures_id',$this->tJoinmodel_voitures,array('class'=>'form-control')) ?></div>
    			</div>
        </div>
      </div>
     
    	<div class="row">
        <div class="col-md-6">
         <div class="form-group">
    				<label class=" control-label">Nom</label>
    				<div ><input type="text" name="name" value="<?php echo _root::getAuth()->getAccount()->name ?>" class="form-control" disabled></div>
    					<input type="hidden" name="users_id" value="<?php echo _root::getAuth()->getAccount()->id ?>"/>
    			</div>
        </div>
        <div class="col-md-6">
          <div class="form-group">
    				<label class="control-label">Prénom</label>
    				<div ><input type="text" name="name" value="<?php echo _root::getAuth()->getAccount()->lastName?>" class="form-control" disabled></div>
    			</div>
        </div>
      </div>
     
    	<div class="row">
        <div class="col-md-12">
          <div class="form-group">
    				<label class="control-label">Personnes transportées</label>
    				<div><?php echo $oForm->getInputText('personnes_transportees',array('class'=>'form-control','placeholder'=>'Taper une liste de nom, prénom séparée par une virgule')) ?></div>
    			</div>
        </div>
      </div>
    	<br>
    	<div class="row">
        <div class="col-md-12">
            <div class=" form-inline">
    					<div class="form-group">
    					 <label class="control-label">Réservation du</label>
    						<?php echo $oForm->getInputText('date_du',array('class'=>'form-control text-center sandbox-container','placeholder'=> 'JJ/MM/AAAA','autocomplete'=>'off','data-provide' =>'datepicker','id'=>'date_du')) ?>
    					</div>
    					<div class="form-group">
    						<label class="control-label">à</label>
    						<div class="input-group bootstrap-timepicker timepicker">
    							<input id="timepicker1" name="time_a" type="text" class="form-control input-small">
    							<span class="input-group-addon"><i class="glyphicon glyphicon-time"></i></span>
            		</div>
    					</div>
    					<div class="form-group">
    						<label class="control-label">jusqu'à</label>
    						<div class="input-group bootstrap-timepicker timepicker">
    							<input id="timepicker2" name="time_jusqua" type="text" class="form-control input-small">
    							<span class="input-group-addon"><i class="glyphicon glyphicon-time"></i></span>
            		</div>
    					</div>
            </div>
        </div>
      </div>
    	<br>
    	<div class="row">
        <div class="col-md-9">
          <div class="form-group">
    				<label class="control-label">Motif du déplacement</label>
    				<div><?php echo $oForm->getInputTextArea('motif_deplacement',array('class'=>'form-control')) ?></div>
    			</div>
        </div>
        <div class="col-md-3">
          <div class="form-group">
    				<label class="control-label">Destination</label>
    				<div><?php echo $oForm->getSelect('baremes_id',$this->tJoinmodel_bareme,array('class'=>'form-control')) ?></div>
    			</div>
        </div>
      </div>
     
    	<?php echo $oForm->getToken('token',$this->token)?>
     
    	<input type="hidden" name="annulation" value="<?php echo null; ?>"/>
     
     
    	<div class="form-group">
    			<div >
    			<input type="submit" class="btn btn-success" value="Ajouter" /> <a class="btn btn-link" href="<?php echo $this->getLink('reservations::list')?>">Annuler</a>
    		</div>
    </div>
    </form>
    voila mon main
    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
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
     
    <?php
    class module_reservations extends abstract_module{
     
    	public function before(){
    		$this->oLayout=new _layout('bootstrap');
     
    		$this->oLayout->addModule('menu','menu::index');
    	}
     
     
    	public function _index(){
    	    //on considere que la page par defaut est la page de listage
    	    $this->_list();
    	}
     
     
    	public function _list(){
     
    		$tReservations=model_reservations::getInstance()->findAll();
     
    		$oView=new _view('reservations::list');
    		$oView->tReservations=$tReservations;
     
    				$oView->tJoinmodel_services=model_services::getInstance()->getSelect();
    				$oView->tJoinmodel_centres=model_centres::getInstance()->getSelect();
    				$oView->tJoinmodel_bareme=model_bareme::getInstance()->getSelect();
    				$oView->tJoinmodel_users=model_users::getInstance()->getSelectPersTrans();
    				$oView->tJoinmodel_voitures=model_voitures::getInstance()->getSelect();
     
    		$oModulePagination=new module_pagination;
    		$oModulePagination->setModuleAction('reservations::list');
    		$oModulePagination->setParamPage('page');
    		$oModulePagination->setLimit(5);
    		$oModulePagination->setPage( _root::getParam('page') );
    		$oModulePagination->setTab( $tReservations );
     
    		$oView->tReservations=$oModulePagination->getPageElement();
     
    		$this->oLayout->add('main',$oView);
     
     
    		$oViewPagination=$oModulePagination->build();
     
    		$this->oLayout->add('main',$oViewPagination);
     
    	}
     
     
     
    	public function _new(){
    		$oDate = new plugin_date(_root::getParam('exercer_date'),'d/m/Y');
    		$date = $oDate->toString('Y-m-d');
    plugin_debug::addSpy('$date ',$date );		
    		$tMessage=$this->processSave();
    		$oReservationsExistantes = model_reservations::getInstance()->findReservationsByVoiture(_root::getParam('voitures_id',null),_root::getParam('date_du',null),_root::getParam('time_a',null));
    		plugin_debug::addSpy('$oReservationsExistantes ',$oReservationsExistantes );
     
    		$oReservations=new row_reservations;
     
    		$tCentres_id = model_centres::getInstance()->findById(_root::getAuth()->getAccount()->centres_id);
    		$tServices_id = model_services::getInstance()->findById(_root::getAuth()->getAccount()->centres_id);
     
    		$oView=new _view('reservations::new');
    		$oView->oReservations=$oReservations;
     
     
    				$oView->tJoinmodel_services=model_services::getInstance()->getSelect();
    				$oView->tCentres_id = $tCentres_id;
    				$oView->tServices_id = $tServices_id;
    				$oView->tJoinmodel_bareme=model_bareme::getInstance()->getSelect();
    				$oView->tJoinmodel_users=model_users::getInstance()->getSelectPersTrans();
    				$oView->tJoinmodel_voitures=model_voitures::getInstance()->getSelect();
     
    		$oPluginXsrf=new plugin_xsrf();
    		$oView->token=$oPluginXsrf->getToken();
    		$oView->tMessage=$tMessage;
     
    		$this->oLayout->add('main',$oView);
    	}
     
     
     
    	public function _edit(){
    		$tMessage=$this->processSave();
     
    		$oReservations=model_reservations::getInstance()->findById( _root::getParam('id') );
    		$tCentres_id=model_centres::getInstance()->findById(_root::getAuth()->getAccount()->centres_id);
    		$tServices_id=model_services::getInstance()->findById(_root::getAuth()->getAccount()->centres_id);
     
    		$oView=new _view('reservations::edit');
    		$oView->oReservations=$oReservations;
    		$oView->tId=model_reservations::getInstance()->getIdTab();
     
    				$oView->tJoinmodel_services=model_services::getInstance()->getSelect();
    				$oView->tJoinmodel_centres=model_centres::getInstance()->getSelect();
    				$oView->tJoinmodel_bareme=model_bareme::getInstance()->getSelect();
    				$oView->tJoinmodel_voitures=model_voitures::getInstance()->getSelect();
    				$oView->tCentres_id = $tCentres_id;
    				$oView->tServices_id = $tServices_id;
    				$oView->tJoinmodel_annulation=['0'=>'NON','1'=>'OUI'];
     
    		$oPluginXsrf=new plugin_xsrf();
    		$oView->token=$oPluginXsrf->getToken();
    		$oView->tMessage=$tMessage;
     
    		$this->oLayout->add('main',$oView);
    	}
     
     
     
    	public function _show(){
    		$oReservations=model_reservations::getInstance()->findById( _root::getParam('id') );
     
    		$oView=new _view('reservations::show');
    		$oView->oReservations=$oReservations;
     
    				$oView->tJoinmodel_services=model_services::getInstance()->getSelect();
    				$oView->tJoinmodel_centres=model_centres::getInstance()->getSelect();
    				$oView->tJoinmodel_bareme=model_bareme::getInstance()->getSelect();
     
    		$this->oLayout->add('main',$oView);
    	}
     
     
     
    	public function _delete(){
    		$tMessage=$this->processDelete();
     
    		$oReservations=model_reservations::getInstance()->findById( _root::getParam('id') );
     
    		$oView=new _view('reservations::delete');
    		$oView->oReservations=$oReservations;
     
    				$oView->tJoinmodel_services=model_services::getInstance()->getSelect();
    				$oView->tJoinmodel_centres=model_centres::getInstance()->getSelect();
    				$oView->tJoinmodel_bareme=model_bareme::getInstance()->getSelect();
     
    		$oPluginXsrf=new plugin_xsrf();
    		$oView->token=$oPluginXsrf->getToken();
    		$oView->tMessage=$tMessage;
     
    		$this->oLayout->add('main',$oView);
    	}
     
     
     
    	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){
    			$oReservations=new row_reservations;
     
    			$tColumn=array('services_id','users_id','voitures_id','centres_id','baremes_id','date_du','time_a','time_jusqua','personnes_transportees','motif_deplacement','parcours_prioritaire');
     
    			foreach($tColumn as $sColumn){
    				$oReservations->$sColumn=_root::getParam($sColumn,null) ;
    			}
    			$km = model_bareme::getInstance()->findBaremeKm(_root::getParam('centres_id',null),_root::getParam('baremes_id',null));
     
    			$pers_trans=explode(',',$oReservations->personnes_transportees);
     
    			$oReservations->parcours_prioritaire = $km->km * 2 * count($pers_trans);
    			$oReservations->date_du = _root::getParam('date_du',null);
    		}else{
    			$oReservations=model_reservations::getInstance()->findById( _root::getParam('id',null) );
     
    			$tColumn=array('services_id','users_id','voitures_id','centres_id','baremes_id','date_du','time_a','time_jusqua','annulation','personnes_transportees','motif_deplacement','date_annulation','parcours_prioritaire');
     
    			foreach($tColumn as $sColumn){
    				$oReservations->$sColumn=_root::getParam($sColumn,null) ;
    			}
    			$date = new DateTime();
    			$oReservations->date_updated = $date->format('Y-m-d H:i:s');	
    		}
     
    		if($oReservations->save()){
    			//une fois enregistre on redirige (vers la page liste)
    			_root::redirect('reservations::list');
    		}else{
    			return $oReservations->getListError();
    		}
     
    	}
     
     
    	public function processDelete(){
    		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() );
    		}
     
    		$oReservations=model_reservations::getInstance()->findById( _root::getParam('id',null) );
     
    		$oReservations->delete();
    		//une fois enregistre on redirige (vers la page liste)
    		_root::redirect('reservations::list');
     
    	}
     
     
    	public function after(){
    		$this->oLayout->show();
    	}
     
     
    }
    voilà l'erreur
    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
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
     
    Undefined variable: iAnnee
    #0 C:\xampp\htdocs\2-mkFramework\mkframework\data\genere\oreli\plugin\plugin_datetime.php(168): exception_error_handler(8, 'Undefined varia...', 'C:\\xampp\\htdocs...', 168, Array)
    #1 C:\xampp\htdocs\2-mkFramework\mkframework\data\genere\oreli\plugin\plugin_datetime.php(51): plugin_datetime->convertFromFormatToTab('2018-03-14 13:1...', 'Y-m-d H:i:s')
    #2 C:\xampp\htdocs\2-mkFramework\mkframework\data\genere\oreli\plugin\plugin_datetime.php(37): plugin_datetime->loadFromFormat('2018-03-14 13:1...', 'Y-m-d H:i:s')
    #3 C:\xampp\htdocs\2-mkFramework\mkframework\data\genere\oreli\model\model_reservations.php(74): plugin_datetime->__construct('2018-03-14 13:1...')
    #4 C:\xampp\htdocs\2-mkFramework\mkframework\lib\framework\abstract\abstract_sgbd_pdo.php(158): row_reservations->__construct(Array)
    #5 C:\xampp\htdocs\2-mkFramework\mkframework\lib\framework\abstract\abstract_model.php(134): abstract_sgbd_pdo->findMany(Array, 'row_reservation...')
    #6 C:\xampp\htdocs\2-mkFramework\mkframework\data\genere\oreli\model\model_reservations.php(19): abstract_model->findMany('SELECT * FROM r...')
    #7 C:\xampp\htdocs\2-mkFramework\mkframework\data\genere\oreli\module\reservations\main.php(19): model_reservations->findAll()
    #8 C:\xampp\htdocs\2-mkFramework\mkframework\lib\framework\class_root.php(264): module_reservations->_list()
    #9 C:\xampp\htdocs\2-mkFramework\mkframework\data\genere\oreli\public\index.php(47): _root->run()
    #10 {main}
     
    Detail:
    #0 C:\xampp\htdocs\2-mkFramework\mkframework\data\genere\oreli\plugin\plugin_datetime.php (168) 
    exception_error_handler( , 'Undefined variable: iAnnee' , 'C:\xampp\htdocs\2-mkFramework\mkframework\data\genere\oreli\plugin\plugin_datetime.php' , , Array ( [sDate] => 2018-03-14 13:14:17 [sFormat] => Y-m-d H:i:s [iHeure] => 0 [iMinute] => 0 [iSeconde] => 0 ) ) 
    #1 C:\xampp\htdocs\2-mkFramework\mkframework\data\genere\oreli\plugin\plugin_datetime.php (51) 
    plugin_datetime -> convertFromFormatToTab( '2018-03-14 13:14:17' , 'Y-m-d H:i:s' ) 
    #2 C:\xampp\htdocs\2-mkFramework\mkframework\data\genere\oreli\plugin\plugin_datetime.php (37) 
    plugin_datetime -> loadFromFormat( '2018-03-14 13:14:17' , 'Y-m-d H:i:s' ) 
    #3 C:\xampp\htdocs\2-mkFramework\mkframework\data\genere\oreli\model\model_reservations.php (74) 
    plugin_datetime -> __construct( '2018-03-14 13:14:17' ) 
    #4 C:\xampp\htdocs\2-mkFramework\mkframework\lib\framework\abstract\abstract_sgbd_pdo.php (158) 
    row_reservations -> __construct( Array ( [id] => 52 [services_id] => 1 [users_id] => 14 [voitures_id] => 1 [centres_id] => Saint-Denis [baremes_id] => Cambuston [situation] => en cours [date_du] => 30/11/1999 [time_a] => 08:00:00 [time_jusqua] => 15:00:00 [personnes_transportees] => g,h [motif_deplacement] => fgfg [annulation] => [date_annulation] => [parcours_prioritaire] => 104 [date_created] => 2018-03-14 13:14:17 [date_updated] => ) ) 
    #5 C:\xampp\htdocs\2-mkFramework\mkframework\lib\framework\abstract\abstract_model.php (134) 
    abstract_sgbd_pdo -> findMany( Array ( [0] => SELECT * FROM reservations ) , 'row_reservations' ) 
    #6 C:\xampp\htdocs\2-mkFramework\mkframework\data\genere\oreli\model\model_reservations.php (19) 
    abstract_model -> findMany( 'SELECT * FROM reservations' ) 
    #7 C:\xampp\htdocs\2-mkFramework\mkframework\data\genere\oreli\module\reservations\main.php (19) 
    model_reservations -> findAll( ) 
    #8 C:\xampp\htdocs\2-mkFramework\mkframework\lib\framework\class_root.php (264) 
    module_reservations -> _list( ) 
    #9 C:\xampp\htdocs\2-mkFramework\mkframework\data\genere\oreli\public\index.php (47) 
    _root -> run( ) 
    #10 {main}
    Fichier : C:\xampp\htdocs\2-mkFramework\mkframework\data\genere\oreli\plugin\plugin_datetime.php ligne 168
     
    Message : Undefined variable: iAnnee
     
    150	            list($iJour,$iMois,$iAnnee)=explode('-',$sDate);
    151	        }elseif($sFormat=='d/m/Y'){
    152	            list($iJour,$iMois,$iAnnee)=explode('/',$sDate);
    153	        }elseif($sFormat=='Y/m/d'){
    154	            list($iAnnee,$iMois,$iJour)=explode('/',$sDate);
    155	        }elseif($sFormat=='m-d-Y'){
    156	            list($iMois,$iJour,$iAnnee)=explode('-',$sDate);
    157	        }elseif($sFormat=='y-m-d'){
    158	            list($iAnnee,$iMois,$iJour)=explode('-',$sDate);
    159	            $iAnnee=2000+intval($iAnnee);
    160	        }elseif($sFormat=='Y-m-d h:i:s'){
    161	            $tDatetime=preg_split('/\s/',$sDate);
    162	            list($iAnnee,$iMois,$iJour)=explode('-',$tDatetime[0]);
    163	            list($iHeure,$iMinute,$iSeconde)=explode(':',$tDatetime[1]);
    164	        }        
    165	        
    166	
    167	        return array(
    168	                sprintf('%04d',$iAnnee),
    169	                sprintf('%02d',$iMois),
    170	                sprintf('%02d',$iJour),
    171	                sprintf('%02d',$iHeure),
    172	                sprintf('%02d',$iMinute),
    173	                sprintf('%02d',$iSeconde),    
    174	        );
    175	        
    176	    }
    177	}
    178	
    Navigation
    Module:reservations Action:list
    $_GET
    Array
    (
    [:nav] => reservations::list
    )
    $_POST
    Array
    (
    )
    $_SESSION
    Array
    (
    [ip] => 363baea9cba210afac6d7a556fca596e30c46333
    [userAgent] => fa3a570078ed1610120c5928a03ca0be6b0997ae
    [timeout] => 1521020967
    [oAccount] => O:9:"row_users":4:{s:14:"*sClassModel";s:11:"model_users";s:28:"abstract_row_bChooseUpdate";b:1;s:13:"*_tProperty";a:7:{s:2:"id";s:2:"14";s:10:"centres_id";s:1:"1";s:11:"services_id";s:1:"1";s:4:"name";s:6:"Dijoux";s:8:"lastName";s:15:"Béatrice";s:5:"email";s:38:"beatrice.dijoux@ersm-reunion.cnamts.fr";s:8:"password";s:40:"5a0f1fe5a83b5e0dbf23ec27271e01013cd46c87";}s:21:"*_tPropertyToUpdate";N;}
    [gestionuser_tabAllowDeny] => Array
    (
    [rightsManagerMulti::index] => Array
    (
    [deny] => 1
    )
     
    [actions::index] => Array
    (
    [access] => 1
    )
     
    [groupe::index] => Array
    (
    [deny] => 1
    )
     
    [groupe::list] => Array
    (
    [deny] => 1
    )
     
    [auth::logout] => Array
    (
    [access] => 1
    )
     
    [items::list] => Array
    (
    [deny] => 1
    )
     
    [calendrier::index] => Array
    (
    [access] => 1
    )
     
    [messagerie::list] => Array
    (
    [access] => 1
    )
     
    [users::index] => Array
    (
    [access] => 1
    )
     
    [voitures::index] => Array
    (
    [access] => 1
    )
     
    [bareme::index] => Array
    (
    [access] => 1
    )
     
    [rightsManagerMulti::groupUser] => Array
    (
    [access] => 1
    )
     
    [reservations::list] => Array
    (
    [access] => 1
    )
     
    )
     
    )
    $_SERVER
    Array
    (
    [MIBDIRS] => C:/xampp/php/extras/mibs
    [MYSQL_HOME] => \xampp\mysql\bin
    [OPENSSL_CONF] => C:/xampp/apache/bin/openssl.cnf
    [PHP_PEAR_SYSCONF_DIR] => \xampp\php
    [PHPRC] => \xampp\php
    [TMP] => \xampp\tmp
    [HTTP_HOST] => localhost
    [HTTP_CONNECTION] => keep-alive
    [HTTP_UPGRADE_INSECURE_REQUESTS] => 1
    [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36
    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
    [HTTP_ACCEPT_ENCODING] => gzip, deflate, br
    [HTTP_ACCEPT_LANGUAGE] => fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7
    [HTTP_COOKIE] => PHPSESSID=cuk33h2be13hqctqh32tk8ft3c; _ga=GA1.1.1469998816.1505206093
    [PATH] => c:\iss\shared_lib;c:\iss\bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\COMM;C:\NSDLL;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Program Files\MongoDB\Server\3.2\bin;C:\Program Files\PuTTY\;C:\Program Files\Bitvise SSH Client;C:\Users\JUE-04034\AppData\Roaming\npm;C:\Program Files\SSH Communications Security\SSH Secure Shell;C:\Program Files\Microsoft VS Code\bin;C:\Users\JUE-04034\AppData\Local\Turbo\Cmd\
    [SystemRoot] => C:\windows
    [COMSPEC] => C:\windows\system32\cmd.exe
    [PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    [WINDIR] => C:\windows
    [SERVER_SIGNATURE] =>
    Apache/2.4.27 (Win32) OpenSSL/1.0.2l PHP/7.1.8 Server at localhost Port 80
     
     
    [SERVER_SOFTWARE] => Apache/2.4.27 (Win32) OpenSSL/1.0.2l PHP/7.1.8
    [SERVER_NAME] => localhost
    [SERVER_ADDR] => ::1
    [SERVER_PORT] => 80
    [REMOTE_ADDR] => ::1
    [DOCUMENT_ROOT] => C:/xampp/htdocs
    [REQUEST_SCHEME] => http
    [CONTEXT_PREFIX] => 
    [CONTEXT_DOCUMENT_ROOT] => C:/xampp/htdocs
    [SERVER_ADMIN] => postmaster@localhost
    [SCRIPT_FILENAME] => C:/xampp/htdocs/2-mkFramework/mkframework/data/genere/oreli/public/index.php
    [REMOTE_PORT] => 64475
    [GATEWAY_INTERFACE] => CGI/1.1
    [SERVER_PROTOCOL] => HTTP/1.1
    [REQUEST_METHOD] => GET
    [QUERY_STRING] => :nav=reservations::list
    [REQUEST_URI] => /2-mkFramework/mkframework/data/genere/oreli/public/index.php?:nav=reservations::list
    [SCRIPT_NAME] => /2-mkFramework/mkframework/data/genere/oreli/public/index.php
    [PHP_SELF] => /2-mkFramework/mkframework/data/genere/oreli/public/index.php
    [REQUEST_TIME_FLOAT] => 1521019167.499
    [REQUEST_TIME] => 1521019167
    )
    qd je regarde dans ma base de données pour date_du j'ai 0000-00-00.
    Pourquoi?

  2. #2
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 100
    Points
    19 100
    Billets dans le blog
    17
    Par défaut
    Bonjour,
    Je pense que le soucis vient du format demandé: c'est h (h minuscule) et non H majuscule qui est accepté
    Extrait du plugin
    Code php : 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
     
    if($sFormat=='Y-m-d'){
    			list($iAnnee,$iMois,$iJour)=explode('-',$sDate);
    		}elseif($sFormat=='d-m-Y'){
    			list($iJour,$iMois,$iAnnee)=explode('-',$sDate);
    		}elseif($sFormat=='d/m/Y'){
    			list($iJour,$iMois,$iAnnee)=explode('/',$sDate);
    		}elseif($sFormat=='Y/m/d'){
    			list($iAnnee,$iMois,$iJour)=explode('/',$sDate);
    		}elseif($sFormat=='m-d-Y'){
    			list($iMois,$iJour,$iAnnee)=explode('-',$sDate);
    		}elseif($sFormat=='y-m-d'){
    			list($iAnnee,$iMois,$iJour)=explode('-',$sDate);
    			$iAnnee=2000+intval($iAnnee);
    		}elseif($sFormat=='Y-m-d h:i:s'){
    			$tDatetime=preg_split('/\s/',$sDate);
    			list($iAnnee,$iMois,$iJour)=explode('-',$tDatetime[0]);
    			list($iHeure,$iMinute,$iSeconde)=explode(':',$tDatetime[1]);
    		}
    Framework php sécurisé et simple à prendre en main avec générateur web http://mkframework.com/ (hebergé sur developpez.com)
    Mes cours/tutoriaux

  3. #3
    Membre habitué
    Homme Profil pro
    Assistant statisticien
    Inscrit en
    Juillet 2009
    Messages
    132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Réunion

    Informations professionnelles :
    Activité : Assistant statisticien
    Secteur : Santé

    Informations forums :
    Inscription : Juillet 2009
    Messages : 132
    Points : 168
    Points
    168
    Par défaut toujours les dates
    Bonjour Imikado

    Merci pour tes éclaircissements sur mon précédent post.

    J'ai encore un souci pour les dates.
    Comme tu le vois sur l'image Nom : oreli.PNG
Affichages : 162
Taille : 7,2 Ko j'ai pour les champs "mise à jour le" et "du" de mauvaises dates. Cela correspond à nav=reservations::list
    TU trouveras ci dessous mon model reservations
    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
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
     
    <?php
    class model_reservations extends abstract_model{
     
    	protected $sClassRow='row_reservations';
     
    	protected $sTable='reservations';
    	protected $sConfig='pdoMysqlExple';
     
    	protected $tId=array('id');
     
    	public static function getInstance(){
    		return self::_getInstance(__CLASS__);
    	}
     
    	public function findById($uId){
    		return $this->findOne('SELECT * FROM '.$this->sTable.' WHERE id=?',$uId );
    	}
    	public function findAll(){
    		return $this->findMany('SELECT * FROM '.$this->sTable);
    	}
     
    	public function findReservationsByVoiture($voiture,$date_du,$time_a){
    		return $this->findAll('SELECT voitures_id, date_du, time_a FROM '.$this->sTable.' WHERE voitures_id=? OR date_du=? OR time_a=?',$voiture,$date_du,$time_a);
    	}
     
     
    }
     
    class row_reservations extends abstract_row{
     
    	protected $sClassModel='model_reservations';
     
    	/*exemple jointure
    	public function findAuteur(){
    		return model_auteur::getInstance()->findById($this->auteur_id);
    	}
    	*/
    	/*exemple test validation*/
    	private function getCheck(){
    		$oPluginValid=new plugin_valid($this->getTab());
     
     
    		/* renseigner vos check ici
    		$oPluginValid->isEqual('champ','valeurB','Le champ n\est pas &eacute;gal &agrave; '.$valeurB);
    		$oPluginValid->isNotEqual('champ','valeurB','Le champ est &eacute;gal &agrave; '.$valeurB);
    		$oPluginValid->isUpperThan('champ','valeurB','Le champ n\est pas sup&eacute; &agrave; '.$valeurB);
    		$oPluginValid->isUpperOrEqualThan('champ','valeurB','Le champ n\est pas sup&eacute; ou &eacute;gal &agrave; '.$valeurB);
    		$oPluginValid->isLowerThan('champ','valeurB','Le champ n\est pas inf&eacute;rieur &agrave; '.$valeurB);
    		$oPluginValid->isLowerOrEqualThan('champ','valeurB','Le champ n\est pas inf&eacute;rieur ou &eacute;gal &agrave; '.$valeurB);
    		$oPluginValid->isEmpty('champ','Le champ n\'est pas vide');
    		$oPluginValid->isNotEmpty('champ','Le champ ne doit pas &ecirc;tre vide');
    		$oPluginValid->isEmailValid('champ','L\email est invalide');
    		$oPluginValid->matchExpression('champ','/[0-9]/','Le champ n\'est pas au bon format');
    		$oPluginValid->notMatchExpression('champ','/[a-zA-Z]/','Le champ ne doit pas &ecirc;tre a ce format');
    		*/
     
    		return $oPluginValid;
    	}
     
    	public function isValid(){
    		return $this->getCheck()->isValid();
    	}
    	public function getListError(){
    		return $this->getCheck()->getListError();
    	}
     
    	//on surcharge le constructeur
    	public function __construct($tRow = ''){
     
    		if ($tRow != '' ) {
    			//on modifie le champ date avant d'initialiser l'objet pour l'affichage
    			$oDate = new plugin_date($tRow['date_du']);
    			$tRow['date_du'] = $oDate->toString('d/m/Y');
    			$oDate = new plugin_datetime($tRow['date_created']);
    			$tRow['date_created'] = $oDate->toString('d/m/Y h:i:s');
    			$oDate = new plugin_datetime($tRow['date_updated']);
    			$tRow['date_updated'] = $oDate->toString('d/m/Y h:i:s');
    		}
     
    		//on appelle le constructeur normal de la row
    		parent::__construct($tRow);
    	 }
     
    	public function save(){
    		if(!$this->isValid()){
    			return false;
    		}
     
    		/*FORMATAGE DES DATES*/
    		//on formate à la volée
           $oDate = new plugin_date($this->date_du,'d/m/Y');
           $this->date_du = $oDate->toString('Y-m-d');
    	   $oDate = new plugin_datetime($this->date_created,'d/m/Y h:i:s');
           $this->date_du = $oDate->toString('Y-m-d h:i:s');
     
    		parent::save();
    		return true;
    	}
     
    }
    le main de reservations :
    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
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
     
    <?php
    class module_reservations extends abstract_module{
     
    	public function before(){
    		$this->oLayout=new _layout('bootstrap');
     
    		$this->oLayout->addModule('menu','menu::index');
    	}
     
     
    	public function _index(){
    	    //on considere que la page par defaut est la page de listage
    	    $this->_list();
    	}
     
     
    	public function _list(){
     
    		$tReservations=model_reservations::getInstance()->findAll();
     
    		$oView=new _view('reservations::list');
    		$oView->tReservations=$tReservations;
     
    				$oView->tJoinmodel_services=model_services::getInstance()->getSelect();
    				$oView->tJoinmodel_centres=model_centres::getInstance()->getSelect();
    				$oView->tJoinmodel_bareme=model_bareme::getInstance()->getSelect();
    				$oView->tJoinmodel_users=model_users::getInstance()->getSelectPersTrans();
    				$oView->tJoinmodel_voitures=model_voitures::getInstance()->getSelect();
     
    		$oModulePagination=new module_pagination;
    		$oModulePagination->setModuleAction('reservations::list');
    		$oModulePagination->setParamPage('page');
    		$oModulePagination->setLimit(5);
    		$oModulePagination->setPage( _root::getParam('page') );
    		$oModulePagination->setTab( $tReservations );
     
    		$oView->tReservations=$oModulePagination->getPageElement();
     
    		$this->oLayout->add('main',$oView);
     
     
    		$oViewPagination=$oModulePagination->build();
     
    		$this->oLayout->add('main',$oViewPagination);
     
    	}
     
     
     
    	public function _new(){
    		$oDate = new plugin_date(_root::getParam('exercer_date'),'d/m/Y');
    		$date = $oDate->toString('Y-m-d');
    plugin_debug::addSpy('$date ',$date );		
    		$tMessage=$this->processSave();
    		$oReservationsExistantes = model_reservations::getInstance()->findReservationsByVoiture(_root::getParam('voitures_id',null),_root::getParam('date_du',null),_root::getParam('time_a',null));
    		plugin_debug::addSpy('$oReservationsExistantes ',$oReservationsExistantes );
     
    		$oReservations=new row_reservations;
     
    		$tCentres_id = model_centres::getInstance()->findById(_root::getAuth()->getAccount()->centres_id);
    		$tServices_id = model_services::getInstance()->findById(_root::getAuth()->getAccount()->centres_id);
     
    		$oView=new _view('reservations::new');
    		$oView->oReservations=$oReservations;
     
     
    				$oView->tJoinmodel_services=model_services::getInstance()->getSelect();
    				$oView->tCentres_id = $tCentres_id;
    				$oView->tServices_id = $tServices_id;
    				$oView->tJoinmodel_bareme=model_bareme::getInstance()->getSelect();
    				$oView->tJoinmodel_users=model_users::getInstance()->getSelectPersTrans();
    				$oView->tJoinmodel_voitures=model_voitures::getInstance()->getSelect();
     
    		$oPluginXsrf=new plugin_xsrf();
    		$oView->token=$oPluginXsrf->getToken();
    		$oView->tMessage=$tMessage;
     
    		$this->oLayout->add('main',$oView);
    	}
     
     
     
    	public function _edit(){
    		$tMessage=$this->processSave();
     
    		$oReservations=model_reservations::getInstance()->findById( _root::getParam('id') );
    		$tCentres_id=model_centres::getInstance()->findById(_root::getAuth()->getAccount()->centres_id);
    		$tServices_id=model_services::getInstance()->findById(_root::getAuth()->getAccount()->centres_id);
     
    		$oView=new _view('reservations::edit');
    		$oView->oReservations=$oReservations;
    		$oView->tId=model_reservations::getInstance()->getIdTab();
     
    				$oView->tJoinmodel_services=model_services::getInstance()->getSelect();
    				$oView->tJoinmodel_centres=model_centres::getInstance()->getSelect();
    				$oView->tJoinmodel_bareme=model_bareme::getInstance()->getSelect();
    				$oView->tJoinmodel_voitures=model_voitures::getInstance()->getSelect();
    				$oView->tCentres_id = $tCentres_id;
    				$oView->tServices_id = $tServices_id;
    				$oView->tJoinmodel_annulation=['0'=>'NON','1'=>'OUI'];
     
    		$oPluginXsrf=new plugin_xsrf();
    		$oView->token=$oPluginXsrf->getToken();
    		$oView->tMessage=$tMessage;
     
    		$this->oLayout->add('main',$oView);
    	}
     
     
     
    	public function _show(){
    		$oReservations=model_reservations::getInstance()->findById( _root::getParam('id') );
     
    		$oView=new _view('reservations::show');
    		$oView->oReservations=$oReservations;
     
    				$oView->tJoinmodel_services=model_services::getInstance()->getSelect();
    				$oView->tJoinmodel_centres=model_centres::getInstance()->getSelect();
    				$oView->tJoinmodel_bareme=model_bareme::getInstance()->getSelect();
     
    		$this->oLayout->add('main',$oView);
    	}
     
     
     
    	public function _delete(){
    		$tMessage=$this->processDelete();
     
    		$oReservations=model_reservations::getInstance()->findById( _root::getParam('id') );
     
    		$oView=new _view('reservations::delete');
    		$oView->oReservations=$oReservations;
     
    				$oView->tJoinmodel_services=model_services::getInstance()->getSelect();
    				$oView->tJoinmodel_centres=model_centres::getInstance()->getSelect();
    				$oView->tJoinmodel_bareme=model_bareme::getInstance()->getSelect();
     
    		$oPluginXsrf=new plugin_xsrf();
    		$oView->token=$oPluginXsrf->getToken();
    		$oView->tMessage=$tMessage;
     
    		$this->oLayout->add('main',$oView);
    	}
     
     
     
    	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){
    			$oReservations=new row_reservations;
     
    			$tColumn=array('services_id','users_id','voitures_id','centres_id','baremes_id','date_du','time_a','time_jusqua','personnes_transportees','motif_deplacement','parcours_prioritaire');
     
    			foreach($tColumn as $sColumn){
    				$oReservations->$sColumn=_root::getParam($sColumn,null) ;
    			}
    			$km = model_bareme::getInstance()->findBaremeKm(_root::getParam('centres_id',null),_root::getParam('baremes_id',null));
     
    			$pers_trans=explode(',',$oReservations->personnes_transportees);
     
    			$oReservations->parcours_prioritaire = $km->km * 2 * count($pers_trans);
    			$oReservations->date_du = _root::getParam('date_du',null);
    		}else{
    			$oReservations=model_reservations::getInstance()->findById( _root::getParam('id',null) );
     
    			$tColumn=array('services_id','users_id','voitures_id','centres_id','baremes_id','date_du','time_a','time_jusqua','annulation','personnes_transportees','motif_deplacement','date_annulation','parcours_prioritaire');
     
    			foreach($tColumn as $sColumn){
    				$oReservations->$sColumn=_root::getParam($sColumn,null) ;
    			}
    			$date = new DateTime();
    			$oReservations->date_updated = $date->format('Y-m-d H:i:s');	
    		}
     
    		if($oReservations->save()){
    			//une fois enregistre on redirige (vers la page liste)
    			_root::redirect('reservations::list');
    		}else{
    			return $oReservations->getListError();
    		}
     
    	}
     
     
    	public function processDelete(){
    		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() );
    		}
     
    		$oReservations=model_reservations::getInstance()->findById( _root::getParam('id',null) );
     
    		$oReservations->delete();
    		//une fois enregistre on redirige (vers la page liste)
    		_root::redirect('reservations::list');
     
    	}
     
     
    	public function after(){
    		$this->oLayout->show();
    	}
     
     
    }
    La vue new
    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
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
     
    <?php 
    $oForm=new plugin_form($this->oReservations);
    $oForm->setMessage($this->tMessage);
    plugin_debug::addSpy('$oForm',$oForm);
    plugin_debug::addSpy('$this->oReservations',$this->oReservations);
    ?>
     
    <form  action="" method="POST" >
     
    	<div class="row">
        <div class="form-group">
          <h2 class="page-header text-center">Demande de réservation <label class="control-label">créée le</label></h2>
        </div>
      </div>
     
    	<div class="row">
        <div class="col-md-4">
    			<div class="form-group">
    				<label class=" control-label">Centre</label>
    				<div ><input type="text" name="centres" value="<?php echo $this->tCentres_id->name?>" class="form-control" disabled></div>
    				<input type="hidden" name="centres_id" value="<?php echo $this->tCentres_id->name?>"/>
    			</div>
        </div>
        <div class="col-md-4">
          <div class="form-group">
    				<label class=" control-label">Service</label>
    				<div ><input type="text" name="services" value="<?php echo $this->tServices_id->name ?>" 
    				class="form-control" disabled></div>
    				<input type="hidden" name="services_id" value="<?php echo $this->tServices_id->id ?>"/>
    			</div>
        </div>
        <div class="col-md-4">
         	<div class="form-group">
    				<label class="control-label">Voiture</label>
    				<div ><?php echo $oForm->getSelect('voitures_id',$this->tJoinmodel_voitures,array('class'=>'form-control')) ?></div>
    			</div>
        </div>
      </div>
     
    	<div class="row">
        <div class="col-md-6">
         <div class="form-group">
    				<label class=" control-label">Nom</label>
    				<div ><input type="text" name="name" value="<?php echo _root::getAuth()->getAccount()->name ?>" class="form-control" disabled></div>
    					<input type="hidden" name="users_id" value="<?php echo _root::getAuth()->getAccount()->id ?>"/>
    			</div>
        </div>
        <div class="col-md-6">
          <div class="form-group">
    				<label class="control-label">Prénom</label>
    				<div ><input type="text" name="name" value="<?php echo _root::getAuth()->getAccount()->lastName?>" class="form-control" disabled></div>
    			</div>
        </div>
      </div>
     
    	<div class="row">
        <div class="col-md-12">
          <div class="form-group">
    				<label class="control-label">Personnes transportées</label>
    				<div><?php echo $oForm->getInputText('personnes_transportees',array('class'=>'form-control','placeholder'=>'Taper une liste de nom, prénom séparée par une virgule')) ?></div>
    			</div>
        </div>
      </div>
    	<br>
    	<div class="row">
        <div class="col-md-12">
            <div class=" form-inline">
    					<div class="form-group">
    					 <label class="control-label">Réservation du</label>
    						<?php echo $oForm->getInputText('date_du',array('class'=>'form-control text-center sandbox-container','placeholder'=> 'JJ/MM/AAAA','autocomplete'=>'off','data-provide' =>'datepicker','id'=>'date_du')) ?>
    					</div>
    					<div class="form-group">
    						<label class="control-label">à</label>
    						<div class="input-group bootstrap-timepicker timepicker">
    							<input id="timepicker1" name="time_a" type="text" class="form-control input-small">
    							<span class="input-group-addon"><i class="glyphicon glyphicon-time"></i></span>
            		</div>
    					</div>
    					<div class="form-group">
    						<label class="control-label">jusqu'à</label>
    						<div class="input-group bootstrap-timepicker timepicker">
    							<input id="timepicker2" name="time_jusqua" type="text" class="form-control input-small">
    							<span class="input-group-addon"><i class="glyphicon glyphicon-time"></i></span>
            		</div>
    					</div>
            </div>
        </div>
      </div>
    	<br>
    	<div class="row">
        <div class="col-md-9">
          <div class="form-group">
    				<label class="control-label">Motif du déplacement</label>
    				<div><?php echo $oForm->getInputTextArea('motif_deplacement',array('class'=>'form-control')) ?></div>
    			</div>
        </div>
        <div class="col-md-3">
          <div class="form-group">
    				<label class="control-label">Destination</label>
    				<div><?php echo $oForm->getSelect('baremes_id',$this->tJoinmodel_bareme,array('class'=>'form-control')) ?></div>
    			</div>
        </div>
      </div>
     
    	<?php echo $oForm->getToken('token',$this->token)?>
     
    	<input type="hidden" name="annulation" value="<?php echo null; ?>"/>
     
     
    	<div class="form-group">
    			<div >
    			<input type="submit" class="btn btn-success" value="Ajouter" /> <a class="btn btn-link" href="<?php echo $this->getLink('reservations::list')?>">Annuler</a>
    		</div>
    </div>
    </form>
    la vue list
    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
     
    <div class="row">
        <div class="form-group">
          <h2 class="page-header">Tableau de bord</h2>
        </div>
    </div>
    <table class="table table-striped">
    	<tr>
    		<th>Créé le</th>
    		<th>Situation</th>
    		<th>Mise à jour le</th>
    		<th>Agent</th>
    		<th>Voiture</th>
    		<th>Personnes transportées</th>
    		<th>Du</th>
    		<th>Destination</th>
    		<th>Actions</th>
    	</tr>
    	<?php if($this->tReservations):?>
    		<?php foreach($this->tReservations as $oReservations):?>
    		<tr <?php echo plugin_tpl::alternate(array('','class="alt"'))?>>
    			<td><?php echo $oReservations->date_created ?></td>
    			<td><?php echo $oReservations->situation ?></td>
    			<td><?php echo $oReservations->date_updated ?></td>
    			<td><?php if(isset($this->tJoinmodel_users[$oReservations->users_id])){ echo $this->tJoinmodel_users[$oReservations->users_id];}else{ echo $oReservations->users_id ;} ?>
    			</td>
    			<td><?php if(isset($this->tJoinmodel_voitures[$oReservations->voitures_id])){ echo $this->tJoinmodel_voitures[$oReservations->voitures_id];}else{ echo $oReservations->voitures_id ;} ?>
    			</td>
    			<td><?php echo $oReservations->personnes_transportees ?></td>
    			<td><?php echo $oReservations->date_du ?></td>
    			<td><?php if(isset($this->tJoinmodel_bareme[$oReservations->baremes_id])){ echo $this->tJoinmodel_bareme[$oReservations->baremes_id];}else{ echo $oReservations->baremes_id ;}?></td>
    			<td>
    				<a class="btn btn-success" href="<?php echo $this->getLink('reservations::edit',array(
    														'id'=>$oReservations->getId()
    													)
    											)?>">Modifier</a>
    							|
    				<a class="btn btn-danger" href="<?php echo $this->getLink('reservations::delete',array(
    														'id'=>$oReservations->getId()
    													)
    											)?>">Supprimer</a>
    			</td>
    		</tr>
    		<?php endforeach;?>
    	<?php else:?>
    		<tr>
    			<td colspan="15">Aucune ligne</td>
    		</tr>
    	<?php endif;?>
    </table>
     
    <p><a class="btn btn-primary" href="<?php echo $this->getLink('reservations::new') ?>">Nouvelle reservation</a></p>
    Voilà le code de ma table en bdd mysql
    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
     
    CREATE TABLE `reservations` (
      `id` int(11) NOT NULL,
      `services_id` int(11) NOT NULL,
      `users_id` int(11) NOT NULL,
      `voitures_id` int(11) NOT NULL,
      `centres_id` varchar(50) NOT NULL,
      `baremes_id` varchar(50) NOT NULL,
      `situation` varchar(30) NOT NULL DEFAULT 'en cours',
      `date_du` date NOT NULL,
      `time_a` time NOT NULL,
      `time_jusqua` time NOT NULL,
      `personnes_transportees` varchar(200) DEFAULT NULL,
      `motif_deplacement` text NOT NULL,
      `annulation` varchar(10) DEFAULT NULL,
      `date_annulation` datetime DEFAULT NULL,
      `parcours_prioritaire` smallint(6) DEFAULT NULL,
      `date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
      `date_updated` datetime DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

    Peux tu me dire où j'ai fait une erreur?

  4. #4
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 100
    Points
    19 100
    Billets dans le blog
    17
    Par défaut
    J'ai créé un projet similaire

    vous aviez une erreur sur le save du fichier model

    Code php : 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 save(){
    		if(!$this->isValid()){
    			return false;
    		}
     
    		/*FORMATAGE DES DATES*/
    		$oDate = new plugin_date($this->date_du,'d/m/Y');
    		$this->date_du = $oDate->toString('Y-m-d');
     
    		$oDate = new plugin_datetime($this->date_created,'d/m/Y h:i:s');
    		$this->date_created = $oDate->toString('Y-m-d h:i:s');
     
    		$oDate = new plugin_datetime($this->date_updated,'d/m/Y h:i:s');
    		$this->date_updated = $oDate->toString('Y-m-d h:i:s');
     
    		parent::save();
     
    		return true;
    	}
    Framework php sécurisé et simple à prendre en main avec générateur web http://mkframework.com/ (hebergé sur developpez.com)
    Mes cours/tutoriaux

Discussions similaires

  1. Probleme avec datetime
    Par saladin04 dans le forum MS SQL Server
    Réponses: 2
    Dernier message: 31/08/2010, 10h48
  2. probleme avec le format DateTime
    Par chamamo dans le forum Développement
    Réponses: 1
    Dernier message: 23/04/2008, 20h42
  3. Réponses: 4
    Dernier message: 14/05/2007, 10h45
  4. Probleme avec la fonction replace et convert datetime
    Par gazzall dans le forum MS SQL Server
    Réponses: 1
    Dernier message: 27/04/2007, 09h07
  5. Probleme avec un champ DATETIME Acces
    Par tryonyco dans le forum Access
    Réponses: 2
    Dernier message: 06/09/2006, 04h22

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo