示例#1
0
		
    // Output as a download file (some automatic fields are merged here)
    $TBS->Show(OPENTBS_DOWNLOAD+TBS_EXIT, 'abs_notif_'.$notification->getId().'.odt');
    die();

} else if ($notification->getTypeNotification() == AbsenceEleveNotificationPeer::TYPE_NOTIFICATION_EMAIL) {
    // Load the template
    $email=repertoire_modeles('absence_email.txt');
    include_once '../orm/helpers/AbsencesNotificationHelper.php';
    $TBS = AbsencesNotificationHelper::MergeNotification($notification, $email);
    $message = $TBS->Source;

    $retour_envoi = AbsencesNotificationHelper::EnvoiNotification($notification, $message);

} else if ($notification->getTypeNotification() == AbsenceEleveNotificationPeer::TYPE_NOTIFICATION_SMS) {
    // Load the template
    $sms=repertoire_modeles('absence_sms.txt');
    include_once '../orm/helpers/AbsencesNotificationHelper.php';
    $TBS = AbsencesNotificationHelper::MergeNotification($notification, $sms);
    $message = $TBS->Source;

    $retour_envoi = AbsencesNotificationHelper::EnvoiNotification($notification, $message);
}
if ($notification->getStatutEnvoi() == AbsenceEleveNotificationPeer::STATUT_ENVOI_SUCCES) {
    $message_enregistrement = 'Envoi réussi. '.$retour_envoi;
} else {
    $message_enregistrement = 'Échec de l\'envoi. '.$retour_envoi;
}
include('visu_notification.php');
?>
    echo '<a href="liste_notifications.php">liste des notifications</a>';
    die;
}

//
//on envoi les emails
//
$nb_mail_envoyés = 0;
if (isset($_GET['envoyer_email']) && $_GET['envoyer_email'] == 'true') {
    // Load the template
    include_once 'lib/function.php';
    $email_modele=repertoire_modeles('absence_email.txt');
    include_once '../orm/helpers/AbsencesNotificationHelper.php';
    foreach($notifications_col as $notif) {
	$TBS = AbsencesNotificationHelper::MergeNotification($notif, $email_modele);
	$retour_envoi = AbsencesNotificationHelper::EnvoiNotification($notif, $TBS->Source);
	if ($retour_envoi == '') {
	    $nb_mail_envoyés = $nb_mail_envoyés + 1;
	}
    }
    echo 'Mail envoyés : '.$nb_mail_envoyés.'<br/>';
}
//
//on affiche les notifications de type email
//
$notif_mail_a_envoyer_col = new PropelCollection();
$notif_mail_fini_col = new PropelCollection();
foreach($notifications_col as $notif) {
    if ($notif->getTypeNotification() == AbsenceEleveNotificationPeer::TYPE_NOTIFICATION_EMAIL) {
	if ($notif->getStatutEnvoi() == AbsenceEleveNotificationPeer::STATUT_ENVOI_ETAT_INITIAL || $notif->getStatutEnvoi() == AbsenceEleveNotificationPeer::STATUT_ENVOI_PRET_A_ENVOYER) {
	    $notif_mail_a_envoyer_col->add($notif);