diff options
Diffstat (limited to 'Templates/Includes/incl_form_userInfo.php')
| -rw-r--r-- | Templates/Includes/incl_form_userInfo.php | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/Templates/Includes/incl_form_userInfo.php b/Templates/Includes/incl_form_userInfo.php new file mode 100644 index 0000000..5873a5a --- /dev/null +++ b/Templates/Includes/incl_form_userInfo.php @@ -0,0 +1,137 @@ +<?php + +// ############################################################################ +// # # +// # Description: Formulaire pour modifier les informations de l'utilisateur # +// # # +// ############################################################################ + +// Import des textes en fonction de la langue définie dans la variable "lang" de la session. +require_once(dirname( __FILE__ )."./".$_SESSION["lang"]."/text.php"); +// Import des méthodes de la base de donnée pour les recherches. +require_once(dirname( __FILE__ )."./../../Database/meth_dbsearch.php"); + +// Instanciation de la bdd avec les méthodes de recherche. +$dbsearch = new DbSearch; +// Recherches des informations avec l'id de l'utilisateur actuellement connecté. +$info = $dbsearch->get_user_info_by_userid($_SESSION["userId"]); + +// Si pas encore d'infos pour cette utilisateur on initialise avec des champs vide +if (!$info) { + $info = [ + ["lastname" => "", + "firstname" => "", + "phoneNumber" => "", + "adress" => "", + "zipCode" => "", + "city" => "", + "degree" => "", + "capability" => "", + "description" => ""] + ]; +} + +// **************************************************************************** +// SEPARATEUR +// **************************************************************************** +echo('<!-- Separateur --> +<div class="separator"></div>'); + +// **************************************************************************** +// DIV PRINCIPALE AVEC TITRE ET FORMULAIRE COMMUN AUX PROS ET CLIENTS +// **************************************************************************** +echo('<!-- Division principale --> +<main id="mainUserInfo"> +<!-- Modification des infos de l\'utilisateur --> +<h2>'.$text[basename(__FILE__, ".php")]["h2"].'</h2> +<form action="/../Core/wrapper.php" method="post"> + <label> + <i class="fas fa-users"></i> + <input type="text" name="lastname" id="lastname" maxlength="128" placeholder="'.$text[basename(__FILE__, ".php")]["lastname"].'" value="'.$info[0]["lastname"].'" required> + </label> + <label> + <i class="fas fa-user"></i> + <input type="text" name="firstname" id="firstname" maxlength="128" placeholder="'.$text[basename(__FILE__, ".php")]["firstname"].'" value="'.$info[0]["firstname"].'" required> + </label> + <label> + <i class="fas fa-mobile-alt"></i> + <input type="text" name="phoneNumber" id="phoneNumber" maxlength="10" placeholder="'.$text[basename(__FILE__, ".php")]["phoneNumber"].'" value="'.$info[0]["phoneNumber"].'" required> + </label> + <label> + <i class="fas fa-home"></i> + <input type="text" name="adress" id="adress" maxlength="128" placeholder="'.$text[basename(__FILE__, ".php")]["adress"].'" value="'.$info[0]["adress"].'" required> + </label> + <label> + <i class="fas fa-map-marker-alt"></i> + <input type="text" name="zipCode" id="zipCode" maxlength="6" placeholder="'.$text[basename(__FILE__, ".php")]["zipCode"].'" value="'.$info[0]["zipCode"].'" required> + </label> + <label> + <i class="fas fa-city"></i> + <input type="text" name="city" id="city" maxlength="128" placeholder="'.$text[basename(__FILE__, ".php")]["city"].'" value="'.$info[0]["city"].'" required> + </label>'.PHP_EOL); + +// **************************************************************************** +// EXTENSION DU FORMULAIRE AVEC LA PARTIE UNIQUEMENT RESERVEE AUX PROS +// **************************************************************************** +if ($_SESSION["userStatus"] == 1) { + // Récupération de tous les emplois ainsi que ceux deja sélectionnés par le pro + $allJobs = $dbsearch->get_job_all(); + $proJobs = $dbsearch->get_pro_job_by_proid($_SESSION["userId"]); + + // **************************************************************************** + // PARTIE SELECTION D'UN EMPLOI + // **************************************************************************** + echo(' <label id="userJob"> + <i class="fas fa-wrench"></i> + <p>Selectionner mes jobs:</p>'.PHP_EOL); + echo(' <select id="jobsSel"> + <option value="" selected>'.$text[basename(__FILE__, ".php")]["jobsSel"].'</option>'.PHP_EOL); + //Peuplement du select qui comprend tous les emplois + for ($i = 0; $i < count($allJobs); $i++) { + echo(' <option value="'.$allJobs[$i]["jobCategoryId"].'">'.$allJobs[$i]["jobCategoryName".ucwords($_SESSION["lang"])].'</option>'.PHP_EOL); + } + echo(' </select> + <button type="button" onclick="add()">'.$text[basename(__FILE__, ".php")]["jobsAdd"].'</button> + </label>'.PHP_EOL); + + // **************************************************************************** + // PARTIE EMPLOI DEJA SELECTIONNE + // **************************************************************************** + echo(' <ul id="jobsList">'.PHP_EOL); + for ($i = 0; $i < count($proJobs); $i++) { + echo(' <li>'.$proJobs[$i]["jobCategoryName".ucwords($_SESSION["lang"])].'</li>'.PHP_EOL); + } + echo(' </ul> + <input type="hidden" name="jobs" id="jobs" value="">'.PHP_EOL); + + // **************************************************************************** + // PARTIE DIPLOME, CAPACITES & DESCRIPTION + // **************************************************************************** + echo(' <label> + <i class="fas fa-user-graduate"></i> + <input type="text" name="degree" id="degree" maxlength="128" placeholder="'.$text[basename(__FILE__, ".php")]["degree"].'"value="'.$info[0]["degree"].'" required> + </label> + <label> + <i class="fas fa-cogs"></i> + <textarea name="capability" id="capability" placeholder="'.$text[basename(__FILE__, ".php")]["capability"].'" cols="30" rows="2" required>'.$info[0]["capability"].'</textarea> + </label> + <label> + <i class="fas fa-file-signature"></i> + <textarea name="description" id="description" placeholder="'.$text[basename(__FILE__, ".php")]["description"].'" cols="30" rows="2" required>'.$info[0]["description"].'</textarea> + </label>'.PHP_EOL); + + // **************************************************************************** + // CHARGEMENT ET DECLENCHEMENT DU JAVASCRIPT DEDIE A CETTE PAGE + // **************************************************************************** + echo(' <script src="/Statics/Js/userinfo.js"></script> + <script>init()</script>'); +} + +// **************************************************************************** +// FIN DU FORM ET DE LA DIV PRINCIPALE +// **************************************************************************** +echo(' <input type="submit" value="'.$text[basename(__FILE__, ".php")]["submit"].'"> +</form> +</main>'); + +?>
\ No newline at end of file |
