X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fxnetgrp.php;h=051b0da218797281992fa62b32d110810f9a4e44;hb=7b4bde3f565265cfe95f8a4ce1f9fec4f028e3fd;hp=0da98ab8159466f6b2974c1f26be0625e571c612;hpb=82f1afdea040757a970bfd9e859a87981c23d4e9;p=platal.git diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index 0da98ab..051b0da 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -1,6 +1,6 @@ $this->make_hook('site', AUTH_PUBLIC), '%grp/edit' => $this->make_hook('edit', AUTH_PASSWD, 'groupadmin'), '%grp/mail' => $this->make_hook('mail', AUTH_PASSWD, 'groupadmin'), - '%grp/forum' => $this->make_hook('forum', AUTH_PASSWD, 'groupmember'), + '%grp/forum' => $this->make_hook('forum', AUTH_PASSWD, 'groupannu'), '%grp/former_users' => $this->make_hook('former_users', AUTH_PASSWD, 'admin'), '%grp/annuaire' => $this->make_hook('annuaire', AUTH_PASSWD, 'groupannu'), '%grp/annuaire/vcard' => $this->make_hook('vcard', AUTH_PASSWD, 'groupmember:groupannu'), @@ -245,6 +245,7 @@ class XnetGrpModule extends PLModule $page->assign('pub', Post::v('pub')); $page->assign('notif_unsub', Post::i('notif_unsub')); $page->assign('descr', Post::t('descr')); + $page->assign('disable_mails', Post::b('disable_mails')); $page->assign('error', $error); return; } @@ -261,7 +262,7 @@ class XnetGrpModule extends PLModule descr={?}, site={?}, mail={?}, resp={?}, forum={?}, mail_domain={?}, ax={?}, axDate = {?}, pub={?}, sub_url={?}, inscriptible={?}, unsub_url={?}, - flags = {?}, welcome_msg = {?} + flags = {?}, welcome_msg = {?}, disable_mails = {?} WHERE id={?}", Post::v('nom'), Post::v('diminutif'), Post::v('cat'), (Post::i('dom') == 0) ? null : Post::i('dom'), @@ -271,6 +272,7 @@ class XnetGrpModule extends PLModule Post::has('ax'), $axDate, Post::v('pub'), Post::v('sub_url'), Post::v('inscriptible'), Post::v('unsub_url'), $flags, Post::t('welcome_msg'), + Post::b('disable_mails'), $globals->asso('id')); if (Post::v('mail_domain')) { XDB::execute('INSERT IGNORE INTO email_virtual_domains (name) @@ -347,11 +349,15 @@ class XnetGrpModule extends PLModule $page->assign('pub', $globals->asso('pub')); $page->assign('notif_unsub', $globals->asso('notif_unsub')); $page->assign('notify_all', $globals->asso('notify_all')); + $page->assign('disable_mails', $globals->asso('disable_mails')); } function handler_mail($page) { global $globals; + if ($globals->asso('disable_mails')) { + return PL_FORBIDDEN; + } $page->changeTpl('xnetgrp/mail.tpl'); $mmlist = new MMList(S::user(), $globals->asso('mail_domain')); @@ -454,12 +460,25 @@ class XnetGrpModule extends PLModule $filename = $globals->asso('diminutif') . '.csv'; } $users = $globals->asso()->getMembersFilter(null, new UFO_Name())->getUsers(); + $admin = may_update(); pl_cached_content_headers('text/x-csv', 'iso-8859-1', 1); - echo utf8_decode("Nom;Prénom;Sexe;Promotion;Commentaire\n"); + echo utf8_decode("Nom;Prénom;Sexe;Promotion;Commentaire"); + if ($admin) { + echo utf8_decode(";Société;Poste\n"); + } else { + echo utf8_decode("\n"); + } foreach ($users as $user) { $line = $user->lastName() . ';' . $user->firstName() . ';' . ($user->isFemale() ? 'F' : 'M') - . ';' . $user->promo() . ';' . strtr($user->group_comm, ';', ','); + . ';' . $user->promo() . ';' . strtr($user->group_comm, ';', ','); + if ($admin) { + if ($user->hasProfile()) { + $line .= ';' . $user->profile()->getMainJob()->company->name . ';' . $user->profile()->getMainJob()->description; + } else { + $line .= ';;'; + } + } echo utf8_decode($line) . "\n"; } exit();