aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--languages/en.php12
-rw-r--r--models/model.php9
-rw-r--r--start.php29
-rw-r--r--views/default/object/event_calendar.php2
-rw-r--r--views/default/settings/event_calendar/edit.php3
5 files changed, 43 insertions, 12 deletions
diff --git a/languages/en.php b/languages/en.php
index 8c32bd842..da055c6e5 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -75,6 +75,8 @@
'event_calendar:remove_from_my_calendar_response' => "This event has been removed from your personal calendar.",
'event_calendar:add_to_the_calendar' => "Add to calendar",
'event_calendar:remove_from_the_calendar' => "Remove",
+ 'event_calendar:add_to_the_calendar_menu_text' => "Add to mine",
+ 'event_calendar:remove_from_the_calendar_menu_text' => "Remove from mine",
'event_calendar:remove_from_the_calendar_button' => "Remove from calendar",
'event_calendar:added_to_the_calendar' => "Added to calendar",
'event_calendar:removed_from_the_calendar' => "Removed calendar",
@@ -85,7 +87,8 @@
'event_calendar:users_for_event_menu_title' => "People listing this event on their personal calendars",
'event_calendar:users_for_event_title' => "Personal calendars for \"%s'\"",
- 'event_calendar:personal_event_calendars_link' => "Calendars (%s)",
+ 'event_calendar:personal_event_calendars_link' => "On %s calendars",
+ 'event_calendar:personal_event_calendars_link_one' => "On 1 calendar",
'event_calendar:users_for_event_breadcrumb' => "Personal calendars",
'event_calendar:settings:group_profile_display:title' => "Group calendar profile display (if group calendars are enabled)",
'event_calendar:settings:group_profile_display_option:left' => "left column",
@@ -203,7 +206,7 @@ You can manage calendar requests for this event here:
'event_calendar:add_to_group:success' => "Event added to group calendar",
'event_calendar:settings:add_to_group_calendar:title' => "Allow group admins to add any existing event to a group calendar",
- 'event_calendar:group_breadcrumb' => "Group event calendar",
+ 'event_calendar:group_breadcrumb' => "Group calendar",
'event_calendar:no_group' => "There is no such group.",
'event_calendar:generic_error_title' => "Error",
'event_calendar:error_event_edit' => "Error: there is no such event or you do not have permission to edit it.",
@@ -220,6 +223,11 @@ You can manage calendar requests for this event here:
'event_calendar:show_friends' => "My friends' calendars",
'event_calendar:show_only' => "Show only those on:",
+ 'event_calendar:listing_title:all' => "All events",
+ 'event_calendar:listing_title:open' => "Open events",
+ 'event_calendar:listing_title:mine' => "My calendar",
+ 'event_calendar:listing_title:friends' => "Friends' calendars",
+
/**
* Event calendar river
**/
diff --git a/models/model.php b/models/model.php
index dedb69efc..446415e4b 100644
--- a/models/model.php
+++ b/models/model.php
@@ -1099,7 +1099,7 @@ function event_calendar_get_page_content_list($page_type,$container_guid,$start_
global $autofeed;
$autofeed = true;
if ($page_type == 'group') {
- if (!event_calendar_activated_for_group($container__guid)) {
+ if (!event_calendar_activated_for_group($container_guid)) {
forward();
}
elgg_push_breadcrumb(elgg_echo('event_calendar:group_breadcrumb'));
@@ -1150,7 +1150,7 @@ function event_calendar_get_page_content_list($page_type,$container_guid,$start_
));
}
}
- }
+ }
$params = event_calendar_generate_listing_params($page_type,$container_guid,$start_date,$display_mode,$filter,$region);
@@ -1449,8 +1449,10 @@ function event_calendar_generate_listing_params($page_type,$container_guid,$orig
if ($event_calendar_listing_format == 'paged') {
$title = elgg_echo('event_calendar:upcoming_events_title');
+ } else if ($page_type == 'group') {
+ $title = elgg_echo('event_calendar:group'). ' ('.$subtitle.')';
} else {
- $title = elgg_echo('event_calendar:show_events_title'). ' ('.$subtitle.')';
+ $title = elgg_echo('event_calendar:listing_title:'.$filter). ' ('.$subtitle.')';
}
$params = array('title' => $title, 'content' => $content, 'filter_override'=>$filter_override);
@@ -1460,6 +1462,7 @@ function event_calendar_generate_listing_params($page_type,$container_guid,$orig
function event_calendar_get_page_content_view($event_guid) {
// add personal calendar button and links
+ elgg_push_context('event_calendar:view');
$event = get_entity($event_guid);
if (!elgg_instanceof($event, 'object', 'event_calendar')) {
diff --git a/start.php b/start.php
index 54ab6e296..f99c6ceb9 100644
--- a/start.php
+++ b/start.php
@@ -83,6 +83,7 @@ function event_calendar_init() {
// entity menu
elgg_register_plugin_hook_handler('register', 'menu:entity', 'event_calendar_entity_menu_setup');
+ elgg_register_plugin_hook_handler('prepare', 'menu:entity', 'event_calendar_entity_menu_prepare');
// register actions
$action_path = elgg_get_plugins_path() . 'event_calendar/actions/event_calendar';
@@ -271,7 +272,7 @@ function event_calendar_entity_menu_setup($hook, $type, $return, $params) {
if (event_calendar_has_personal_event($entity->guid,$user_guid)) {
$options = array(
'name' => 'personal_calendar',
- 'text' => elgg_echo('event_calendar:remove_from_the_calendar'),
+ 'text' => elgg_echo('event_calendar:remove_from_the_calendar_menu_text'),
'title' => elgg_echo('event_calendar:remove_from_my_calendar'),
'href' => elgg_add_action_tokens_to_url("action/event_calendar/remove_personal?guid={$entity->guid}"),
'priority' => 150,
@@ -281,7 +282,7 @@ function event_calendar_entity_menu_setup($hook, $type, $return, $params) {
if (!event_calendar_is_full($entity->guid) && !event_calendar_has_collision($entity->guid,$user_guid)) {
$options = array(
'name' => 'personal_calendar',
- 'text' => elgg_echo('event_calendar:add_to_the_calendar'),
+ 'text' => elgg_echo('event_calendar:add_to_the_calendar_menu_text'),
'title' => elgg_echo('event_calendar:add_to_my_calendar'),
'href' => elgg_add_action_tokens_to_url("action/event_calendar/add_personal?guid={$entity->guid}"),
'priority' => 150,
@@ -301,9 +302,16 @@ function event_calendar_entity_menu_setup($hook, $type, $return, $params) {
}
}
+ $count = event_calendar_get_users_for_event($entity->guid,0,0,true);
+ if ($count == 1) {
+ $calendar_text = elgg_echo('event_calendar:personal_event_calendars_link_one');
+ } else {
+ $calendar_text = elgg_echo('event_calendar:personal_event_calendars_link',array($count));
+ }
+
$options = array(
'name' => 'calendar_listing',
- 'text' => elgg_echo('event_calendar:personal_event_calendars_link',array(event_calendar_get_users_for_event($entity->guid,0,0,true))),
+ 'text' => $calendar_text,
'title' => elgg_echo('event_calendar:users_for_event_menu_title'),
'href' => "event_calendar/display_users/{$entity->guid}",
'priority' => 150,
@@ -320,3 +328,18 @@ function event_calendar_entity_menu_setup($hook, $type, $return, $params) {
return $return;
}
+
+function event_calendar_entity_menu_prepare($hook, $type, $return, $params) {
+ // remove access level from listings
+ if (!elgg_in_context('event_calendar:view')) {
+ $new_return = array();
+ foreach($return['default'] AS $item) {
+ if ($item->getName() != 'access') {
+ $new_return[] = $item;
+ }
+ }
+ $return['default'] = $new_return;
+ }
+
+ return $return;
+}
diff --git a/views/default/object/event_calendar.php b/views/default/object/event_calendar.php
index c3c18cc92..717e2803e 100644
--- a/views/default/object/event_calendar.php
+++ b/views/default/object/event_calendar.php
@@ -76,7 +76,7 @@ if ($full) {
if (elgg_in_context('widgets')) {
$metadata = '';
- } else {
+ } else {
$metadata = elgg_view_menu('entity', array(
'entity' => $event,
'handler' => 'event_calendar',
diff --git a/views/default/settings/event_calendar/edit.php b/views/default/settings/event_calendar/edit.php
index 9fb025755..54ff5c1c3 100644
--- a/views/default/settings/event_calendar/edit.php
+++ b/views/default/settings/event_calendar/edit.php
@@ -7,8 +7,6 @@ $access_options = array( ACCESS_PRIVATE => elgg_echo("PRIVATE"),
ACCESS_LOGGED_IN => elgg_echo("LOGGED_IN"),
ACCESS_PUBLIC => elgg_echo("PUBLIC"));
-// TODO - merge the agenda view into the list format options
-
$listing_options = array(elgg_echo('event_calendar:settings:paged')=>'paged',
elgg_echo('event_calendar:settings:agenda')=>'agenda',
elgg_echo('event_calendar:settings:month')=>'month',
@@ -373,4 +371,3 @@ $body .= '<br />';
$body .= elgg_view('input/text',array('name'=>'params[ical_auth_file_name]','value'=>$ical_auth_file_name, 'class'=>'event-calendar-ical-auth-setting'));
echo $body;
-?> \ No newline at end of file