}
// Fetch a set of users from a list of UIDs
- public static function getBulkUsersWithUIDs(array $uids)
+ public static function getBulkUsersWithUIDs(array $data, $orig = null, $dest = null)
{
+ // Fetch the list of uids
+ if (is_null($orig)) {
+ $uids = $data;
+ } else {
+ if (is_null($dest)) {
+ $dest = $orig;
+ }
+ $uids = array();
+ foreach ($data as $key=>$entry) {
+ if (isset($entry[$orig])) {
+ $uids[] = $entry[$orig];
+ }
+ }
+ }
+
+ // Fetch users
if (count($uids) == 0) {
- return array();
+ return $data;
}
$fields = self::loadMainFieldsFromUIDs($uids);
$table = array();
while (($list = $fields->next())) {
$table[$list['uid']] = User::getSilentWithValues(null, $list);
}
- $users = array();
- foreach ($uids as $key=>$uid) {
- $users[$key] = $table[$uid];
+
+ // Build the result with respect to input order.
+ if (is_null($orig)) {
+ $users = array();
+ foreach ($uids as $key=>$uid) {
+ $users[$key] = $table[$uid];
+ }
+ return $users;
+ } else {
+ foreach ($data as $key=>$entry) {
+ if (isset($entry[$orig])) {
+ $entry[$dest] = $table[$entry[$orig]];
+ $data[$key] = $entry;
+ }
+ }
+ return $data;
}
- return $users;
+ }
+
+ public static function getBulkUsersFromDB()
+ {
+ $args = func_get_args();
+ $uids = call_user_func_array(array('XDB', 'fetchColumn'), $args);
+ return self::getBulkUsersWithUIDs($uids);
}
}
if (count($uids) == 0) {
return UserFilterCondition::COND_FALSE;
} else {
- return '$UID IN (' . implode(', ', $uids) . ')';
+ return '$UID IN ' . XDB::formatArray($uids);
}
}
}
} else {
$sube = $uf->addEducationFilter(true, $this->grade);
$field = 'pe' . $sube . '.' . UserFilter::promoYear($this->grade);
- return $field . ' IN (' . implode(', ', $promos) . ')';
+ return $field . ' IN ' . XDB::formatArray($promos);
}
}
}
}
$cond = '';
if (!is_null($uids)) {
- $cond = ' AND a.uid IN (' . implode(', ', $uids) . ')';
+ $cond = ' AND a.uid IN ' . XDB::formatArray($uids);
}
$fetched = XDB::fetchColumn('SELECT SQL_CALC_FOUND_ROWS a.uid
' . $this->query . $cond . '
$table = array();
$uids = array();
foreach ($users as $user) {
- $uids[] = $user->id();
- $table[$user->id()] = $user;
+ if ($user instanceof PlUser) {
+ $uid = $user->id();
+ } else {
+ $uid = $user;
+ }
+ $uids[] = $uid;
+ $table[$uid] = $user;
}
$fetched = $this->getUIDList($uids, $count, $offset);
$output = array();
return new UserFilter(new UFC_And($min, $max));
}
+ static public function sortByName()
+ {
+ return array(new UFO_Name(self::LASTNAME), new UFO_Name(self::FIRSTNAME));
+ }
+
+ static public function sortByPromo()
+ {
+ return array(new UFO_Promo(), new UFO_Name(self::LASTNAME), new UFO_Name(self::FIRSTNAME));
+ }
+
static private function getDBSuffix($string)
{
return preg_replace('/[^a-z0-9]/i', '', $string);
-Subproject commit b5e56a710b4bf25ed7b186c2cb9ea6e822db8fa3
+Subproject commit 0ef5bd4bceb37a6ed6a1afb719d403f25c71ef02
}
$page->assign('archive', $archive);
- $evenements = XDB::iterator(
- "SELECT e.*, LEFT(10, e.debut) AS first_day, LEFT(10, e.fin) AS last_day,
- IF(e.deadline_inscription, e.deadline_inscription >= LEFT(NOW(), 10),
- 1) AS inscr_open, e.deadline_inscription,
- u.nom, u.prenom, u.promo, a.alias,
- MAX(ep.nb) IS NOT NULL AS inscrit, MAX(ep.paid) AS paid
- FROM groupex.evenements AS e
- INNER JOIN x4dat.auth_user_md5 AS u ON u.user_id = e.organisateur_uid
- INNER JOIN x4dat.aliases AS a ON (a.type = 'a_vie' AND a.id = u.user_id)
- LEFT JOIN groupex.evenements_participants AS ep ON (ep.eid = e.eid AND ep.uid = {?})
- WHERE asso_id = {?}
- AND archive = " . ($archive ? "1 " : "0 ")
- . "GROUP BY e.eid
- ORDER BY inscr_open DESC, debut DESC", S::v('uid'), $globals->asso('id'));
+ $evenements = XDB::iterator('SELECT e.*, LEFT(10, e.debut) AS first_day, LEFT(10, e.fin) AS last_day,
+ IF(e.deadline_inscription,
+ e.deadline_inscription >= LEFT(NOW(), 10),
+ 1) AS inscr_open,
+ e.deadline_inscription,
+ MAX(ep.nb) IS NOT NULL AS inscrit, MAX(ep.paid) AS paid
+ FROM groupex.evenements AS e
+ LEFT JOIN groupex.evenements_participants AS ep ON (ep.eid = e.eid AND ep.uid = {?})
+ WHERE asso_id = {?} AND archive = {?}
+ GROUP BY e.eid
+ ORDER BY inscr_open DESC, debut DESC',
+ S::i('uid'), $globals->asso('id'), $archive ? 1 : 0);
$evts = array();
$undisplayed_events = 0;
}
$e['show_participants'] = ($e['show_participants'] && (is_member() || may_update()));
- $res = XDB::query(
- "SELECT titre, details, montant, ei.item_id, nb, ep.paid
- FROM groupex.evenements_items AS ei
- LEFT JOIN groupex.evenements_participants AS ep
- ON (ep.eid = ei.eid AND ep.item_id = ei.item_id AND uid = {?})
- WHERE ei.eid = {?}",
- S::v('uid'), $e['eid']);
- $e['moments'] = $res->fetchAllAssoc();
+ $e['moments'] = XDB::fetchAllAssoc('SELECT titre, details, montant, ei.item_id, nb, ep.paid
+ FROM groupex.evenements_items AS ei
+ LEFT JOIN groupex.evenements_participants AS ep
+ ON (ep.eid = ei.eid AND ep.item_id = ei.item_id AND ep.uid = {?})
+ WHERE ei.eid = {?}',
+ S::i('uid'), $e['eid']);
$e['topay'] = 0;
$e['paid'] = $e['moments'][0]['paid'];
$admin = may_update();
- $tri = (Env::v('order') == 'alpha' ? 'promo, nom, prenom' : 'nom, prenom, promo');
+ $tri = (Env::v('order') == 'alpha' ? UserFilter::sortByPromo() : UserFilter::sortByName());
$page->assign('participants',
get_event_participants($evt, $item_id, $tri));
$page->assign('admin', may_update());
if (may_update()) {
- $page->assign('participants', get_event_participants($evt, null, 'promo, nom, prenom'));
+ $page->assign('participants', get_event_participants($evt, null, UserFilter::sortByPromo()));
}
$page->register_function('display_ical', 'display_ical');
$page->assign_by_ref('e', $evt);
$page->assign('moments', $evt['moments']);
}
- $tri = (Env::v('order') == 'alpha' ? 'promo, nom, prenom' : 'nom, prenom, promo');
- $whereitemid = is_null($item_id) ? '' : "AND ep.item_id = $item_id";
- $res = XDB::iterRow(
- 'SELECT UPPER(SUBSTRING(IF(u.nom IS NULL, m.nom,
- IF(u.nom_usage<>"", u.nom_usage, u.nom)), 1, 1)),
- COUNT(DISTINCT ep.uid)
- FROM groupex.evenements_participants AS ep
- INNER JOIN groupex.evenements AS e ON (ep.eid = e.eid)
- LEFT JOIN groupex.membres AS m ON ( ep.uid = m.uid AND e.asso_id = m.asso_id)
- LEFT JOIN auth_user_md5 AS u ON ( u.user_id = ep.uid )
- WHERE ep.eid = {?} '.$whereitemid . '
- GROUP BY UPPER(SUBSTRING(IF(u.nom IS NULL,m.nom,u.nom), 1, 1))', $evt['eid']);
-
- $alphabet = array();
- $nb_tot = 0;
- while (list($char, $nb) = $res->next()) {
- $alphabet[ord($char)] = $char;
- $nb_tot += $nb;
- if (Env::has('initiale') && $char == strtoupper(Env::v('initiale'))) {
- $tot = $nb;
- }
- }
- ksort($alphabet);
- $page->assign('alphabet', $alphabet);
-
+ $page->assign('alphabet', array());
if ($evt['paiement_id']) {
- $res = XDB::iterator(
- "SELECT IF(u.nom_usage<>'', u.nom_usage, u.nom) AS nom, u.prenom,
- u.promo, a.alias AS email, t.montant
- FROM {$globals->money->mpay_tprefix}transactions AS t
- INNER JOIN auth_user_md5 AS u ON(t.uid = u.user_id)
- INNER JOIN aliases AS a ON (a.id = t.uid AND a.type='a_vie' )
- LEFT JOIN groupex.evenements_participants AS ep ON(ep.uid = t.uid AND ep.eid = {?})
- WHERE t.ref = {?} AND ep.uid IS NULL",
- $evt['eid'], $evt['paiement_id']);
- $page->assign('oublis', $res->total());
- $page->assign('oubliinscription', $res);
- }
-
- $absents = XDB::iterator("SELECT p.uid,
- IF(m.origine = 'X', IF(u.nom_usage != '', u.nom_usage, u.nom), m.nom) AS nom,
- IF(m.origine = 'X', u.prenom, u.prenom) AS prenom,
- IF(m.origine = 'X', u.promo, m.origine) AS promo,
- IF(m.origine = 'X', FIND_IN_SET('femme', u.flags), m.sexe) AS sexe,
- IF(m.origine = 'X', a.alias, m.email) AS email
- FROM groupex.evenements_participants AS p
- INNER JOIN groupex.membres AS m USING(uid)
- LEFT JOIN groupex.evenements_participants AS p2 ON (p2.uid = m.uid AND p2.eid = p.eid
- AND p2.nb != 0)
- LEFT JOIN auth_user_md5 AS u ON (u.user_id = m.uid)
- LEFT JOIN aliases AS a ON (a.id = u.user_id AND a.type = 'a_vie')
- WHERE p.eid = {?} AND p2.eid IS NULL
- " . (Env::v('initiale') ? " AND IF(u.nom IS NULL, m.nom,
- IF(u.nom_usage<>'', u.nom_usage, u.nom)) LIKE '" . Env::v('initiale') . "%'"
- : "") . "
- GROUP BY m.uid
- ORDER BY nom, prenom, promo", $evt['eid']);
+ $infos = User::getBulkUsersWithUIDs(
+ XDB::fetchAllAssoc('SELECT t.uid, t.montant
+ FROM ' . $globals->money->mpay_tprefix . 'transactions AS t
+ LEFT JOIN groupex.evenements_participants AS ep ON(ep.uid = t.uid AND ep.eid = {?})
+ WHERE t.ref = {?} AND ep.uid IS NULL',
+ $evt['eid'], $evt['paiement_id']),
+ 'uid', 'user');
+ $page->assign('oublis', count($infos));
+ $page->assign('oubliinscription', $infos);
+ }
+
+ $absents = User::getBulkUsersFromDB('SELECT p.uid
+ FROM groupex.evenements_participants AS p
+ LEFT JOIN groupex.evenements_participants AS p2 ON (p2.uid = p.uid
+ AND p2.eid = p.eid
+ AND p2.nb != 0)
+ WHERE p.eid = {?} AND p2.eid IS NULL
+ GROUP BY p.uid', $evt['eid']);
$ofs = Env::i('offset');
$tot = (Env::v('initiale') ? $tot : $nb_tot);
$page->assign('links', $links);
}
-
$page->assign('absents', $absents);
$page->assign('participants',
- get_event_participants($evt, $item_id, $tri,
- "LIMIT ".($ofs*NB_PER_PAGE).", ".NB_PER_PAGE));
+ get_event_participants($evt, $item_id, UserFilter::sortByName(),
+ NB_PER_PAGE, $ofs * NB_PER_PAGE));
}
}
if (is_null($asso_id)) {
$asso_id = $globals->asso('id');
}
- $res = XDB::query(
- "SELECT SUM(nb) AS nb_tot, COUNT(DISTINCT ep.uid) AS nb, e.*,
- IF(e.deadline_inscription, e.deadline_inscription >= LEFT(NOW(), 10),
- 1) AS inscr_open,
- LEFT(10, e.debut) AS start_day, LEFT(10, e.fin) AS last_day,
- LEFT(NOW(), 10) AS now,
- ei.titre,
- al.vid AS absent_list, pl.vid AS participant_list,
- a.nom, a.prenom, a.promo, aa.alias
- FROM groupex.evenements AS e
- INNER JOIN x4dat.auth_user_md5 AS a ON a.user_id = e.organisateur_uid
- INNER JOIN x4dat.aliases AS aa ON (aa.type = 'a_vie' AND aa.id = a.user_id)
- INNER JOIN groupex.evenements_items AS ei ON (e.eid = ei.eid)
- LEFT JOIN groupex.evenements_participants AS ep ON(e.eid = ep.eid AND ei.item_id = ep.item_id)
- LEFT JOIN virtual AS al ON(al.type = 'evt' AND al.alias = CONCAT(short_name, {?}))
- LEFT JOIN virtual AS pl ON(pl.type = 'evt' AND pl.alias = CONCAT(short_name, {?}))
- WHERE (e.eid = {?} OR e.short_name = {?}) AND ei.item_id = {?} AND e.asso_id = {?}
- GROUP BY ei.item_id",
- '-absents@'.$globals->xnet->evts_domain,
- '-participants@'.$globals->xnet->evts_domain,
- $eid, $eid, $item_id ? $item_id : 1, $asso_id);
-
+ $res = XDB::query('SELECT SUM(nb) AS nb_tot, COUNT(DISTINCT ep.uid) AS nb, e.*,
+ IF(e.deadline_inscription,
+ e.deadline_inscription >= LEFT(NOW(), 10),
+ 1) AS inscr_open,
+ LEFT(10, e.debut) AS start_day, LEFT(10, e.fin) AS last_day,
+ LEFT(NOW(), 10) AS now,
+ ei.titre, al.vid AS absent_list, pl.vid AS participant_list
+ FROM groupex.evenements AS e
+ INNER JOIN groupex.evenements_items AS ei ON (e.eid = ei.eid)
+ LEFT JOIN groupex.evenements_participants AS ep ON(e.eid = ep.eid AND ei.item_id = ep.item_id)
+ LEFT JOIN virtual AS al ON(al.type = \'evt\' AND al.alias = CONCAT(short_name, {?}))
+ LEFT JOIN virtual AS pl ON(pl.type = \'evt\' AND pl.alias = CONCAT(short_name, {?}))
+ WHERE (e.eid = {?} OR e.short_name = {?}) AND ei.item_id = {?} AND e.asso_id = {?}
+ GROUP BY ei.item_id',
+ '-absents@'.$globals->xnet->evts_domain,
+ '-participants@'.$globals->xnet->evts_domain,
+ $eid, $eid, $item_id ? $item_id : 1, $asso_id);
$evt = $res->fetchOneAssoc();
if (!$evt) {
// smart calculation of the total number
if (!$item_id) {
- $res = XDB::query(
- "SELECT MAX(nb)
- FROM groupex.evenements AS e
- INNER JOIN groupex.evenements_items AS ei ON (e.eid = ei.eid)
- LEFT JOIN groupex.evenements_participants AS ep
- ON (e.eid = ep.eid AND ei.item_id = ep.item_id)
- WHERE e.eid = {?}
- GROUP BY ep.uid", $evt['eid']);
+ $res = XDB::query('SELECT MAX(nb)
+ FROM groupex.evenements AS e
+ INNER JOIN groupex.evenements_items AS ei ON (e.eid = ei.eid)
+ LEFT JOIN groupex.evenements_participants AS ep ON (e.eid = ep.eid AND ei.item_id = ep.item_id)
+ WHERE e.eid = {?}
+ GROUP BY ep.uid', $evt['eid']);
$evt['nb_tot'] = array_sum($res->fetchColumn());
$evt['titre'] = '';
$evt['item_id'] = 0;
}
- $res = XDB::query(
- "SELECT titre, details, montant, ei.item_id, nb, ep.paid, FIND_IN_SET('notify_payment', ep.flags) AS notify_payment
- FROM groupex.evenements_items AS ei
- LEFT JOIN groupex.evenements_participants AS ep
- ON (ep.eid = ei.eid AND ep.item_id = ei.item_id AND uid = {?})
- WHERE ei.eid = {?}",
- S::v('uid'), $evt['eid']);
- $evt['moments'] = $res->fetchAllAssoc();
-
+ $evt['moments'] = XDB::fetchAllAssoc('SELECT titre, details, montant, ei.item_id, nb,
+ ep.paid, FIND_IN_SET(\'notify_payment\', ep.flags) AS notify_payment
+ FROM groupex.evenements_items AS ei
+ LEFT JOIN groupex.evenements_participants AS ep ON (ep.eid = ei.eid AND ep.item_id = ei.item_id
+ AND uid = {?})
+ WHERE ei.eid = {?}',
+ S::i('uid'), $evt['eid']);
$evt['topay'] = 0;
$evt['paid'] = 0;
$evt['notify_payment'] = false;
$evt['notify_payment'] = $evt['notify_payment'] || $m['notify_payment'];
}
- $req = XDB::query(
- "SELECT montant
- FROM {$globals->money->mpay_tprefix}transactions AS t
- WHERE ref = {?} AND uid = {?}", $evt['paiement_id'], S::v('uid'));
- $montants = $req->fetchColumn();
-
+ $montants = XDB::fetchColumn('SELECT montant
+ FROM ' . $globals->money->mpay_tprefix . 'transactions AS t
+ WHERE ref = {?} AND uid = {?}',
+ $evt['paiement_id'], S::v('uid'));
$evt['telepaid'] = 0;
foreach ($montants as $m) {
$p = strtr(substr($m, 0, strpos($m, 'EUR')), ',', '.');
// }}}
// {{{ function get_event_participants()
-function get_event_participants(&$evt, $item_id, $tri, $limit = '') {
+function get_event_participants(&$evt, $item_id, array $tri = array(), $count = null, $offset = null)
+{
global $globals;
- if (Env::has('initiale')) {
- $where = 'AND IF(u.nom IS NULL, m.nom,
- IF(u.nom_usage<>"", u.nom_usage, u.nom))
- LIKE "'.addslashes(Env::v('initiale')).'%"';
- } else {
- $where = '';
- }
-
$eid = $evt['eid'];
$money = $evt['money'] && (function_exists('may_update')) && may_update();
$pay_id = $evt['paiement_id'];
- $query =
- "SELECT IF(m.origine != 'X',m.nom,IF(u.nom_usage<>'', u.nom_usage, u.nom)) AS nom,
- IF(m.origine != 'X',m.prenom,u.prenom) AS prenom,
- IF(m.origine != 'X','extérieur',u.promo) AS promo,
- IF(m.origine != 'X' OR u.perms = 'pending',m.email,a.alias) AS email,
- IF(m.origine != 'X',m.sexe,FIND_IN_SET('femme', u.flags)) AS femme,
- m.perms='admin' AS admin,
- (m.origine = 'X' OR m.origine IS NULL) AS x,
- ep.uid, SUM(ep.paid) AS paid, SUM(ep.nb) AS nb,
- FIND_IN_SET('notify_payment', ep.flags) AS notify_payment
- FROM groupex.evenements_participants AS ep
- INNER JOIN groupex.evenements AS e ON (ep.eid = e.eid)
- LEFT JOIN groupex.membres AS m ON ( ep.uid = m.uid AND e.asso_id = m.asso_id)
- LEFT JOIN auth_user_md5 AS u ON ( u.user_id = ep.uid )
- LEFT JOIN aliases AS a ON ( a.id = ep.uid AND a.type='a_vie' )
- WHERE ep.eid = {?}
- ".(($item_id)?" AND item_id = $item_id":"")."
- $where
- GROUP BY ep.uid
- ORDER BY $tri $limit";
+ $append = $item_id ? XDB::foramt(' AND ep.item_id = {?}', $item_id) : '';
+ $query = XDB::fetchAllAssoc('uid', 'SELECT ep.uid, SUM(ep.paid) AS paid, SUM(ep.nb) AS nb,
+ FIND_IN_SET(\'notify_payment\', ep.flags) AS notify_payment
+ FROM groupex.evenements_participants AS ep
+ WHERE ep.eid = {?} AND nb > 0 ' . $append . '
+ GROUP BY ep.uid', $eid);
+ $uf = new UserFilter(new UFC_True(), $tri);
+ $users = User::getBulkUsersWithUIDs($uf->filter(array_keys($query), $count, $offset));
+ $tab = array();
+ foreach ($users as $user) {
+ $uid = $user->id();
+ $tab[$uid] = $query[$uid];
+ $tab[$uid]['user'] = $user;
+ }
if ($item_id) {
- $res = XDB::query($query, $eid);
- return $res->fetchAllAssoc();
+ return $tab;
}
- $res = XDB::iterator($query, $eid);
- $tab = array();
- $user = 0;
-
$evt['adminpaid'] = 0;
$evt['telepaid'] = 0;
$evt['topay'] = 0;
$evt['paid'] = 0;
- while ($u = $res->next()) {
- if ($u['nb'] == 0) {
- continue;
- }
+ foreach ($tab as $uid=>&$u) {
$u['adminpaid'] = $u['paid'];
$u['montant'] = 0;
if ($money && $pay_id) {
- $res_ = XDB::query(
- "SELECT montant
- FROM {$globals->money->mpay_tprefix}transactions AS t
- WHERE ref = {?} AND uid = {?}",
- $pay_id, $u['uid']);
- $montants = $res_->fetchColumn();
+ $montants = XDB::fetchColumn('SELECT montant
+ FROM ' . $globals->money->mpay_tprefix . 'transactions AS t
+ WHERE ref = {?} AND uid = {?}',
+ $pay_id, $uid);
foreach ($montants as $m) {
$p = strtr(substr($m, 0, strpos($m, "EUR")), ",", ".");
$u['paid'] += trim($p);
}
}
$u['telepayment'] = $u['paid'] - $u['adminpaid'];
- $res_ = XDB::iterator(
- "SELECT ep.nb, ep.item_id, ei.montant
- FROM groupex.evenements_participants AS ep
- INNER JOIN groupex.evenements_items AS ei ON (ei.eid = ep.eid AND ei.item_id = ep.item_id)
- WHERE ep.eid = {?} AND ep.uid = {?}",
- $eid, $u['uid']);
+ $res_ = XDB::iterator('SELECT ep.nb, ep.item_id, ei.montant
+ FROM groupex.evenements_participants AS ep
+ INNER JOIN groupex.evenements_items AS ei ON (ei.eid = ep.eid AND ei.item_id = ep.item_id)
+ WHERE ep.eid = {?} AND ep.uid = {?}',
+ $eid, $uid);
while ($i = $res_->next()) {
$u[$i['item_id']] = $i['nb'];
$u['montant'] += $i['montant']*$i['nb'];
}
- $tab[] = $u;
$evt['telepaid'] += $u['telepayment'];
$evt['adminpaid'] += $u['adminpaid'];
$evt['paid'] += $u['paid'];
$new.'-participants@'.$globals->xnet->evts_domain);
$lastid = XDB::insertId();
- XDB::execute(
- "INSERT IGNORE INTO virtual_redirect (
- SELECT {?} AS vid, IF(u.nom IS NULL, m.email, CONCAT(a.alias, {?})) AS redirect
- FROM groupex.evenements_participants AS ep
- LEFT JOIN groupex.membres AS m ON (ep.uid = m.uid)
- LEFT JOIN auth_user_md5 AS u ON (u.user_id = ep.uid)
- LEFT JOIN aliases AS a ON (a.id = ep.uid AND a.type = 'a_vie')
- WHERE ep.eid = {?} AND ep.nb > 0
- GROUP BY ep.uid)",
+ XDB::execute('INSERT IGNORE INTO virtual_redirect (
+ SELECT {?} AS vid, IF(al.alias IS NULL, a.email, CONCAT(al.alias, {?})) AS redirect
+ FROM groupex.evenements_participants AS ep
+ LEFT JOIN accounts AS a ON (ep.uid = a.uid)
+ LEFT JOIN aliases AS al ON (al.id = a.uid AND al.type = \'a_vie\')
+ WHERE ep.eid = {?} AND ep.nb > 0
+ GROUP BY ep.uid)',
$lastid, '@'.$globals->mail->domain, $eid);
XDB::execute("INSERT INTO virtual SET type = 'evt', alias = {?}",
$new.'-absents@'.$globals->xnet->evts_domain);
$lastid = XDB::insertId();
- XDB::execute("INSERT IGNORE INTO virtual_redirect (
- SELECT {?} AS vid, IF(a.alias IS NULL, m.email, CONCAT(a.alias, {?})) AS redirect
- FROM groupex.membres AS m
- LEFT JOIN groupex.evenements_participants AS ep ON (ep.uid = m.uid AND ep.eid = {?})
- LEFT JOIN auth_user_md5 AS u ON (u.user_id = m.uid)
- LEFT JOIN aliases AS a ON (a.id = m.uid AND a.type = 'a_vie')
- WHERE m.asso_id = {?} AND ep.uid IS NULL
- GROUP BY m.uid)",
+ XDB::execute("INSERT IGNORE INTO virtual_redirect (
+ SELECT {?} AS vid, IF(al.alias IS NULL, a.email, CONCAT(al.alias, {?})) AS redirect
+ FROM groupex.membres AS m
+ LEFT JOIN groupex.evenements_participants AS ep ON (ep.uid = m.uid AND ep.eid = {?})
+ LEFT JOIN accounts AS a ON (a.uid = m.uid)
+ LEFT JOIN aliases AS al ON (al.id = a.uid AND al.type = 'a_vie')
+ WHERE m.asso_id = {?} AND ep.uid IS NULL
+ GROUP BY m.uid)",
$lastid, "@".$globals->mail->domain, $eid, $globals->asso('id'));
return $new;
{
$start = strtotime($e['debut']);
$end = strtotime($e['fin']);
- $first_day = strtotime($e['first_day']);
+ $first_day = @strtotime($e['first_day']);
$last_day = strtotime($e['last_day']);
unset($e['debut'], $e['fin'], $e['first_day'], $e['last_day']);
{iterate from=$oubliinscription item=m}
<tr class="pair">
<td>
- <a href="" {if $is_admin}onclick="return remplitAuto('{$m.email}')"{/if}>
- {if !$m.prenom && !$m.nom}
- {$m.email}
- {else}
- {$m.prenom} {$m.nom}
- {/if}
+ <a href="" {if $is_admin}onclick="return remplitAuto('{$m.user->login()}')"{/if}>
+ {profile user=$m.user link=false}
</a>
</td>
- <td>{$m.promo}</td>
+ <td>{$m.user->promo()}</td>
<td>
- <a href="https://www.polytechnique.org/profile/{$m.email}">{icon name=user_suit title="fiche"}</a>
- <a href="https://www.polytechnique.org/vcard/{$m.email}.vcf">{icon name=vcard title="vcard"}</a>
- <a href="mailto:{$m.email}@{#globals.mail.domain#}">{icon name=email title="email"}</a>
+ <a href="https://www.polytechnique.org/profile/{$m.user->login()}">{icon name=user_suit title="fiche"}</a>
+ <a href="https://www.polytechnique.org/vcard/{$m.user->login()}.vcf">{icon name=vcard title="vcard"}</a>
+ <a href="mailto:{$m.user->bestEmail()}">{icon name=email title="email"}</a>
</td>
<td>{$m.montant}</td>
</tr>
{foreach from=$participants item=m}
<tr>
<td>
- {if $is_admin}<a href="javascript:remplitAuto('{$m.email}')">{/if}
- {if $m.femme}•{/if}{if !$m.prenom && !$m.nom}{$m.email}{else}{$m.prenom} {$m.nom}{/if}
+ {if $is_admin}<a href="javascript:remplitAuto('{$m.user->login()}')">{/if}
+ {profile user=$m.user promo=false link=false}
{if $is_admin}</a>{/if}
</td>
- <td>{$m.promo}</td>
+ <td>{$m.user->promo()}</td>
<td>
- {if $m.x}
- <a href="https://www.polytechnique.org/profile/{$m.email}">{icon name=user_suit title="fiche"}</a>
- <a href="https://www.polytechnique.org/vcard/{$m.email}.vcf">{icon name=vcard title="vcard"}</a>
- <a href="mailto:{$m.email}@{#globals.mail.domain#}">{icon name=email title="email"}</a>
+ {if $m.user->hasProfile()}
+ <a href="https://www.polytechnique.org/profile/{$m.user->login()}">{icon name=user_suit title="fiche"}</a>
+ <a href="https://www.polytechnique.org/vcard/{$m.user->login()}.vcf">{icon name=vcard title="vcard"}</a>
+ <a href="mailto:{$m.user->bestEmail()}">{icon name=email title="email"}</a>
{else}
- <a href="mailto:{$m.email}">{icon name=email title="email"}</a>
+ <a href="mailto:{$m.user->bestEmail()}">{icon name=email title="email"}</a>
{/if}
</td>
{if $tout}
{/foreach}
</p>
-{if $absents->total()}
+{if $absents|@count}
<hr />
<table class="tinybicol">
<tr><th>Prénom NOM</th><th>Origine</th></tr>
- {iterate from=$absents item=m}
+ {foreach from=$absents item=m}
<tr>
<td>
- {if $is_admin}<a href="javascript:remplitAuto('{$m.email}')">{/if}
- {if $m.sexe}•{/if}{$m.prenom} {$m.nom}
+ {if $is_admin}<a href="javascript:remplitAuto('{$m->login()}')">{/if}
+ {profile user=$m link=false promo=false}
{if $is_admin}</a>{/if}
</td>
<td>
- {$m.promo}
+ {$m->promo()}
</td>
</tr>
- {/iterate}
+ {/foreach}
</table>
{/if}
{foreach from=$participants item=m}
;
-{$m.nom};{$m.prenom};{$m.promo}{if $tout}{foreach from=$moments item=i};{$m[$i.item_id]}{/foreach}{if $admin &&
+{$m.user->lastName()};{$m.user->firstName()};{$m.user->promo()}{if $tout}{foreach from=$moments item=i};{$m[$i.item_id]}{/foreach}{if $admin &&
$money};{$m.montant};{if $telepayment}{$m.telepayment};{$m.adminpaid};{/if}{$m.paid}{/if}{else};{$m.nb}{/if}
{/foreach}
<tr>
<td class="titre">Annonceur :</td>
- <td>
- <a href='https://www.polytechnique.org/profile/{$e.alias}' class='popup2'>{$e.prenom} {$e.nom} ({$e.promo})</a>
- </td>
+ <td>{profile user=$e.organisateur_uid promo=true groupperms=false}</td>
</tr>
{if $is_admin || $e.show_participants || ($e.deadline_inscription && $e.inscr_open)}