public static function testUtilisateur($request, $context) { $data = array("identifiant" => $request["identifiant"], "pass" => sha1($request["pass"]), "nom" => $request["nom"], "prenom" => $request["prenom"], "statut" => $request["statut"], "avatar" => ""); $u = new utilisateur($data); $u->id = $u->save(); if (is_null($u->id)) { return NULL; } else { return $u; } }
public static function edituser($request, $context) { //print_r($request); if (!empty($request['edituserform'])) { $userInfo['id'] = $context->getSessionAttribute('id'); $userInfo['pass'] = sha1($request['motdepasse']); $userInfo['nom'] = $request['nom']; $userInfo['prenom'] = $request['prenom']; if (isset($request['statut'])) { $userInfo['statut'] = $request['statut']; } if (isset($request['avatar'])) { $userInfo['avatar'] = $request['avatar']; } $user = new utilisateur($userInfo); $id = $user->save(); return context::SUCCESS; } return context::ACCESS; }