X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fxnetgrp.php;h=3c8861ac0563f113c3865a220e79e384f05aa559;hb=0d49fd8b92774934368ddc1600ea7bf58da183d1;hp=4852cb412ccce00ef28e3645b5807f41eff3f29b;hpb=14bc135e67414e08b7d8c4df59ff5d755d52ad7f;p=platal.git diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index 4852cb4..3c8861a 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -69,7 +69,7 @@ class XnetGrpModule extends PLModule XDB::query('DELETE r.* FROM group_announces_read AS r INNER JOIN group_announces AS a ON (a.id = r.announce_id) - WHERE peremption < CURRENT_DATE()'); + WHERE expiration < CURRENT_DATE()'); XDB::query('INSERT INTO group_announces_read VALUES ({?}, {?})', Env::i('read'), S::i('uid')); @@ -85,25 +85,25 @@ class XnetGrpModule extends PLModule $arts = XDB::iterator("SELECT a.*, FIND_IN_SET('photo', a.flags) AS photo FROM group_announces AS a LEFT JOIN group_announces_read AS r ON (r.uid = {?} AND r.announce_id = a.id) - WHERE asso_id = {?} AND peremption >= CURRENT_DATE() + WHERE asso_id = {?} AND expiration >= CURRENT_DATE() AND (promo_min = 0 OR promo_min <= {?}) AND (promo_max = 0 OR promo_max >= {?}) AND r.announce_id IS NULL - ORDER BY a.peremption", + ORDER BY a.expiration", S::i('uid'), $globals->asso('id'), S::i('promo'), S::i('promo')); - $index = XDB::iterator("SELECT a.id, a.titre, r.user_id IS NULL AS nonlu + $index = XDB::iterator("SELECT a.id, a.titre, r.uid IS NULL AS nonlu FROM group_announces AS a LEFT JOIN group_announces_read AS r ON (a.id = r.announce_id AND r.uid = {?}) - WHERE asso_id = {?} AND peremption >= CURRENT_DATE() + WHERE asso_id = {?} AND expiration >= CURRENT_DATE() AND (promo_min = 0 OR promo_min <= {?}) AND (promo_max = 0 OR promo_max >= {?}) - ORDER BY a.peremption", + ORDER BY a.expiration", S::i('uid'), $globals->asso('id'), S::i('promo'), S::i('promo')); $page->assign('article_index', $index); } else { $arts = XDB::iterator("SELECT *, FIND_IN_SET('photo', flags) AS photo FROM group_announces - WHERE asso_id = {?} AND peremption >= CURRENT_DATE() + WHERE asso_id = {?} AND expiration >= CURRENT_DATE() AND FIND_IN_SET('public', flags)", $globals->asso('id')); } @@ -282,21 +282,20 @@ class XnetGrpModule extends PLModule { global $globals; - if ($action == 'search') { - http_redirect("https://www.polytechnique.org/search/adv?rechercher=Chercher&groupex={$globals->asso('id')}" - . "&cityid=" . Env::v('cityid') . "&mapid=" . Env::v('mapid')); - } else if ($action == 'geoloc' || $action == 'trombi') { - $view = new UserSet(); + if ($action == 'trombi') { + __autoload('userset'); + if ($action == 'trombi') { + $view = new ProfileSet(new UFC_Group($globals->asso('id'))); + } else { + $view = new UserSet(new UFC_Group($globals->asso('id'))); + } $view->addMod('trombi', 'Trombinoscope'); - // TODO: Reactivate when the new map is completed. - // $view->addMod('geoloc', 'Planisphère', false, array('with_annu' => 'annuaire/search')); $view->apply('annuaire', $page, $action, $subaction); - if ($action == 'geoloc' && $subaction) { - return; - } + $page->changeTpl('xnetgrp/annuaire.tpl'); + return; } - $page->changeTpl('xnetgrp/annuaire.tpl'); + $page->changeTpl('xnetgrp/annuaire.tpl'); $sort = Env::s('order', 'directory_name'); $ofs = Env::i('offset'); if ($ofs < 0) { @@ -312,9 +311,9 @@ class XnetGrpModule extends PLModule } if (Env::b('admin')) { - $uf = $globals->asso()->getAdmins(null, $se); + $uf = $globals->asso()->getAdminsFilter(null, $se); } else { - $uf = $globals->asso()->getMembers(null, $se); + $uf = $globals->asso()->getMembersFilter(null, $se); } $users = $uf->getUsers(new PlLimit(NB_PER_PAGE, $ofs * NB_PER_PAGE)); $count = $uf->getTotalCount(); @@ -340,7 +339,7 @@ class XnetGrpModule extends PLModule { global $globals; $vcard = new VCard($photos == 'photos', 'Membre du groupe ' . $globals->asso('nom')); - $vcard->addProfiles($globals->asso()->getMembers()->getProfiles()); + $vcard->addProfiles($globals->asso()->getMembersFilter()->getProfiles()); $vcard->show(); } @@ -350,7 +349,7 @@ class XnetGrpModule extends PLModule if (is_null($filename)) { $filename = $globals->asso('diminutif') . '.csv'; } - $users = $globals->asso()->getMembers(null, new UFO_Name('directory_name'))->getUsers(); + $users = $globals->asso()->getMembersFilter(null, new UFO_Name('directory_name'))->getUsers(); header('Content-Type: text/x-csv; charset=utf-8;'); header('Pragma: '); header('Cache-Control: '); @@ -704,8 +703,9 @@ class XnetGrpModule extends PLModule if ($globals->asso('notif_unsub')) { $mailer = new PlMailer('xnetgrp/unsubscription-notif.mail.tpl'); - foreach ($globals->asso()->getMembers()->getUsers() as $user) { - $mailer->addTo($user); + $admins = $globals->asso()->iterAdmins(); + while ($admin = $admins->next()) { + $mailer->addTo($admin); } $mailer->assign('group', $globals->asso('nom')); $mailer->assign('user', $user); @@ -810,7 +810,7 @@ class XnetGrpModule extends PLModule $page->trigError("Le login $login correspond a plusieurs camarades."); return false; } - $uid = $x[0]['user_id']; + $uid = $x[0]['uid']; $sub = false; } else { list($uid, $login) = $res->fetchOneRow(); @@ -1052,7 +1052,7 @@ class XnetGrpModule extends PLModule $art['prenom'] = S::v('prenom'); $art['promo'] = S::v('promo'); $art['hruid'] = S::user()->login(); - $art['peremption'] = Post::v('peremption'); + $art['expiration'] = Post::v('expiration'); $art['public'] = Post::has('public'); $art['xorg'] = Post::has('xorg'); $art['nl'] = Post::has('nl'); @@ -1116,10 +1116,10 @@ class XnetGrpModule extends PLModule $art['titre'], MiniWiki::wikiToText($fulltext, false, 0, 80)); }*/ XDB::query('INSERT INTO group_announces (uid, asso_id, create_date, titre, texte, contacts, - peremption, promo_min, promo_max, flags, post_id) + expiration, promo_min, promo_max, flags, post_id) VALUES ({?}, {?}, NOW(), {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})', S::i('uid'), $globals->asso('id'), $art['titre'], $art['texte'], $art['contact_html'], - $art['peremption'], $promo_min, $promo_max, $flags, $post); + $art['expiration'], $promo_min, $promo_max, $flags, $post); $aid = XDB::insertId(); if ($art['photo']) { list($imgx, $imgy, $imgtype) = $upload->imageInfo(); @@ -1130,7 +1130,7 @@ class XnetGrpModule extends PLModule if ($art['xorg']) { require_once('validations.inc.php'); $article = new EvtReq("[{$globals->asso('nom')}] " . $art['titre'], $fulltext, - $art['promo_min'], $art['promo_max'], $art['peremption'], "", S::user(), + $art['promo_min'], $art['promo_max'], $art['expiration'], "", S::user(), $upload); $article->submit(); $page->trigWarning("L'affichage sur la page d'accueil de Polytechnique.org est en attente de validation."); @@ -1146,10 +1146,10 @@ class XnetGrpModule extends PLModule } } else { XDB::query('UPDATE group_announces - SET titre = {?}, texte = {?}, contacts = {?}, peremption = {?}, + SET titre = {?}, texte = {?}, contacts = {?}, expiration = {?}, promo_min = {?}, promo_max = {?}, flags = {?} WHERE id = {?} AND asso_id = {?}', - $art['titre'], $art['texte'], $art['contacts'], $art['peremption'], + $art['titre'], $art['texte'], $art['contacts'], $art['expiration'], $promo_min, $promo_max, $flags, $art['id'], $globals->asso('id')); if ($art['photo'] && $upload->exists()) { @@ -1205,10 +1205,10 @@ class XnetGrpModule extends PLModule WHERE id = {?} AND asso_id = {?}', Env::i('del'), $globals->asso('id')); } - $res = XDB::iterator('SELECT id, titre, peremption, peremption < CURRENT_DATE() AS perime + $res = XDB::iterator('SELECT id, titre, expiration, expiration < CURRENT_DATE() AS perime FROM group_announces WHERE asso_id = {?} - ORDER BY peremption DESC', + ORDER BY expiration DESC', $globals->asso('id')); $page->assign('articles', $res); }