function session_rapide() { global $page; global $session; global $url; global $message; $page['gabarit'] = "administration"; if (isset($_SESSION['role_user']) && droit_acces($session['creer_session'], $_SESSION['role_user'])) { $page['vue'] = "sessions/session_rapide.vue.php"; $page['colonne'] = "sessions/sidebar_session.vue.php"; $page['sessions'] = liste_session(); $page['genre'] = liste_genre(); $page['diplome'] = liste_diplome(); $page['lieux'] = liste_lieux(); $page['cirfa'] = liste_cirfa(); $motif_json = liste_motif_json(0); $page['motif_json'] = json_encode($motif_json); if (isset($_POST['cre_session'])) { if (!isset($_POST['motif']) || $_POST['date_session'] == '' || $_POST['duree_session'] == "" | !is_numeric($_POST['duree_session']) || !is_numeric($_POST['nb_candidats_max']) || $_POST['nid_candidat'] == '' && $_POST['nid_temp_candidat'] == '' || $_POST['date_naissance_candidat'] == "" || $_POST['nom_candidat'] == "" || $_POST['prenom_candidat'] == "") { $page['message'] = $message['champs_obligatoire']; } elseif ($_POST['nid_candidat'] != '' && strlen($_POST['nid_candidat']) != 10) { $page['message'] = $message['NID_incorrect']; } elseif (!valide_date($_POST['date_session']) || !valide_date($_POST['date_naissance_candidat'])) { $page['message'] = $message['date_incorrect']; } else { if (isset($_POST['fictif_candidat'])) { $fictif = "on"; } else { $fictif = "off"; } $destination = ''; if ($_POST['nid_candidat'] == '') { $nid_temp = get_nid_temp($_POST['nid_temp_candidat']); $valeur = $nid_temp[0]['valeur']; $num = (int) $valeur; $taille = strlen($num); $concat = ""; for ($taille; $taille < 7; $taille++) { $concat = $concat . "0"; } $nid_tempo = $nid_temp[0]['code_organisme'] . $concat . ($num + 1); $destination = "./photo_candidat/" . $nid_tempo; } else { $nid_tempo = ''; $destination = "./photo_candidat/" . $_POST['nid_candidat']; } if (isset($_FILES['photo_candidat']['name']) && ($_FILES['photo_candidat']['name'] != null || $_FILES['photo_candidat']['name'] != "")) { $ext = pathinfo($_FILES['photo_candidat']['name']); $ext = "." . $ext['extension']; /*upload de l'image*/ move_uploaded_file($_FILES['photo_candidat']['tmp_name'], $destination . $ext); } else { $destination = ""; $ext = ""; } $id_candidat = creation_candidat2($_POST['nid_candidat'], $nid_tempo, date_fr_to_en($_POST['date_naissance_candidat']), $_POST['nom_candidat'], $_POST['nom_2_candidat'], $_POST['prenom_candidat'], $_POST['prenom_2_candidat'], $_POST['lieu_naissance_candidat'], $_POST['secu_candidat'], $_POST['genre_candidat'], $_POST['dernier_diplome_candidat'], $fictif, $destination . $ext, $_POST['cp_lieu_naissance_candidat'], $_POST['adresse_candidat'], $_POST['complement_adresse_candidat'], $_POST['ville_candidat'], $_POST['cp_candidat'], $_POST['mail_candidat'], $_POST['cirfa'], $_POST['francophone']); $id_session = creation_session(date_fr_to_en($_POST['date_session']), $_POST['id_lieu'], $_POST['duree_session'], $_POST['nb_candidats_max']); /****/ if ($id_candidat == 'a') { $page['message'] = $message['candidat_existe2']; } elseif ($id_candidat == 'b') { $page['message'] = $message['candidat_existe']; } else { $candidature = creation_candidature($id_candidat, 0); foreach ($_POST['motif'] as $m) { creation_motif_candidature($candidature, $m); } creation_inscription($candidature, $id_session); header("Location: index.php?controleur=session&tache=visualiser_session&id=" . $id_session); } } } } else { $page['vue'] = "erreur_droit.vue.php"; } }
function creer_candidat() { global $page; global $administration; global $url; global $message; $page['gabarit'] = "administration"; if (isset($_SESSION['role_user']) && droit_acces($administration['creer_candidat'], $_SESSION['role_user'])) { //chargement des vues $page['vue'] = "participants/candidat.vue.php"; $page['colonne'] = "participants/sidebar_candidat.vue.php"; //chargement des listes $page['candidats'] = liste_candidat(); $page['genre'] = liste_genre(); $page['diplome'] = liste_diplome(); $page['lieux'] = liste_lieux(); $page['cirfa'] = liste_cirfa(); if (isset($_POST['cre_candidat'])) { /*test sur champs obligatoire*/ if ($_POST['nid_candidat'] == '' && $_POST['nid_temp_candidat'] == '' || $_POST['date_naissance_candidat'] == "" || $_POST['nom_candidat'] == "" || $_POST['prenom_candidat'] == "") { $page['message'] = $message['champs_obligatoire']; } elseif ($_POST['nid_candidat'] != '' && strlen($_POST['nid_candidat']) != 10) { $page['message'] = $message['NID_incorrect']; } elseif (!valide_date($_POST['date_naissance_candidat'])) { $page['message'] = $message['date_incorrect']; } else { if (isset($_POST['fictif_candidat'])) { $fictif = "on"; } else { $fictif = "off"; } $destination = ''; if ($_POST['nid_candidat'] == '') { $nid_temp = get_nid_temp($_POST['nid_temp_candidat']); $valeur = $nid_temp[0]['valeur']; $num = (int) $valeur; $taille = strlen($num); $concat = ""; for ($taille; $taille < 7; $taille++) { $concat = $concat . "0"; } $nid_tempo = $nid_temp[0]['code_organisme'] . $concat . ($num + 1); $destination = "./photo_candidat/" . $nid_tempo; } else { $nid_tempo = ''; $destination = "./photo_candidat/" . $_POST['nid_candidat']; } if (isset($_FILES['photo_candidat']['name']) && ($_FILES['photo_candidat']['name'] != null || $_FILES['photo_candidat']['name'] != "")) { $ext = pathinfo($_FILES['photo_candidat']['name']); $ext = "." . $ext['extension']; /*upload de l'image*/ move_uploaded_file($_FILES['photo_candidat']['tmp_name'], $destination . $ext); } else { $destination = ""; $ext = ""; } /*creation du candidat en base*/ $res = creation_candidat2($_POST['nid_candidat'], $nid_tempo, date_fr_to_en($_POST['date_naissance_candidat']), $_POST['nom_candidat'], $_POST['nom_2_candidat'], $_POST['prenom_candidat'], $_POST['prenom_2_candidat'], $_POST['lieu_naissance_candidat'], $_POST['secu_candidat'], $_POST['genre_candidat'], $_POST['dernier_diplome_candidat'], $fictif, $destination . $ext, $_POST['cp_lieu_naissance_candidat'], $_POST['adresse_candidat'], $_POST['complement_adresse_candidat'], $_POST['ville_candidat'], $_POST['cp_candidat'], $_POST['mail_candidat'], $_POST['cirfa'], $_POST['francophone']); if ($res == 'a') { $page['message'] = $message['candidat_existe2']; } elseif ($res == 'b') { $page['message'] = $message['candidat_existe']; } else { home_candidat(); } } } } else { $page['vue'] = "erreur_droit.vue.php"; } }