diff options
author | Kevin Jardine <kevinjardine@yahoo.com> | 2012-04-03 12:31:42 +0200 |
---|---|---|
committer | Kevin Jardine <kevinjardine@yahoo.com> | 2012-04-03 12:31:42 +0200 |
commit | 0b25adcd921149b50845647980284e8ab66d8fed (patch) | |
tree | 0702f1ef157f0417cd1c17ba711f76e563e299ef /views/default/event_calendar | |
parent | 2d19bfa232be5eff43bb6c1d1eef12e681552956 (diff) | |
download | elgg-0b25adcd921149b50845647980284e8ab66d8fed.tar.gz elgg-0b25adcd921149b50845647980284e8ab66d8fed.tar.bz2 |
major changes to add new features, including a full calendar and repeating events
Diffstat (limited to 'views/default/event_calendar')
-rw-r--r-- | views/default/event_calendar/container.php | 24 | ||||
-rw-r--r-- | views/default/event_calendar/css.php | 98 | ||||
-rw-r--r-- | views/default/event_calendar/datetime_edit.php | 45 | ||||
-rw-r--r-- | views/default/event_calendar/full_calendar_view.php | 64 | ||||
-rw-r--r-- | views/default/event_calendar/repeat_form_element.php | 43 | ||||
-rw-r--r-- | views/default/event_calendar/show_events.php | 12 |
6 files changed, 243 insertions, 43 deletions
diff --git a/views/default/event_calendar/container.php b/views/default/event_calendar/container.php new file mode 100644 index 000000000..fdd7da2c6 --- /dev/null +++ b/views/default/event_calendar/container.php @@ -0,0 +1,24 @@ +<?php +elgg_load_library('elgg:event_calendar'); +$site_calendar = elgg_get_plugin_setting('site_calendar', 'event_calendar'); +$admin = elgg_is_admin_logged_in(); +$containers = array(0 => elgg_echo('event_calendar:site_calendar')); +$user = elgg_get_logged_in_user_entity(); +$groups = $user->getGroups('',0,0); +foreach ($groups as $group) { + if (event_calendar_activated_for_group($group)) { + if ($admin || !$group_calendar || $group_calendar == 'members') { + if ($group->canWriteToContainer($user->guid)) { + $containers[$group->guid] = $group->name; + } + } else if ($group->canEdit()) { + $containers[$group->guid] = $group->name; + } + } +} +if ($vars['container_guid']) { + $value = $vars['container_guid']; +} else { + $value = 0; +} +echo elgg_view('input/dropdown',array('name'=>'group_guid', 'value'=>$vars['container_guid'],'options_values'=>$containers)); diff --git a/views/default/event_calendar/css.php b/views/default/event_calendar/css.php index a2437e065..4d68f500f 100644 --- a/views/default/event_calendar/css.php +++ b/views/default/event_calendar/css.php @@ -171,8 +171,102 @@ li.event-calendar-filter-menu-show-only { margin-right: 10px; } -.event-calendar-date-time-setter label { +.event-calendar-medium-text { + width: 500px !important; +} + +.event-calendar-edit-form-block label { float: left; - width: 50px; + width: 90px; + margin-top: 5px; +} + +.event-calendar-long-text { + width: 500px !important; +} + +.event-calendar-edit-form-other-block .mceLayout { + width: 500px !important; +} + +.event-calendar-edit-form { + background-color: #FFFFFF; +} + +.event-calendar-edit-form-block { + width: 90%; + background-color: #DDDDDD; + border-width:1px; + border-style:solid; + border-color:#bfbfbf; + padding: 5px; + margin-bottom: 10px; + clear: both; +} + +.event-calendar-repeating-wrapper { + padding: 0; margin-top: 5px; +} +.event-calendar-repeating-unselected { + font-size: 16px; + font-weight: bold; + color: #DDDDDD; + background-color: #AAAAAA; + border: 1px solid #444444; + padding: 5px; + width: 25px; + text-align: center; + display: inline-block; + margin: 0; +} + +.event-calendar-repeating-unselected:hover { + text-decoration: none; +} + +.event-calendar-repeating-selected { + font-size: 16px; + font-weight: bold; + color: #000000; + background-color: #FFFFFF; + border: 1px solid #000000; + padding: 5px; + width: 25px; + text-align: center; + display: inline-block; + margin: 0; +} + +.event-calendar-repeating-selected:hover { + text-decoration: none; + color: #CCCCCC; +} + +.event-calendar-edit-form-schedule-block ul.elgg-vertical li { + display: block !important; + clear: both; +} + +.event-calendar-edit-form-block ul.elgg-vertical li label { + font-weight: normal; + width: 500px; +} + +.event-calendar-edit-form-block h2 { + font-size: 18px; + color: #000000; +} + +.event-calendar-edit-date-wrapper { + clear: both; + margin-left: 20px; +} + +.event-calendar-edit-reminder-wrapper { + margin-top: 10px; +} + +.event-calendar-description { + display: none; }
\ No newline at end of file diff --git a/views/default/event_calendar/datetime_edit.php b/views/default/event_calendar/datetime_edit.php new file mode 100644 index 000000000..aa3a8f2de --- /dev/null +++ b/views/default/event_calendar/datetime_edit.php @@ -0,0 +1,45 @@ +<?php +$event_calendar_times = elgg_get_plugin_setting('times', 'event_calendar'); +$event_calendar_hide_end = elgg_get_plugin_setting('hide_end', 'event_calendar'); +$prefix = $vars['prefix']; +$body = ''; + +if ($event_calendar_times != 'no') { + if ($event_calendar_hide_end != 'yes') { + $body .= '<p><label>'.elgg_echo('event_calendar:from_label').'</label>'; + } + $body .= elgg_view("event_calendar/input/date_local",array( + 'timestamp'=>TRUE, + 'autocomplete'=>'off', + 'class'=>'event-calendar-compressed-date', + 'name' => 'start_date', + 'value'=>$vars['start_date'])); + $body .= elgg_view("input/timepicker",array('name' => 'start_time','value'=>$vars['start_time'])); + if ($event_calendar_hide_end != 'yes') { + $body .= '</p><p><label>'.elgg_echo('event_calendar:to_label').'</label>'; + $body .= elgg_view("event_calendar/input/date_local",array( + 'timestamp'=>TRUE, + 'autocomplete'=>'off', + 'class'=>'event-calendar-compressed-date', + 'name' => 'end_date', + 'value'=>$vars['end_date'], + )); + $body .= elgg_view("input/timepicker",array('name' => 'end_time','value'=>$vars['end_time'])); + } + $body .= '</p>'; +} else { + + $body .= '<p><label>'.elgg_echo("event_calendar:start_date_label").'<br />'; + $body .= elgg_view("event_calendar/input/date_local",array('timestamp'=>TRUE, 'autocomplete'=>'off','name' => 'start_date','value'=>$vars['start_date'])); + $body .= '</label></p>'; + $body .= '<p class="description">'.$prefix['start_date'].elgg_echo('event_calendar:start_date_description').'</p>'; + + if ($event_calendar_hide_end != 'yes') { + $body .= '<p><label>'.elgg_echo("event_calendar:end_date_label").'<br />'; + $body .= elgg_view("event_calendar/input/date_local",array('timestamp'=>TRUE,'autocomplete'=>'off','name' => 'end_date','value'=>$vars['end_date'])); + $body .= '</label></p>'; + $body .= '<p class="description">'.$prefix['end_date'].elgg_echo('event_calendar:end_date_description').'</p>'; + } +} + +echo $body;
\ No newline at end of file diff --git a/views/default/event_calendar/full_calendar_view.php b/views/default/event_calendar/full_calendar_view.php index 58aefe741..2c97eb159 100644 --- a/views/default/event_calendar/full_calendar_view.php +++ b/views/default/event_calendar/full_calendar_view.php @@ -1,31 +1,6 @@ <?php elgg_load_js('elgg.full_calendar'); -$events = $vars['events']; - -$event_array = array(); -$times_supported = elgg_get_plugin_setting('times','event_calendar') != 'no'; - -foreach($events as $e) { - $event_item = array( - 'guid' => $e->guid, - //'title' => '<a href="'.$e->url.'">'.$e->title.'</a>', - 'title' => $e->title, - 'url' => $e->getURL(), - 'start_date' => $e->start_date, - 'end_date' => $e->real_end_time, - ); - if ($times_supported) { - $event_item['allDay'] = FALSE; - } else { - $event_item['allDay'] = TRUE; - } - - $event_array[] = $event_item; -} - -$json_events_string = json_encode($event_array); - // TODO: is there an easy way to avoid embedding JS? ?> <script> @@ -58,31 +33,40 @@ handleEventDrop = function(event,dayDelta,minuteDelta,allDay,revertFunc) { } }; -$(document).ready(function() { - var events = <?php echo $json_events_string; ?>; - var cal_events = []; - for (var i = 0; i < events.length; i++) { - cal_events.push({ - guid: events[i].guid, - title : events[i].title, - url: events[i].url, - start : new Date(1000*events[i].start_date), - end : new Date(1000*events[i].end_date), - allDay: events[i].allDay - }); - } - +getISODate = function(d) { + var year = d.getFullYear(); + var month = d.getMonth()+1; + month = month < 10 ? '0' + month : month; + var day = d.getDay()+1; + day = day < 10 ? '0' + day : day; + return year +"-"+month+"-"+day; +} + +handleGetEvents = function(start, end, callback) { + var start_date = getISODate(start); + var end_date = getISODate(end); + var url = "event_calendar/get_fullcalendar_events/"+start_date+"/"+end_date+"/<?php echo $vars['filter']; ?>/<?php echo $vars['group_guid']; ?>"; + elgg.getJSON(url, {success: + function(events) { + callback(events); + } + }); +} + +$(document).ready(function() { $('#calendar').fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, + month: <?php echo date('n',strtotime($vars['start_date']))-1; ?>, + ignoreTimezone: true, editable: true, slotMinutes: 15, eventDrop: handleEventDrop, eventClick: handleEventClick, - events: cal_events + events: handleGetEvents }); }); </script> diff --git a/views/default/event_calendar/repeat_form_element.php b/views/default/event_calendar/repeat_form_element.php new file mode 100644 index 000000000..45fdabfa1 --- /dev/null +++ b/views/default/event_calendar/repeat_form_element.php @@ -0,0 +1,43 @@ +<?php +$event = $vars['event']; +$fd = $vars['form_data']; +if ($fd['repeats'] == 'yes') { + echo elgg_view('input/checkbox',array('name'=>'repeats','value'=>'yes','checked'=>'checked')); +} else { + echo elgg_view('input/checkbox',array('name'=>'repeats','value'=>'yes')); +} +echo elgg_echo('event_calendar:repeat_interval_label').' '; +echo elgg_view('input/dropdown',array('name'=>'repeat_interval','value'=>$fd['repeat_interval'],'options_values'=>array('1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6','7'=>'7','8'=>'8'))); +echo ' '.elgg_echo('event_calendar:repeat_weeks'); +echo ' '.elgg_echo('event_calendar:on_these_days'); +?> +<div class="event-calendar-repeating-wrapper"> +<a id="event-calendar-repeating-monday" href="javascript:void(0);" class="event-calendar-repeating-unselected"> + <?php echo elgg_echo('event_calendar:day_abbrev:monday'); ?> +</a> +<a id="event-calendar-repeating-tuesday" href="javascript:void(0);" class="event-calendar-repeating-unselected"> + <?php echo elgg_echo('event_calendar:day_abbrev:tuesday'); ?> +</a> +<a id="event-calendar-repeating-wednesday" href="javascript:void(0);" class="event-calendar-repeating-unselected"> + <?php echo elgg_echo('event_calendar:day_abbrev:wednesday'); ?> +</a> +<a id="event-calendar-repeating-thursday" href="javascript:void(0);" class="event-calendar-repeating-unselected"> + <?php echo elgg_echo('event_calendar:day_abbrev:thursday'); ?> +</a> +<a id="event-calendar-repeating-friday" href="javascript:void(0);" class="event-calendar-repeating-unselected"> + <?php echo elgg_echo('event_calendar:day_abbrev:friday'); ?> +</a> +<a id="event-calendar-repeating-saturday" href="javascript:void(0);" class="event-calendar-repeating-unselected"> + <?php echo elgg_echo('event_calendar:day_abbrev:saturday'); ?> +</a> +<a id="event-calendar-repeating-sunday" href="javascript:void(0);" class="event-calendar-repeating-unselected"> + <?php echo elgg_echo('event_calendar:day_abbrev:sunday'); ?> +</a> +</div> +<input type="hidden" name="event-calendar-repeating-monday-value" value="<?php echo $fd['event-calendar-repeating-monday-value']; ?>"> +<input type="hidden" name="event-calendar-repeating-tuesday-value" value="<?php echo $fd['event-calendar-repeating-tuesday-value']; ?>"> +<input type="hidden" name="event-calendar-repeating-wednesday-value" value="<?php echo $fd['event-calendar-repeating-wednesday-value']; ?>"> +<input type="hidden" name="event-calendar-repeating-thursday-value" value="<?php echo $fd['event-calendar-repeating-thursday-value']; ?>"> +<input type="hidden" name="event-calendar-repeating-friday-value" value="<?php echo $fd['event-calendar-repeating-friday-value']; ?>"> +<input type="hidden" name="event-calendar-repeating-saturday-value" value="<?php echo $fd['event-calendar-repeating-saturday-value']; ?>"> +<input type="hidden" name="event-calendar-repeating-sunday-value" value="<?php echo $fd['event-calendar-repeating-sunday-value']; ?>"> diff --git a/views/default/event_calendar/show_events.php b/views/default/event_calendar/show_events.php index 63d722247..3a484e756 100644 --- a/views/default/event_calendar/show_events.php +++ b/views/default/event_calendar/show_events.php @@ -10,16 +10,21 @@ * */ +elgg_load_library('elgg:event_calendar'); + $listing_format = $vars['listing_format']; if ($vars['events']) { if ($listing_format == 'agenda') { + $vars['events'] = event_calendar_flatten_event_structure($vars['events']); $event_list = elgg_view('event_calendar/agenda_view',$vars); } else if ($listing_format == 'paged') { + $vars['events'] = event_calendar_flatten_event_structure($vars['events']); $event_list = elgg_view('event_calendar/paged_view',$vars); } else if ($listing_format == 'full') { $event_list = elgg_view('event_calendar/full_calendar_view',$vars); } else { + $vars['events'] = event_calendar_flatten_event_structure($vars['events']); $options = array( 'list_class' => 'elgg-list-entity', 'full_view' => FALSE, @@ -32,7 +37,12 @@ if ($vars['events']) { $event_list = elgg_view_entity_list($vars['events'], $options); } } else { - $event_list = '<p>'.elgg_echo('event_calendar:no_events_found').'</p>'; + if ($listing_format == 'full') { + // show the empty calendar + $event_list = elgg_view('event_calendar/full_calendar_view',$vars); + } else { + $event_list = '<p>'.elgg_echo('event_calendar:no_events_found').'</p>'; + } } if ($listing_format == 'paged' || $listing_format == 'full') { echo $event_list; |