blob: ca97bc0efee56d15a3668900fb412197217710f1 (
plain)
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
|
<?php
// ****************************************************************************
// Description: Fonction de modifications des informations de l'utilisateur par ID
// ****************************************************************************
function modify_user_info($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_category($userId);
$userJobsId = [];
for ($i = 0; $i < count($userJobs); $i++) {
array_push($userJobsId, $userJobs[$i]["jobCategoryId"]);
}
$dbuser->user_infos_update($userInfos, $userId, $isPro, $userJobsId);
} else {
$dbuser->user_infos_update($userInfos, $userId, $isPro);
}
// Redirection vers message avec l'index du message à afficher.
$message = ["infosUpdate", "success"];
$_SESSION["message"] = $message;
header("Location: /Views/message.php");
die();
}
?>
|