<?php
/***************************************************************************
- * Copyright (C) 2003-2011 Polytechnique.org *
+ * Copyright (C) 2003-2014 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
'id' => 'Id',
'group_name' => 'Groupe',
'name' => 'Titre',
- 'custom_css' => 'CSS spécifique',
'criteria' => 'Critères actifs'
);
static $next_orders = array(
if (!$issue) {
$page->kill("La lettre {$nid} n'existe pas.");
}
+
+ if ($issue->isEmpty()) {
+ $page->trigErrorRedirect("La lettre étant vide, il n'est pas possible de l'envoyer.", $nl->adminPrefix());
+ }
+
if (!$issue->scheduleMailing()) {
$page->trigErrorRedirect("Une erreur est survenue lors de la validation de l'envoi.", $nl->adminPrefix());
}
$page->setTitle('Statistiques - Newsletter');
$page->changeTpl('newsletter/statistics.tpl');
+
+ $data = array();
+ foreach (Profile::$cycles as $grade => $name) {
+ $data[$name] = array();
+ list($min, $max) = Profile::extremePromotions($grade);
+ $bound = (((int)($min / 10)) + 1) * 10;
+ while ($bound <= $max) {
+ $data[$name][$min . ' - ' . $bound] = array(
+ 'count' => $nl->subscriberCount(null, null, $grade, $min, $bound),
+ 'lost' => $nl->subscriberCount(true, null, $grade, $min, $bound),
+ 'count_female' => $nl->subscriberCount(null, User::GENDER_FEMALE, $grade, $min, $bound),
+ 'lost_female' => $nl->subscriberCount(true, User::GENDER_FEMALE, $grade, $min, $bound)
+ );
+ $min = $bound + 1;
+ $bound += 10;
+ }
+ $bound -= 9;
+ if ($bound <= $max) {
+ $data[$name][$bound . ' - ' . $max] = array(
+ 'count' => $nl->subscriberCount(null, null, $grade, $bound, $max),
+ 'lost' => $nl->subscriberCount(true, null, $grade, $bound, $max),
+ 'count_female' => $nl->subscriberCount(null, User::GENDER_FEMALE, $grade, $bound, $max),
+ 'lost_female' => $nl->subscriberCount(true, User::GENDER_FEMALE, $grade, $bound, $max)
+ );
+ }
+ }
$page->assign_by_ref('nl', $nl);
+ $page->assign('count', $nl->subscriberCount());
+ $page->assign('lost', $nl->lostSubscriberCount());
+ $page->assign('count_female', $nl->subscriberCount(null, User::GENDER_FEMALE));
+ $page->assign('lost_female', $nl->lostSubscriberCount(User::GENDER_FEMALE));
+ $page->assign('data', $data);
}
}
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8:
?>