aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--languages/en.php49
-rw-r--r--models/model.php456
-rw-r--r--start.php25
-rw-r--r--views/default/event_calendar/container.php24
-rw-r--r--views/default/event_calendar/css.php98
-rw-r--r--views/default/event_calendar/datetime_edit.php45
-rw-r--r--views/default/event_calendar/full_calendar_view.php64
-rw-r--r--views/default/event_calendar/repeat_form_element.php43
-rw-r--r--views/default/event_calendar/show_events.php12
-rw-r--r--views/default/forms/event_calendar/edit.php388
-rw-r--r--views/default/input/timepicker.php38
-rw-r--r--views/default/js/event_calendar/event_calendar.php58
-rw-r--r--views/default/plugins/event_calendar/settings.php44
13 files changed, 1088 insertions, 256 deletions
diff --git a/languages/en.php b/languages/en.php
index 2e4c3373a..cef293be0 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -15,7 +15,7 @@
."You can click on the calendar icons to set the start and end dates.",
'event_calendar:title_label' => "Title",
'event_calendar:title_description' => "One to four words",
- 'event_calendar:brief_description_label' => "Brief description",
+ 'event_calendar:brief_description_label' => "Description",
'event_calendar:brief_description_description' => "A short phrase.",
'event_calendar:venue_label' => "Venue",
'event_calendar:venue_description' => "Where will this event be held?",
@@ -250,9 +250,12 @@ You can manage calendar requests for this event here:
'event_calendar:personal_manage:closed' => "closed",
'event_calendar:personal_manage:private' => "private",
'event_calendar:personal_manage:by_event' => "by event",
- 'event_calendar:personal_manage:label' => "Calendar permission",
+ 'event_calendar:personal_manage:label' => "Personal calendars",
'event_calendar:personal_manage:description' => "Determines whether people can add this event to their calendars (open), "
."need to apply to do so (closed) or have no option at all (private - so only you or a site admin can add the event to calendars).",
+ 'event_calendar:personal_manage:by_event:open' => "Open. People can freely add this event to their personal calendars.",
+ 'event_calendar:personal_manage:by_event:closed' => "Closed. People can request to add this event to their personal calendars. You can review and approve requests.",
+ 'event_calendar:personal_manage:by_event:private' => "Private. You or another event administrator must add this event to personal calendars. There is no way for other users to add or request this event.",
'event_calendar:settings:full_calendar:title' => "Support full calendar",
'event_calendar:modify_full_calendar:error' => "Error: could not modify full calendar",
@@ -261,6 +264,48 @@ You can manage calendar requests for this event here:
'event_calendar:settings:timeformat:title' => "Time format",
'event_calendar:time_format:12hour' => "12 hour (am/pm)",
'event_calendar:time_format:24hour' => "24 hour",
+ 'event_calendar:all_day_label' => "All-day event",
+ 'event_calendar:repeat_interval_label' => "Repeat every",
+ 'event_calendar:repeat_weeks' => "week(s)",
+ 'event_calendar:on_these_days' => "on these days:",
+ 'event_calendar:day_abbrev:monday' => "M",
+ 'event_calendar:day_abbrev:tuesday' => "T",
+ 'event_calendar:day_abbrev:wednesday' => "W",
+ 'event_calendar:day_abbrev:thursday' => "T",
+ 'event_calendar:day_abbrev:friday' => "F",
+ 'event_calendar:day_abbrev:saturday' => "S",
+ 'event_calendar:day_abbrev:sunday' => "S",
+ 'event_calendar:dow:full:monday' => "Monday",
+ 'event_calendar:dow:full:tuesday' => "Tuesday",
+ 'event_calendar:dow:full:wednesday' => "Wednesday",
+ 'event_calendar:dow:full:thursday' => "Thursday",
+ 'event_calendar:dow:full:friday' => "Friday",
+ 'event_calendar:dow:full:saturday' => "Saturday",
+ 'event_calendar:dow:full:sunday' => "Sunday",
+ 'event_calendar:schedule_type:poll' => "Create poll asking invitees about day/time",
+ 'event_calendar:schedule_type:fixed' => "Set day/time",
+ 'elgg_calendar:send_reminder_label' => "Send reminder",
+ 'elgg_calendar:send_reminder_before' => "before",
+ 'event_calendar:interval:minute' => "minute(s)",
+ 'event_calendar:interval:hour' => "hour(s)",
+ 'event_calendar:interval:day' => "day(s)",
+ 'event_calendar:site_calendar' => "Site-wide calendar",
+ 'event_calendar:calendar_label' => "Calendar",
+ 'event_calendar:calendar_description' => "Calendar for this event.",
+ 'event_calendar:schedule:header' => "Schedule",
+ 'event_calendar:permissions:header' => "Permissions",
+ 'event_calendar:read_access' => "Read access",
+ 'event_calendar:web_conference_label' => "Include a web conference for this event.",
+ 'event_calendar:share_ownership:label' => "Share ownership of this event",
+ 'event_calendar:share_ownership:description' => "Allow the following people to edit or delete this event, invite participants, etc.",
+ 'event_calendar:settings:fewer_fields:title' => "Hide fees, contact, organiser and long description fields",
+ 'event_calendar:settings:restricted_times:title' => "Restricted time to between 6am and 9pm (6:00 and 21:00)",
+ 'event_calendar:edit_form:error:missing_title' => "Error: please supply the missing title.",
+ 'event_calendar:repeated_event:week_interval' => "every %s weeks.",
+ 'event_calendar:repeated_event:week_single' => "every week.",
+ 'event_calendar:repeated_event:format' => "Starting on %s and repeated on %s",
+ 'event_calendar:settings:repeated_events:title' => "Allow repeated events (currently only works properly in full calendar mode)",
+ 'event_calendar:settings:reminders:title' => "Allow sending reminders (To be done - currently does not send reminders)",
/**
* Event calendar river
diff --git a/models/model.php b/models/model.php
index aa97bfddb..b29ad2ad7 100644
--- a/models/model.php
+++ b/models/model.php
@@ -32,6 +32,7 @@ function event_calendar_set_event_from_form($event_guid,$group_guid) {
$event_calendar_hide_end = elgg_get_plugin_setting('hide_end', 'event_calendar');
$event_calendar_more_required = elgg_get_plugin_setting('more_required', 'event_calendar');
$event_calendar_personal_manage = elgg_get_plugin_setting('personal_manage', 'event_calendar');
+ $event_calendar_repeating_events = elgg_get_plugin_setting('repeating_events', 'event_calendar');
if ($event_calendar_more_required == 'yes') {
$required_fields = array('title','venue','start_date',
@@ -54,7 +55,7 @@ function event_calendar_set_event_from_form($event_guid,$group_guid) {
$required_fields[] = 'spots';
}
} else {
- $required_fields = array('title','venue','start_date');
+ $required_fields = array('title','start_date');
}
if ($event_guid) {
@@ -78,15 +79,21 @@ function event_calendar_set_event_from_form($event_guid,$group_guid) {
$event->title = get_input('title');
$event->description = get_input('description');
$event->venue = get_input('venue');
- // convert start date from current server time to GMT
+
$start_date = get_input('start_date');
- $start_date_text = date("Y-m-d",$start_date);
+ $event->original_start_date = get_input('start_date');
+ //$end_date = trim(get_input('end_date',''));
+ // convert start date from current server time to GMT
+ $start_date_text = gmdate("Y-m-d",$start_date);
+ $event->munged_start_date_string = $start_date_text." ".date_default_timezone_get();
$event->start_date = strtotime($start_date_text." ".date_default_timezone_get());
$end_date = trim(get_input('end_date',''));
+ $event->original_end_date = get_input('end_date');
if ($end_date) {
- $end_date_text = date("Y-m-d",$end_date);
+ $end_date_text = gmdate("Y-m-d",$end_date);
$event->end_date = strtotime($end_date_text." ".date_default_timezone_get());
+ $event->munged_end_date_string = $end_date_text." ".date_default_timezone_get();
} else {
$event->end_date = '';
}
@@ -122,11 +129,29 @@ function event_calendar_set_event_from_form($event_guid,$group_guid) {
if ($event_calendar_personal_manage == 'by_event') {
$event->personal_manage = get_input('personal_manage');
}
+
+ if ($event_calendar_repeating_events != 'no') {
+ $repeats = get_input('repeats');
+ $event->repeats = $repeats;
+ if ($repeats == 'yes') {
+ $event->repeat_interval = get_input('repeat_interval');
+ $dow = array('monday','tuesday','wednesday','thursday','friday','saturday','sunday');
+ foreach ($dow as $w) {
+ $v = 'event-calendar-repeating-'.$w.'-value';
+ $event->$v = get_input($v);
+ }
+ }
+ }
$event->fees = get_input('fees');
$event->contact = get_input('contact');
$event->organiser = get_input('organiser');
$event->tags = string_to_tag_array(get_input('tags'));
$event->long_description = get_input('long_description');
+ $event->all_day = get_input('all_day');
+ $event->schedule_type = get_input('schedule_type');
+ $event->send_reminder = get_input('send_reminder');
+ $event->reminder_number = get_input('reminder_number');
+ $event->reminder_interval = get_input('reminder_interval');
$event->real_end_time = event_calendar_get_end_time($event);
foreach ($required_fields as $fn) {
if (!trim($event->$fn)) {
@@ -171,10 +196,127 @@ function event_calendar_get_events_between($start_date,$end_date,$is_count,$limi
return $count;
} else {
$events = event_calendar_get_entities_from_metadata_between2('start_date','end_date',
- $start_date, $end_date, "object", "event_calendar", 0, $container_guid, $limit,$offset,"",0,false,false,$region);
- //return event_calendar_vsort($events,'start_date');
- return $events;
+ $start_date, $end_date, "object", "event_calendar", 0, $container_guid, $limit,$offset,"",0,false,false,$region);
+ $repeating_events = event_calendar_get_repeating_events_between($start_date,$end_date,$container_guid,$region);
+ $all_events = event_calendar_merge_repeating_events($events, $repeating_events);
+ return $all_events;
+ }
+}
+
+function event_calendar_merge_repeating_events($events, $repeating_events) {
+ $non_repeating_events = array();
+ foreach($events as $e) {
+ if ($e->repeats != 'yes') {
+ $non_repeating_events[] = array('event' => $e,'data' => array(array('start_time' => $e->start_date, 'end_time' => $e->real_end_time)));
+ }
+ }
+
+ return array_merge($non_repeating_events, $repeating_events);
+}
+
+function event_calendar_get_repeating_events_between($start_date,$end_date,$container_guid,$region) {
+ // game plan: get all repeating events with start date <= $end_date and then generate all possible events
+ // sanity check
+ if ($start_date <= $end_date) {
+ $options = array(
+ 'type' => 'object',
+ 'subtype' => 'event_calendar',
+ 'limit' => 0,
+ 'metadata_name_value_pairs' => array(
+ array(
+ 'name' => 'start_date',
+ 'value' => $end_date,
+ 'operand' => '<='
+ ),
+ array(
+ 'name' => 'repeats',
+ 'value' => 'yes'
+ ),
+ )
+ );
+ if ($container_guid) {
+ if (is_array($container_guid)) {
+ $options['container_guids'] = $container_guid;
+ } else {
+ $options['container_guid'] = $container_guid;
+ }
+ }
+
+ if ($region && $region != '-') {
+ $options['metadata_name_value_pairs'][] = array(
+ 'name' => 'region',
+ 'value' => $region
+ );
+ }
+
+ $events = elgg_get_entities_from_metadata($options);
}
+ return event_calendar_get_repeating_event_structure($events, $start_date, $end_date);
+}
+
+
+function event_calendar_get_repeating_event_structure($events, $start_date, $end_date) {
+ $dow = array('monday','tuesday','wednesday','thursday','friday','saturday','sunday');
+ $repeating_events = array();
+ if ($events) {
+ $incs = array();
+ foreach($events as $e) {
+ $repeat_data = array();
+ $day_num = date('N',$e->start_date)-1;
+ for($d=0;$d<7;$d++) {
+ $fn = 'event-calendar-repeating-'.$dow[$d].'-value';
+ if ($e->$fn) {
+ $increment = $d - $day_num;
+ $incs[] = $increment;
+ }
+ }
+ if ($incs) {
+ sort($incs);
+
+ $repeat_interval = $e->repeat_interval;
+ $event_start_time = $e->start_date;
+ $event_end_time = $e->real_end_time;
+ $week = 0;
+ if ($event_start_time <= $event_end_time) {
+ $more_to_do = TRUE;
+ $cur_start_time = $event_start_time;
+ $cur_end_time = $event_end_time;
+ // keep generating events until after $end_date
+ // repeat_times is a sanity check to prevent infinite loops in case of bad data
+ $repeat_times = 0;
+ do {
+ foreach($incs as $inc) {
+ //$seconds = $inc*60*60*24;
+ if ($inc >=0) {
+ $tinc = "+ " . $inc;
+ } else {
+ $tinc = $inc;
+ }
+ $this_start_time = strtotime($tinc . " day", $cur_start_time);
+ $this_end_time = strtotime($tinc . " day", $cur_end_time);
+ if ($this_start_time > $end_date) {
+ $more_to_do = FALSE;
+ break;
+ }
+ if ($this_start_time >= $event_start_time) {
+ $repeat_data[] = array (
+ 'start_time' => $this_start_time,
+ 'end_time' => $this_end_time,
+ );
+ }
+ }
+ // repeat_interval weeks later
+ $week += $repeat_interval;
+ $cur_start_time = strtotime("+" . $week . " week", $event_start_time);
+ $cur_end_time = strtotime("+" . $week ." week", $event_end_time);
+ $repeat_times += 1;
+ } while ($repeat_times < 1000 && $more_to_do);
+ }
+ }
+ $repeating_events[] = array('event'=>$e,'data'=>$repeat_data);
+ }
+ }
+ return $repeating_events;
}
function event_calendar_get_open_events_between($start_date,$end_date,
@@ -187,10 +329,73 @@ $is_count,$limit=10,$offset=0,$container_guid=0,$region='-', $meta_max = 'spots'
$events = event_calendar_get_entities_from_metadata_between2('start_date','end_date',
$start_date, $end_date, "object", "event_calendar", 0, $container_guid, $limit,$offset,"",0,false,false,$region,$meta_max,$annotation_name);
//return event_calendar_vsort($events,'start_date');
- return $events;
+ $repeating_events = event_calendar_get_open_repeating_events_between($start_date,$end_date,$container_guid,$region);
+ $all_events = event_calendar_merge_repeating_events($events, $repeating_events);
+ return $all_events;
}
}
+function event_calendar_get_open_repeating_events_between($start_date,$end_date,$container_guid,$region) {
+ $db_prefix = elgg_get_config('dbprefix');
+ $meta_max = 'spots';
+ $annotation_name = 'personal_event';
+ $joins = array();
+ $wheres = array();
+ $meta_max_n = get_metastring_id($meta_max);
+ $ann_n = get_metastring_id($annotation_name);
+ if (!$meta_max_n || !$ann_n) {
+ if ($count) {
+ return 0;
+ } else {
+ return false;
+ }
+ }
+
+ $joins[] = "LEFT JOIN {$dbprefix}metadata m4 ON (e.guid = m4.entity_guid AND m4.name_id=$meta_max_n) ";
+ $joins[] = "LEFT JOIN {$dbprefix}metastrings ms4 ON (m4.value_id = ms4.id) ";
+ $wheres[] = "((ms4.string is null) OR (ms4.string = \"\") OR (CONVERT(ms4.string,SIGNED) > (SELECT count(id) FROM {$dbprefix}annotations ann WHERE ann.entity_guid = e.guid AND name_id = $ann_n GROUP BY entity_guid)))";
+
+ // sanity check
+ if ($start_date <= $end_date) {
+ $options = array(
+ 'type' => 'object',
+ 'subtype' => 'event_calendar',
+ 'limit' => 0,
+ 'metadata_name_value_pairs' => array(
+ array(
+ 'name' => 'start_date',
+ 'value' => $end_date,
+ 'operand' => '<='
+ ),
+ array(
+ 'name' => 'repeats',
+ 'value' => 'yes'
+ ),
+ ),
+ 'joins' => $joins,
+ 'wheres' => $wheres,
+
+ );
+ if ($container_guid) {
+ if (is_array($container_guid)) {
+ $options['container_guids'] = $container_guid;
+ } else {
+ $options['container_guid'] = $container_guid;
+ }
+ }
+
+ if ($region && $region != '-') {
+ $options['metadata_name_value_pairs'][] = array(
+ 'name' => 'region',
+ 'value' => $region
+ );
+ }
+
+ $events = elgg_get_entities_from_metadata($options);
+ }
+ return event_calendar_get_repeating_event_structure($events, $start_date, $end_date);
+}
+
function event_calendar_get_events_for_user_between($start_date,$end_date,$is_count,$limit=10,$offset=0,$user_guid,$container_guid=0,$region='-') {
if ($is_count) {
// old way
@@ -244,14 +449,82 @@ function event_calendar_get_events_for_user_between2($start_date,$end_date,$is_c
//print_r($options_new_way);
$events_new_way = elgg_get_entities_from_relationship($options_new_way);
//return event_calendar_vsort($events,'start_date');
- if (!$events_old_way) {
- return $events_new_way;
- } else if (!$events_new_way) {
- return $events_old_way;
+ $repeating_events = event_calendar_get_repeating_events_for_user_between($user_guid,$start_date,$end_date,$container_guid,$region);
+ $all_events = event_calendar_merge_repeating_events(array_merge($events_old_way,$events_new_way), $repeating_events);
+ return $all_events;
+ }
+}
+
+function event_calendar_get_repeating_events_for_user_between($user_guid,$start_date,$end_date,$container_guid,$region) {
+ $options = array(
+ 'type' => 'object',
+ 'subtype' => 'event_calendar',
+ 'relationship' => 'personal_event',
+ 'relationship_guid' => $user_guid,
+ 'metadata_name_value_pairs' => array(
+ array(
+ 'name' => 'start_date',
+ 'value' => $end_date,
+ 'operand' => '<='
+ ),
+ array(
+ 'name' => 'repeats',
+ 'value' => 'yes'
+ ),
+ )
+ );
+
+ if ($container_guid) {
+ if (is_array($container_guid)) {
+ $options['container_guids'] = $container_guid;
+ } else {
+ $options['container_guid'] = $container_guid;
+ }
+ }
+
+ if ($region && $region != '-') {
+ $options['metadata_name_value_pairs'][] = array(
+ 'name' => 'region',
+ 'value' => $region
+ );
+ }
+
+ $events = elgg_get_entities_from_relationship($options);
+ return event_calendar_get_repeating_event_structure($events, $start_date, $end_date);
+}
+
+function event_calendar_get_repeating_events_for_friends_between($user_guid,$friend_list,$start_date,$end_date,$container_guid=0,$region='-') {
+
+ $db_prefix = elgg_get_config('dbprefix');
+ $options = array(
+ 'type' => 'object',
+ 'subtype' => 'event_calendar',
+ 'metadata_name_value_pairs' => array(
+ array( 'name' => 'start_date',
+ 'value' => $end_date,
+ 'operand' => '<='
+ ),
+ array( 'name' => 'repeats',
+ 'value' => 'yes'
+ )
+ ),
+ 'joins' => array("JOIN {$db_prefix}entity_relationships r ON (r.guid_two = e.guid)"),
+ 'wheres' => array("r.relationship = 'personal_event'","r.guid_one IN ($friend_list)"),
+ );
+
+ if ($container_guid) {
+ if (is_array($container_guid)) {
+ $options['container_guids'] = $container_guid;
} else {
- return array_merge($events_old_way,$events_new_way);
+ $options['container_guid'] = $container_guid;
}
}
+ if ($region && $region != '-') {
+ $options['metadata_name_value_pairs'][] = array('name'=>'region','value'=>sanitize_string($region));
+ }
+
+ $events = elgg_get_entities_from_relationship($options);
+ return event_calendar_get_repeating_event_structure($events, $start_date, $end_date);
}
function event_calendar_get_events_for_friends_between($start_date,$end_date,$is_count,$limit=10,$offset=0,$user_guid,$container_guid=0,$region='-') {
@@ -300,13 +573,9 @@ function event_calendar_get_events_for_friends_between($start_date,$end_date,$is
$options_new_way['order_by_metadata'] = array(array('name'=>'start_date','direction'=>'ASC','as'=>'integer'));
//print_r($options_new_way);
$events_new_way = elgg_get_entities_from_metadata($options_new_way);
- if (!$events_old_way) {
- return $events_new_way;
- } else if (!$events_new_way) {
- return $events_old_way;
- } else {
- return array_merge($events_old_way,$events_new_way);
- }
+ $repeating_events = event_calendar_get_repeating_events_for_friends_between($user_guid,$friend_list,$start_date,$end_date,$container_guid,$region);
+ $all_events = event_calendar_merge_repeating_events(array_merge($events_old_way,$events_new_way), $repeating_events);
+ return $all_events;
}
}
}
@@ -469,18 +738,19 @@ function event_calendar_get_entities_from_metadata_between($meta_start_name, $me
$query .= ' and ' . get_access_sql_suffix("m"); // Add access controls
$query .= ' and ' . get_access_sql_suffix("m2"); // Add access controls
-
-
if (!$count) {
- $query .= " order by $order_by limit $offset, $limit"; // Add order and limit
+ $query .= " order by $order_by";
+ if ($limit) {
+ $query .= " limit $offset, $limit"; // Add order and limit
+ }
$entities = get_data($query, "entity_row_to_elggstar");
if (elgg_get_plugin_setting('add_to_group_calendar', 'event_calendar') == 'yes') {
if (get_entity($container_guid) instanceOf ElggGroup) {
$entities = event_calendar_get_entities_from_metadata_between_related($meta_start_name, $meta_end_name,
- $meta_start_value, $meta_end_value, $entity_type,
- $entity_subtype, $owner_guid, $container_guid,
- $limit = 10, $offset = 0, $order_by = "", $site_guid = 0,
- $filter = false, $count = false, $region='-',$entities);
+ $meta_start_value, $meta_end_value, $entity_type,
+ $entity_subtype, $owner_guid, $container_guid,
+ 0, 0, "", 0,
+ false, false, '-',$entities);
}
}
return $entities;
@@ -557,6 +827,8 @@ $filter = false, $count = false, $region='-',$main_events) {
* @param string $annotation_name annotation name to count
*
* @return int|array A list of entities, or a count if $count is set to true
+ *
+ * TODO: see if the new API is robust enough to avoid this custom query
*/
function event_calendar_get_entities_from_metadata_between2
($meta_start_name, $meta_end_name, $meta_start_value, $meta_end_value,
@@ -690,7 +962,10 @@ $count = false, $region='-', $meta_max = '', $annotation_name = '')
$query .= ' AND ' . get_access_sql_suffix("m2"); // Add access controls
if (!$count) {
- $query .= " order by $order_by limit $offset, $limit"; // Add order and limit
+ $query .= " order by $order_by";
+ if ($limit) {
+ $query .= " limit $offset, $limit"; // Add order and limit
+ }
return get_data($query, "entity_row_to_elggstar");
} else {
if ($row = get_data_row($query))
@@ -843,28 +1118,6 @@ function event_calendar_get_events_for_group($group_guid) {
return elgg_get_entities($options);
}
-function event_calendar_handle_join($event, $object_type, $object) {
- $group = $object['group'];
- $user = $object['user'];
- $user_guid = $user->getGUID();
- $events = event_calendar_get_events_for_group($group->getGUID());
- foreach ($events as $event) {
- $event_id = $event->getGUID();
- event_calendar_add_personal_event($event_id,$user_guid);
- }
-}
-
-function event_calendar_handle_leave($event, $object_type, $object) {
- $group = $object['group'];
- $user = $object['user'];
- $user_guid = $user->getGUID();
- $events = event_calendar_get_events_for_group($group->getGUID());
- foreach ($events as $event) {
- $event_id = $event->getGUID();
- event_calendar_remove_personal_event($event_id,$user_guid);
- }
-}
-
function event_calendar_convert_time($time) {
$event_calendar_time_format = elgg_get_plugin_setting('timeformat','event_calendar');
if ($event_calendar_time_format == '12') {
@@ -978,17 +1231,35 @@ function event_calendar_get_formatted_time($event) {
$end_date = date($date_format,$event->end_date);
}
if ((!$event->end_date) || ($end_date == $start_date)) {
- if ($event_calendar_times) {
+ if (!$event->all_day && $event_calendar_times) {
$start_date = event_calendar_format_time($start_date,$event->start_time,$event->end_time);
}
$time_bit = $start_date;
} else {
- if ($event_calendar_times) {
+ if (!$event->all_day && $event_calendar_times) {
$start_date = event_calendar_format_time($start_date,$event->start_time);
$end_date = event_calendar_format_time($end_date,$event->end_time);
}
$time_bit = "$start_date - $end_date";
}
+
+ if ($event->repeats == 'yes') {
+ $dow = array('monday','tuesday','wednesday','thursday','friday','saturday','sunday');
+ $r = array();
+ foreach ($dow as $w) {
+ $fn = 'event-calendar-repeating-'.$w.'-value';
+ if ($event->$fn) {
+ $r[] = elgg_echo('event_calendar:dow:full:'.$w);
+ }
+ }
+ $week_bit = implode(", ",$r);
+ if ($event->repeat_interval > 1) {
+ $week_bit .= ' '.elgg_echo('event_calendar:repeated_event:week_interval',array($event->repeat_interval));
+ } else {
+ $week_bit .= ' '.elgg_echo('event_calendar:repeated_event:week_single');
+ }
+ $time_bit = elgg_echo('event_calendar:repeated_event:format',array($time_bit, $week_bit));
+ }
return $time_bit;
}
@@ -1229,6 +1500,7 @@ function event_calendar_get_page_content_list($page_type,$container_guid,$start_
}
function event_calendar_get_page_content_edit($page_type,$guid) {
+ elgg_load_js('elgg.event_calendar');
$vars = array();
$vars['id'] = 'event-calendar-edit';
$vars['name'] = 'event_calendar_edit';
@@ -1311,7 +1583,21 @@ function event_calendar_prepare_edit_form_vars($event = NULL) {
'contact' => NULL,
'organiser' => NULL,
'tags' => NULL,
- 'personal_manage' => NULL,
+ 'all_day' => 0,
+ 'send_reminder' => NULL,
+ 'reminder_number' => 1,
+ 'reminder_interval' => 60,
+ 'schedule_type' => 'fixed',
+ 'repeats' => NULL,
+ 'repeat_interval' => 1,
+ 'event-calendar-repeating-monday-value' => 0,
+ 'event-calendar-repeating-tuesday-value' => 0,
+ 'event-calendar-repeating-wednesday-value' => 0,
+ 'event-calendar-repeating-thursday-value' => 0,
+ 'event-calendar-repeating-friday-value' => 0,
+ 'event-calendar-repeating-saturday-value' => 0,
+ 'event-calendar-repeating-sunday-value' => 0,
+ 'personal_manage' => 'open',
'long_description' => NULL,
'access_id' => ACCESS_DEFAULT,
'group_guid' => NULL,
@@ -1466,6 +1752,7 @@ function event_calendar_generate_listing_params($page_type,$container_guid,$orig
$filter = 'all';
}
}
+
if ($filter == 'all') {
$count = event_calendar_get_events_between($start_ts,$end_ts,true,$limit,$offset,$container_guid,$region);
$events = event_calendar_get_events_between($start_ts,$end_ts,false,$limit,$offset,$container_guid,$region);
@@ -1506,6 +1793,8 @@ function event_calendar_generate_listing_params($page_type,$container_guid,$orig
if ($event_calendar_listing_format == 'paged') {
$title = elgg_echo('event_calendar:upcoming_events_title');
+ } else if ($event_calendar_listing_format == 'full') {
+ $title = elgg_echo('event_calendar:show_events_title');
} else if ($page_type == 'group') {
$title = elgg_echo('event_calendar:group'). ' ('.$subtitle.')';
} else {
@@ -1769,3 +2058,64 @@ function event_calendar_modify_full_calendar($event_guid,$day_delta,$minute_delt
}
return FALSE;
}
+
+function event_calendar_get_page_content_fullcalendar_events($start_date,$end_date,$filter='all',$container_guid=0,$region='-') {
+ //print "$start_date - $end_date";
+ $start_ts = strtotime($start_date);
+ $end_ts = strtotime($end_date);
+ if ($filter == 'all') {
+ $events = event_calendar_get_events_between($start_ts,$end_ts,false,0,0,$container_guid,$region);
+ } else if ($filter == 'open') {
+ $events = event_calendar_get_open_events_between($start_ts,$end_ts,false,0,0,$container_guid,$region);
+ } else if ($filter == 'friends') {
+ $user_guid = elgg_get_logged_in_user_guid();
+ $events = event_calendar_get_events_for_friends_between($start_ts,$end_ts,false,0,0,$user_guid,$container_guid,$region);
+ } else if ($filter == 'mine') {
+ $user_guid = elgg_get_logged_in_user_guid();
+ $events = event_calendar_get_events_for_user_between2($start_ts,$end_ts,false,0,0,$user_guid,$container_guid,$region);
+ }
+ $event_array = array();
+ $times_supported = elgg_get_plugin_setting('times','event_calendar') != 'no';
+ foreach($events as $e) {
+ $event = $e['event'];
+ $event_data = $e['data'];
+ $c = count($event_data);
+ foreach($event_data as $ed) {
+ $event_item = array(
+ 'id' => $event->guid,
+ 'guid' => $event->guid,
+ 'title' => $event->title,
+ 'url' => $event->getURL(),
+ 'start' => date('c',$ed['start_time']),
+ 'end' => date('c',$ed['end_time']),
+ );
+ if (!$times_supported || $event->all_day) {
+ $event_item['allDay'] = TRUE;
+ } else {
+ $event_item['allDay'] = FALSE;
+ }
+
+ $event_array[] = $event_item;
+ }
+ }
+
+ $json_events_string = json_encode($event_array);
+ return $json_events_string;
+}
+
+// right now this does not return repeated events in sorted order, so repeated events only really work properly for the full calendar
+// TODO: find another solution for displaying repeated events
+
+function event_calendar_flatten_event_structure($events) {
+ $flattened = array();
+ $guids = array();
+ foreach($events as $e) {
+ $this_event = $e['event'];
+ $guid = $this_event->guid;
+ if (!in_array($guid,$guids)) {
+ $guids[] = $guid;
+ $flattened[] = $this_event;
+ }
+ }
+ return $flattened;
+} \ No newline at end of file
diff --git a/start.php b/start.php
index e838194f5..523987154 100644
--- a/start.php
+++ b/start.php
@@ -265,6 +265,9 @@ function event_calendar_page_handler($page) {
gatekeeper();
echo event_calendar_get_page_content_review_requests($page[1]);
break;
+ case 'get_fullcalendar_events':
+ echo event_calendar_get_page_content_fullcalendar_events($page[1],$page[2],$page[3],$page[4]);
+ break;
default:
return FALSE;
}
@@ -365,3 +368,25 @@ function event_calendar_entity_menu_prepare($hook, $type, $return, $params) {
return $return;
}
+
+function event_calendar_handle_join($event, $object_type, $object) {
+ $group = $object['group'];
+ $user = $object['user'];
+ $user_guid = $user->getGUID();
+ $events = event_calendar_get_events_for_group($group->getGUID());
+ foreach ($events as $event) {
+ $event_id = $event->getGUID();
+ event_calendar_add_personal_event($event_id,$user_guid);
+ }
+}
+
+function event_calendar_handle_leave($event, $object_type, $object) {
+ $group = $object['group'];
+ $user = $object['user'];
+ $user_guid = $user->getGUID();
+ $events = event_calendar_get_events_for_group($group->getGUID());
+ foreach ($events as $event) {
+ $event_id = $event->getGUID();
+ event_calendar_remove_personal_event($event_id,$user_guid);
+ }
+}
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;
diff --git a/views/default/forms/event_calendar/edit.php b/views/default/forms/event_calendar/edit.php
index 3526627a7..713fb9abc 100644
--- a/views/default/forms/event_calendar/edit.php
+++ b/views/default/forms/event_calendar/edit.php
@@ -3,20 +3,29 @@ $event = $vars['event'];
$fd = $vars['form_data'];
$personal_manage_options = array(
- elgg_echo('event_calendar:personal_manage:open') => 'open',
- elgg_echo('event_calendar:personal_manage:closed') => 'closed',
- elgg_echo('event_calendar:personal_manage:private') => 'private',
+ elgg_echo('event_calendar:personal_manage:by_event:open') => 'open',
+ elgg_echo('event_calendar:personal_manage:by_event:closed') => 'closed',
+ elgg_echo('event_calendar:personal_manage:by_event:private') => 'private',
);
-$event_calendar_times = elgg_get_plugin_setting('times', 'event_calendar');
+$schedule_options = array(
+ elgg_echo('event_calendar:schedule_type:poll')=>'poll',
+ elgg_echo('event_calendar:schedule_type:fixed')=>'fixed',
+);
+
+$event_calendar_fewer_fields = elgg_get_plugin_setting('fewer_fields', 'event_calendar');
+$event_calendar_repeating_events = elgg_get_plugin_setting('repeating_events', 'event_calendar');
+
$event_calendar_region_display = elgg_get_plugin_setting('region_display', 'event_calendar');
$event_calendar_type_display = elgg_get_plugin_setting('type_display', 'event_calendar');
$event_calendar_spots_display = elgg_get_plugin_setting('spots_display', 'event_calendar');
//$event_calendar_add_users = elgg_get_plugin_setting('add_users', 'event_calendar');
$event_calendar_hide_access = elgg_get_plugin_setting('hide_access', 'event_calendar');
-$event_calendar_hide_end = elgg_get_plugin_setting('hide_end', 'event_calendar');
+
$event_calendar_more_required = elgg_get_plugin_setting('more_required', 'event_calendar');
$event_calendar_personal_manage = elgg_get_plugin_setting('personal_manage', 'event_calendar');
+$event_calendar_repeated_events = elgg_get_plugin_setting('repeated_events', 'event_calendar');
+$event_calendar_reminders = elgg_get_plugin_setting('reminders', 'event_calendar');
if ($event_calendar_more_required == 'yes') {
$required_fields = array('title','venue','start_date','start_time',
@@ -39,7 +48,7 @@ foreach ($all_fields as $fn) {
}
if ($event) {
- $title = $event->title;
+ /*$title = $event->title;
$brief_description = $event->description;
$venue = $event->venue;
// this is a form redisplay, so take the values as submitted
@@ -65,7 +74,15 @@ if ($event) {
$fees = $event->fees;
$contact = $event->contact;
$organiser = $event->organiser;
- $event_tags = $event->event_tags;
+ if ($event->tags) {
+ $event_tags = $event->tags;
+ } else {
+ // old way
+ $event_tags = $event->event_tags;
+ }
+ $reminder_number = $event->reminder_number;
+ $reminder_interval = $event->reminder_interval;
+
$long_description = $event->long_description;
$access = $event->access_id;
if ($event_calendar_times != 'no') {
@@ -77,91 +94,144 @@ if ($event) {
if (!$personal_manage) {
$personal_manage = 'open';
}
- }
+ }*/
$event_action = 'manage_event';
$event_guid = $event->guid;
-} else {
- $title = $fd['title'];
- $brief_description = $fd['description'];
- $venue = $fd['venue'];
- $start_date = $fd['start_date'];
- $end_date = $fd['end_date'];
- $fees = $fd['fees'];
- if ($event_calendar_spots_display) {
- $spots = $fd['spots'];
- }
- if ($event_calendar_region_display) {
- $region = $fd['region'];
- }
- if ($event_calendar_type_display) {
- $event_type = $fd['event_type'];
- }
- $contact = $fd['contact'];
- $organiser = $fd['organiser'];
- $event_tags = $fd['event_tags'];
- $long_description = $fd['long_description'];
- $access = $fd['access_id'];
- if ($event_calendar_times != 'no') {
- $start_time = $fd['start_time'];
- $end_time = $fd['end_time'];
- }
- if ($event_calendar_personal_manage == 'by_event') {
- $personal_manage = $fd['personal_manage'];
- }
+} else {
$event_action = 'add_event';
$event_guid = 0;
}
-$body = '';
+
+$title = $fd['title'];
+$brief_description = $fd['description'];
+$venue = $fd['venue'];
+$start_date = $fd['start_date'];
+$end_date = $fd['end_date'];
+$fees = $fd['fees'];
+if ($event_calendar_spots_display) {
+ $spots = $fd['spots'];
+}
+if ($event_calendar_region_display) {
+ $region = $fd['region'];
+}
+if ($event_calendar_type_display) {
+ $event_type = $fd['event_type'];
+}
+$contact = $fd['contact'];
+$organiser = $fd['organiser'];
+$event_tags = $fd['tags'];
+$all_day = $fd['all_day'];
+$send_reminder = $fd['send_reminder'];
+$reminder_number = $fd['reminder_number'];
+$reminder_interval = $fd['reminder_interval'];
+$schedule_type = $fd['schedule_type'];
+$long_description = $fd['long_description'];
+$access = $fd['access_id'];
+if ($event_calendar_times != 'no') {
+ $start_time = $fd['start_time'];
+ $end_time = $fd['end_time'];
+}
+if ($event_calendar_personal_manage == 'by_event') {
+ $personal_manage = $fd['personal_manage'];
+}
+
+$body = '<div class="event-calendar-edit-form">';
$body .= elgg_view('input/hidden',array('name'=>'event_action', 'value'=>$event_action));
$body .= elgg_view('input/hidden',array('name'=>'event_guid', 'value'=>$event_guid));
$body .= elgg_view('input/hidden',array('name'=>'group_guid', 'value'=>$vars['group_guid']));
-$body .= '<p><label>'.elgg_echo("event_calendar:title_label").'<br />';
-$body .= elgg_view("input/text",array('name' => 'title','value'=>$title));
-$body .= '</label></p>';
-$body .= '<p class="description">'.$prefix['title'].elgg_echo('event_calendar:title_description').'</p>';
+$body .= '<div class="event-calendar-edit-form-block event-calendar-edit-form-top-block">';
-$body .= '<p><label>'.elgg_echo("event_calendar:venue_label").'<br />';
-$body .= elgg_view("input/text",array('name' => 'venue','value'=>$venue));
-$body .= '</label></p>';
-$body .= '<p class="description">'.$prefix['venue'].elgg_echo('event_calendar:venue_description').'</p>';
+$body .= '<p><label>'.elgg_echo("event_calendar:title_label").'</label>';
+$body .= elgg_view("input/text",array('name' => 'title','class'=>'event-calendar-medium-text','value'=>$title));
+$body .= '</p>';
+$body .= '<p class="event-calendar-description">'.$prefix['title'].elgg_echo('event_calendar:title_description').'</p>';
-if ($event_calendar_times != 'no') {
- $body .= '<div class="event-calendar-date-time-setter">';
- 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'=>$start_date));
- $body .= elgg_view("input/timepicker",array('name' => 'start_time','value'=>$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'=>$end_date));
- $body .= elgg_view("input/timepicker",array('name' => 'end_time','value'=>$end_time));
- }
+$body .= '<p><label>'.elgg_echo("event_calendar:venue_label").'</label>';
+$body .= elgg_view("input/text",array('name' => 'venue','class'=>'event-calendar-medium-text','value'=>$venue));
+$body .= '</p>';
+$body .= '<p class="event-calendar-description">'.$prefix['venue'].elgg_echo('event_calendar:venue_description').'</p>';
+
+$body .= '<p><label>'.elgg_echo("event_calendar:brief_description_label").'</label>';
+$body .= elgg_view("input/text",array('name' => 'description','class'=>'event-calendar-medium-text','value'=>$brief_description));
+$body .= '</p>';
+$body .= '<p class="event-calendar-description">'.$prefix['brief_description'].elgg_echo('event_calendar:brief_description_description').'</p>';
+
+$body .= '<p><label>'.elgg_echo("event_calendar:event_tags_label").'</label>';
+$body .= elgg_view("input/tags",array('name' => 'tags','class'=>'event-calendar-medium-text','value'=>$event_tags));
+$body .= '</p>';
+$body .= '<p class="event-calendar-description">'.$prefix['event_tags'].elgg_echo('event_calendar:event_tags_description').'</p>';
+
+$body .= '<p><label>'.elgg_echo("event_calendar:calendar_label").'</label>';
+$body .= elgg_view('event_calendar/container',array('container_guid'=>$vars['container_guid']));
+$body .= '</p>';
+$body .= '<p class="event-calendar-description">'.$prefix['calendar'].elgg_echo('event_calendar:calendar_description').'</p>';
+
+if(elgg_plugin_exists('sched_conf')) {
+ $body .= '<p>';
+ $body .= elgg_view('input/checkbox',array('name'=>'web_conference','value'=>$web_conference,'options_values'=>array('1')));
+ $body .= elgg_echo('event_calendar:web_conference_label');
$body .= '</p>';
- $body .= '</div>';
-} 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'=>$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'=>$end_date));
- $body .= '</label></p>';
- $body .= '<p class="description">'.$prefix['end_date'].elgg_echo('event_calendar:end_date_description').'</p>';
+$body .= '</div>';
+
+$body .= '<div class="event-calendar-edit-form-block event-calendar-edit-form-schedule-block">';
+$body .= '<h2>'.elgg_echo('event_calendar:schedule:header').'</h2>';
+if ($all_day) {
+ $body .= elgg_view('input/checkbox',array('name'=>'all_day','value'=>1,'checked'=>'checked'));
+} else {
+ $body .= elgg_view('input/checkbox',array('name'=>'all_day','value'=>1));
+}
+$body .= elgg_echo('event_calendar:all_day_label');
+if(elgg_plugin_exists('event_poll')) {
+ $body .= elgg_view('input/radio',array('name'=>'schedule_type','value'=>$schedule_type,'options'=>$schedule_options));
+}
+$body .= '<div class="event-calendar-edit-date-wrapper">';
+$body .= elgg_view('event_calendar/datetime_edit',
+ array(
+ 'start_date' => $start_date,
+ 'end_date' => $end_date,
+ 'start_time' => $start_time,
+ 'end_time' => $end_time,
+ 'prefix' => $prefix,
+));
+if ($event_calendar_repeated_events == 'yes') {
+ $body .= elgg_view('event_calendar/repeat_form_element',$vars);
+}
+if ($event_calendar_reminders == 'yes') {
+ $body .= '<div class="event-calendar-edit-reminder-wrapper">';
+ if ($send_reminder) {
+ $body .= elgg_view('input/checkbox',array('name'=>'send_reminder','checked' => 'checked','value'=>1));
+ } else {
+ $body .= elgg_view('input/checkbox',array('name'=>'send_reminder','value'=>1));
+ }
+ $body .= elgg_echo('elgg_calendar:send_reminder_label'). ' ';
+ $numbers = array();
+ for ($i=1;$i<60;$i++) {
+ $numbers[$i] = $i;
}
+ $intervals = array(
+ 1 => elgg_echo('event_calendar:interval:minute'),
+ 60 => elgg_echo('event_calendar:interval:hour'),
+ 60*24 => elgg_echo('event_calendar:interval:day'),
+ );
+
+ $body .= elgg_view('input/dropdown',array('name'=>'reminder_number','options_values'=>$numbers,'value'=>$reminder_number));
+ $body .= elgg_view('input/dropdown',array('name'=>'reminder_interval','options_values'=>$intervals,'value'=>$reminder_interval));
+ $body .= elgg_echo('elgg_calendar:send_reminder_before');
+ $body .= '</div>';
}
if ($event_calendar_spots_display == 'yes') {
$body .= '<p><label>'.elgg_echo("event_calendar:spots_label").'<br />';
- $body .= elgg_view("input/text",array('name' => 'spots','value'=>$spots));
+ $body .= elgg_view("input/text",array('name' => 'spots','class'=>'event-calendar-medium-text','value'=>$spots));
$body .= '</label></p>';
- $body .= '<p class="description">'.$prefix['spots'].elgg_echo('event_calendar:spots_description').'</p>';
+ $body .= '<p class="event-calendar-description">'.$prefix['spots'].elgg_echo('event_calendar:spots_description').'</p>';
}
+$body .= '</div>';
+$body .= '</div>';
// the following feature has been superceded by the manage subscribers feature
@@ -172,91 +242,17 @@ if ($event_calendar_spots_display == 'yes') {
$body .= '<p class="description">'.elgg_echo('event_calendar:add_user_description').'</p>';
}*/
-$body .= '<p><label>'.elgg_echo("event_calendar:brief_description_label").'<br />';
-$body .= elgg_view("input/text",array('name' => 'description','value'=>$brief_description));
-$body .= '</label></p>';
-$body .= '<p class="description">'.$prefix['brief_description'].elgg_echo('event_calendar:brief_description_description').'</p>';
-
-if ($event_calendar_region_display == 'yes') {
- $region_list = trim(elgg_get_plugin_setting('region_list', 'event_calendar'));
- $region_list_handles = elgg_get_plugin_setting('region_list_handles', 'event_calendar');
- // make sure that we are using Unix line endings
- $region_list = str_replace("\r\n","\n",$region_list);
- $region_list = str_replace("\r","\n",$region_list);
- if ($region_list) {
- $options = array();
- $options[] = '-';
- foreach(explode("\n",$region_list) as $region_item) {
- $region_item = trim($region_item);
- if ($region_list_handles == 'yes') {
- $options[$region_item] = elgg_echo('event_calendar:region:'.$region_item);
- } else {
- $options[$region_item] = $region_item;
- }
- }
- $body .= '<p><label>'.elgg_echo("event_calendar:region_label").'<br />';
- $body .= elgg_view("input/dropdown",array('name' => 'region','value'=>$region,'options_values'=>$options));
- $body .= '</label></p>';
- $body .= '<p class="description">'.$prefix['region'].elgg_echo('event_calendar:region_description').'</p>';
- }
-}
-
-if ($event_calendar_type_display == 'yes') {
- $type_list = trim(elgg_get_plugin_setting('type_list', 'event_calendar'));
- $type_list_handles = elgg_get_plugin_setting('type_list_handles', 'event_calendar');
- // make sure that we are using Unix line endings
- $type_list = str_replace("\r\n","\n",$type_list);
- $type_list = str_replace("\r","\n",$type_list);
- if ($type_list) {
- $options = array();
- $options[] = '-';
- foreach(explode("\n",$type_list) as $type_item) {
- $type_item = trim($type_item);
- if ($type_list_handles == 'yes') {
- $options[$type_item] = elgg_echo('event_calendar:type:'.$type_item);
- } else {
- $options[$type_item] = $type_item;
- }
- }
- $body .= '<p><label>'.elgg_echo("event_calendar:type_label").'<br />';
- $body .= elgg_view("input/dropdown",array('name' => 'event_type','value'=>$event_type,'options_values'=>$options));
- $body .= '</label></p>';
- $body .= '<p class="description">'.$prefix['event_type'].elgg_echo('event_calendar:type_description').'</p>';
- }
-}
-
-$body .= '<p><label>'.elgg_echo("event_calendar:fees_label").'<br />';
-$body .= elgg_view("input/text",array('name' => 'fees','value'=>$fees));
-$body .= '</label></p>';
-$body .= '<p class="description">'.$prefix['fees'].elgg_echo('event_calendar:fees_description').'</p>';
-
-$body .= '<p><label>'.elgg_echo("event_calendar:contact_label").'<br />';
-$body .= elgg_view("input/text",array('name' => 'contact','value'=>$contact));
-$body .= '</label></p>';
-$body .= '<p class="description">'.$prefix['contact'].elgg_echo('event_calendar:contact_description').'</p>';
-
-$body .= '<p><label>'.elgg_echo("event_calendar:organiser_label").'<br />';
-$body .= elgg_view("input/text",array('name' => 'organiser','value'=>$organiser));
-$body .= '</label></p>';
-$body .= '<p class="description">'.$prefix['organiser'].elgg_echo('event_calendar:organiser_description').'</p>';
-
if ($event_calendar_personal_manage == 'by_event') {
- $body .= '<p><label>'.elgg_echo('event_calendar:personal_manage:label').'<br />';
+ $body .= '<div class="event-calendar-edit-form-block event-calendar-edit-form-membership-block">';
+ $body .= '<h2>'.elgg_echo('event_calendar:personal_manage:label').'</h2>';
$body .= elgg_view("input/radio",array('name' => 'personal_manage','value'=>$personal_manage,'options'=>$personal_manage_options));
- $body .= '</label></p>';
- $body .= '<p class="description">'.$prefix['personal_manage'].elgg_echo('event_calendar:personal_manage:description').'</p>';
+ //$body .= '<p class="event-calendar-description">'.$prefix['personal_manage'].elgg_echo('event_calendar:personal_manage:description').'</p>';
+ $body .= '<br clear="both" />';
+ $body .= '</div>';
}
-$body .= '<p><label>'.elgg_echo("event_calendar:event_tags_label").'<br />';
-$body .= elgg_view("input/tags",array('name' => 'tags','value'=>$event_tags));
-$body .= '</label></p>';
-$body .= '<p class="description">'.$prefix['event_tags'].elgg_echo('event_calendar:event_tags_description').'</p>';
-
-$body .= '<p><label>'.elgg_echo("event_calendar:long_description_label").'<br />';
-$body .= elgg_view("input/longtext",array('name' => 'long_description','value'=>$long_description));
-$body .= '</label></p>';
-$body .= '<p class="description">'.$prefix['long_description'].elgg_echo('event_calendar:long_description_description').'</p>';
-
+$body .= '<div class="event-calendar-edit-form-block event-calendar-edit-form-share-block">';
+$body .= '<h2>'.elgg_echo('event_calendar:permissions:header').'</h2>';
if($event_calendar_hide_access == 'yes') {
$event_calendar_default_access = elgg_get_plugin_setting('default_access', 'event_calendar');
if($event_calendar_default_access) {
@@ -265,11 +261,95 @@ if($event_calendar_hide_access == 'yes') {
$body .= elgg_view("input/hidden",array('name' => 'access_id','value'=>ACCESS_PRIVATE));
}
} else {
- $body .= '<p><label>'.elgg_echo("access").'<br />';
+ $body .= '<p><label>'.elgg_echo('event_calendar:read_access').'</label>';
$body .= elgg_view("input/access",array('name' => 'access_id','value'=>$access));
- $body .= '</label></p>';
+ $body .= '</p>';
+}
+$body .= elgg_echo('event_calendar:share_ownership:label');
+$body .= '<br />';
+$body .= elgg_echo('event_calendar:share_ownership:description');
+$body .= elgg_view('input/entity_admins_dropdown',array('entity'=>$event));
+$body .= '</div>';
+
+if ($event_calendar_region_display == 'yes' || $event_calendar_type_display == 'yes' || $event_calendar_fewer_fields != 'yes') {
+ $body .= '<div class="event-calendar-edit-form-block event-calendar-edit-form-other-block">';
+
+ if ($event_calendar_region_display == 'yes') {
+ $region_list = trim(elgg_get_plugin_setting('region_list', 'event_calendar'));
+ $region_list_handles = elgg_get_plugin_setting('region_list_handles', 'event_calendar');
+ // make sure that we are using Unix line endings
+ $region_list = str_replace("\r\n","\n",$region_list);
+ $region_list = str_replace("\r","\n",$region_list);
+ if ($region_list) {
+ $options = array();
+ $options[] = '-';
+ foreach(explode("\n",$region_list) as $region_item) {
+ $region_item = trim($region_item);
+ if ($region_list_handles == 'yes') {
+ $options[$region_item] = elgg_echo('event_calendar:region:'.$region_item);
+ } else {
+ $options[$region_item] = $region_item;
+ }
+ }
+ $body .= '<p><label>'.elgg_echo("event_calendar:region_label").'</label>';
+ $body .= elgg_view("input/dropdown",array('name' => 'region','value'=>$region,'options_values'=>$options));
+ $body .= '</p>';
+ $body .= '<p class="event-calendar-description">'.$prefix['region'].elgg_echo('event_calendar:region_description').'</p>';
+ }
+ }
+
+ if ($event_calendar_type_display == 'yes') {
+ $type_list = trim(elgg_get_plugin_setting('type_list', 'event_calendar'));
+ $type_list_handles = elgg_get_plugin_setting('type_list_handles', 'event_calendar');
+ // make sure that we are using Unix line endings
+ $type_list = str_replace("\r\n","\n",$type_list);
+ $type_list = str_replace("\r","\n",$type_list);
+ if ($type_list) {
+ $options = array();
+ $options[] = '-';
+ foreach(explode("\n",$type_list) as $type_item) {
+ $type_item = trim($type_item);
+ if ($type_list_handles == 'yes') {
+ $options[$type_item] = elgg_echo('event_calendar:type:'.$type_item);
+ } else {
+ $options[$type_item] = $type_item;
+ }
+ }
+ $body .= '<p><label>'.elgg_echo("event_calendar:type_label").'</label>';
+ $body .= elgg_view("input/dropdown",array('name' => 'event_type','value'=>$event_type,'options_values'=>$options));
+ $body .= '</p>';
+ $body .= '<p class="event-calendar-description">'.$prefix['event_type'].elgg_echo('event_calendar:type_description').'</p>';
+ }
+ }
+
+ if ($event_calendar_fewer_fields != 'yes') {
+
+ $body .= '<p><label>'.elgg_echo("event_calendar:fees_label").'</label>';
+ $body .= elgg_view("input/text",array('name' => 'fees','class'=>'event-calendar-medium-text','value'=>$fees));
+ $body .= '</p>';
+ $body .= '<p class="event-calendar-description">'.$prefix['fees'].elgg_echo('event_calendar:fees_description').'</p>';
+
+ $body .= '<p><label>'.elgg_echo("event_calendar:contact_label").'</label>';
+ $body .= elgg_view("input/text",array('name' => 'contact','class'=>'event-calendar-medium-text','value'=>$contact));
+ $body .= '</p>';
+ $body .= '<p class="event-calendar-description">'.$prefix['contact'].elgg_echo('event_calendar:contact_description').'</p>';
+
+ $body .= '<p><label>'.elgg_echo("event_calendar:organiser_label").'</label>';
+ $body .= elgg_view("input/text",array('name' => 'organiser','class'=>'event-calendar-medium-text','value'=>$organiser));
+ $body .= '</p>';
+ $body .= '<p class="event-calendar-description">'.$prefix['organiser'].elgg_echo('event_calendar:organiser_description').'</p>';
+
+ $body .= '<p><label>'.elgg_echo("event_calendar:long_description_label").'</label>';
+ $body .= elgg_view("input/longtext",array('name' => 'long_description','class'=>'event-calendar-long-text','value'=>$long_description));
+ $body .= '</p>';
+ $body .= '<p class="event-calendar-description">'.$prefix['long_description'].elgg_echo('event_calendar:long_description_description').'</p>';
+ }
+
+ $body .= '</div>';
}
$body .= elgg_view('input/submit', array('name'=>'submit','value'=>elgg_echo('event_calendar:submit')));
+$body .= '</div>';
+
echo $body;
diff --git a/views/default/input/timepicker.php b/views/default/input/timepicker.php
index d7df04699..ccbb88778 100644
--- a/views/default/input/timepicker.php
+++ b/views/default/input/timepicker.php
@@ -1,5 +1,5 @@
<?php
-
+$event_calendar_restricted_times = elgg_get_plugin_setting('restricted_times', 'event_calendar');
$time_format = elgg_get_plugin_setting('timeformat', 'event_calendar');
if (!$time_format) {
$time_format = '24';
@@ -18,7 +18,14 @@ $dates = array();
$dates['-'] = '-';
if ($time_format == '12') {
- for($h=0;$h<=12;$h++) {
+ if ($event_calendar_restricted_times == 'yes') {
+ $h1 = 6;
+ $h2 = 9;
+ } else {
+ $h1 = 0;
+ $h2 = 11;
+ }
+ for($h=$h1;$h<=12;$h++) {
$ht = sprintf("%02d",$h);
for($m=0;$m<60;$m=$m+15) {
$mt = sprintf("%02d",$m);
@@ -30,7 +37,7 @@ if ($time_format == '12') {
}
}
}
- for($h=1;$h<12;$h++) {
+ for($h=1;$h<$h2;$h++) {
$ht = sprintf("%02d",$h);
for($m=0;$m<60;$m=$m+15) {
$mt = sprintf("%02d",$m);
@@ -38,8 +45,23 @@ if ($time_format == '12') {
$dates[$t] = "$ht:$mt pm";
}
}
+ if ($event_calendar_restricted_times == 'yes') {
+ $m = 0;
+ $h = 9;
+ $ht = sprintf("%02d",$h);
+ $mt = sprintf("%02d",$m);
+ $t = 12*60+$h*60+$m;
+ $dates[$t] = "$ht:$mt pm";
+ }
} else {
- for($h=0;$h<24;$h++) {
+ if ($event_calendar_restricted_times == 'yes') {
+ $h1 = 6;
+ $h2 = 21;
+ } else {
+ $h1 = 0;
+ $h2 = 24;
+ }
+ for($h=$h1;$h<$h2;$h++) {
$ht = sprintf("%02d",$h);
for($m=0;$m<60;$m=$m+15) {
$mt = sprintf("%02d",$m);
@@ -47,6 +69,14 @@ if ($time_format == '12') {
$dates[$t] = "$ht:$mt";
}
}
+ if ($event_calendar_restricted_times == 'yes') {
+ $m = 0;
+ $h = 21;
+ $ht = sprintf("%02d",$h);
+ $mt = sprintf("%02d",$m);
+ $t = 12*60+$h*60+$m;
+ $dates[$t] = "$ht:$mt pm";
+ }
}
echo elgg_view('input/dropdown',array('name'=>$vars['name'],'value'=>$time,'options_values'=>$dates));
diff --git a/views/default/js/event_calendar/event_calendar.php b/views/default/js/event_calendar/event_calendar.php
index 8c4e735a6..b3ca2cc7b 100644
--- a/views/default/js/event_calendar/event_calendar.php
+++ b/views/default/js/event_calendar/event_calendar.php
@@ -6,6 +6,64 @@ elgg.event_calendar.init = function () {
$('.event-calendar-personal-calendar-toggle').click(elgg.event_calendar.handleDisplayPagePersonalCalendarToggle);
$('#event-calendar-region').change(elgg.event_calendar.handleRegionChange);
$('#event-calendar-ical-link').click(elgg.event_calendar.handleIcalPopup);
+ $('.event-calendar-repeating-unselected').each(elgg.event_calendar.setRepeatingClass);
+ $('.event-calendar-repeating-unselected').live('click',elgg.event_calendar.handleRepeatingSelect);
+ $('.event-calendar-repeating-selected').live('click',elgg.event_calendar.handleRepeatingUnselect);
+ $('#event-calendar-edit').submit(elgg.event_calendar.handleEditFormSubmit);
+
+ var all_day_field = $('[name="all_day"][type="checkbox"]');
+ if (all_day_field.is(':checked')) {
+ $('[name="start_time"]').val(0);
+ $('[name="start_time"]').attr('disabled','disabled');
+ $('[name="end_time"]').val(0);
+ $('[name="end_time"]').attr('disabled','disabled');
+ }
+ all_day_field.change(elgg.event_calendar.handleAllDayField);
+}
+
+elgg.event_calendar.handleAllDayField = function(e) {
+ var field = $('[name="start_time"]');
+ if (field.attr('disabled') == 'disabled') {
+ field.removeAttr('disabled');
+ } else {
+ field.attr('disabled','disabled');
+ }
+
+ field = $('[name="end_time"]');
+ if (field.attr('disabled') == 'disabled') {
+ field.removeAttr('disabled');
+ } else {
+ field.attr('disabled','disabled');
+ }
+}
+
+elgg.event_calendar.handleEditFormSubmit = function(e) {
+ if ($.trim($('[name="title"]').val()) == '') {
+ alert(elgg.echo('event_calendar:edit_form:error:missing_title'));
+ e.preventDefault();
+ }
+}
+
+elgg.event_calendar.setRepeatingClass = function(e) {
+ var id = $(this).attr('id');
+ if ($("[name='"+id+"-value']").val() == 1) {
+ $(this).removeClass('event-calendar-repeating-unselected');
+ $(this).addClass('event-calendar-repeating-selected');
+ }
+}
+
+elgg.event_calendar.handleRepeatingSelect = function(e) {
+ $(this).removeClass('event-calendar-repeating-unselected');
+ $(this).addClass('event-calendar-repeating-selected');
+ var id = $(this).attr('id');
+ $("[name='"+id+"-value']").val(1);
+}
+
+elgg.event_calendar.handleRepeatingUnselect = function(e) {
+ $(this).removeClass('event-calendar-repeating-selected');
+ $(this).addClass('event-calendar-repeating-unselected');
+ var id = $(this).attr('id');
+ $("[name='"+id+"-value']").val(0);
}
elgg.event_calendar.handleRegionChange = function(e) {
diff --git a/views/default/plugins/event_calendar/settings.php b/views/default/plugins/event_calendar/settings.php
index 93724484c..908818998 100644
--- a/views/default/plugins/event_calendar/settings.php
+++ b/views/default/plugins/event_calendar/settings.php
@@ -79,6 +79,28 @@ $body .= elgg_view('input/radio',array('name'=>'params[listing_format]','value'=
$body .= '<br />';
+$event_calendar_repeated_events = elgg_get_plugin_setting('repeated_events', 'event_calendar');
+if (!$event_calendar_repeated_events) {
+ $event_calendar_repeated_events = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:repeated_events:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('name'=>'params[repeated_events]','value'=>$event_calendar_repeated_events,'options'=>$yn_options));
+
+$body .= '<br />';
+
+$event_calendar_reminders = elgg_get_plugin_setting('reminders', 'event_calendar');
+if (!$event_calendar_reminders) {
+ $event_calendar_reminders = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:reminders:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('name'=>'params[reminders]','value'=>$event_calendar_reminders,'options'=>$yn_options));
+
+$body .= '<br />';
+
$event_calendar_times = elgg_get_plugin_setting('times', 'event_calendar');
if (!$event_calendar_times) {
$event_calendar_times = 'yes';
@@ -90,6 +112,17 @@ $body .= elgg_view('input/radio',array('name'=>'params[times]','value'=>$event_c
$body .= '<br />';
+$event_calendar_restricted_times = elgg_get_plugin_setting('restricted_times', 'event_calendar');
+if (!$event_calendar_restricted_times) {
+ $event_calendar_restricted_times = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:restricted_times:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('name'=>'params[restricted_times]','value'=>$event_calendar_restricted_times,'options'=>$yn_options));
+
+$body .= '<br />';
+
$event_calendar_time_format = elgg_get_plugin_setting('timeformat', 'event_calendar');
if (!$event_calendar_time_format) {
$event_calendar_time_format = '24';
@@ -158,6 +191,17 @@ $body .= elgg_view('input/radio',array('name'=>'params[venue_view]','value'=>$ev
$body .= '<br />';
+$event_calendar_fewer_fields = elgg_get_plugin_setting('fewer_fields', 'event_calendar');
+if (!$event_calendar_fewer_fields) {
+ $event_calendar_fewer_fields = 'no';
+}
+
+$body .= elgg_echo('event_calendar:settings:fewer_fields:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('name'=>'params[fewer_fields]','value'=>$event_calendar_fewer_fields,'options'=>$yn_options));
+
+$body .= '<br />';
+
$options = array(elgg_echo('event_calendar:settings:no')=>'no',
elgg_echo('event_calendar:settings:site_calendar:admin')=>'admin',
elgg_echo('event_calendar:settings:site_calendar:loggedin')=>'loggedin',