aboutsummaryrefslogtreecommitdiff
path: root/start.php
diff options
context:
space:
mode:
authorKevin Jardine <kevinjardine@yahoo.com>2011-10-05 16:27:50 +0200
committerKevin Jardine <kevinjardine@yahoo.com>2011-10-05 16:27:50 +0200
commit934e73de5c3835e40d9154a4cd2b85434b5f4565 (patch)
treefceda9ae0abd4b80877ec2d0ee72d911b8de84fe /start.php
parente31ddb848d0aa949d8ca737c0acd92abce004ece (diff)
downloadelgg-934e73de5c3835e40d9154a4cd2b85434b5f4565.tar.gz
elgg-934e73de5c3835e40d9154a4cd2b85434b5f4565.tar.bz2
removed access levels from listing view and revised some text
Diffstat (limited to 'start.php')
-rw-r--r--start.php29
1 files changed, 26 insertions, 3 deletions
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;
+}