aboutsummaryrefslogtreecommitdiff
path: root/views/default/event_calendar/calendar_toggle.php
diff options
context:
space:
mode:
authorKevin Jardine <kevinjardine@yahoo.com>2011-10-19 11:23:52 +0200
committerKevin Jardine <kevinjardine@yahoo.com>2011-10-19 11:23:52 +0200
commite40bd05afc559335bc9b326f4ae2400043104818 (patch)
tree6dbd25f155a9b73f64b90cbca46f6f64e1ec87bb /views/default/event_calendar/calendar_toggle.php
parent3b6f9d887fea4a97ae9b948922a8679496862bbf (diff)
downloadelgg-e40bd05afc559335bc9b326f4ae2400043104818.tar.gz
elgg-e40bd05afc559335bc9b326f4ae2400043104818.tar.bz2
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
Diffstat (limited to 'views/default/event_calendar/calendar_toggle.php')
-rw-r--r--views/default/event_calendar/calendar_toggle.php18
1 files changed, 8 insertions, 10 deletions
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 = '<p class="event-calendar-personal-calendar-toggle"><a href="javascript:void(0);" ';
- $link .= 'onclick="javascript:event_calendar_personal_toggle('.$event->guid.','.$vars['entity']->guid.'); return false;" ';
- $link .= ' >';
- $link .= '<span id="event_calendar_user_data_'.$vars['entity']->guid.'">'.elgg_echo('event_calendar:remove_from_the_calendar').'</span>';
- $link .= '</a></p>';
-
+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 '<div class="event-calendar-personal-calendar-toggle-wrapper">'.$button.'<div>';
}
-
-echo '<div class="event-calendar-personal-calendar-toggle-wrapper">'.$button.'<div>';