<?php /** * Acceptation d'une nouvelle mission * * PHP version 5 * * @category Ajax * @package LeQG * @author Damien Senger <*****@*****.**> * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0 * @link http://leqg.info */ // On vérifie qu'un code de mission a été entré if ((isset($_GET['code']) || isset($_POST['code'])) && (isset($_GET['user']) || isset($_POST['user']))) { // On récupère le code de la mission $code = isset($_GET['code']) ? $_GET['code'] : $_POST['code']; $user = isset($_GET['user']) ? $_GET['user'] : $_POST['user']; // On ouvre la mission $mission = new Mission($code); $type = $mission->get('mission_type') == 'porte' ? 'porte' : 'boite'; // On change le statut de la mission comme ouvert et on redirige if ($mission->reponse(1, $user)) { Core::goPage($type, array('action' => 'missions'), true); } else { // En cas d'erreur, on affiche un code d'erreur http_response_code(418); } } else { http_response_code(418); }
?> "> <small><span><?php echo Event::displayType($e->get('type')); ?> </span></small> <strong><a href="<?php echo Core::goPage('contact', array('contact' => $c->get('id'), 'evenement' => $e->get('id'))); ?> "><?php echo !empty($e->get('objet')) ? $e->get('objet') : 'Événement sans titre'; ?> </a></strong> <ul class="infosAnnexes"> <li class="contact"><a href="<?php echo Core::goPage('contact', array('contact' => $c->get('id'))); ?> "><?php echo $c->display_name(); ?> </a></li> <li class="date"><?php echo date('d/m/Y', strtotime($e->get('date'))); ?> </li> </ul> </li> <?php } ?> </ul>
<section id="missions"> <h3 class="titrebloc">Missions ouvertes auxquelles vous participez</h3> <ul class="liste-missions"> <?php foreach ($missions_ouvertes as $mission_ouverte) { $mission = new Mission(md5($mission_ouverte)); $deadline = DateTime::createFromFormat('Y-m-d', $mission->get('mission_deadline')); ?> <li> <a href="<?php Core::goPage('reporting', array('mission' => $mission->get('mission_hash'))); ?> " class="nostyle"><button style="float: right; margin-top: 1.33em;">Ouvrir la mission</button></a> <a href="<?php Core::goPage('reporting', array('mission' => $mission->get('mission_hash'))); ?> " class="nostyle"><h4><?php echo $mission->get('mission_nom'); ?> </h4></a> <?php if ($mission->get('mission_deadline')) { ?> <p>Cette mission de porte-à-porte doit être terminée pour le <strong><?php echo $deadline->format('d/m/Y'); ?> </strong>.</p> <?php } else { ?>
if (empty($coordonnee)) { unset($reporting[$report]); } else { // On récupère l'identifiant de l'électeur $electeur = explode('-', $report); // On retraite dans le tableau initial $reporting[$electeur[1]][$electeur[0]] = $coordonnee; // On supprime l'ancienne information unset($reporting[$report]); } } // Pour chaque contact, on enregistre l'information foreach ($reporting as $report => $infos) { $contact = new People($report); // On enregistre l'adresse mail si elle existe if (isset($infos['email'])) { $contact->contact_details_add($infos['email']); } // On regarde le type de numéro de téléphone puis on l'enregistre s'il existe if (isset($infos['phone'])) { $numero = preg_replace('`[^0-9]`', '', $infos['phone']); $premiersNums = $numero[0] . $numero[1]; if ($premiersNums == 06 || $premiersNums == 07) { $contact->contact_details_add($numero); } else { $contact->contact_details_add($numero); } } } Core::goPage('reporting', array('mission' => $_GET['mission'], 'rue' => $_GET['rue']), true);
Core::goPage('mission', array('code' => $data->get('mission_hash'))); ?> ">Supervision</a> <a href="<?php Core::goPage('mission', array('code' => $data->get('mission_hash'), 'admin' => 'militant')); ?> ">Militants</a> <a href="<?php Core::goPage('mission', array('code' => $data->get('mission_hash'), 'admin' => 'parcours')); ?> ">Parcours</a> <?php if ($data->get('mission_type') == 'porte') { ?> <a href="<?php Core::goPage('mission', array('code' => $data->get('mission_hash'), 'admin' => 'retours')); ?> ">Demandes</a><?php } ?> </nav> <div class="colonne demi gauche"> <section class="contenu demi"> <h4>Supervision des militants</h4> <?php if ($militants) { ?> <ul class="informations"> <li class="responsable">
?> <h2>Mission « <?php echo $data->get('mission_nom'); ?> »</h2> <h3 style="margin: 20px;"><?php echo $immeuble['immeuble_numero']; ?> <?php echo $rue['rue_nom']; ?> </h3> <a href="<?php Core::goPage('report', array('code' => $_GET['code'], 'rue' => $_GET['rue'], 'immeuble' => $_GET['immeuble'], 'electeur' => $_GET['immeuble'], 'statut' => 1)); ?> " class="nostyle bouton">Inaccessible</a> <a href="<?php Core::goPage('report', array('code' => $_GET['code'], 'rue' => $_GET['rue'], 'immeuble' => $_GET['immeuble'], 'electeur' => $_GET['immeuble'], 'statut' => 2)); ?> " class="nostyle bouton">Boîtage réalisé</a> <a href="<?php Core::goPage('mission', array('code' => $_GET['code'], 'rue' => $_GET['rue'])); ?> " class="bouton nostyle">Retour à la rue</a> <?php Core::loadFooter();
<?php User::protection(5); Core::loadHeader(); ?> <ul id="actions"> <li> <a href="<?php Core::goPage('recherche', array('destination' => 'interaction')); ?> "> <span></span> <p>Nouvelle interaction</p> </a> </li> <li> <a href="<?php Core::goPage('recherche', array('destination' => 'fiche')); ?> "> <span></span> <p>Consulter une fiche</p> </a> </li> </ul> <?php Core::loadFooter();
<div class="colonne demi droite"> <section class="contenu demi"> <h4>Contacts connus du bureau</h4> <ul class="listeContacts"> <?php $adresses = array(); $contacts = Carto::listeElecteursParBureau($bureau['bureau_id'], true); foreach ($contacts as $contact) { $classSexe = array('M' => 'homme', 'F' => 'femme', 'i' => 'isexe'); $c = new Contact($contact['code']); $adresses[] = explode('|', $c->adresse('electorale', '|')); ?> <a href="<?php Core::goPage('contact', array('contact' => $contact['code'])); ?> " class="nostyle"> <li class="contact <?php echo $classSexe[$contact['contact_sexe']]; ?> "> <?php if (!empty($contact['contact_nom']) || !empty($contact['contact_nom_usage']) || !empty($contact['contact_prenoms'])) { ?> <strong><?php echo mb_convert_case($contact['contact_nom'], MB_CASE_UPPER); ?> <?php echo mb_convert_case($contact['contact_nom_usage'], MB_CASE_UPPER); ?>
<?php /** * Suppression d'un numéro à appeler dans une mission de phoning * * PHP version 5 * * @category Ajax * @package LeQG * @author Damien Senger <*****@*****.**> * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0 * @link http://leqg.info */ if (isset($_POST['mission'])) { // On ouvre la fiche concernée $link = Configuration::read('db.link'); // On effectue la modification $query = $link->prepare('UPDATE `argumentaires` SET `argumentaire_statut` = 0 WHERE `argumentaire_id` = :id'); $query->bindParam(':id', $_POST['mission'], PDO::PARAM_INT); $query->execute(); // On supprime tous les rappels non fait de cette mission $query = $link->prepare('DELETE FROM `rappels` WHERE `rappel_statut` = 0 AND `argumentaire_id` = :id'); $query->bindParam(':id', $_POST['mission'], PDO::PARAM_INT); $query->execute(); // On redirige vers les dossiers Core::goPage('rappels', true); }
?> "> </li> <li> <label for="form-fixe">Téléphone</label> <input type="tel" name="fixe" id="form-fixe" value="<?php echo $contact->get('fixe'); ?> "> </li> <li> <input type="submit" value="Enregistrer"> </li> </ul> </form> <nav id="actions-fiche"> <a href="#" id="retourDepuisModif" class="retour"></a> </nav> </section> <nav id="actions-fiche"> <a href="#" id="goToHistorique" class="historique"></a> <a href="<?php Core::goPage('interaction', array('action' => 'ajout', 'fiche' => $contact->get('contact_id'))); ?> " id="ajoutInteraction" class="central"></a> <a href="#" id="goToModif" class="modifier"></a> </nav> <?php Core::loadFooter();
"> <span></span> <p>Reporting mobile</p> </a> </li> </ul> <?php } else { ?> <ul id="actions"> <li> <a href="<?php Core::goPage('boitage'); ?> "> <span></span> <p>Boîtage</p> </a> </li> <li> <a href="<?php Core::goPage('porte'); ?> "> <span></span> <p>Porte à porte</p> </a> </li> </ul> <?php }
<h1><a href="<?php Core::goPage(); ?> " class="nostyle">LeQG</a></h1> <a id="goToMenu" href="#menu"></a> </header> <nav id="menu"> <a href="<?php Core::goPage('recherche'); ?> "><span></span>Recherche</a> <a href="<?php Core::goPage('contacts'); ?> "><span></span>Contacts</a> <a href="<?php Core::goPage('porte'); ?> "><span></span>Porte à porte</a> <a href="<?php Core::goPage('boitage'); ?> "><span></span>Boîtage</a> <a href="<?php Core::goPage('deconnexion'); ?> " onclick="return confirm('Êtes-vous sûr de vouloir vous déconnecter ?');"><span></span>Déconnexion</a> </nav> <main>
<?php /** * Suppression d'une mission de porte à porte * * PHP version 5 * * @category Ajax * @package LeQG * @author Damien Senger <*****@*****.**> * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0 * @link http://leqg.info */ if (isset($_POST['mission'])) { // On ouvre la fiche concernée $link = Configuration::read('db.link'); // On effectue la modification $query = 'UPDATE `mission` SET `mission_statut` = 0 WHERE `mission_id` = :id'; $query = $link->prepare($query); $query->bindParam(':id', $_POST['mission'], PDO::PARAM_INT); $query->execute(); // On redirige vers les dossiers Core::goPage('porte', true); }
<?php } else { ?> <p><?php if (empty($data->get('message'))) { echo 'Aucun message actuellement, ce paramètre est nécessaire pour l\'envoi.'; } else { echo $data->get('message'); } ?> </p> <?php if ($data->get('status') == 'open') { ?> <p style="text-align: center;"><a href="<?php echo Core::goPage('campagne', array('id' => $_GET['id'], 'operation' => 'modificationSMS')); ?> " class="modifierObjet">Modifier le message</a></p><?php } ?> <?php } ?> </section> <?php } ?> </div> <?php }
<?php } ?> <?php if (User::authLevel() > 5) { ?> <a href="<?php Core::goPage('porte', array('mission' => $_GET['mission'])); ?> " class="nostyle"><button>Revenir à la mission</button></a> <?php } else { ?> <a href="<?php Core::goPage('porte', array('action' => 'voir', 'mission' => $mission['mission_id'])); ?> " class="nostyle"><button>Revenir à la mission</button></a> <?php } ?> </section> <?php if (Porte::nombreVisites($mission['mission_id'])) { $rues = Porte::liste($mission['mission_id']); foreach ($rues as $rue => $immeubles) { if (count($immeubles)) { if ($rue == $_GET['rue']) { $ville = Carto::ville(Carto::villeParRue($rue)); // On va tenter de retrier les immeubles dans le bon ordre
} else { ?> <section class="icone" id="aucunDossier"> <h3>Aucun dossier ouvert actuellement.</h3> </section> <?php } ?> </div> <div class="colonne demi droite"> <section class="contenu demi"> <h4>Recherche thématique</h4> <form action="<?php echo Core::goPage('recherche-thematique'); ?> " method="post"> <ul class="formulaire"> <li> <span class="form-icon decalage search"> <input type="text" name="rechercheThematique" id="rechercheThematique" placeholder="Tapez ici un tag à rechercher"> </span> </li> <li> <button type="submit" style="margin: .33em auto .15em;">Lancer la recherche</button> </li> </ul> </form> </section> </div>
// On lance l'envoi du mail avec les informations de connexion $email = file_get_contents('tpl/mail/user-creation.tpl.html'); $objet = 'LeQG – Votre compte a été créé par ' . User::getLoginByID(User::ID()) . '.'; // On insère dans le mail l'URL du fichier pour qu'il puisse être téléchargé $email = strtr($email, array('{COMPTE}' => $form['prenom'] . ' ' . $form['nom'])); $email = strtr($email, array('{USER}' => User::getLoginByID(User::ID()))); $email = strtr($email, array('{EMAIL}' => $form['email'])); $email = strtr($email, array('{PASS}' => $form['pass'])); // On démarre l'instance $mail = new PHPMailer(); // On récupère les informations sur l'API $api = Configuration::read('api'); // On contacte le serveur d'envoi SMTP $mail->IsSMTP(); $mail->SMTPAuth = true; $mail->Host = $api['mail']['smtp']['host']; $mail->Port = $api['mail']['smtp']['port']; $mail->Username = $api['mail']['smtp']['user']; $mail->Password = $api['mail']['smtp']['pass']; // On configure le mail à envoyer $mail->CharSet = $api['mail']['charset']; $mail->SetFrom('*****@*****.**', 'LeQG'); $mail->AddReplyTo('*****@*****.**', 'LeQG équipe technique'); $mail->AddAddress($form['email'], $form['prenom'] . ' ' . $form['nom']); $mail->Subject = $objet; $mail->MsgHTML($email); $mail->Send(); Core::goPage('administration', true); } else { Core::goPage('administration', true); }
$sexe = 'homme'; } elseif ($fiche->get('sexe') == 'F') { $sexe = 'femme'; } else { $sexe = 'isexe'; } if (!empty($fiche->display_name())) { $nomAffichage = $fiche->display_name(); } elseif (!empty($fiche->get('organisme'))) { $nomAffichage = $fiche->get('organisme'); } else { $nomAffichage = 'Fiche sans nom'; } ?> <a href="<?php Core::goPage('contact', array('contact' => $fiche->get('id'))); ?> " class="nostyle contact-<?php echo $fiche->get('id'); ?> "> <li class="contact <?php echo $sexe; ?> "> <strong><?php echo $nomAffichage; ?> </strong> </li> </a>
} else { if (isset($_GET['fiche'])) { Core::goPage('contacts', array('fiche' => $_GET['fiche']), true); } else { Core::goPage('contacts', array(), true); } } } else { // Si aucune action n'est demandée, // on charge la page de lecture d'une interaction // s'il existe une fiche demandée if (isset($_GET['interaction'])) { Core::loadTemplate('interaction'); // Sinon, on charge le module "contacts" } else { Core::goPage('contacts', array(), true); } } // S'il s'agit du module de boîtage ou de porte-à-porte } elseif ($_GET['page'] == 'boitage' || $_GET['page'] == 'porte') { // On regarde s'il s'agit d'une action particulière, // sinon on charge le démarrage du module if (isset($_GET['mission']) && isset($_GET['rue'])) { Core::loadTemplate($_GET['page'], 'rue'); } else { if (isset($_GET['mission']) && isset($_GET['immeuble'])) { Core::loadTemplate($_GET['page'], 'immeuble'); } else { if (isset($_GET['mission'])) { Core::loadTemplate($_GET['page'], 'mission'); } else {
Core::loadHeader(); ?> <a href="<?php Core::goPage('reporting', array('mission' => $data->get('mission_hash'))); ?> " class="nostyle"><button class="gris" style="float: right; margin-top: 0em;">Retour à la mission</button></a> <h2 id="titre-mission" class="titre" data-mission="<?php echo $data->get('mission_hash'); ?> ">Mission « <?php echo $data->get('mission_nom'); ?> »</h2> <form action="<?php Core::goPage('reporting', array('action' => 'coordonnees', 'mission' => $_GET['mission'], 'rue' => $_GET['rue'])); ?> " method="post"> <section class="contenu"> <h4>Demande d'informations complémentaires</h4> <table class="reporting"> <thead> <tr> <th>Électeur</th> <th style="width: 300px">Email</th> <th style="width: 200px">Téléphone</th> </tr> </thead> <tbody> <?php
$liste = Campaign::all('email'); // On charge le template Core::loadHeader(); ?> <h2 class="titreCampagne" data-page="campagnes">Campagnes de Email groupés</h2> <?php if (count($liste)) { ?> <section id="campagnes"> <ul class="liste-campagnes"> <?php foreach ($liste as $element) { ?> <li> <a href="<?php Core::goPage('campagne', array('id' => $element['id'])); ?> " class="nostyle"><h4><?php if (!empty($element['objet'])) { echo $element['objet']; } else { echo 'Campagne sans titre'; } ?> </h4></a> <p>Campagne <?php echo $element['type']; ?> créée le <?php echo date('d/m/Y', strtotime($element['date'])); ?>
<?php /** * Suppression d'une opération de boîtage * * PHP version 5 * * @category Ajax * @package LeQG * @author Damien Senger <*****@*****.**> * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0 * @link http://leqg.info */ if (isset($_POST['mission'])) { // On ouvre la fiche concernée $link = Configuration::read('db.link'); // On effectue la modification $query = 'UPDATE `mission` SET `mission_statut` = 0 WHERE `mission_id` = :id'; $query = $link->prepare($query); $query->bindParam(':id', $_POST['mission'], PDO::PARAM_INT); $query->execute(); // On redirige vers les dossiers Core::goPage('boite', true); }
<?php /** * Suppression d'un contact * * PHP version 5 * * @category Ajax * @package LeQG * @author Damien Senger <*****@*****.**> * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0 * @link http://leqg.info */ if (isset($_POST['fiche'])) { // On ouvre la fiche concernée $contact = new People($_POST['fiche']); // On détruit ce contact $contact->delete(); // On redirige vers les dossiers Core::goPage('contacts', true); }
?> .<br> </p> </li> <?php } ?> </ul> <a class="nostyle" href="<?php Core::goPage('rappels', array('action' => 'nouveau')); ?> "><button>Créer un argumentaire et sa mission</button></a> </section> <?php } else { ?> <section class="icone" id="aucuneMission"> <h3>Aucune mission de rappels militant disponible actuellement.</h3> <a class="nostyle" href="<?php Core::goPage('rappels', array('action' => 'nouveau')); ?> "><button>Créer un argumentaire et sa mission</button></a> </section> <?php } ?> <?php Core::loadFooter();
<?php /** * Arrêt d'une mission en cours * * PHP version 5 * * @category Ajax * @package LeQG * @author Damien Senger <*****@*****.**> * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0 * @link http://leqg.info */ // On vérifie qu'un code de mission a été entré if (isset($_GET['code']) || isset($_POST['code'])) { // On récupère le code de la mission $code = isset($_GET['code']) ? $_GET['code'] : $_POST['code']; // On ouvre la mission $mission = new Mission($code); // On change le statut de la mission comme ouvert et on redirige if ($mission->fermer()) { Core::goPage('mission', array('code' => $code), true); } else { // En cas d'erreur, on affiche un code d'erreur http_response_code(418); } } else { http_response_code(418); }
Core::goPage('boite'); ?> "><span></span><p>Boîtage</p></a></td> <td><a href="<?php Core::goPage('rappels'); ?> " class="inactif"><span class="inactif"></span><p class="inactif">Rappels</p></a></td> </tr> <?php } else { ?> <tr> <td><a href="<?php Core::goPage('porte', array('action' => 'missions')); ?> "><span></span><p>Porte à porte</p></a></td> <td><a href="<?php Core::goPage('boite', array('action' => 'missions')); ?> "><span></span><p>Boîtage</p></a></td> <td><a href="<?php Core::goPage('rappels', array('action' => 'appel')); ?> "><span></span><p>Rappels</p></a></td> </tr> <?php } ?> </table> <?php Core::loadFooter();
<?php /** * Création d'une mission de porte à porte * * PHP version 5 * * @category Ajax * @package LeQG * @author Damien Senger <*****@*****.**> * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0 * @link http://leqg.info */ // On récupère les informations $info = $_POST; // On lance la création de la mission avec les informations récupérées $mission = Mission::creation('porte', $info); // On redirige vers la page de la mission Core::goPage('mission', array('code' => md5($mission)), true);
if ($_GET['statut'] != 4 && $data->get('mission_type') == 'porte') { Core::goPage('mission', array('code' => $_GET['code'], 'rue' => $_GET['rue'], 'immeuble' => $_GET['immeuble']), true); } if ($data->get('mission_type') == 'boitage') { Core::goPage('mission', array('code' => $_GET['code'], 'rue' => $_GET['rue']), true); } Core::loadHeader(); ?> <h2>Mission « <?php echo $data->get('mission_nom'); ?> »</h2> <h3 style="margin: 20px;">Comment contacter cet électeur ?</h3> <form action="<?php Core::goPage('report', array('action' => 'coord', 'code' => $_GET['code'], 'rue' => $_GET['rue'], 'immeuble' => $_GET['immeuble'], 'electeur' => $_GET['electeur'])); ?> " method="post"> <p style="text-align: center;">Email</p> <input type="email" name="email"> <p style="text-align: center;">Téléphone</p> <input type="text" name="phone"> <input type="submit" value="Valider"> </form> <?php Core::loadFooter();
<h4>Rues concernées par cette mission</h4> <?php if ($rues) { ?> <ul class="form-liste" id="listeDesRues"> <?php foreach ($rues as $rue) { $stats = $data->streetStats($rue['id']); ?> <li> <?php if ($stats['proportion'] < 100) { ?> <a href="<?php Core::goPage('reporting', array('mission' => $data->get('mission_hash'), 'rue' => $rue['id'])); ?> " class="nostyle"><button class="voirRue gris">Voir la fiche</button></a><?php } ?> <span><?php echo $rue['street']; ?> </span> <?php if ($stats && $stats['proportion']) { ?> <span>Réalisée à <?php echo $stats['proportion']; ?> %</span>
?> <li class="contact user homme">Aucun militant ayant refusé l'invitation.</li> <?php } ?> </ul> </section> </div> <div class="colonne demi droite"> <section class="contenu demi"> <h4>Militants invités</h4> <ul class="listeContacts"> <a href="<?php Core::goPage('mission', array('code' => $data->get('mission_hash'), 'admin' => 'invitations')); ?> " class="nostyle"><li class="contact ajout">Inviter de nouveaux militants à la mission</li></a> <?php if ($militants[0]) { foreach ($militants[0] as $militant) { ?> <li class="contact user homme"><?php echo User::getLoginByID($militant['user_id']); ?> </li> <?php } } else { ?> <li class="contact user homme">Aucun militant invité.</li>