From e40bd05afc559335bc9b326f4ae2400043104818 Mon Sep 17 00:00:00 2001 From: Kevin Jardine Date: Wed, 19 Oct 2011 11:23:52 +0200 Subject: fixes personal calendar toggle bug and adds the ability to add any site member to a site event and any group member to a group event --- views/default/event_calendar/calendar_toggle.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'views/default') diff --git a/views/default/event_calendar/calendar_toggle.php b/views/default/event_calendar/calendar_toggle.php index 7180dec75..30de15cf2 100644 --- a/views/default/event_calendar/calendar_toggle.php +++ b/views/default/event_calendar/calendar_toggle.php @@ -2,19 +2,17 @@ $event = $vars['event_calendar_event']; $user = $vars['entity']; $container = get_entity($event->container_guid); +if (event_calendar_has_personal_event($event->guid, $user->guid)) { + $label = elgg_echo('event_calendar:remove_from_the_calendar_button'); +} else { + $label = elgg_echo('event_calendar:add_to_the_calendar'); +} -if ($container->canEdit()) { - $link = '

guid.','.$vars['entity']->guid.'); return false;" '; - $link .= ' >'; - $link .= ''.elgg_echo('event_calendar:remove_from_the_calendar').''; - $link .= '

'; - +if ($container->canEdit()) { $button = elgg_view('input/button',array( 'id'=>'event_calendar_user_data_'.$event->guid.'_'.$user->guid, 'class' => "event-calendar-personal-calendar-toggle", - 'value' => elgg_echo('event_calendar:remove_from_the_calendar_button'), + 'value' => $label, )); + echo '
'.$button.'
'; } - -echo '
'.$button.'
'; -- cgit v1.2.3