<?php
/***************************************************************************
- * Copyright (C) 2003-2009 Polytechnique.org *
+ * Copyright (C) 2003-2010 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
}
$matricule = $user->profile()->xorg_id;
- require_once('user.func.inc.php');
- $matricule_X = get_X_mat($matricule);
+ $matricule_X = Profile::getSchoolId($matricule);
$page->assign('full_name', $user->fullName());
$page->assign('promo', $user->promo());
$res = XDB::iterator(
"SELECT r.*, a.alias
FROM register_marketing AS r
- LEFT JOIN aliases AS a ON (r.sender=a.id AND a.type = 'a_vie')
- WHERE uid={?}
+ LEFT JOIN aliases AS a ON (r.sender = a.uid AND a.type = 'a_vie')
+ WHERE r.uid = {?}
ORDER BY date", $user->id());
$page->assign('addr', $res);
}
$page->assign('promo', $promo);
- $uf = new UserFilter(new UFC_And(new UFC_Promo('=', UserFilter::DISPLAY, $promo),
- new UFC_Not(new UFC_Registered())),
- array(new UFO_Name(UserFilter::LASTNAME), new UFO_Name(UserFilter::FIRSTNAME)));
+ $uf = new UserFilter(new PFC_And(new UFC_Promo('=', UserFilter::DISPLAY, $promo),
+ new PFC_Not(new UFC_Registered())),
+ array(new UFO_Name(Profile::LASTNAME), new UFO_Name(Profile::FIRSTNAME)));
$users = $uf->getUsers();
$page->assign('nonins', $users);
}
require_once 'emails.inc.php';
if (!isvalid_email_redirection($email)) {
- $page->trigError("Email invalide !");
+ $page->trigError('Email invalide !');
} else {
// On cherche les marketings précédents sur cette adresse
// email, en se restreignant au dernier mois
} else {
$page->assign('ok', true);
check_email($email, "Une adresse surveillée est proposée au marketing par " . S::user()->login());
- $market = new Marketing($user->id(), $email, 'default', null, Post::v('origine'), S::v('uid'));
+ $market = new Marketing($user->id(), $email, 'default', null, Post::v('origine'), S::v('uid'),
+ Post::v('origine') == 'user' ? Post::v('personal_notes') : null);
$market->add();
}
}
+ } else {
+ global $globals;
+ require_once 'marketing.inc.php';
+
+ $sender = User::getSilent(S::v('uid'));
+ $market = new AnnuaireMarketing(null, true);
+ $text = $market->getText(array(
+ 'sexe' => $user->isFemale(),
+ 'forlife_email' => $user->login() . '@' . $globals->mail->domain,
+ 'forlife_email2' => $user->login() . '@' . $globals->mail->domain2
+ ));
+ $text = str_replace('%%hash%%', '', $text);
+ $text = str_replace('%%personal_notes%%', '<em id="personal_notes_display"></em>', $text);
+ $text = str_replace('%%sender%%',
+ "<span id=\"sender\">" . $sender->fullName() . '</span>', $text);
+ $page->assign('text', nl2br($text));
+ // TODO (JAC): define a unique Xorg signature for all the emails we send.
+ $page->assign('xorg_signature', "L'équipe de Polytechnique.org,<br />Le portail des élèves & anciens élèves de l'École polytechnique");
+ $page->assign('perso_signature', $sender->fullName());
}
}