diff options
Diffstat (limited to 'Core/Functions/func_info.php')
| -rw-r--r-- | Core/Functions/func_info.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Core/Functions/func_info.php b/Core/Functions/func_info.php new file mode 100644 index 0000000..8464fe1 --- /dev/null +++ b/Core/Functions/func_info.php @@ -0,0 +1,41 @@ +<?php + +// ############################################################################ +// # # +// # Description: Fonction de modifications des informations de l'utilisateur # +// # par ID # +// # # +// ############################################################################ + +function info_update_user_infos($userInfos, $userId, $userStatus) { + $dbuser = new DbUser; + $dbsearch = new DbSearch; + + switch ($userStatus) { + case 1: + $isPro = true; + break; + default: + $isPro = false; + break; + } + + if ($isPro) { + $userJobs = $dbsearch->get_pro_job_by_proid($userId); + $userJobsId = []; + for ($i = 0; $i < count($userJobs); $i++) { + array_push($userJobsId, $userJobs[$i]["jobCategoryId"]); + } + $dbuser->update_user_infos($userInfos, $userId, $isPro, $userJobsId); + } else { + $dbuser->update_user_infos($userInfos, $userId, $isPro); + } + + // Redirection vers message avec l'index du message à afficher. + $message = ["infosUpdate", "success"]; + $_SESSION["message"] = $message; + header("Location: /Templates/message.php"); + die(); +} + +?>
\ No newline at end of file |
