// Liste des codes campagne existant pour cette période $listeCode = array(); $sql = 'SELECT DISTINCT codeCampagne FROM `mail` WHERE `codeCampagne` LIKE "EVALCCPC-' . DatetimeToTimestamp($res_f['debutStage']) . '-' . DatetimeToTimestamp($res_f['finStage']) . '-' . $res_f['promotion'] . '-%"'; $res3 = $db->query($sql); while ($res3_f = $res3->fetch()) { $listeCode[] = explode('-', $res3_f[0])[4]; } sort($listeCode); // On range dans l'ordre croissant sans garder l'association clé-valeur if (count($listeCode) == 0) { $codeCampagneNumber = 1; } else { $codeCampagneNumber = $listeCode[count($listeCode) - 1] + 1; } $codeCampagne = 'EVALCCPC-' . DatetimeToTimestamp($res_f['debutStage']) . '-' . DatetimeToTimestamp($res_f['finStage']) . '-' . $res_f['promotion'] . '-' . $codeCampagneNumber; $campaignPossibilities[] = array('codeCampagne' => $codeCampagne, 'debutStage' => DatetimeToTimestamp($res_f['debutStage']), 'finStage' => DatetimeToTimestamp($res_f['finStage']), 'promotion' => getPromotionData($res_f['promotion']), 'services' => $res2->fetchAll()); } } else { if ($action == 'setMail') { /** Récupère les paramètres actuels **/ $sql = 'SELECT settings FROM typeevaluation WHERE id = :id'; $res = $db->prepare($sql); $res->execute(array('id' => $evaluationTypeData['id'])); $res_f = $res->fetch(); if (isset($res_f[0]) || is_string($res_f[0])) { $settings = unserialize($res_f[0]); } if (!isset($settings) || !is_array($settings)) { $settings = array();
$firstLoop = FALSE; } else { echo '<br />'; } echo $email; } ?> </td> <td><?php echo $userData['nbEtu']; ?> </td> <td> <?php if (isset($userData['promotion'])) { echo getPromotionData($userData['promotion'])['nom']; } ?> </td> <td><?php echo constant('LANG_RANG_VALUE_' . $userData['rang']); ?> </td> </tr> <?php } ?> </table> <?php } }
if (isset($_GET['order'])) { $order = $_GET['order']; } else { $order = 'nom'; } if (isset($_GET['desc'])) { $desc = true; } else { $desc = false; } $listePromotions = getPromotionList($order, $desc); } else { if ($action == 'view' || $action == 'delete' || $action == 'edit') { // On récupère les données sur la promotion if (count(checkPromotion($_GET['id'], array())) == 0) { $promotionData = getPromotionData($_GET['id']); } else { header('Location: ' . ROOT . CURRENT_FILE . '?page=' . $_GET['page']); } } } // On retourne la liste au format CSV si $action == 'dl' if ($action == 'dl') { /* Création de l'array à retourner */ $promotionsCSV = array(array('id', LANG_ADMIN_PROMOTION_NOM_TITRE)); foreach ($listePromotions as $promotion) { $promotionsCSV[] = array($promotion['id'], $promotion['nom']); } // Téléchargement du CSV