aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/event_calendar/add_to_group.php1
-rw-r--r--actions/event_calendar/add_to_group_members.php15
-rw-r--r--actions/event_calendar/remove_from_group_members.php15
-rw-r--r--languages/en.php6
-rw-r--r--models/model.php14
-rw-r--r--start.php2
6 files changed, 52 insertions, 1 deletions
diff --git a/actions/event_calendar/add_to_group.php b/actions/event_calendar/add_to_group.php
index b8c18ebb0..b5eae4693 100644
--- a/actions/event_calendar/add_to_group.php
+++ b/actions/event_calendar/add_to_group.php
@@ -8,4 +8,3 @@ if ($group && $group->canEdit()) {
system_message(elgg_echo('event_calendar:add_to_group:success'));
}
forward($event->getUrl());
-?> \ No newline at end of file
diff --git a/actions/event_calendar/add_to_group_members.php b/actions/event_calendar/add_to_group_members.php
new file mode 100644
index 000000000..d0d555b12
--- /dev/null
+++ b/actions/event_calendar/add_to_group_members.php
@@ -0,0 +1,15 @@
+<?php
+elgg_load_library('elgg:event_calendar');
+$event_guid = get_input("event_guid",0);
+$event = get_entity($event_guid);
+$group = get_entity($event->container_guid);
+if (elgg_instanceof($group,'group') && elgg_instanceof($event,'object','event_calendar') && $group->canEdit()) {
+ $members = $group->getMembers(0,0);
+ foreach($members as $member) {
+ event_calendar_add_personal_event($event->guid,$member->guid);
+ }
+ system_message(elgg_echo('event_calendar:add_to_group_members:success'));
+} else {
+ register_error(elgg_echo('event_calendar:add_to_group_members:error'));
+}
+forward("event_calendar/manage_users/$event_guid");
diff --git a/actions/event_calendar/remove_from_group_members.php b/actions/event_calendar/remove_from_group_members.php
new file mode 100644
index 000000000..a15b66c97
--- /dev/null
+++ b/actions/event_calendar/remove_from_group_members.php
@@ -0,0 +1,15 @@
+<?php
+elgg_load_library('elgg:event_calendar');
+$event_guid = get_input("event_guid",0);
+$event = get_entity($event_guid);
+$group = get_entity($event->container_guid);
+if (elgg_instanceof($group,'group') && elgg_instanceof($event,'object','event_calendar') && $group->canEdit()) {
+ $members = $group->getMembers(0,0);
+ foreach($members as $member) {
+ event_calendar_remove_personal_event($event->guid,$member->guid);
+ }
+ system_message(elgg_echo('event_calendar:remove_from_group_members:success'));
+} else {
+ register_error(elgg_echo('event_calendar:remove_from_group_members:error'));
+}
+forward("event_calendar/manage_users/$event_guid");
diff --git a/languages/en.php b/languages/en.php
index 3239e07bc..1155d76ed 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -231,6 +231,12 @@ You can manage calendar requests for this event here:
'event_calendar:manage_users:breadcrumb' => "Manage subscribers",
'event_calendar:manage_users:description' => "You can add or remove events from personal calendars using the buttons below.",
'event_calendar:manage_users:unauthorized' => "Error: you are not authorised to manage personal calendars for this event.",
+ 'event_calendar:add_to_group_members:success' => "This event has been added to the personal calendars of all group members.",
+ 'event_calendar:add_to_group_members:error' => "Error: could not add this event to the personal calendars of group members.",
+ 'event_calendar:remove_from_group_members:success' => "This event has been removed from the personal calendars of all group members.",
+ 'event_calendar:remove_from_group_members:error' => "Error: could not remove this event from the personal calendars of group members.",
+ 'event_calendar:add_to_group_members:button' => "Add to all",
+ 'event_calendar:remove_from_group_members:button' => "Remove from all",
/**
* Event calendar river
diff --git a/models/model.php b/models/model.php
index 378eeacce..51d4fb870 100644
--- a/models/model.php
+++ b/models/model.php
@@ -1556,6 +1556,18 @@ function event_calendar_get_page_content_manage_users($event_guid) {
elgg_push_breadcrumb(elgg_echo('event_calendar:group_breadcrumb'), 'event_calendar/group/'.$event->container_guid);
$users = $event_container->getMembers($limit,$offset);
$count = $event_container->getMembers($limit,$offset,TRUE);
+ elgg_register_menu_item('title', array(
+ 'name' => 'remove_from_group_members',
+ 'href' => elgg_add_action_tokens_to_url('action/event_calendar/remove_from_group_members?event_guid='.$event_guid),
+ 'text' => elgg_echo('event_calendar:remove_from_group_members:button'),
+ 'class' => 'elgg-button elgg-button-action',
+ ));
+ elgg_register_menu_item('title', array(
+ 'name' => 'add_to_group_members',
+ 'href' => elgg_add_action_tokens_to_url('action/event_calendar/add_to_group_members?event_guid='.$event_guid),
+ 'text' => elgg_echo('event_calendar:add_to_group_members:button'),
+ 'class' => 'elgg-button elgg-button-action',
+ ));
} else {
elgg_push_breadcrumb(elgg_echo('event_calendar:show_events_title'),'event_calendar/list');
$users = elgg_get_entities(array('type'=>'user','limit'=>$limit,'offset'=>$offset));
@@ -1635,11 +1647,13 @@ function event_calendar_handle_menu($event_guid) {
if ($event_calendar_personal_manage == 'no') {
$url = "event_calendar/review_requests/$event_guid";
$item = new ElggMenuItem('event-calendar-0review_requests', elgg_echo('event_calendar:review_requests_menu_title'), $url);
+ $item->setSection('event_calendar');
elgg_register_menu_item('page', $item);
//add_submenu_item(elgg_echo('event_calendar:review_requests_title'), $CONFIG->wwwroot . "pg/event_calendar/review_requests/".$event_id, '0eventcalendaradmin');
}
$url = "event_calendar/manage_users/$event_guid";
$item = new ElggMenuItem('event-calendar-1manage_users', elgg_echo('event_calendar:manage_users:breadcrumb'), $url);
+ $item->setSection('event_calendar');
elgg_register_menu_item('page', $item);
}
function event_calendar_get_secret_key() {
diff --git a/start.php b/start.php
index 8baf86a6b..24a100f9f 100644
--- a/start.php
+++ b/start.php
@@ -98,6 +98,8 @@ function event_calendar_init() {
elgg_register_action("event_calendar/addtocalendar","$action_path/addtocalendar.php");
elgg_register_action("event_calendar/add_to_group","$action_path/add_to_group.php");
elgg_register_action("event_calendar/remove_from_group","$action_path/remove_from_group.php");
+ elgg_register_action("event_calendar/add_to_group_members","$action_path/add_to_group_members.php");
+ elgg_register_action("event_calendar/remove_from_group_members","$action_path/remove_from_group_members.php");
}