diff options
author | Kevin Jardine <kevinjardine@yahoo.com> | 2012-01-25 11:48:15 +0100 |
---|---|---|
committer | Kevin Jardine <kevinjardine@yahoo.com> | 2012-01-25 11:48:15 +0100 |
commit | a62fc25059fb7b67358b285b6d6f3a4a469f35bb (patch) | |
tree | e4d2348ea575613a38dfcf8523ac9bfb4ece3dfb /start.php | |
parent | 2cef39baed704f34c54221301a214f363d2ce65a (diff) | |
download | elgg-a62fc25059fb7b67358b285b6d6f3a4a469f35bb.tar.gz elgg-a62fc25059fb7b67358b285b6d6f3a4a469f35bb.tar.bz2 |
removed calendar entity menu items if no user is logged in
Diffstat (limited to 'start.php')
-rw-r--r-- | start.php | 54 |
1 files changed, 28 insertions, 26 deletions
@@ -274,38 +274,40 @@ function event_calendar_entity_menu_setup($hook, $type, $return, $params) { return $return; } $user_guid = elgg_get_logged_in_user_guid(); - if (event_calendar_personal_can_manage($entity,$user_guid)) { - if (event_calendar_has_personal_event($entity->guid,$user_guid)) { - $options = array( - 'name' => 'personal_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, - ); - $return[] = ElggMenuItem::factory($options); + if ($user_guid) { + if (event_calendar_personal_can_manage($entity,$user_guid)) { + if (event_calendar_has_personal_event($entity->guid,$user_guid)) { + $options = array( + 'name' => 'personal_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, + ); + $return[] = ElggMenuItem::factory($options); + } else { + 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_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, + ); + $return[] = ElggMenuItem::factory($options); } + } } else { - if (!event_calendar_is_full($entity->guid) && !event_calendar_has_collision($entity->guid,$user_guid)) { + if (!event_calendar_has_personal_event($entity->guid,$user_guid) && !check_entity_relationship($user_guid, 'event_calendar_request', $entity->guid)) { $options = array( 'name' => 'personal_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}"), + 'text' => elgg_echo('event_calendar:make_request_title'), + 'title' => elgg_echo('event_calendar:make_request_title'), + 'href' => elgg_add_action_tokens_to_url("action/event_calendar/request_personal_calendar?guid={$entity->guid}"), 'priority' => 150, ); - $return[] = ElggMenuItem::factory($options); } + $return[] = ElggMenuItem::factory($options); + } } - } else { - if (!event_calendar_has_personal_event($entity->guid,$user_guid) && !check_entity_relationship($user_guid, 'event_calendar_request', $entity->guid)) { - $options = array( - 'name' => 'personal_calendar', - 'text' => elgg_echo('event_calendar:make_request_title'), - 'title' => elgg_echo('event_calendar:make_request_title'), - 'href' => elgg_add_action_tokens_to_url("action/event_calendar/request_personal_calendar?guid={$entity->guid}"), - 'priority' => 150, - ); - $return[] = ElggMenuItem::factory($options); - } } $count = event_calendar_get_users_for_event($entity->guid,0,0,true); |