"; // // var_dump($qry); // exit; $tabInvitations = $objDatabase->fxGetResults($qry); return $tabInvitations; } // fonction pour modifier les invitations envoy�es pour une equipe // param : action, donn�es post, langue d'affichage function fxSetInvitation($str_action, $tabData, $str_lang) { // var_dump($str_action); // exit; if (isset($_POST['pec_id'])) { // echo "post set"; // var_dump($tabData); $intPec_id = $_POST['pec_id']; } else { // echo "get"; $intPec_id = $_GET['pec_id']; } // get info capitaine/owner $sqlCaptain = "SELECT p.*, e.pec_nom_equipe FROM resultats_participants p, resultats_epreuves_commandees e WHERE p.pec_id = " . intval($tabData['pec_id']) . " AND p.rol_id = 1 AND p.pec_id = e.pec_id_original"; $tabCaptain = $objDatabase->fxGetRow($sqlCaptain); // var_dump($tabCaptain); $sqlEpreuve = "SELECT * FROM resultats_epreuves_commandees WHERE pec_id_original = " . intval($intPec_id); $qryEpreuve = $objDatabase->fxGetRow($sqlEpreuve); $strNomEquipe = $qryEpreuve['pec_nom_equipe']; $tabEpreuve = fxGetEpreuve($qryEpreuve['epr_id']); switch ($str_action) { case 'invite': case 'inviter': // var_dump($tabData); $sqlParticipants = "SELECT * FROM resultats_participants where pec_id = " . intval($intPec_id) . " AND par_courriel = '" . fxUnescape($tabData['inv_courriel']) . "'"; $qryParticipants = $objDatabase->fxGetResults($sqlParticipants); // var_dump($qryParticipants); // exit; if ($qryParticipants != null) { if ($str_lang == 'fr') $_SESSION['msg'] = 'e139'; else $_SESSION['msg'] = 'e139'; break; } else { $tabCourriel = array(); $intNbCourrielsE = $intNbCourrielsNE = 0; $sqlFrom = "SELECT * from resultats_epreuves_commandees where pec_id_original = " . intval($intPec_id); $tabFrom = $objDatabase->fxGetRow($sqlFrom); if (trim($tabData['inv_nom']) != '' && trim($tabData['inv_prenom']) != '' && trim($tabData['inv_courriel']) != '') $tabCourriel[] = array("nom" => fxUnescape($tabData['inv_nom']), "prenom" => fxUnescape($tabData['inv_prenom']), "courriel" => fxUnescape($tabData['inv_courriel'])); if (count($tabCourriel) > 0) { foreach ($tabCourriel as $intIndex => $tabInfos) { // variables communes pour le courriel $tabMail['to_name'] = fxUnescape($tabInfos['prenom']) . ' ' . fxUnescape($tabInfos['nom']); $tabMail['to_mail'] = fxUnescape($tabInfos['courriel']); $tabMail['from_name'] = fxUnescape($_SESSION['com_info']['com_prenom']) . ' ' . fxUnescape($_SESSION['com_info']['com_nom']); $tabMail['from_mail'] = fxUnescape($_SESSION['com_info']['com_courriel']); $tabMail['pec_id'] = $tabFrom['pec_id_original']; $tabMail['sel_invitee_role'] = $tabData['sel_invitee_role']; $sqlInvitees = "select * from inscriptions_invitations WHERE pec_id = " . intval($intPec_id) . " AND inv_courriel = '" . $objDatabase->fxEscape($tabInfos['courriel']) . "'"; $tabInvitees = $objDatabase->fxGetResults($sqlInvitees); if (isset($tabInvitees)) { $_SESSION['msg'] = 'e536'; } else { fxSendInvitation($tabFrom, $tabMail, $tabInfos, '', 'en'); $_SESSION['msg'] = 'p532'; } } } } break; case 'cancel': $sqlUpdate = "UPDATE inscriptions_invitations SET is_id = 4, inv_envoi = '" . fxGetDateTime() . "' WHERE no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) . "'"; $qryUpdate = $objDatabase->fxQuery($sqlUpdate); if ($str_lang == 'fr') $_SESSION['msg'] = 'p152'; else $_SESSION['msg'] = 'p552'; break; case 'delete': // ANNULER // case 'cancel': // ANNULER $sqlUpdate = "UPDATE inscriptions_invitations SET is_id = 4, inv_envoi = '" . fxGetDateTime() . "' WHERE no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) . "'"; $qryUpdate = $objDatabase->fxQuery($sqlUpdate); // delete participant s'il y a lieu... $sqlParticipant = "SELECT * FROM resultats_participants WHERE pec_id = " . intval($tabData['pec_id']) . " AND no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) . "'"; $tabParticipant = $objDatabase->fxGetRow($sqlParticipant); if ($tabParticipant != null) { // delete // reset nom equipe si epr solo if($tabEpreuve['epr_equipe'] == 0 && $tabParticipant['rol_id'] != 3 && $tabParticipant['rol_id'] != 4){ $sqlReset = "UPDATE resultats_epreuves_commandees SET pec_nom_equipe = '' WHERE pec_id_original = " . intval($tabData['pec_id']); $qryReset = $objDatabase->fxQuery($sqlReset); if(!$qryReset) fxcreer_log('Erreur dans mise-�-jour du nom de l\'�quipe (�preuve solo).'); } $sqlDelete = "DELETE FROM resultats_participants WHERE pec_id = " . intval($tabData['pec_id']) . " AND no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) . "'"; $qryDelete = $objDatabase->fxQuery($sqlDelete); if($tabParticipant['rol_id'] == 3){ $sqlUpdate = "UPDATE resultats_benevoles_positions_shifts SET par_id = 0 WHERE pec_id = " . intval($tabData['pec_id']); $qryUpdate = $objDatabase->fxQuery($sqlUpdate); if(!$qryUpdate) fxcreer_log('Erreur dans mise-�-jour du id du volunteer (table resultats_benevoles_positions_shifts.'); } // set email $strToName = fxUnescape($tabParticipant['par_prenom']) . " " . fxUnescape($tabParticipant['par_nom']); $strToMail = fxUnescape($tabParticipant['par_courriel']); $strFromName = fxUnescape($_SESSION['com_info']['com_prenom']) . " " . fxUnescape($_SESSION['com_info']['com_nom']); $strFromMail = fxUnescape($_SESSION['com_info']['com_courriel']); $sqlTabTeam = "SELECT * FROM resultats_epreuves_commandees WHERE pec_id_original = " . intval($tabData['pec_id']); $tabTeam = $objDatabase->fxGetRow($sqlTabTeam); if ($str_lang == 'fr') { $strSujet = "Retrait de l'�quipe " . fxUnescape($strNomEquipe); // $strSujet = "Retrait de l'�quipe " . fxUnescape($tabCaptain['pec_nom_equipe']); $strMessage = "Bonjour " . $strToName . ",

Ce courriel est pour vous informer que " . $strFromName . " vous a retir�(e) de l'�quipe " . fxUnescape($strNomEquipe) . "

Ce message a �t� envoy� automatiquement par MS1Inscription."; // $strMessage = "Bonjour " . $strToName . ",

Ce courriel est pour vous informer que " . $strFromName . " vous a retir�(e) de l'�quipe " . fxUnescape($tabCaptain['pec_nom_equipe']) . "

Ce message a �t� envoy� automatiquement par MS1Inscription."; } else { $strSujet = "Withdrawn from team " . fxUnescape($strNomEquipe); // $strSujet = "Withdrawn from team " . fxUnescape($tabCaptain['pec_nom_equipe']); $strMessage = "Hello " . $strToName . ",

This email is to notify you that you have been withdrawn from the team " . fxUnescape($strNomEquipe) . " by " . fxUnescape($strFromName) . ".

This auto-message was sent by MS1Inscription."; // $strMessage = "Hello " . $strToName . ",

This email is to notify you that you have been withdrawn from the team " . fxUnescape($tabTeam['pec_nom_equipe']) . " by " . fxUnescape($strFromName) . ".

This auto-message was sent by MS1Inscription."; } fxSendMail($strSujet, $strMessage, $strToMail, $strToName, $strFromMail, $strFromName, 0, 1, $str_lang); } if ($str_lang == 'fr') $_SESSION['msg'] = 'p140'; else $_SESSION['msg'] = 'p540'; break; case 'accept': //get eve_nb_max $sqlEveNbMax = "SELECT eve_nb_max FROM inscriptions_evenements WHERE eve_id = " . intval($tabEpreuve['eve_id']); $intEveNbMax = $objDatabase->fxGetVar($sqlEveNbMax); // MSIN-1055 // Check if current user has role in current event (as of jan. 2015, hardcoded for canmore only if($intEveNbMax > 0){ // if($tabEpreuve['eve_id'] == '175'){ $sqlCurrentUser = "SELECT * FROM resultats_participants WHERE eve_id = " . intval($tabEpreuve['eve_id']) . " AND com_id = " . intval($_SESSION['com_info']['com_id']); $tabCurrentUser = $objDatabase->fxGetResults($sqlCurrentUser); if(isset($tabCurrentUser)) { if ($str_lang == 'fr') $_SESSION['msg'] = 'e151'; else $_SESSION['msg'] = 'e551'; $sqlUpdate = "UPDATE inscriptions_invitations SET is_id = 6, inv_envoi = '" . fxGetDateTime() . "' WHERE no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) . "'"; $qryUpdate = $objDatabase->fxQuery($sqlUpdate); break; } } // fin MSIN-1055 // verifier si l'equipe est complete $sqlNbParticipants = "SELECT COUNT(*) FROM resultats_participants WHERE pec_id = " . intval($tabData['pec_id']) . " AND (rol_id = 1 OR rol_id = 2)"; $intNbParticipants = $objDatabase->fxGetVar($sqlNbParticipants); $sqlInvitation = "SELECT * FROM inscriptions_invitations WHERE no_invitation = '" . $tabData['no_invitation'] . "'"; $tabInvitation = $objDatabase->fxGetRow($sqlInvitation); // var_dump($tabInvitation); if($tabInvitation['rol_id'] == 2){ if ($tabEpreuve['epr_nb_participants'] == $intNbParticipants) { if ($str_lang == 'fr') $_SESSION['msg'] = 'e147'; else $_SESSION['msg'] = 'e547'; // mettre statut invitation a 7 (= 'Automatically cancelled: full team') $sqlUpdate = "UPDATE inscriptions_invitations SET is_id = 7, inv_envoi = '" . fxGetDateTime() . "' WHERE no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) . "'"; $qryUpdate = $objDatabase->fxQuery($sqlUpdate); break; } } // Ajouter nouveau coequipier a table resultats_particiants $sqlParticipant = "SELECT * FROM inscriptions_comptes WHERE com_id = " . intval($_SESSION['com_info']['com_id']); $tabParticipant = $objDatabase->fxGetRow($sqlParticipant); // gender validation (et proceder l'invitation pour les roles "non-participants" (ie volunteer et pit manager) // if($tabParticipant['com_sexe'] == $tabEpreuve['epr_sexe'] || $tabEpreuve['epr_sexe'] == 'm'){ if($tabParticipant['com_sexe'] == $tabEpreuve['epr_sexe'] || $tabEpreuve['epr_sexe'] == 'm' || ($tabInvitation['rol_id'] == 3 || $tabInvitation['rol_id'] == 4)){ $sqlUpdate = "UPDATE inscriptions_invitations SET is_id = 2, inv_nom = '" . $objDatabase->fxEscape($tabParticipant['com_nom']) . "', inv_prenom = '" . $objDatabase->fxEscape($tabParticipant['com_prenom']) . "', inv_envoi = '" . fxGetDateTime() . "' WHERE no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) . "'"; // $sqlUpdate = "UPDATE inscriptions_invitations SET is_id = 2, inv_envoi = '" . fxGetDateTime() . "' WHERE no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) . "'"; $qryUpdate = $objDatabase->fxQuery($sqlUpdate); if($tabParticipant != null) { // verifier si invit� fait deja partie de l'equipe $sqlInvite = "SELECT * FROM resultats_participants WHERE pec_id = " . intval($tabData['pec_id']) . " AND par_courriel = '" . $objDatabase->fxEscape($tabParticipant['com_courriel']) . "'"; $qryInvite = $objDatabase->fxGetRow($sqlInvite); if ($qryInvite != null) { if ($str_lang == 'fr') $_SESSION['msg'] = 'e139'; else $_SESSION['msg'] = 'e539'; break; } else{ // get role invited for $qryRole = "SELECT rol_id FROM inscriptions_invitations WHERE no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) . "'"; $strRoleId = $objDatabase->fxGetVar($qryRole); } // if($strRoleId == '1') { $intPartAge = fxGetAge($tabParticipant['com_naissance'], fxGetDate()); if($intPartAge < 18) $strWaiverCleared = 0; else $strWaiverCleared = 1; $sqlInsertPart = "INSERT into resultats_participants SET no_panier = '" . $objDatabase->fxEscape($tabCaptain['no_panier']) . "', par_nom = '" . $objDatabase->fxEscape($tabParticipant['com_nom']) . "', par_prenom = '" . $objDatabase->fxEscape($tabParticipant['com_prenom']) . "', par_naissance = '" . $objDatabase->fxEscape($tabParticipant['com_naissance']) . "', par_sexe = '" . $objDatabase->fxEscape($tabParticipant['com_sexe']) . "', par_adresse = '" . $objDatabase->fxEscape($tabParticipant['com_adresse']) . "', par_ville = '" . $objDatabase->fxEscape($tabParticipant['com_ville']) . "', pro_id = " . intval($tabParticipant['pro_id']) . ", par_codepostal = '" . $objDatabase->fxEscape($tabParticipant['com_codepostal']) . "', pay_id = " . intval($tabParticipant['pay_id']) . ", par_telephone1 = '" . $objDatabase->fxEscape($tabParticipant['com_telephone1']) . "', par_telephone2 = '" . $objDatabase->fxEscape($tabParticipant['com_telephone2']) . "', par_courriel = '" . $objDatabase->fxEscape($tabParticipant['com_courriel']) . "', com_id = " . intval($tabParticipant['com_id']) . ", par_maj = '" . fxGetDateTime() . "', par_equipe = 1, pec_id = " . intval($tabData['pec_id']) . ", no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) . "', par_age = '" . fxGetAge($tabParticipant['com_naissance'], $tabEpreuve['epr_date_age']) . "', eve_id = " . intval($tabEpreuve['eve_id']) . ", epr_id = " . intval($tabEpreuve['epr_id']) . ", par_nom_equipe = '" . $objDatabase->fxEscape($strNomEquipe) . "', waiver_cleared = " . $strWaiverCleared . ", waiver_cleared_maj = '" . fxGetDateTime() . "'";//, rol_id = '" . $objDatabase->fxEscape($strRoleId) . "'"; $qryInsertPart = $objDatabase->fxQuery($sqlInsertPart); // set participant's role $int_par_id = $objDatabase->fxGetLastId(); // echo "lasst id = " . $int_par_id; if($strRoleId == '1') { // echo 'in if';fxSetCaptain2($int_promotee_id, $int_pec_id, $int_epr_id) fxSetCaptain($tabParticipant['com_id'], $intPec_id, $tabEpreuve['epr_id']); // fxSetCaptain($intPec_id, $tabEpreuve['epr_id'], $int_par_id, $str_lang); } else{ $sqlUpdateRole = "UPDATE resultats_participants set rol_id = '" . $objDatabase->fxEscape($strRoleId) . "' WHERE par_id = " . intval($int_par_id); $qryUpdateRole = $objDatabase->fxQuery($sqlUpdateRole); // set par_id in resultats_benevoles_positions_shifts si rol_id = volunteer if($strRoleId == '3'){ $sqlUpdateVolunteerTable = "UPDATE resultats_benevoles_positions_shifts SET par_id = " . intval($int_par_id) . " WHERE pec_id = " . intval($intPec_id); $qryUpdateVolunteerTable = $objDatabase->fxQuery($sqlUpdateVolunteerTable); if(!$qryUpdateVolunteerTable) fxcreer_log('Erreur avec mise-a-jour du id du benevole.'); } } // nom du participant comme pec_nom_equipe pour epreuves solo (MSIN-1271 if($tabEpreuve['epr_equipe'] == 0 && $tabEpreuve['epr_invitation'] == 1 && $strRoleId != '4'){ $sql = "UPDATE resultats_epreuves_commandees SET pec_nom_equipe = '" . $tabParticipant['com_prenom'] . " " . $tabParticipant['com_nom'] . "' WHERE pec_id_original = " . intval($tabData['pec_id']); $qry = $objDatabase->fxQuery($sql); } } // Mettre a jour infos du participants dans table invitations ?????? // Envoyer courriel au capitaine si tout est ok if($tabCaptain != null){ $strToName = fxUnescape($tabCaptain['par_prenom']) . " " . fxUnescape($tabCaptain['par_nom']); $strToMail = fxUnescape($tabCaptain['par_courriel']); } else{ //get owner to send email notif $tabOwner = fxGetOwner($tabEpreuve['epr_id'], $intPec_id); $strToName = fxUnescape($tabOwner['com_prenom']) . " " . fxUnescape($tabOwner['com_nom']); $strToMail = fxUnescape($tabOwner['com_courriel']); } $strFromName = fxUnescape($tabParticipant['com_prenom']) . " " . fxUnescape($tabParticipant['com_nom']); $strFromMail = fxUnescape($tabParticipant['com_courriel']); // $strSujet = afficheTexte("txt_email_invite_accept", 0) . fxUnescape($tabCaptain['pec_nom_equipe']); if($str_lang == 'fr') { if($tabEpreuve['epr_equipe'] == 1) { $strSujet = "Nouveau membre ajout/ à l'équipe " . fxUnescape($strNomEquipe); // $strSujet = "Nouveau membre ajout� � l'�quipe " . fxUnescape($tabCaptain['pec_nom_equipe']); $strMessage = "Bonjour " . $strToName . ",

Ce courriel est pour vous informer que " . $strFromName . " s'est joint � l'�quipe " . fxUnescape($strNomEquipe) . "

Ce message a �t� envoy� automatiquement par MS1Inscription."; // $strMessage = "Bonjour " . $strToName . ",

Ce courriel est pour vous informer que " . $strFromName . " s'est joint � l'�quipe " . fxUnescape($tabCaptain['pec_nom_equipe']) . "

Ce message a �t� envoy� automatiquement par MS1Inscription."; } else{ $strSujet = "Nouveau participant ajouté"; $strMessage = "Bonjour " . $strToName . ",

Ce courriel est pour vous informer que " . $strFromName . " a accept� votre invitation.

Ce message a �t� envoy� automatiquement par MS1Inscription."; } // $_SESSION['msg'] = 'p140'; } else { if($tabEpreuve['epr_equipe'] == 1) { $strSujet = "New teammate added to team " . fxUnescape($strNomEquipe); // $strSujet = "New teammate added to team " . fxUnescape($tabCaptain['pec_nom_equipe']); $strMessage = "Hello " . $strToName . ",

This email is to notify you that " . $strFromName . " has joined the team " . fxUnescape($strNomEquipe) . ".

This auto-message was sent by MS1Inscription."; // $strMessage = "Hello " . $strToName . ",

This email is to notify you that " . $strFromName . " has joined the team " . fxUnescape($tabCaptain['pec_nom_equipe']) . ".

This auto-message was sent by MS1Inscription."; } else{ $strSujet = "New teammate added"; $strMessage = "Hello " . $strToName . ",

This email is to notify you that " . $strFromName . " has accepted your invitation.

This auto-message was sent by MS1Inscription."; } // $_SESSION['msg'] = 'p540'; } fxSendMail($strSujet, $strMessage, $strToMail, $strToName, $strFromMail, $strFromName, 0, 1, $str_lang); if ($str_lang == 'fr') $_SESSION['msg'] = 'p137'; else $_SESSION['msg'] = 'p537'; } else{ // Cancel invite $sqlUpdate = "UPDATE inscriptions_invitations SET is_id = 4, inv_envoi = '" . fxGetDateTime() . "' WHERE no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) . "'"; $qryUpdate = $objDatabase->fxQuery($sqlUpdate); if ($str_lang == 'fr') $_SESSION['msg'] = 'e145'; else $_SESSION['msg'] = 'e545'; } break; case 'refuse': $sqlUpdate = "UPDATE inscriptions_invitations SET is_id = 3, inv_envoi = '" . fxGetDateTime() . "' WHERE no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) . "'"; $qryUpdate = $objDatabase->fxQuery($sqlUpdate); $qryParticipant = "SELECT * FROM inscriptions_invitations WHERE no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) ."'"; $tabParticipant = $objDatabase->fxGetRow($qryParticipant); // Notify captain/owner of refusal // Envoyer courriel au capitaine si tout est ok if($tabCaptain != null){ $strToName = fxUnescape($tabCaptain['par_prenom']) . " " . fxUnescape($tabCaptain['par_nom']); $strToMail = fxUnescape($tabCaptain['par_courriel']); $strFromName = fxUnescape($tabParticipant['inv_prenom']) . " " . fxUnescape($tabParticipant['inv_nom']); // $strFromName = fxUnescape($tabParticipant['com_prenom']) . " " . fxUnescape($tabParticipant['com_nom']); $strFromMail = fxUnescape($tabParticipant['inv_courriel']); // $strSujet = afficheTexte("txt_email_invite_accept", 0) . fxUnescape($tabCaptain['pec_nom_equipe']); if($str_lang == 'fr') { $strSujet = "Invitation � joindre l'�quipe " . fxUnescape($strNomEquipe) . " refus�e."; // $strSujet = "Invitation � joindre l'�quipe " . fxUnescape($tabCaptain['pec_nom_equipe']) . " refus�e."; $strMessage = "Bonjour " . $strToName . ",

Ce courriel est pour vous informer que " . $strFromName . " a refus� de se joindre � l'�quipe " . fxUnescape($strNomEquipe) . "

Ce message a �t� envoy� automatiquement par MS1Inscription."; // $strMessage = "Bonjour " . $strToName . ",

Ce courriel est pour vous informer que " . $strFromName . " a refus� de se joindre � l'�quipe " . fxUnescape($tabCaptain['pec_nom_equipe']) . "

Ce message a �t� envoy� automatiquement par MS1Inscription."; // $_SESSION['msg'] = 'p140'; } else { $strSujet = "Invitation to join team " . fxUnescape($strNomEquipe) . " was refused."; // $strSujet = "Invitation to join team " . fxUnescape($tabCaptain['pec_nom_equipe']) . " was refused."; $strMessage = "Hello " . $strToName . ",

This email is to notify you that " . $strFromName . " has refused to join the team " . fxUnescape($strNomEquipe) . ".

This auto-message was sent by MS1Inscription."; // $strMessage = "Hello " . $strToName . ",

This email is to notify you that " . $strFromName . " has refused to join the team " . fxUnescape($tabCaptain['pec_nom_equipe']) . ".

This auto-message was sent by MS1Inscription."; // $_SESSION['msg'] = 'p540'; } fxSendMail($strSujet, $strMessage, $strToMail, $strToName, $strFromMail, $strFromName, 0, 1, $str_lang); } if ($str_lang == 'fr') $_SESSION['msg'] = 'e138'; else $_SESSION['msg'] = 'e538'; break; case 'resend': // ENVOYER DE NOUVEAU L'INVITATION $sqlInfos = "SELECT no_invitation, inv_prenom, inv_nom, inv_courriel FROM inscriptions_invitations WHERE no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) . "'"; $tabInfos = $objDatabase->fxGetRow($sqlInfos); if ($tabInfos != null) { $sqlInfos = "SELECT * FROM inscriptions_invitations WHERE pec_id = " . intval($_GET['pec_id']) . " AND no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) . "'"; $tabInfos = $objDatabase->fxGetRow($sqlInfos); if ($tabInfos != null) { // variables pour le courriel $tabMail['to_name'] = fxUnescape($tabInfos['inv_prenom']) . ' ' . fxUnescape($tabInfos['inv_nom']); $tabMail['to_mail'] = fxUnescape($tabInfos['inv_courriel']); $tabMail['from_name'] = fxUnescape($_SESSION['com_info']['com_prenom']) . ' ' . fxUnescape($_SESSION['com_info']['com_nom']); $tabMail['from_mail'] = fxUnescape($_SESSION['com_info']['com_courriel']); // $tabMail['from_mail'] = fxUnescape($tabInfos['par_courriel']); $tabMail['pec_id'] = $tabInfos['pec_id']; // variable du groupe // $sqlGroupe = "SELECT p.par_id, p.par_prenom, p.par_nom, p.par_courriel, e.pec_id, e.pec_nom_equipe, e.pec_id_original //FROM resultats_participants p, resultats_epreuves_commandees e where e.pec_id_original = p.pec_id AND p.pec_id = " . intval($tabInfos['pec_id']); $sqlTabTeam = "SELECT * FROM resultats_epreuves_commandees WHERE pec_id_original = " . intval($tabInfos['pec_id']); $tabTeam = $objDatabase->fxGetRow($sqlTabTeam); // $tabGroupe = array("gro_id" => $tabInfos['gro_id'], "gro_code" => $tabInfos['gro_code'], "gro_nom" => $tabInfos['gro_nom'], "gro_pige" => $tabInfos['gro_pige'], "par_id" => $tabInfos['par_id']); // var_dump($tabTeam); // exit; fxSendInvitation($tabTeam, $tabMail, '', $tabInfos['no_invitation'], $str_lang, 'RESEND -'); $sqlUpdate = "UPDATE inscriptions_invitations SET is_id = 5, pec_id = " . intval($tabInfos['pec_id']) . ", inv_envoi = '" . fxGetDateTime() . "' WHERE no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) . "'"; // $sqlUpdate = "UPDATE invitations SET is_id = 5, par_id = " . intval($tabInfos['par_id']) . ", inv_envoi = '" . fxGetDateTime() . "' WHERE inv_numero = '" . $objDatabase->fxEscape($tabData['inv_numero']) . "'"; $qryUpdate = $objDatabase->fxQuery($sqlUpdate); if ($str_lang == 'fr') $_SESSION['msg'] = 'p133'; else $_SESSION['msg'] = 'p533'; } // var_dump($_SESSION['msg']); exit; } } // echo "end of switch in setinvitation"; // exit; // header("location: /account"); } // fonction qui envoie les invitations par courriel // param : infos de l'equipe, infos du courriel, num�ro d'invitation, langue d'affichage, flag pour re-envoi function fxSendInvitation($tabTeam, $tabMail, $tabInfos, $strNoInvitation = '', $strLangue = 'fr', $str_resent = '') { if ($strNoInvitation == '') { $strNoInvitation = uniqid('INV'); $GLOBALS['no_invitation'] = $strNoInvitation; $sqlInvitation = "INSERT INTO inscriptions_invitations SET is_id = 1, no_invitation = '" . $objDatabase->fxEscape($strNoInvitation) . "', inv_prenom = '" . $objDatabase->fxEscape($tabInfos['prenom']) . "', inv_nom = '" . $objDatabase->fxEscape($tabInfos['nom']) . "', inv_courriel = '" . $objDatabase->fxEscape($tabInfos['courriel']) . "', pec_id = " . intval($tabMail['pec_id']) . ", inv_creation = '" . fxGetDateTime() . "', inv_envoi = '" . fxGetDateTime() . "', rol_id = '" . $objDatabase->fxEscape($tabMail['sel_invitee_role']) . "'"; $qryInvitation = $objDatabase->fxQuery($sqlInvitation); $strUrl = fxGetEvenementsUrl($tabTeam['eve_id']); } $strSujet = $str_resent . " Invitation to the 24h of Adrenalin TEAM " . fxUnescape($tabTeam['pec_nom_equipe']); $strMessage = $tabMail['from_name'] . " is inviting you to join his/her team. Please click the link below to register:

" . $vDomaine . "/" . $strUrl . "/en/join-team/?i=" . $strNoInvitation . "

If you can't click the link, copy and paste it to your browser.

This message was sent from MS1Inscription's website."; fxSendMail($strSujet, $strMessage, $tabMail['to_mail'], $tabMail['to_name'], $tabMail['from_mail'], $tabMail['from_name'], 0, 1, $strLangue); } function fxSwitchRole($int_rol_id, $int_par_id, $int_epr_id, $int_pec_id, $str_lang, $int_com_id){ $strRoleMail = ''; // check if same role??? // update role switch($int_rol_id){ case 1: // captain // call fxSetCaptain() fxSetCaptain($int_com_id, $int_pec_id, $int_epr_id); // fxSetCaptain($int_pec_id, $int_epr_id, $int_par_id, $str_lang); $strRoleMail = "captain"; break; case 2: $strRoleMail = "participant"; break; case 3: $strRoleMail = "volunteer"; break; case 4: $strRoleMail = "pit manager"; break; } $sqlUpdateRole = "UPDATE resultats_participants SET rol_id = " . intval($int_rol_id) . " WHERE par_id = " . intval($int_par_id) . " AND epr_id = " . intval($int_epr_id) . " AND pec_id = " . intval($int_pec_id); // var_dump($sqlUpdateRole); $qryUpdateRole = $objDatabase->fxQuery($sqlUpdateRole); // notify participant via email??? $sqlParticipant = "SELECT * FROM resultats_participants WHERE par_id = " . intval($int_par_id) . " AND pec_id = " . intval($int_pec_id) . " AND epr_id = " . intval($int_epr_id); $tabParticipant = $objDatabase->fxGetRow($sqlParticipant); // var_dump($sqlParticipant); // var_dump($tabParticipant); if($tabParticipant != null){ $strToName = fxUnescape($tabParticipant['par_prenom']) . " " . fxUnescape($tabParticipant['par_nom']); $strToMail = fxUnescape($tabParticipant['par_courriel']); $strFromName = fxUnescape($GLOBALS['vClient']);// . " " . fxUnescape($tabParticipant['inv_nom']); $strFromMail = fxUnescape($GLOBALS['vEmail']); if($str_lang == 'fr') { $strSujet = "Changement de rôle - " . fxUnescape($strRoleMail); $strMessage = "Bonjour " . $strToName . ",

Ce courriel est pour vous informer que votre rôle a chang�.

Ce message a �t� envoy� automatiquement par MS1Inscription."; // $_SESSION['msg'] = 'p140'; } else { $strSujet = "Role change - " . fxUnescape($strRoleMail); $strMessage = "Hello " . $strToName . ",

This email is to notify you that your role has changed.

This auto-message was sent by MS1Inscription."; // $_SESSION['msg'] = 'p540'; } fxSendMail($strSujet, $strMessage, $strToMail, $strToName, $strFromMail, $strFromName, 0, 1, $str_lang); } } /****************************************************************************************************************** /****************************************************************************************************************** OLD CODE: KEPT AS REFERENCE - 24-11-2014 */ // fonction qui envoi les invitations par courriel // param : infos du groupe, infos du courriel, num�ro d'invitation, langue d'affichage //function fxSendInvitation($tabGroupe, $tabMail, $tabInfos, $strNoInvitation = '', $strLangue = 'fr') { // if ($strNoInvitation == '') { // $strNoInvitation = uniqid('INV'); // // $sqlInvitation = "INSERT INTO invitations SET is_id = 1, par_id = " . intval($tabGroupe['par_id']) . ", gro_id = " . intval($tabGroupe['gro_id']) . ", inv_numero = '" . $objDatabase->fxEscape($strNoInvitation) . "', inv_prenom = '" . $objDatabase->fxEscape($tabInfos['prenom']) . "', inv_nom = '" . $objDatabase->fxEscape($tabInfos['nom']) . "', inv_courriel = '" . $objDatabase->fxEscape($tabInfos['courriel']) . "', inv_creation = '" . fxGetDateTime() . "', inv_envoi = '" . fxGetDateTime() . "'"; // // var_dump($sqlInvitation); // exit; // $qryInvitation = $objDatabase->fxQuery($sqlInvitation); // } // // if ($strLangue == 'fr') { // Fran�ais // $strSujet = "Invitation au groupe " . fxUnescape($tabGroupe['gro_nom']); // $strMessage = $tabMail['from_name'] . " vous invite � vous joindre � son groupe d'�change de cadeaux. Veuillez cliquer sur le lien suivant pour vous inscrire:

" . $vDomaine . "/joindre-groupe/?i=" . $strNoInvitation . "

Si vous ne pouvez cliquer le lien, copiez-le et collez-le dans votre navigateur.

Prenez note que la pige aura lieu le " . fxShowDate($tabGroupe['gro_pige'], 'fr') . " � 0:01.

Ce message a �t� envoy� via le site de CADOH!"; // } // else { // Anglais // $strSujet = "Invitation to the 24h of Adrenalin TEAM " . fxUnescape($tabGroupe['pec_nom_equipe']) . ' (resent)'; // $strMessage = $tabMail['from_name'] . " is inviting you to join his/her team. Please click the link below to register:

" . $vDomaine . "/join-group/?i=" . $strNoInvitation . "

If you can't click the link, copy and paste it to your browser.

This message was sent from MS1Inscription's website."; //// $strSujet = "Invitation to the group " . fxUnescape($tabGroupe['gro_nom']); //// $strMessage = $tabMail['from_name'] . " is inviting you to join his gifts exchange group. Please click the link below to register:

" . $vDomaine . "/join-group/?i=" . $strNoInvitation . "

If you can't click the link, copy and paste it to your browser.

Note that the draw is scheduled to take place on " . fxShowDate($tabGroupe['gro_pige'], 'en') . " at 0:01.

This message was sent from CADOH!'s website."; // } // // fxSendMail($strSujet, $strMessage, $tabMail['to_mail'], $tabMail['to_name'], $tabMail['from_mail'], $tabMail['from_name'], 0, 1, $strLangue); //} // fonction pour modifier les invitations envoy�es pour un groupe // param : action, donn�es post, langue d'affichage //function fxSetInvitation($strAction, $tabData, $strLangue = 'fr') { ////var_dump($strAction); //// exit; // switch ($strAction) { // case 'invite': // case 'inviter': // INVVITER // $tabCourriel = array(); // $intNbCourrielsE = $intNbCourrielsNE = 0; // // $sqlGroupe = "SELECT p.par_id, p.par_prenom, p.par_nom, p.par_courriel, g.gro_id, g.gro_code, g.gro_nom, g.gro_pige FROM groupes g, participants p, part_groupes pg WHERE g.gro_id = pg.gro_id AND p.par_id = pg.par_id AND g.gro_id = " . intval($tabData['gro_id']) . " AND p.par_id = " . intval($_SESSION['par_id']); // $tabGroupe = $objDatabase->fxGetRow($sqlGroupe); // //// if ($tabGroupe != null) { //// if ($tabData['sel_gro_id'] != 0) { //// // inviter les membres d'un autre groupe //// $sqlCourriels = "SELECT p.par_prenom, p.par_nom, p.par_courriel FROM groupes g, participants p, part_groupes pg WHERE g.gro_id = pg.gro_id AND p.par_id = pg.par_id AND g.gro_id = " . intval($tabData['sel_gro_id']) . " AND p.par_id <> " . intval($_SESSION['par_id']); //// $tabCourriels = $objDatabase->fxGetResults($sqlCourriels); //// //// if ($tabCourriels != null) { //// for ($intCtr = 1; $intCtr <= count($tabCourriels); $intCtr++) //// $tabCourriel[] = array("nom" => fxUnescape($tabCourriels[$intCtr]['par_nom']), "prenom" => fxUnescape($tabCourriels[$intCtr]['par_prenom']), "courriel" => fxUnescape($tabCourriels[$intCtr]['par_courriel'])); //// } //// } // // if (trim($tabData['inv_nom']) != '' && trim($tabData['inv_prenom']) != '' && trim($tabData['inv_courriel']) != '') // $tabCourriel[] = array("nom" => fxUnescape($tabData['inv_nom']), "prenom" => fxUnescape($tabData['inv_prenom']), "courriel" => fxUnescape($tabData['inv_courriel'])); // // if (count($tabCourriel) > 0) { // foreach ($tabCourriel as $intIndex => $tabInfos) { // // variables communes pour le courriel // $tabMail['to_name'] = fxUnescape($tabInfos['prenom']) . ' ' . fxUnescape($tabInfos['nom']); // $tabMail['to_mail'] = fxUnescape($tabInfos['courriel']); // $tabMail['from_name'] = fxUnescape($tabGroupe['par_prenom']) . ' ' . fxUnescape($tabGroupe['par_nom']); // $tabMail['from_mail'] = fxUnescape($tabGroupe['par_courriel']); // //// $sqlParticipants = "SELECT (SELECT COUNT(p.par_id) FROM participants p, part_groupes pg WHERE p.par_id = pg.par_id AND p.par_courriel = '" . $objDatabase->fxEscape($tabInfos['courriel']) . "' AND pg.gro_id = " . intval($tabData['gro_id']) . ") + (SELECT COUNT(inv_id) FROM invitations WHERE inv_courriel = '" . $objDatabase->fxEscape($tabInfos['courriel']) . "' AND gro_id = " . intval($tabData['gro_id']) . ") AS nb FROM DUAL"; //// $intNbParticipants = $objDatabase->fxGetVar($sqlParticipants); // //// if ($intNbParticipants < 1) { // Ajouter l'invitation dans la bdd et envoyer le courriel //// $intNbCourrielsE++; // // fxSendInvitation2($tabGroupe, $tabMail, $tabInfos, '', $strLangue); //// fxSendInvitation($tabGroupe, $tabMail, $tabInfos, '', $strLangue); //// } //// else // si le participant fait d�j� partie du groupe //// $intNbCourrielsNE++; // } //// //// if ($strLangue == 'fr') { // Fran�ais //// $_SESSION['msg'] = 'p105'; //// header('Location: ' . $vDomaine . '/compte/membres/inviter/' . $tabData['gro_id']); //// } //// else { // Anglais // $_SESSION['msg'] = 'p532'; //// header('Location: ' . $vDomaine . '/account/members/invite/' . $tabData['gro_id']); //// } //// //// exit; // } //// } // break; // // case 'accept': // ACCEPTER // $sqlUpdate = "UPDATE invitations SET is_id = 2 WHERE inv_numero = '" . $objDatabase->fxEscape($tabData['inv_numero']) . "'"; // $qryUpdate = $objDatabase->fxQuery($sqlUpdate); // // // Ajouter le participant au groupe // $sqlInsert = "INSERT INTO part_groupes SET par_id = " . intval($tabData['par_id']) . ", gro_id = " . intval($tabData['gro_id']) . ", pg_participe = 1, pg_date_joint = '" . fxGetDateTime() . "', inv_numero = '" . $objDatabase->fxEscape($tabData['inv_numero']) . "'"; // $qryInsert = $objDatabase->fxQuery($sqlInsert); // // // Mettre � jour les donn�es du participants dans la table invitations // $sqlParticipant = "SELECT par_prenom, par_nom, par_courriel FROM participants WHERE par_id = " . intval($tabData['par_id']); // $tabParticipant = $objDatabase->fxGetRow($sqlParticipant); // // if ($tabParticipant != null) { // $sqlUpdate = "UPDATE invitations SET inv_prenom = '" . $objDatabase->fxEscape($tabParticipant['par_prenom']) . "', inv_nom = '" . $objDatabase->fxEscape($tabParticipant['par_nom']) . "', inv_courriel = '" . $objDatabase->fxEscape($tabParticipant['par_courriel']) . "' WHERE inv_numero = '" . $objDatabase->fxEscape($tabData['inv_numero']) . "'"; // $qryUpdate = $objDatabase->fxQuery($sqlUpdate); // // // Envoyer courriel au responsable // $sqlGroupe = "SELECT * FROM groupes g, participants p, part_groupes pg WHERE g.gro_id = pg.gro_id AND p.par_id = pg.par_id AND pg.pg_responsable = 1 AND g.gro_id = " . intval($tabData['gro_id']); // $tabGroupe= $objDatabase->fxGetResults($sqlGroupe); // // if ($tabGroupe != null) { // for ($intCtr = 1; $intCtr <= count($tabGroupe); $intCtr++) { // $strToName = fxUnescape($tabGroupe[$intCtr]['par_prenom']) . " " . fxUnescape($tabGroupe[$intCtr]['par_nom']); // $strToMail = fxUnescape($tabGroupe[$intCtr]['par_courriel']); // $strFromName = fxUnescape($tabParticipant['par_prenom']) . " " . fxUnescape($tabParticipant['par_nom']); // $strFromMail = fxUnescape($tabParticipant['par_courriel']); // // // Envoyer le courriel de validation // if ($tabGroupe[$intCtr]['par_langue'] == 'fr') { // $strSujet = "Nouveau participant au groupe " . fxUnescape($tabGroupe[$intCtr]['gro_nom']); // $strMessage = "Bonjour " . $strToName . ",

ce courriel est pour vous informer que " . $strFromName . " s'est joint au groupe " . fxUnescape($tabGroupe[$intCtr]['gro_nom']) . "

Ce message a �t� envoy� automatiquement par CADOH!"; // // $_SESSION['msg'] = 'p106'; // } // else { // $strSujet = "New participant to the group " . fxUnescape($tabGroupe[$intCtr]['gro_nom']); // $strMessage = "Hello" . $strToName . ",

this email is to notify you that " . $strFromName . " has joined the group " . fxUnescape($tabGroupe[$intCtr]['gro_nom']) . ".

This auto-message was sent by CADOH!"; // // $_SESSION['msg'] = 'p506'; // } // // fxSendMail($strSujet, $strMessage, $strToMail, $strToName, $strFromMail, $strFromName, 0, 1, $tabGroupe[$intCtr]['par_langue']); // } // } // } // // if ($strLangue == 'fr') // $_SESSION['msg'] = 'p129'; // else // $_SESSION['msg'] = 'p529'; // // break; // // case 'refuse': // REFUSER // $sqlUpdate = "UPDATE invitations SET is_id = 3 WHERE inv_numero = '" . $objDatabase->fxEscape($tabData['inv_numero']) . "'"; // $qryUpdate = $objDatabase->fxQuery($sqlUpdate); // // if ($strLangue == 'fr') // $_SESSION['msg'] = 'p130'; // else // $_SESSION['msg'] = 'p530'; // // break; // // case 'cancel': // ANNULER // $sqlUpdate = "UPDATE inscriptions_invitations SET is_id = 4 WHERE no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) . "'"; //// $sqlUpdate = "UPDATE invitations SET is_id = 4 WHERE inv_numero = '" . $objDatabase->fxEscape($tabData['inv_numero']) . "'"; // $qryUpdate = $objDatabase->fxQuery($sqlUpdate); // // if ($strLangue == 'fr') // $_SESSION['msg'] = 'p134'; // else // $_SESSION['msg'] = 'p534'; // // break; // // case 'resend': // ENVOYER DE NOUVEAU L'INVITATION // $sqlInfos = "SELECT no_invitation, inv_prenom, inv_nom, inv_courriel FROM inscriptions_invitations WHERE no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) . "'"; //// $sqlInfos = "SELECT gro_id, inv_numero, inv_prenom, inv_nom, inv_courriel FROM invitations WHERE inv_numero = '" . $objDatabase->fxEscape($tabData['inv_numero']) . "'"; // // $tabInfos = $objDatabase->fxGetRow($sqlInfos); // // if ($tabInfos != null) { // $sqlInfos = "SELECT * FROM inscriptions_invitations WHERE pec_id = " . intval($_GET['pec_id']) . " AND no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) . "'"; //// $sqlInfos = "SELECT i.no_invitation, i.inv_prenom, i.inv_nom, i.inv_courriel, p.pec_id, p.par_prenom, p.par_nom, p.par_courriel FROM inscriptions_invitations i, resultats_participants p WHERE p.pec_id = i.pec_id AND i.no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) . "'"; //// $sqlInfos = "SELECT i.inv_numero, i.inv_prenom, i.inv_nom, i.inv_courriel, p.par_id, p.par_prenom, p.par_nom, p.par_courriel, g.gro_id, g.gro_code, g.gro_nom, g.gro_pige FROM invitations i, groupes g, participants p WHERE g.gro_id = i.gro_id AND p.par_id = i.par_id AND i.inv_numero = '" . $objDatabase->fxEscape($tabData['inv_numero']) . "'"; // ////var_dump($sqlInfos); // // $tabInfos = $objDatabase->fxGetRow($sqlInfos); // // if ($tabInfos != null) { // // variables pour le courriel // $tabMail['to_name'] = fxUnescape($tabInfos['inv_prenom']) . ' ' . fxUnescape($tabInfos['inv_nom']); // $tabMail['to_mail'] = fxUnescape($tabInfos['inv_courriel']); // // $tabMail['from_name'] = fxUnescape($_SESSION['com_info']['com_prenom']) . ' ' . fxUnescape($_SESSION['com_info']['com_nom']); // $tabMail['from_mail'] = fxUnescape($_SESSION['com_info']['com_courriel']); //// $tabMail['from_mail'] = fxUnescape($tabInfos['par_courriel']); // // $tabMail['pec_id'] = $tabInfos['pec_id']; // // // variable du groupe //// $sqlGroupe = "SELECT p.par_id, p.par_prenom, p.par_nom, p.par_courriel, e.pec_id, e.pec_nom_equipe, e.pec_id_original ////FROM resultats_participants p, resultats_epreuves_commandees e where e.pec_id_original = p.pec_id AND p.pec_id = " . intval($tabInfos['pec_id']); // $sqlTabTeam = "SELECT * FROM resultats_epreuves_commandees WHERE pec_id_original = " . intval($tabInfos['pec_id']); // $tabTeam = $objDatabase->fxGetRow($sqlTabTeam); //// $tabGroupe = array("gro_id" => $tabInfos['gro_id'], "gro_code" => $tabInfos['gro_code'], "gro_nom" => $tabInfos['gro_nom'], "gro_pige" => $tabInfos['gro_pige'], "par_id" => $tabInfos['par_id']); // //// var_dump($tabTeam); //// exit; // //// fxSendInvitation($tabGroupe, $tabMail, '', $tabInfos['no_invitation'], $strLangue); //// fxSendInvitation($tabTeam, $tabMail, '', $tabInfos['no_invitation'], $strLangue); // fxSendInvitation2($tabTeam, $tabMail, '', $tabInfos['no_invitation'], $strLangue, 'RESEND -'); //// fxSendInvitation($tabGroupe, $tabMail, '', $tabInfos['inv_numero'], $strLangue); // // $sqlUpdate = "UPDATE inscriptions_invitations SET is_id = 5, pec_id = " . intval($tabInfos['pec_id']) . ", inv_envoi = '" . fxGetDateTime() . "' WHERE no_invitation = '" . $objDatabase->fxEscape($tabData['no_invitation']) . "'"; //// $sqlUpdate = "UPDATE invitations SET is_id = 5, par_id = " . intval($tabInfos['par_id']) . ", inv_envoi = '" . fxGetDateTime() . "' WHERE inv_numero = '" . $objDatabase->fxEscape($tabData['inv_numero']) . "'"; // $qryUpdate = $objDatabase->fxQuery($sqlUpdate); // // if ($strLangue == 'fr') // $_SESSION['msg'] = 'p133'; // else // $_SESSION['msg'] = 'p533'; // } // } // } //} //// fonction qui r�cup�re les invitations envoy�es pour un groupe //// param : id du groupe, id du participant responsable //function fxGetInvitations($intGroupe = 0, $intParticipant = 0) { // $tabInvitations = false; // // if ($intGroupe != 0 && $intParticipant != 0) { // $sqlInvitations = "SELECT i.*, s.is_nom_fr, s.is_nom_en FROM invitations i, invitations_statuts s, part_groupes pg WHERE i.is_id = s.is_id AND i.gro_id = pg.gro_id AND pg.par_id = " . intval($intParticipant) . " AND i.gro_id = " . intval($intGroupe) . " AND pg.pg_responsable = 1 ORDER BY i.inv_nom, i.inv_prenom"; // $tabInvitations = $objDatabase->fxGetResults($sqlInvitations); // } // // return $tabInvitations; //}