From: x2003bruneau Date: Sun, 22 Oct 2006 16:36:32 +0000 (+0000) Subject: Can archive the events (useful to clean %grp/events without deleting the events) X-Git-Tag: xorg/0.9.12~180 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=f02eefd4d0eabc353e9020150c4692b70450c54e;p=platal.git Can archive the events (useful to clean %grp/events without deleting the events) git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1006 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/ChangeLog b/ChangeLog index 9186518..a1c5ba4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,9 @@ New: * Xnet: - Add a vcard of all the members of a group -FRU + * Xnet/Events: + - Events can be archived -FRU + Bug/Wish: * Admin: diff --git a/modules/xnetevents.php b/modules/xnetevents.php index 22b4586..5e3d31b 100644 --- a/modules/xnetevents.php +++ b/modules/xnetevents.php @@ -34,19 +34,35 @@ class XnetEventsModule extends PLModule ); } - function handler_events(&$page) + function handler_events(&$page, $archive = null) { global $globals; - new_group_open_page('xnetevents/index.tpl'); + if ($archive == 'archive') { + $archive = true; + new_groupadmin_page('xnetevents/index.tpl'); + } else { + $archive = false; + new_group_open_page('xnetevents/index.tpl'); + } + $action = null; if (Post::has('del')) { + $action = 'del'; + $eid = Post::v('del'); + } elseif (Post::has('archive')) { + $action = 'archive'; + $eid = Post::v('archive'); + } elseif (Post::has('unarchive')) { + $action = 'unarchive'; + $eid = Post::v('unarchive'); + } + + if (!is_null($action)) { if (!may_update()) { return PL_NOT_ALLOWED; } - $eid = Post::v('del'); - $res = XDB::query("SELECT asso_id, short_name FROM groupex.evenements WHERE eid = {?} AND asso_id = {?}", $eid, $globals->asso('id')); @@ -55,7 +71,9 @@ class XnetEventsModule extends PLModule if (!$tmp) { return PL_NOT_ALLOWED; } + } + if ($action == 'del') { // deletes the event mailing aliases if ($tmp[1]) { XDB::execute( @@ -85,6 +103,21 @@ class XnetEventsModule extends PLModule PayReq::same_event($eid, $globals->asso('id'))); } + if ($action == 'archive') { + XDB::execute("UPDATE groupex.evenements + SET archive = 1 + WHERE eid = {?} AND asso_id = {?}", + $eid, $globals->asso('id')); + } + + if ($action == 'unarchive') { + XDB::execute("UPDATE groupex.evenements + SET archive = 0 + WHERE eid = {?} AND asso_id = {?}", + $eid, $globals->asso('id')); + } + + $page->assign('archive', $archive); $page->assign('admin', may_update()); $evenements = XDB::iterator( @@ -97,7 +130,8 @@ class XnetEventsModule extends PLModule 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 = {?}" + WHERE asso_id = {?} + AND archive = " . ($archive ? "1 " : "0 ") . (is_member() || may_update() ? "" : " AND accept_nonmembre != 0 ") . "GROUP BY e.eid ORDER BY inscr_open DESC, debut DESC", S::v('uid'), $globals->asso('id')); diff --git a/templates/xnetevents/index.tpl b/templates/xnetevents/index.tpl index 2f282d1..54187c9 100644 --- a/templates/xnetevents/index.tpl +++ b/templates/xnetevents/index.tpl @@ -20,9 +20,15 @@ {* *} {**************************************************************************} +{if !$admin}

{$asso.nom} : Evénements

+{else} +

+ {$asso.nom} : + {if $archive}[Evénements] {else}Evénements {/if} + {if $archive}Archives {else}[Archives] {/if} +

-{if $admin}

[Annoncer un nouvel événement]

@@ -45,7 +51,16 @@ [ modifier {icon name=date_edit title="Edition de l'événement"}] -      +   + [ + {if !$archive} + archiver + {icon name=package_add title="Archivage"}] + {else} + désarchiver + {icon name=package_delete title="Désarchivage"}] + {/if} +   [ supprimer diff --git a/upgrade/0.9.12/01_xnet.sql b/upgrade/0.9.12/01_xnet.sql index 81b87e0..62cf075 100644 --- a/upgrade/0.9.12/01_xnet.sql +++ b/upgrade/0.9.12/01_xnet.sql @@ -1,3 +1,4 @@ use groupex; -alter table evenements add accept_nonmembre tinyint(1) default 0; +alter table evenements add column accept_nonmembre tinyint(1) not null default 0; +alter table evenements add column archive tinyint(1) not null default 0; use x4dat;