get_display_list(); } function update_esuser_from_form() { global $msg,$id; global $esuser_username, $esuser_esgroup; if ($esuser_esgroup) { //Vérifions que le groupe existe if (!es_esgroup::id_exists($esuser_esgroup)) { print $msg['es_user_error_unknowngroup']; $the_user = new es_esuser(); $the_user->set_properties_from_form(); print $the_user->get_form(); return false; } } if (!$id) { //Ajout d'un nouvel utilisateur if (!$esuser_username) { print $msg['es_user_error_emptyfield']; $the_user = new es_esuser(); $the_user->set_properties_from_form(); print $the_user->get_form(); return false; } if (es_esuser::username_exists($esuser_username)) { print $msg['es_user_error_usernamealreadyexists']; $the_user = new es_esuser(); $the_user->set_properties_from_form(); print $the_user->get_form(); return false; } $new_esuser = es_esuser::add_new(); $new_esuser->set_properties_from_form(); $new_esuser->commit_to_db(); } else { $the_user = new es_esuser($id); if ($the_user->error) { return false; } $the_user->set_properties_from_form(); $the_user->commit_to_db(); } return true; } switch ($action) { case "add": $the_user = new es_esuser(); print $the_user->get_form(); break; case "edit": $the_user = new es_esuser($id); print $the_user->get_form(); break; case "update": if (update_esuser_from_form()) list_users(); break; case "del": if ($id) { $the_user = new es_esuser($id); $the_user->delete(); } list_users(); break; default: list_users(); break; } ?>