public function validationForm($table, $value) { $message = ""; switch ($table) { case 'poste': # code... $message = PostForm::validation($value); break; case 'guard': # code... $message = GuardForm::validation($value); break; case 'guardtours': # code... $message = GuardToursForm::validation($value); break; case 'admin': # code... $message = UserForm::validation($value); break; case 'tours': # code... $message = array('error' => 0); break; default: # code... break; } return $message; }
$uid = explode("|", $_POST['guard_id']); $adress = explode("|", $_POST['poste_id']); $_POST['intervale_limit'] = $limit; $_POST['guard_id'] = $model->getBy('guard', 'id', 'uid', $uid[0]); $_POST['poste_id'] = $model->getBy('poste', 'id', 'adress', $adress[0]); if ($update && $data['page'] == 'Guard tours') { $message = $form->update("guardtours", $_POST, $dataUpdate['id']); if ($message === 1) { header("Location: post.php?page=guardTours"); } } else { $message = $form->register("guardtours", $_POST); } } $guardId = GuardToursForm::listDataFK()['guard_id']; $postId = GuardToursForm::listDataFK()['poste_id']; include "../vue/register_guardTours.php"; break; // case 'Tours': // # code... // if(isset($_POST['register'])){ // $heure = $_POST['heure']; // $guard_tours_id = $_POST['guardtours_id']; // $mention = $tours->getMention($heure, $guard_tours_id); // $_POST['mention'] = $mention; // if($update){ // // $message = $form->update("tours", $_POST, $dataUpdate['id']); // // if($message === 1){ // // if(isset($_SESSION['data'])) unset($_SESSION['data']); // // header("Location: post.php?page=users"); // // }