function selectionneTutorielsService($base, $data) { $service = $data[0]; $statut = $data[1]; $dated = $data[2]; $datef = $data[3]; if ($service === "*" && $statut === "tout") { return selectionneTutoriels($base, $dated, $datef); } elseif ($service === "*" && $statut !== "tout") { return selectionneTutorielsChamps($base, "statut", $statut, $dated, $datef); } elseif ($service !== "*" && $statut === "tout") { return selectionneTutorielsChamps($base, "service_titre", $service, $dated, $datef); } elseif ($service !== "*" && $statut !== "tout") { return selectionneTutorielsToSend($base, $service, $statut, $dated, $datef); } }
function prepareEnvoieTutoriels($base) { //selectionner l'ensemble des tutoriels prêts à être envoyés $dated = Date("Y-m-d H:") . "00:00"; $datef = Date("Y-m-d H:") . "59:59"; $tutos = selectionneTutorielsChamps($base, "statut", "pret", $dated, $datef); while ($tuto = $tutos->fetch()) { //selectionner les destinataires des sms $clients = selectionneInscriptionsEnOrdre($tuto['service_titre'], 1, $base); while ($client = $clients->fetch()) { //pour chaque client, recuperer ses details $details = selectionneClient($client['client_UID'], $base); //envoyer le tutoriel envoieTutoriel($details, $tuto, $base); } } }