diff options
Diffstat (limited to 'start.php')
-rw-r--r-- | start.php | 29 |
1 files changed, 26 insertions, 3 deletions
@@ -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; +} |