$password = fabriquer_mdp($DB_ROW[$prefixe . 'profil_sigle']); DB_STRUCTURE_ADMINISTRATEUR::DB_modifier_user($DB_ROW[$prefixe . 'id'], array(':password' => crypter_mdp($password))); $tab_password[$DB_ROW[$prefixe . 'id']] = $password; } } // //////////////////////////////////////////////////////////////////////////////////////////////////// // Forcer plusieurs mots de passe avec la date de naissance // //////////////////////////////////////////////////////////////////////////////////////////////////// if ($action == 'forcer_mdp_birth') { if ($profil != 'eleves') { exit('Fonctionnalité disponible uniquement pour les élèves !'); } $tab_password = array(); // Récupérer les données des utilisateurs concernés (besoin de le faire maintenant, on a besoin des infos pour générer le mdp) $listing_champs = $profil != 'parents' ? 'user_id,user_sconet_id,user_sconet_elenoet,user_reference,user_profil_sigle,user_nom,user_prenom,user_naissance_date,user_login,user_naissance_date' : 'parent.user_id AS parent_id,parent.user_sconet_id AS parent_sconet_id,parent.user_sconet_elenoet AS parent_sconet_elenoet,parent.user_reference AS parent_reference,parent.user_profil_sigle AS parent_profil_sigle,parent.user_nom AS parent_nom,parent.user_prenom AS parent_prenom,parent.user_login AS parent_login'; $DB_TAB = DB_STRUCTURE_ADMINISTRATEUR::DB_lister_users_cibles(implode(',', $tab_user), $listing_champs, $avec_info); // Mettre à jour les mots de passe des utilisateurs concernés foreach ($DB_TAB as $key => $DB_ROW) { if ($DB_ROW['user_naissance_date']) { $password = str_replace('/', '', convert_date_mysql_to_french($DB_ROW['user_naissance_date'])); DB_STRUCTURE_ADMINISTRATEUR::DB_modifier_user($DB_ROW[$prefixe . 'id'], array(':password' => crypter_mdp($password))); $tab_password[$DB_ROW[$prefixe . 'id']] = $password; } } if (!count($tab_password)) { exit('Les mots de passe de ces élèves ne sont pas dans la base !'); } } // //////////////////////////////////////////////////////////////////////////////////////////////////// // Générer une sortie csv (login ou mdp) (élève ou prof) // ////////////////////////////////////////////////////////////////////////////////////////////////////
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if($action=='reintegrer') { DB_STRUCTURE_ADMINISTRATEUR::DB_modifier_users_statut($tab_user_id,TRUE); exit('ok,'.implode(',',$tab_user_id)); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Supprimer des comptes // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if($action=='supprimer') { // Récupérer le profil des utilisateurs indiqués, vérifier qu'ils sont déjà sortis et qu'on y a pas glissé l'id d'un administrateur $DB_TAB = DB_STRUCTURE_ADMINISTRATEUR::DB_lister_users_cibles( implode(',',$tab_user_id) , 'user_id,user_profil,user_sortie_date' , '' /*avec_info*/ ); $tab_user_id = array(); foreach($DB_TAB as $DB_ROW) { if( ($DB_ROW['user_sortie_date']<=TODAY_MYSQL) && ($DB_ROW['user_profil']!='administrateur') ) { DB_STRUCTURE_ADMINISTRATEUR::DB_supprimer_utilisateur( $DB_ROW['user_id'] , $DB_ROW['user_profil'] ); $tab_user_id[] = $DB_ROW['user_id']; // Log de l'action SACocheLog::ajouter('Suppression d\'un utilisateur ('.$DB_ROW['user_profil'].' '.$DB_ROW['user_id'].').'); } } $retour = (count($tab_user_id)) ? 'ok,'.implode(',',$tab_user_id) : 'Aucun compte indiqué n\'est supprimable !' ; exit($retour); }
DB_STRUCTURE_ADMINISTRATEUR::DB_modifier_users_statut($tab_user_id, FALSE); exit('ok,' . implode(',', $tab_user_id)); } // //////////////////////////////////////////////////////////////////////////////////////////////////// // Réintégrer des comptes // //////////////////////////////////////////////////////////////////////////////////////////////////// if ($action == 'reintegrer') { DB_STRUCTURE_ADMINISTRATEUR::DB_modifier_users_statut($tab_user_id, TRUE); exit('ok,' . implode(',', $tab_user_id)); } // //////////////////////////////////////////////////////////////////////////////////////////////////// // Supprimer des comptes // //////////////////////////////////////////////////////////////////////////////////////////////////// if ($action == 'supprimer') { // Récupérer le profil des utilisateurs indiqués, vérifier qu'ils sont déjà sortis et qu'on y a pas glissé l'id d'un administrateur $DB_TAB = DB_STRUCTURE_ADMINISTRATEUR::DB_lister_users_cibles(implode(',', $tab_user_id), 'user_id,user_nom,user_prenom,user_profil_sigle,user_sortie_date', ''); $tab_user_id = array(); $notification_contenu = ''; $notification_intro = date('d-m-Y H:i:s') . ' ' . $_SESSION['USER_PRENOM'] . ' ' . $_SESSION['USER_NOM']; foreach ($DB_TAB as $DB_ROW) { if ($DB_ROW['user_sortie_date'] <= TODAY_MYSQL && $DB_ROW['user_profil_sigle'] != 'ADM') { DB_STRUCTURE_ADMINISTRATEUR::DB_supprimer_utilisateur($DB_ROW['user_id'], $DB_ROW['user_profil_sigle']); $tab_user_id[] = $DB_ROW['user_id']; // Log de l'action SACocheLog::ajouter('Suppression de l\'utilisateur ' . $DB_ROW['user_nom'] . ' ' . $DB_ROW['user_prenom'] . ' (' . $DB_ROW['user_profil_sigle'] . ' ' . $DB_ROW['user_id'] . ').'); $notification_contenu .= $notification_intro . ' a supprimé l\'utilisateur ' . $DB_ROW['user_nom'] . ' ' . $DB_ROW['user_prenom'] . ' (' . $DB_ROW['user_profil_sigle'] . ' ' . $DB_ROW['user_id'] . ').' . "\r\n"; } } // Notifications (rendues visibles ultérieurement) if ($notification_contenu) { DB_STRUCTURE_NOTIFICATION::enregistrer_action_admin($notification_contenu, $_SESSION['USER_ID']);
$tab_ids = Clean::map_entier($tab_ids); $tab_ids = array_filter($tab_ids, 'positif'); $nb_ids = count($tab_ids); $abonnement_ref = 'message_accueil'; // //////////////////////////////////////////////////////////////////////////////////////////////////// // Afficher une liste d'utilisateurs ou de destinataires // //////////////////////////////////////////////////////////////////////////////////////////////////// $tab_types = array('d' => 'all', 'n' => 'niveau', 'c' => 'classe', 'g' => 'groupe', 'b' => 'besoin'); if ($action == 'afficher_users' && $profil && $groupe_id && isset($tab_types[$groupe_type])) { $champs = $profil != 'parent' ? 'CONCAT(user_nom," ",user_prenom) AS texte , user_id AS valeur' : 'CONCAT(parent.user_nom," ",parent.user_prenom," (",enfant.user_nom," ",enfant.user_prenom,")") AS texte , parent.user_id AS valeur'; $DB_TAB = DB_STRUCTURE_COMMUN::DB_lister_users_regroupement($profil, TRUE, $tab_types[$groupe_type], $groupe_id, 'alpha', $champs); exit(HtmlForm::afficher_select($DB_TAB, 'f_user', FALSE, TRUE, '', TRUE)); } if ($action == 'afficher_destinataires' && $nb_ids) { $champs = $profil != 'parent' ? 'CONCAT(user_nom," ",user_prenom) AS texte , user_id AS valeur' : 'CONCAT(parent.user_nom," ",parent.user_prenom," (",enfant.user_nom," ",enfant.user_prenom,")") AS texte , parent.user_id AS valeur'; $DB_TAB = DB_STRUCTURE_ADMINISTRATEUR::DB_lister_users_cibles(implode(',', $tab_ids), 'user_id AS valeur, CONCAT(user_nom," ",user_prenom) AS texte', ''); exit(HtmlForm::afficher_select($DB_TAB, 'f_destinataires', FALSE, FALSE, '', TRUE)); } // //////////////////////////////////////////////////////////////////////////////////////////////////// // Ajouter un nouveau message // //////////////////////////////////////////////////////////////////////////////////////////////////// if ($action == 'ajouter' && $date_debut_fr && $date_fin_fr && $message_contenu && $nb_destinataires) { $date_debut_mysql = convert_date_french_to_mysql($date_debut_fr); $date_fin_mysql = convert_date_french_to_mysql($date_fin_fr); if ($date_fin_mysql < $date_debut_mysql) { exit('Date de fin antérieure à la date de début !'); } $message_id = DB_STRUCTURE_COMMUN::DB_ajouter_message($_SESSION['USER_ID'], $date_debut_mysql, $date_fin_mysql, $message_contenu, $tab_destinataires); // Notifications (rendues visibles ultérieurement) if (!$mode_discret) { $listing_abonnes = DB_STRUCTURE_NOTIFICATION::DB_lister_destinataires_listing_id($abonnement_ref, implode(',', $tab_destinataires));