aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/event_calendar/edit.php4
-rw-r--r--actions/event_calendar/modify_full_calendar.php13
-rw-r--r--activate.php4
-rw-r--r--languages/ca.php143
-rw-r--r--languages/en.php97
-rw-r--r--languages/es.php107
-rw-r--r--languages/fr.php1
-rw-r--r--models/model.php992
-rw-r--r--start.php53
-rw-r--r--views/default/css/elements/forms/datepicker_multi.php39
-rw-r--r--views/default/event_calendar/conference_button.php32
-rw-r--r--views/default/event_calendar/container.php28
-rw-r--r--views/default/event_calendar/css.php94
-rw-r--r--views/default/event_calendar/datetime_edit.php46
-rw-r--r--views/default/event_calendar/filter_menu.php16
-rw-r--r--views/default/event_calendar/forms/add_to_group.php2
-rw-r--r--views/default/event_calendar/forms/delete_confirm.php13
-rw-r--r--views/default/event_calendar/forms/manage_event.php22
-rw-r--r--views/default/event_calendar/forms/manage_event_content.php254
-rw-r--r--views/default/event_calendar/full_calendar_view.php213
-rw-r--r--views/default/event_calendar/groupprofile_calendar.php4
-rw-r--r--views/default/event_calendar/input/date_local.php1
-rw-r--r--views/default/event_calendar/input/longtext.php25
-rw-r--r--views/default/event_calendar/personal_manage_section.php20
-rw-r--r--views/default/event_calendar/reminder_section.php28
-rw-r--r--views/default/event_calendar/repeat_form_element.php32
-rw-r--r--views/default/event_calendar/schedule_section.php22
-rw-r--r--views/default/event_calendar/share_section.php26
-rw-r--r--views/default/event_calendar/show_events.php12
-rw-r--r--views/default/forms/event_calendar/edit.php372
-rw-r--r--views/default/input/datepicker_inline.php3
-rw-r--r--views/default/input/datepicker_popup.php31
-rw-r--r--views/default/input/timepicker.php62
-rw-r--r--views/default/js/event_calendar/event_calendar.php101
-rw-r--r--views/default/object/event_calendar.php14
-rw-r--r--views/default/plugins/event_calendar/settings.php74
-rw-r--r--views/default/river/object/event_calendar/create.php23
-rw-r--r--views/default/river/object/event_calendar/update.php19
-rw-r--r--views/default/widgets/event_calendar/content.php8
-rw-r--r--views/default/widgets/event_calendar/view.php39
-rw-r--r--views/ical/event_calendar/show_events.php2
41 files changed, 2156 insertions, 935 deletions
diff --git a/actions/event_calendar/edit.php b/actions/event_calendar/edit.php
index 0cc956d73..aef1a59cc 100644
--- a/actions/event_calendar/edit.php
+++ b/actions/event_calendar/edit.php
@@ -34,6 +34,10 @@ if ($event) {
add_to_river('river/object/event_calendar/create','create',$user_guid,$event->guid);
system_message(elgg_echo('event_calendar:add_event_response'));
}
+
+ if ($event->schedule_type == 'poll') {
+ forward('event_poll/add/'.$event->guid);
+ }
forward($event->getURL());
} else {
diff --git a/actions/event_calendar/modify_full_calendar.php b/actions/event_calendar/modify_full_calendar.php
index 595bdbe4b..1e0bd3a01 100644
--- a/actions/event_calendar/modify_full_calendar.php
+++ b/actions/event_calendar/modify_full_calendar.php
@@ -3,9 +3,18 @@ elgg_load_library('elgg:event_calendar');
$event_guid = get_input('event_guid',0);
$day_delta = get_input('dayDelta');
$minute_delta = get_input('minuteDelta','');
-
-if (event_calendar_modify_full_calendar($event_guid,$day_delta,$minute_delta)) {
+$start_time = get_input('startTime','');
+$resend = get_input('resend','');
+$minutes = get_input('minutes');
+$iso_date = get_input('iso_date');
+$result = event_calendar_modify_full_calendar($event_guid,$day_delta,$minute_delta,$start_time,$resend,$minutes,$iso_date);
+if ($result) {
$response = array('success'=>TRUE);
+ // special handling for event polls
+ if (is_array($result)) {
+ $response['minutes'] = $result['minutes'];
+ $response['iso_date'] = $result['iso_date'];
+ }
} else {
$response = array('success'=>FALSE, 'message' =>elgg_echo('event_calendar:modify_full_calendar:error'));
}
diff --git a/activate.php b/activate.php
new file mode 100644
index 000000000..3be14d287
--- /dev/null
+++ b/activate.php
@@ -0,0 +1,4 @@
+<?php
+
+elgg_set_plugin_setting('listing_format', 'full', 'event_calendar');
+elgg_set_plugin_setting('fewer_fields', 'yes', 'event_calendar'); \ No newline at end of file
diff --git a/languages/ca.php b/languages/ca.php
new file mode 100644
index 000000000..4881d7458
--- /dev/null
+++ b/languages/ca.php
@@ -0,0 +1,143 @@
+<?php
+$language = array (
+ 'item:object:event_calendar' => 'Calendari',
+ 'tag_names:event_tags' => 'Etiquetes',
+ 'event_calendar:optional' => 'Opcional.',
+ 'event_calendar:required' => 'Requerit.',
+ 'event_calendar:new_event' => 'Nou esdeveniment',
+ 'event_calendar:no_such_event_edit_error' => 'Error: no hi ha cap esdeveniment o no tens permissos per editar-lo.',
+ 'event_calendar:add_event_title' => 'Afegeix esdeveniment',
+ 'event_calendar:manage_event_title' => 'Edita esdeveniment',
+ 'event_calendar:manage_event_description' => 'Introdueix detalls del teu esdeveniment a sota. El títol, lloc on serà i data d\'inici són requerits. Pots fer clic a les icones del calendari per indicar les dates d\'inici i final.',
+ 'event_calendar:title_label' => 'Títol',
+ 'event_calendar:title_description' => 'D\'una a quatre paraules',
+ 'event_calendar:brief_description_label' => 'Descripció',
+ 'event_calendar:brief_description_description' => 'Una frase curta.',
+ 'event_calendar:venue_label' => 'On',
+ 'event_calendar:venue_description' => 'On serà aquest esdeveniment?',
+ 'event_calendar:start_date_label' => 'Data d\'inici',
+ 'event_calendar:start_date_description' => 'Quan començarà?',
+ 'event_calendar:end_date_label' => 'Data de finalització',
+ 'event_calendar:end_date_description' => 'Quan finalitzarà aquest esdeveniment? La data d\'inici serà utilitzada com a data de finalització si no en poses cap.',
+ 'event_calendar:start_time_label' => 'Hora d\'inici',
+ 'event_calendar:start_time_description' => 'A quina hora començarà aquest esdeveniment?',
+ 'event_calendar:end_time_label' => 'Hora de finalització',
+ 'event_calendar:end_time_description' => 'A quina hora finalitzarà aquest esdeveniment?',
+ 'event_calendar:fees_label' => 'Costos',
+ 'event_calendar:fees_description' => 'El cost d\'aquest esdeveniment, si és que en té.',
+ 'event_calendar:contact_label' => 'Contacte',
+ 'event_calendar:contact_description' => 'La persona de contacte per a més informació, preferiblement amb un número de telèfon o una adreça d\'email',
+ 'event_calendar:organiser_label' => 'Organitzadora',
+ 'event_calendar:organiser_description' => 'La persona o organització responsable d\'aquest esdeveniment.',
+ 'event_calendar:event_tags_label' => 'Etiquetes',
+ 'event_calendar:event_tags_description' => 'Una llista separada amb comes de les etiquetes més destacables per a aquest esdeveniment.',
+ 'event_calendar:long_description_label' => 'Descripció llarga',
+ 'event_calendar:long_description_description' => 'Pot ser un paràgraf o més com a requerit.',
+ 'event_calendar:manage_event_response' => 'El teu esdeveniment s\'ha desat correctament.',
+ 'event_calendar:add_event_response' => 'El teu esdeveniment s\'ha afegit correctament.',
+ 'event_calendar:show_events_title' => 'Calendari',
+ 'event_calendar:day_label' => 'Dia',
+ 'event_calendar:week_label' => 'Setmana',
+ 'event_calendar:month_label' => 'Mes',
+ 'event_calendar:group' => 'Calendari del grup',
+ 'event_calendar:new' => 'Afegir esdeveniment',
+ 'event_calendar:submit' => 'Desa i continua',
+ 'event_calendar:cancel' => 'Cancel·la',
+ 'event_calendar:widget_title' => 'Calendari',
+ 'event_calendar:widget:description' => 'Mostra els teus esdeveniments.',
+ 'event_calendar:num_display' => 'Número d\'esdeveniments per mostrar',
+ 'event_calendar:groupprofile' => 'Propers esdeveniments',
+ 'event_calendar:view_calendar' => 'vista del calendari',
+ 'event_calendar:when_label' => 'Quan',
+ 'event_calendar:site_wide_link' => 'Veure tots els esdeveniments',
+ 'event_calendar:view_link' => 'Veure aquest esdeveniment',
+ 'event_calendar:edit_link' => 'Edita aquest esdeveniment',
+ 'event_calendar:delete_link' => 'Esborra aquest esdeveniment',
+ 'event_calendar:delete_response' => 'Aquest esdeveniment ha estat esborrat.',
+ 'event_calendar:error_delete' => 'Aquest esdeveniment no existeix o no tens permisos per esborrar-lo.',
+ 'event_calendar:delete_cancel_response' => 'Esborrat de l\'esdeveniment cancel·lat.',
+ 'event_calendar:add_to_my_calendar' => 'Afegeix al meu calendari',
+ 'event_calendar:remove_from_my_calendar' => 'Treure del meu calendari',
+ 'event_calendar:add_to_my_calendar_response' => 'Aquest esdeveniment ha estat afegit al teu calendari personal',
+ 'event_calendar:add_to_the_calendar' => 'Afegeix al calendari',
+ 'event_calendar:remove_from_the_calendar' => 'Elimina',
+ 'event_calendar:add_to_the_calendar_menu_text' => 'Afegir al meu',
+ 'event_calendar:remove_from_the_calendar_menu_text' => 'Elimina del meu',
+ 'event_calendar:remove_from_the_calendar_button' => 'Elimina del calendari',
+ 'event_calendar:added_to_the_calendar' => 'Afegit al calendari',
+ 'event_calendar:removed_from_the_calendar' => 'Calendari eliminat',
+ 'event_calendar:personal_event_calendars_link' => 'A %s calendaris',
+ 'event_calendar:personal_event_calendars_link_one' => 'A un calendari',
+ 'event_calendar:users_for_event_breadcrumb' => 'Calendaris personals',
+ 'event_calendar:settings:group_profile_display_option:left' => 'columna esquerra',
+ 'event_calendar:settings:group_profile_display_option:right' => 'columna dreta',
+ 'event_calendar:settings:group_profile_display_option:none' => 'cap',
+ 'event_calendar:settings:agenda_view:title' => 'Utilitza la vista d\'agenda',
+ 'event_calendar:settings:yes' => 'sí',
+ 'event_calendar:settings:no' => 'no',
+ 'event_calendar:region_label' => 'Regió',
+ 'event_calendar:type_label' => 'Tipus',
+ 'event_calendar:all' => 'Tots',
+ 'event_calendar:no_events_found' => 'No s\'han trobat esdeveniments.',
+ 'event_calendar:mine' => 'Meus',
+ 'event_calendar:agenda:column:time' => 'Temps',
+ 'event_calendar:agenda:column:session' => 'Sessió',
+ 'event_calendar:agenda:column:venue' => 'Localització',
+ 'event_calendar:settings:agenda' => 'agenda',
+ 'event_calendar:settings:month' => 'per mes',
+ 'event_calendar:settings:full' => 'vista completa',
+ 'event_calendar:paged:column:date' => 'Data',
+ 'event_calendar:paged:column:time' => 'Hora',
+ 'event_calendar:paged:column:event' => 'Esdeveniment',
+ 'event_calendar:paged:column:venue' => 'Localització',
+ 'event_calendar:paged:column:calendar' => 'Calendari',
+ 'event_calendar:open' => 'Obrir',
+ 'event_calendar:add_user_label' => 'Afegir habitants',
+ 'event_calendar:show_all' => 'Tots',
+ 'event_calendar:show_mine' => 'El meu calendari',
+ 'event_calendar:show_friends' => 'Calendari de les amigues',
+ 'event_calendar:listing_title:all' => 'Tots',
+ 'event_calendar:listing_title:mine' => 'El meu calendari',
+ 'event_calendar:listing_title:friends' => 'Calendari de les amigues',
+ 'event_calendar:personal_manage:open' => 'obert',
+ 'event_calendar:personal_manage:closed' => 'tancat',
+ 'event_calendar:personal_manage:private' => 'privat',
+ 'event_calendar:from_label' => 'De:',
+ 'event_calendar:to_label' => 'A:',
+ 'event_calendar:settings:timeformat:title' => 'Format d\'hora',
+ 'event_calendar:time_format:12hour' => '12 hores (am/pm)',
+ 'event_calendar:time_format:24hour' => '24 hores',
+ 'event_calendar:all_day_label' => 'Event de tot el dia',
+ 'event_calendar:repeat_interval_label' => 'Repeteix cada',
+ 'event_calendar:repeat_weeks' => 'setmana(es)',
+ 'event_calendar:on_these_days' => 'en aquests dies',
+ 'event_calendar:day_abbrev:monday' => 'DL',
+ 'event_calendar:day_abbrev:tuesday' => 'DM',
+ 'event_calendar:day_abbrev:wednesday' => 'DC',
+ 'event_calendar:day_abbrev:thursday' => 'DJ',
+ 'event_calendar:day_abbrev:friday' => 'DV',
+ 'event_calendar:day_abbrev:saturday' => 'DS',
+ 'event_calendar:day_abbrev:sunday' => 'DG',
+ 'event_calendar:dow:full:monday' => 'Dilluns',
+ 'event_calendar:dow:full:tuesday' => 'Dimarts',
+ 'event_calendar:dow:full:wednesday' => 'Dimecres',
+ 'event_calendar:dow:full:thursday' => 'Dijous',
+ 'event_calendar:dow:full:friday' => 'Divendres',
+ 'event_calendar:dow:full:saturday' => 'Dissabte',
+ 'event_calendar:dow:full:sunday' => 'Diumenge',
+ 'event_calendar:schedule_type:fixed' => 'Posa data i hora',
+ 'event_calendar:interval:minute' => 'minut(s)',
+ 'event_calendar:interval:hour' => 'hora(es)',
+ 'event_calendar:interval:day' => 'dia(es)',
+ 'event_calendar:site_calendar' => 'Calendari del lloc',
+ 'event_calendar:calendar_label' => 'Calendari',
+ 'event_calendar:calendar_description' => 'Calendari per aquest esdeveniment.',
+ 'event_calendar:basic:header' => 'Informació bàsica',
+ 'event_calendar:schedule:header' => 'Horari',
+ 'event_calendar:permissions:header' => 'Permisos',
+ 'event_calendar:read_access' => 'Accés de lectura',
+ 'event_calendar:add_event' => 'Afegeix event',
+ 'event_calendar:poll_suffix' => '(enquesta)',
+ 'event_calendar:add' => 'Afegeix',
+);
+add_translation("ca", $language);
diff --git a/languages/en.php b/languages/en.php
index 2e4c3373a..dfbe0cda4 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -2,7 +2,7 @@
$english = array(
- 'item:object:event_calendar' => "Event calendar",
+ 'item:object:event_calendar' => "Calendar",
'tag_names:event_tags' => "Tags",
'event_calendar:optional' => "Optional.",
'event_calendar:required' => "Required.",
@@ -15,9 +15,9 @@
."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_label' => "Where",
'event_calendar:venue_description' => "Where will this event be held?",
'event_calendar:start_date_label' => "Start date",
'event_calendar:start_date_description' => "When will this event start?",
@@ -44,15 +44,15 @@
'event_calendar:manage_event_error' => "Error: There was an error in saving your event. "
."Please make sure that you have provided the required fields.",
'event_calendar:error_nosuchevent' => "Error: there is no such event.",
- 'event_calendar:show_events_title' => "Event calendar",
+ 'event_calendar:show_events_title' => "Calendar",
'event_calendar:day_label' => "Day",
'event_calendar:week_label' => "Week",
'event_calendar:month_label' => "Month",
'event_calendar:group' => "Group calendar",
'event_calendar:new' => "Add event",
- 'event_calendar:submit' => "Submit",
+ 'event_calendar:submit' => "Save and Continue",
'event_calendar:cancel' => "Cancel",
- 'event_calendar:widget_title' => "Event calendar",
+ 'event_calendar:widget_title' => "Calendar",
'event_calendar:widget:description' => "Displays your events.",
'event_calendar:num_display' => "Number of events to display",
'event_calendar:groupprofile' => "Upcoming events",
@@ -62,8 +62,6 @@
'event_calendar:view_link' => "View this event",
'event_calendar:edit_link' => "Edit this event",
'event_calendar:delete_link' => "Delete this event",
- 'event_calendar:delete_confirm_title' => "Confirm event deletion",
- 'event_calendar:delete_confirm_description' => "Are you sure that you want to delete this event (\"%s\")? This action cannot be undone.",
'event_calendar:delete_response' => "This event has been deleted.",
'event_calendar:error_delete' => "This event does not exist or you do not have the right to delete it.",
'event_calendar:delete_cancel_response' => "Event delete cancelled.",
@@ -117,13 +115,13 @@
'event_calendar:region_description' => "Select the region that this event will be held in.",
'event_calendar:settings:type_display:title' => "Add event type to events",
'event_calendar:settings:type_list:title' => "List of event types (one per line)",
- 'event_calendar:type_label' => "Type of event",
+ 'event_calendar:type_label' => "Type",
'event_calendar:type_description' => "Select the type of event.",
'event_calendar:all' => "All",
'event_calendar:region_filter_by_label' => "Filter by region: ",
'event_calendar:settings:first_date:title' => "First allowable date (in YYYY-MM-DD format)",
'event_calendar:settings:last_date:title' => "Last allowable date (in YYYY-MM-DD format)",
- 'event_calendar:enable_event_calendar' => "Enable group event calendar",
+ 'event_calendar:enable_event_calendar' => "Enable group calendar",
'event_calendar:no_events_found' => "No events found.",
'event_calendar:mine' => "Mine",
'event_calendar:feature' => "Feature",
@@ -250,9 +248,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 +262,78 @@ 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:are_you_sure' => "Are you sure about this change?",
+ 'event_calendar:basic:header' => "Basic info",
+ '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:add_event' => "Add event",
+ 'event_calendar:schedule_event' => "Schedule event",
+ 'event_calendar:list_polls' => "List event polls",
+ '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",
+ 'event_calendar:reminder:subject' => "Reminder for event: %s",
+ 'event_calendar:reminder:body' => "The event
+
+%s
+
+takes place at
+
+%s.
+
+You can visit the event page here:
+%s
+ ",
+
+ /**
+ * BBB support
+ */
+
+ 'event_calendar:bbb_server_url' => "Big Blue Button server URL (must end with slash)",
+ 'event_calendar:bbb_security_salt' => "Big Blue Button security salt",
+ 'event_calendar:bbb_create_error' => "Error: unable to create BBB conference, message was: %s",
+ 'event_calendar:bbb_settings_error' => "Error: must set conference URL and salt in plugin settings",
+ 'event_calendar:join_conf_button' => "Join conference",
+
+ 'event_calendar:poll_suffix' => "(poll)",
+ 'event_calendar:resend_poll_invitation' => "Do you want to alert poll invitees that the options have changed?",
/**
* Event calendar river
@@ -283,5 +356,3 @@ You can manage calendar requests for this event here:
);
add_translation("en",$english);
-
-?> \ No newline at end of file
diff --git a/languages/es.php b/languages/es.php
index 1eefff2a3..2282591d3 100644
--- a/languages/es.php
+++ b/languages/es.php
@@ -1,6 +1,100 @@
<?php
$language = array (
- 'item:object:event_calendar' => 'Calendario de eventos',
+ 'tag_names:event_tags' => 'Etiqueta',
+ 'event_calendar:optional' => 'Opcional.',
+ 'event_calendar:required' => 'Requerido.',
+ 'event_calendar:add_to_my_calendar_error' => 'No se puede añadir ese evento a tu calendario personal. (Quizás tu calendario ya esté lleno o ¿intentas agendar dos eventos a la vez en tu calendario personal?)',
+ 'event_calendar:add_to_the_calendar' => 'Añadir al calendario',
+ 'event_calendar:remove_from_the_calendar' => 'Remover',
+ 'event_calendar:add_to_the_calendar_menu_text' => 'Añadir a mi calendario',
+ 'event_calendar:remove_from_the_calendar_menu_text' => 'Remover de mi calendario',
+ 'event_calendar:remove_from_the_calendar_button' => 'Remover del calendario',
+ 'event_calendar:added_to_the_calendar' => 'Añadir al calendario',
+ 'event_calendar:removed_from_the_calendar' => 'Remover calendario',
+ 'event_calendar:add_to_the_calendar_response' => 'Evento añadido al calendario personal',
+ 'event_calendar:add_to_the_calendar_error' => 'No se puede añadir ese evento a tu calendario personal. (Quizás tu calendario ya esté lleno o ¿intentas agendar dos eventos a la vez en tu calendario personal?)',
+ 'event_calendar:remove_from_the_calendar_response' => 'Evento borrado del calendario.',
+ 'event_calendar:users_for_event_menu_title' => 'Habitantes que apuntan ese evento en su calendario personal',
+ 'event_calendar:personal_event_calendars_link_one' => 'En 1 calendario',
+ 'event_calendar:users_for_event_breadcrumb' => 'Calendario personal',
+ 'event_calendar:settings:agenda' => 'Agenda',
+ 'event_calendar:settings:full' => 'Vista completa',
+ 'event_calendar:settings:spots_display:title' => 'Añade un campo para cada evento para que puedas limitar el numero de personas que pueden añadir el evento a su propio calendario',
+ 'event_calendar:settings:no_collisions:title' => 'Colisión detectada: evita que se añadan dos eventos a la vez en el calendario',
+ 'event_calendar:settings:collision_length:title' => 'Cuanto tiempo (en segundos) un evento puede ser considerado como activo si no se establece una fecha o hora para su fin (usado para la detección de colisiones). Por defecto: 3600 segundos = 1 hora.',
+ 'event_calendar:spots_description' => '¿A cuantas habitantes se aceptarán que añadan ese evento a sus calendarios personales?',
+ 'event_calendar:open' => 'Abierto',
+ 'event_calendar:add_user_label' => 'Añadir habitantes',
+ 'event_calendar:add_users_notify:subject' => 'Un nuevo evento se ha añadido a tu calendario personal',
+ 'event_calendar:add_users_notify:body' => '%s,
+
+Se ha añadido un evento de "%s" a tu calendario personal.',
+ 'event_calendar:settings:personal_manage:title' => 'Permisos del calendario',
+ 'event_calendar:request_event_response' => 'Tu petición para añadir ese evento ha sido enviada,',
+ 'event_calendar:request_event_error' => 'Error: Tu petición para añadir el evento al calendario no se ha enviado.',
+ 'event_calendar:request_subject' => 'Haz recebido una invitación de calendario',
+ 'event_calendar:review_requests_request_none' => 'No hay peticiones a revisar para ese evento.',
+ 'event_calendar:request:remove:check' => '¿Estas seguro que quieres rechazar esa petición?',
+ 'event_calendar:requestkilled' => 'La petición ha sido rechazada.',
+ 'event_calendar:request_approved' => 'La petición ha sido aceptada.',
+ 'event_calendar:make_request_title' => 'Enviar petición a ese evento',
+ 'event_calendar:review_requests:reject' => 'Rechazar',
+ 'event_calendar:review_requests:reject:title' => 'Rechazar la petición',
+ 'event_calendar:review_requests:accept' => 'Aceptar',
+ 'event_calendar:review_requests:accept:title' => 'Aceptar la petición',
+ 'event_calendar:review_requests:error:approve' => 'Error: la petición no se ha aprobado.',
+ 'event_calendar:review_requests:error:reject' => 'Error: No se ha podido rechazar la petición.',
+ 'event_calendar:settings:hide_access:title' => 'Ocultar acceso al calendario',
+ 'event_calendar:settings:hide_end:title' => 'Ocultar campos de fecha y hora',
+ 'event_calendar:settings:more_required:title' => 'Hacer visible todos los campos excepto si se requiere una larga descripción.',
+ 'event_calendar:add_to_group:remove_group_title' => 'Remover ese evento del grupo',
+ 'event_calendar:add_to_group:remove_group_button' => 'Remover del grupo',
+ 'event_calendar:remove_from_group:success' => 'Evento removido del calendario del grupo',
+ 'event_calendar:add_to_group:add_group_title' => 'Añadir ese evento al grupo',
+ 'event_calendar:add_to_group:add_group_button' => 'Adicionar al grupo',
+ 'event_calendar:add_to_group:success' => 'Evento añadido al calendario del grupo',
+ 'event_calendar:settings:add_to_group_calendar:title' => 'Aceptar que el grupo de operadores añadan cualquier evento existente al calendario del grupo',
+ 'event_calendar:group_breadcrumb' => 'Calendario del grupo',
+ 'event_calendar:generic_error_title' => 'Error',
+ 'event_calendar:add' => 'Añadir',
+ 'event_calendar:owner:permissions_error' => 'No ienes permisos para visualizar esa pagina.',
+ 'event_calendar:feature_not_activated' => 'Esa funcionalidad no esta activada',
+ 'event_calendar:show_all' => 'Muestra todo',
+ 'event_calendar:show_mine' => 'Mi calendario',
+ 'event_calendar:show_friends' => 'Calendario de mis amigas',
+ 'event_calendar:from_label' => 'Desde:',
+ 'event_calendar:to_label' => 'Hasta:',
+ 'event_calendar:time_format:12hour' => '12 horas (am/pm)',
+ 'event_calendar:time_format:24hour' => '24 horas',
+ 'event_calendar:all_day_label' => 'El evento dura todo el día',
+ 'event_calendar:repeat_interval_label' => 'Repite cada',
+ 'event_calendar:day_abbrev:monday' => 'L',
+ 'event_calendar:day_abbrev:tuesday' => 'M',
+ 'event_calendar:day_abbrev:wednesday' => 'M',
+ 'event_calendar:day_abbrev:thursday' => 'J',
+ 'event_calendar:day_abbrev:friday' => 'V',
+ 'event_calendar:day_abbrev:saturday' => 'S',
+ 'event_calendar:day_abbrev:sunday' => 'D',
+ 'event_calendar:dow:full:monday' => 'Lunes',
+ 'event_calendar:dow:full:tuesday' => 'Martes',
+ 'event_calendar:dow:full:wednesday' => 'Miércoles',
+ 'event_calendar:dow:full:thursday' => 'Jueves',
+ 'event_calendar:dow:full:friday' => 'Viernes',
+ 'event_calendar:dow:full:saturday' => 'Sabado',
+ 'event_calendar:dow:full:sunday' => 'Domingo',
+ 'event_calendar:schedule_type:fixed' => 'Selecciona dia/hora',
+ 'event_calendar:interval:minute' => 'minuto(s)',
+ 'event_calendar:interval:hour' => 'hora(s)',
+ 'event_calendar:interval:day' => 'día(s)',
+ 'event_calendar:site_calendar' => 'Calendario del sitio',
+ 'event_calendar:calendar_label' => 'Calendario',
+ 'event_calendar:basic:header' => 'Información básica',
+ 'event_calendar:schedule:header' => 'Fecha',
+ 'event_calendar:permissions:header' => 'Permisos',
+ 'event_calendar:read_access' => 'Acceso de lectura',
+ 'event_calendar:add_event' => 'Añadir evento',
+ 'event_calendar:schedule_event' => 'Evento agendado',
+ 'item:object:event_calendar' => 'Calendario',
'event_calendar:new_event' => 'Nuevo evento',
'event_calendar:no_such_event_edit_error' => 'Error: No existe tal evento o usted no tiene autorización para editarlo.',
'event_calendar:add_event_title' => 'Agregar evento',
@@ -10,7 +104,7 @@ $language = array (
'event_calendar:title_description' => 'Una a cuatro palabras',
'event_calendar:brief_description_label' => 'Descripción breve',
'event_calendar:brief_description_description' => 'Una frase corta.',
- 'event_calendar:venue_label' => 'Sede',
+ 'event_calendar:venue_label' => 'Lugar',
'event_calendar:venue_description' => '¿Dónde se llevará a cabo este evento?',
'event_calendar:start_date_label' => 'Fecha de inicio',
'event_calendar:start_date_description' => '¿Cuándo comenzará este evento?',
@@ -34,7 +128,7 @@ $language = array (
'event_calendar:add_event_response' => 'Su evento ha sido agregado.',
'event_calendar:manage_event_error' => 'Error: Hubo un error al guardar su evento. Por favor asegúrese que todos los campos requeridos hayan sido proporcionados.',
'event_calendar:error_nosuchevent' => 'Error: no existe tal evento.',
- 'event_calendar:show_events_title' => 'Calendario del evento',
+ 'event_calendar:show_events_title' => 'Calendario',
'event_calendar:day_label' => 'Día',
'event_calendar:week_label' => 'Semana',
'event_calendar:month_label' => 'Mes',
@@ -42,7 +136,7 @@ $language = array (
'event_calendar:new' => 'Agregar evento',
'event_calendar:submit' => 'Enviar',
'event_calendar:cancel' => 'Cancelar',
- 'event_calendar:widget_title' => 'Calendario del evento',
+ 'event_calendar:widget_title' => 'Calendario',
'event_calendar:widget:description' => 'Exponer sus eventos.',
'event_calendar:num_display' => 'Número de eventos expuestos',
'event_calendar:groupprofile' => 'Eventos venideros',
@@ -52,8 +146,6 @@ $language = array (
'event_calendar:view_link' => 'Ver este evento',
'event_calendar:edit_link' => 'Editar este evento',
'event_calendar:delete_link' => 'Eliminar este evento',
- 'event_calendar:delete_confirm_title' => 'Confirmar eliminación de este evento',
- 'event_calendar:delete_confirm_description' => '¿Está seguro que desea eliminar este evento ("%s")? Esta acción es irreversible.',
'event_calendar:delete_response' => 'Este evento ha sido eliminado.',
'event_calendar:error_delete' => 'Este evento no existe o usted no tiene el derecho de eliminarlo.',
'event_calendar:delete_cancel_response' => 'Eliminación del evento cancelada.',
@@ -74,7 +166,7 @@ $language = array (
'event_calendar:settings:venue_view:title' => 'Mostrar sede en vista rápida (listados de eventos)',
'event_calendar:settings:yes' => 'sí',
'event_calendar:settings:no' => 'no',
- 'event_calendar:settings:site_calendar:title' => 'Sitio del calendario',
+ 'event_calendar:settings:site_calendar:title' => 'Calendario del sitio',
'event_calendar:settings:site_calendar:admin' => 'sí, solamente si administradores pueden anunciar eventos',
'event_calendar:settings:site_calendar:loggedin' => 'sí, cualquier usuario registrado puede anunciar un evento',
'event_calendar:settings:group_calendar:title' => 'Calendarios de grupo',
@@ -121,4 +213,3 @@ $language = array (
'event_calendar:river:the_event' => 'un evento titulado',
);
add_translation("es", $language);
-?> \ No newline at end of file
diff --git a/languages/fr.php b/languages/fr.php
index 876a53ecb..6e2624691 100644
--- a/languages/fr.php
+++ b/languages/fr.php
@@ -122,4 +122,3 @@ $language = array (
'event_calendar:river:the_event' => 'un événement intitulé',
);
add_translation("fr", $language);
-?> \ No newline at end of file
diff --git a/models/model.php b/models/model.php
index aa97bfddb..a196fcebb 100644
--- a/models/model.php
+++ b/models/model.php
@@ -22,6 +22,22 @@ function event_calendar_get_event_for_edit($event_id) {
}
}
+// converts to time in minutes since midnight
+function event_calendar_convert_to_time($hour,$minute,$meridian) {
+ if ($meridian) {
+ if ($meridian == 'am') {
+ if ($hour == 12) {
+ $hour = 0;
+ }
+ } else {
+ if ($hour < 12) {
+ $hour += 12;
+ }
+ }
+ }
+ return 60*$hour+$minute;
+}
+
// returns the event or FALSE
function event_calendar_set_event_from_form($event_guid,$group_guid) {
@@ -32,6 +48,8 @@ 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');
+ $schedule_type = get_input('schedule_type');
if ($event_calendar_more_required == 'yes') {
$required_fields = array('title','venue','start_date',
@@ -54,7 +72,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');
}
if ($event_guid) {
@@ -78,36 +96,48 @@ 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->start_date = strtotime($start_date_text." ".date_default_timezone_get());
- $end_date = trim(get_input('end_date',''));
- if ($end_date) {
- $end_date_text = date("Y-m-d",$end_date);
- $event->end_date = strtotime($end_date_text." ".date_default_timezone_get());
- } else {
- $event->end_date = '';
- }
- if ($event_calendar_times != 'no') {
- $st = get_input('start_time','');
- if (is_numeric($st)) {
- $event->start_time = $st;
- } else {
- $event->start_time = '';
- }
- $et = get_input('end_time','');
- if (is_numeric($et)) {
- $event->end_time = $et;
+ if ($schedule_type != 'poll') {
+ $start_date_text = trim(get_input('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();*/
+
+ // TODO: is the timezone bit necessary?
+ $event->start_date = strtotime($start_date_text." GMT");
+ $end_date_text = trim(get_input('end_date',''));
+ //$event->original_end_date = get_input('end_date');
+ if ($end_date_text) {
+ $event->end_date = strtotime($end_date_text." GMT");
+ //$event->munged_end_date_string = $end_date_text." ".date_default_timezone_get();
} else {
- $event->end_time = '';
+ $event->end_date = '';
}
- if (is_numeric($event->start_time)) {
- // Set start date to the Unix start time, if set.
- // This allows sorting by date *and* time.
- $event->start_date += $event->start_time*60;
+
+ if ($event_calendar_times != 'no') {
+ $hour = get_input('start_time_hour','');
+ $minute = get_input('start_time_minute','');
+ $meridian = get_input('start_time_meridian','');
+ if (is_numeric($hour) && is_numeric($minute)) {
+ $event->start_time = event_calendar_convert_to_time($hour,$minute,$meridian);
+ } else {
+ $event->start_time = '';
+ }
+ $hour = get_input('end_time_hour','');
+ $minute = get_input('end_time_minute','');
+ $meridian = get_input('end_time_meridian','');
+ if (is_numeric($hour) && is_numeric($minute)) {
+ $event->end_time = event_calendar_convert_to_time($hour,$minute,$meridian);
+ } else {
+ $event->end_time = '';
+ }
+ if (is_numeric($event->start_date) && is_numeric($event->start_time)) {
+ // Set start date to the Unix start time, if set.
+ // This allows sorting by date *and* time.
+ $event->start_date += $event->start_time*60;
+ }
}
}
if ($event_calendar_spots_display == 'yes') {
@@ -122,11 +152,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->schedule_type = $schedule_type;
+ $event->send_reminder = get_input('send_reminder');
+ $event->reminder_number = get_input('reminder_number');
+ $event->reminder_interval = get_input('reminder_interval');
+ $event->web_conference = get_input('web_conference');
$event->real_end_time = event_calendar_get_end_time($event);
foreach ($required_fields as $fn) {
if (!trim($event->$fn)) {
@@ -135,6 +183,9 @@ function event_calendar_set_event_from_form($event_guid,$group_guid) {
}
}
if ($event->save()) {
+ if (!$event_guid && $event->web_conference) {
+ event_calendar_create_bbb_conf($event);
+ }
if ($group_guid && (elgg_get_plugin_setting('autogroup', 'event_calendar') == 'yes')) {
event_calendar_add_personal_events_from_group($event->guid,$group_guid);
}
@@ -148,12 +199,12 @@ function event_calendar_set_event_from_form($event_guid,$group_guid) {
event_calendar_add_personal_event($event->guid,$user_id);
if (elgg_get_plugin_setting('add_users_notify', 'event_calendar') == 'yes') {
notify_user($user_id, $CONFIG->site->guid, elgg_echo('event_calendar:add_users_notify:subject'),
- sprintf(
- elgg_echo('event_calendar:add_users_notify:body'),
- $user->name,
- $event->title,
- $event->getURL()
- )
+ sprintf(
+ elgg_echo('event_calendar:add_users_notify:body'),
+ $user->name,
+ $event->title,
+ $event->getURL()
+ )
);
}
}
@@ -164,19 +215,142 @@ function event_calendar_set_event_from_form($event_guid,$group_guid) {
return $event;
}
-function event_calendar_get_events_between($start_date,$end_date,$is_count,$limit=10,$offset=0,$container_guid=0,$region='-') {
+function event_calendar_get_events_between($start_date,$end_date,$is_count=FALSE,$limit=10,$offset=0,$container_guid=0,$region='-') {
+ $polls_supported = elgg_is_active_plugin('event_poll');
if ($is_count) {
$count = 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,true,$region);
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);
+ if ($polls_supported) {
+ elgg_load_library('elgg:event_poll');
+ $all_events = event_poll_merge_poll_events($all_events,$start_date,$end_date);
+ }
+
+ 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,
$is_count,$limit=10,$offset=0,$container_guid=0,$region='-', $meta_max = 'spots', $annotation_name = 'personal_event') {
if ($is_count) {
@@ -187,10 +361,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 +481,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 {
- 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' => $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 {
+ $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 +605,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 +770,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 +859,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,8 +994,21 @@ $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
- return get_data($query, "entity_row_to_elggstar");
+ $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,
+ 0, 0, "", 0,
+ false, false, '-',$entities);
+ }
+ }
+ return $entities;
} else {
if ($row = get_data_row($query))
return $row->total;
@@ -784,7 +1101,7 @@ function event_calendar_get_personal_events_for_user($user_guid,$limit) {
// the old way used annotations, and the new Elgg 1.8 way uses relationships
// for now this version attempts to bridge the gap by using both methods for older sites
-function event_calendar_get_users_for_event($event_guid,$limit,$offset,$is_count) {
+function event_calendar_get_users_for_event($event_guid,$limit,$offset=0,$is_count=FALSE) {
$options = array(
'type' => 'user',
'relationship' => 'personal_event',
@@ -833,38 +1150,16 @@ function event_calendar_security_fields() {
return "__elgg_token=$token&__elgg_ts=$ts";
}
-function event_calendar_get_events_for_group($group_guid) {
+function event_calendar_get_events_for_group($group_guid, $limit = 0) {
$options = array(
'type' => 'object',
'subtype' => 'event_calendar',
'container_guid' => $group_guid,
- 'limit' => 0,
+ 'limit' => $limit,
);
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') {
@@ -922,10 +1217,14 @@ function event_calendar_get_region($event) {
function event_calendar_get_type($event) {
$event_calendar_type_list_handles = elgg_get_plugin_setting('type_list_handles', 'event_calendar');
$type = trim($event->event_type);
- if ($event_calendar_type_list_handles == 'yes') {
- $type = elgg_echo('event_calendar:type:'.$type);
- }
- return htmlspecialchars($type);
+ if ($type) {
+ if ($event_calendar_type_list_handles == 'yes') {
+ $type = elgg_echo('event_calendar:type:'.$type);
+ }
+ return htmlspecialchars($type);
+ } else {
+ return $type;
+ }
}
function event_calendar_get_formatted_full_items($event) {
@@ -933,10 +1232,12 @@ function event_calendar_get_formatted_full_items($event) {
$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_items = array();
- $item = new stdClass();
- $item->title = elgg_echo('event_calendar:when_label');
- $item->value = $time_bit;
- $event_items[] = $item;
+ if ($time_bit) {
+ $item = new stdClass();
+ $item->title = elgg_echo('event_calendar:when_label');
+ $item->value = $time_bit;
+ $event_items[] = $item;
+ }
$item = new stdClass();
$item->title = elgg_echo('event_calendar:venue_label');
$item->value = htmlspecialchars($event->venue);
@@ -948,10 +1249,13 @@ function event_calendar_get_formatted_full_items($event) {
$event_items[] = $item;
}
if ($event_calendar_type_display == 'yes') {
- $item = new stdClass();
- $item->title = elgg_echo('event_calendar:type_label');
- $item->value = event_calendar_get_type($event);
- $event_items[] = $item;
+ $event_type = event_calendar_get_type($event);
+ if ($event_type) {
+ $item = new stdClass();
+ $item->title = elgg_echo('event_calendar:type_label');
+ $item->value = event_calendar_get_type($event);
+ $event_items[] = $item;
+ }
}
$item = new stdClass();
$item->title = elgg_echo('event_calendar:fees_label');
@@ -970,6 +1274,9 @@ function event_calendar_get_formatted_full_items($event) {
}
function event_calendar_get_formatted_time($event) {
+ if (!$event->start_date) {
+ return '';
+ }
$date_format = 'j M Y';
$event_calendar_times = elgg_get_plugin_setting('times', 'event_calendar') != 'no';
@@ -978,17 +1285,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;
}
@@ -1156,55 +1481,30 @@ function event_calendar_get_page_content_list($page_type,$container_guid,$start_
elgg_push_context('groups');
elgg_set_page_owner_guid($container_guid);
$user_guid = elgg_get_logged_in_user_guid();
- $group_calendar = elgg_get_plugin_setting('group_calendar', 'event_calendar');
- if (!$group_calendar || $group_calendar == 'members') {
- if (elgg_get_page_owner_entity()->canWriteToContainer($user_guid)){
- elgg_register_menu_item('title', array(
- 'name' => 'add',
- 'href' => "event_calendar/add/".$container_guid,
- 'text' => elgg_echo('event_calendar:add'),
- 'class' => 'elgg-button elgg-button-action',
- ));
- }
- } else if ($group_calendar == 'admin') {
- if (elgg_is_admin_logged_in() || ($group->owner_guid == $user_guid)) {
- elgg_register_menu_item('title', array(
- 'name' => 'add',
- 'href' => "event_calendar/add/".$container_guid,
- 'text' => elgg_echo('event_calendar:add'),
- 'class' => 'elgg-button elgg-button-action',
- ));
- }
+ if(event_calendar_can_add($container_guid)) {
+ elgg_register_menu_item('title', array(
+ 'name' => 'add',
+ 'href' => "event_calendar/add/".$container_guid,
+ 'text' => elgg_echo('event_calendar:add'),
+ 'class' => 'elgg-button elgg-button-action event-calendar-button-add',
+ ));
}
} else {
elgg_push_breadcrumb(elgg_echo('item:object:event_calendar'));
- $site_calendar = elgg_get_plugin_setting('site_calendar', 'event_calendar');
- if (!$site_calendar || $site_calendar == 'admin') {
- // only admins can post directly to the site-wide calendar
- if (elgg_is_admin_logged_in()) {
- elgg_register_menu_item('title', array(
- 'name' => 'add',
- 'href' => "event_calendar/add",
- 'text' => elgg_echo('event_calendar:add'),
- 'class' => 'elgg-button elgg-button-action',
- ));
- }
- } else if ($site_calendar == 'loggedin') {
- // any logged-in user can post to the site calendar
- if (elgg_is_logged_in()) {
- elgg_register_menu_item('title', array(
- 'name' => 'add',
- 'href' => "event_calendar/add",
- 'text' => elgg_echo('event_calendar:add'),
- 'class' => 'elgg-button elgg-button-action',
- ));
- }
+ $user_guid = elgg_get_logged_in_user_guid();
+ if(event_calendar_can_add($container_guid)) {
+ elgg_register_menu_item('title', array(
+ 'name' => 'add',
+ 'href' => "event_calendar/add",
+ 'text' => elgg_echo('event_calendar:add'),
+ 'class' => 'elgg-button elgg-button-action event-calendar-button-add',
+ ));
}
}
$params = event_calendar_generate_listing_params($page_type,$container_guid,$start_date,$display_mode,$filter,$region);
- $url = full_url();
+ $url = current_page_url();
if (substr_count($url, '?')) {
$url .= "&view=ical";
} else {
@@ -1215,23 +1515,32 @@ function event_calendar_get_page_content_list($page_type,$container_guid,$start_
$menu_options = array(
'name' => 'ical',
'id' => 'event-calendar-ical-link',
- 'text' => '<img src="'.elgg_get_site_url().'mod/event_calendar/images/ics.png" />',
+ 'text' => elgg_view_icon('calendar'),
'href' => $url,
'title' => elgg_echo('feed:ical'),
'priority' => 800,
+ 'rel' => 'popup',
);
$menu_item = ElggMenuItem::factory($menu_options);
elgg_register_menu_item('extras', $menu_item);
$body = elgg_view_layout("content", $params);
+ $body .= elgg_view_module('popup', elgg_echo('feed:ical'), elgg_echo('event_calendar:ical_popup_message') . elgg_view('output/url', array(
+ 'href' => $url,
+ 'text' => elgg_echo('export'),
+ 'class' => 'elgg-button elgg-button-action',
+ )), array(
+ 'id' => 'event-calendar-ical',
+ 'class' => 'event-calendar-ical hidden',
+ ));
- return elgg_view_page($title,$body);
+ return elgg_view_page($title, $body);
}
-function event_calendar_get_page_content_edit($page_type,$guid) {
+function event_calendar_get_page_content_edit($page_type,$guid,$start_date='') {
+ elgg_load_js('elgg.event_calendar');
$vars = array();
$vars['id'] = 'event-calendar-edit';
- $vars['name'] = 'event_calendar_edit';
// just in case a feature adds an image upload
$vars['enctype'] = 'multipart/form-data';
@@ -1242,12 +1551,15 @@ function event_calendar_get_page_content_edit($page_type,$guid) {
$event = get_entity((int)$guid);
if (elgg_instanceof($event, 'object', 'event_calendar') && $event->canEdit()) {
$body_vars['event'] = $event;
- $body_vars['form_data'] = event_calendar_prepare_edit_form_vars($event);
+ $body_vars['form_data'] = event_calendar_prepare_edit_form_vars($event,$page_type);
+
$event_container = get_entity($event->container_guid);
if (elgg_instanceof($event_container, 'group')) {
elgg_push_breadcrumb(elgg_echo('event_calendar:group_breadcrumb'), 'event_calendar/group/'.$event->container_guid);
+ $body_vars['group_guid'] = $event_container->guid;
} else {
elgg_push_breadcrumb(elgg_echo('event_calendar:show_events_title'),'event_calendar/list');
+ $body_vars['group_guid'] = 0;
}
elgg_push_breadcrumb($event->title,$event->getURL());
elgg_push_breadcrumb(elgg_echo('event_calendar:manage_event_title'));
@@ -1258,6 +1570,7 @@ function event_calendar_get_page_content_edit($page_type,$guid) {
}
} else {
$title = elgg_echo('event_calendar:add_event_title');
+
if ($guid) {
// add to group
$group = get_entity($guid);
@@ -1265,16 +1578,17 @@ function event_calendar_get_page_content_edit($page_type,$guid) {
$body_vars['group_guid'] = $guid;
elgg_push_breadcrumb(elgg_echo('event_calendar:group_breadcrumb'), 'event_calendar/group/'.$guid);
elgg_push_breadcrumb(elgg_echo('event_calendar:add_event_title'));
- $body_vars['form_data'] = event_calendar_prepare_edit_form_vars();
+ $body_vars['form_data'] = event_calendar_prepare_edit_form_vars(NULL,$page_type,$start_date);
$content = elgg_view_form('event_calendar/edit', $vars, $body_vars);
} else {
$content = elgg_echo('event_calendar:no_group');
}
} else {
+ $body_vars['group_guid'] = 0;
elgg_push_breadcrumb(elgg_echo('event_calendar:show_events_title'),'event_calendar/list');
elgg_push_breadcrumb(elgg_echo('event_calendar:add_event_title'));
- $body_vars['form_data'] = event_calendar_prepare_edit_form_vars();
+ $body_vars['form_data'] = event_calendar_prepare_edit_form_vars(NULL,$page_type,$start_date);
$content = elgg_view_form('event_calendar/edit', $vars, $body_vars);
}
@@ -1293,17 +1607,27 @@ function event_calendar_get_page_content_edit($page_type,$guid) {
* @param ElggObject $event
* @return array
*/
-function event_calendar_prepare_edit_form_vars($event = NULL) {
+function event_calendar_prepare_edit_form_vars($event = NULL, $page_type = '', $start_date = '') {
// input names => defaults
+ $now = time();
+ $iso_date = date('Y-m-d',$now);
+ $now_midnight = strtotime($iso_date);
+ if ($start_date) {
+ $start_date = strtotime($start_date);
+ } else {
+ $start_date = $now+60*60;
+ }
+ $start_time = floor(($now-$now_midnight)/60) + 60;
+ $start_time = floor($start_time/5)*5;
$values = array(
'title' => NULL,
'description' => NULL,
'venue' => NULL,
- 'start_date' => NULL,
- 'end_date' => NULL,
- 'start_time' => NULL,
- 'end_time' => NULL,
+ 'start_date' => $start_date,
+ 'end_date' => $start_date+60*60,
+ 'start_time' => $start_time,
+ 'end_time' => $start_time + 60,
'spots' => NULL,
'region' => '-',
'event_type' => '-',
@@ -1311,11 +1635,30 @@ function event_calendar_prepare_edit_form_vars($event = NULL) {
'contact' => NULL,
'organiser' => NULL,
'tags' => NULL,
- 'personal_manage' => NULL,
+ 'send_reminder' => NULL,
+ 'reminder_number' => 1,
+ 'reminder_interval' => 60,
+ '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',
+ 'web_conference' => NULL,
'long_description' => NULL,
'access_id' => ACCESS_DEFAULT,
'group_guid' => NULL,
);
+
+ if ($page_type == 'schedule') {
+ $values['schedule_type'] = 'poll';
+ } else {
+ $values['schedule_type'] = 'all_day';
+ }
if ($event) {
foreach (array_keys($values) as $field) {
@@ -1466,6 +1809,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);
@@ -1498,7 +1842,7 @@ function event_calendar_generate_listing_params($page_type,$container_guid,$orig
);
$content = elgg_view('event_calendar/show_events', $vars);
- if ($page_type == 'owner') {
+ if ($page_type == 'group') {
$filter_override = '';
} else {
$filter_override = elgg_view('event_calendar/filter_menu',$vars);
@@ -1506,6 +1850,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 {
@@ -1517,7 +1863,7 @@ function event_calendar_generate_listing_params($page_type,$container_guid,$orig
return $params;
}
-function event_calendar_get_page_content_view($event_guid) {
+function event_calendar_get_page_content_view($event_guid,$light_box = FALSE) {
// add personal calendar button and links
elgg_push_context('event_calendar:view');
$event = get_entity($event_guid);
@@ -1541,18 +1887,22 @@ function event_calendar_get_page_content_view($event_guid) {
}
elgg_push_breadcrumb($event->title);
- $content = elgg_view_entity($event, array('full_view' => true));
+ $content = elgg_view_entity($event, array('full_view' => true,'light_box'=>$light_box));
//check to see if comment are on - TODO - add this feature to all events
if ($event->comments_on != 'Off') {
$content .= elgg_view_comments($event);
}
}
-
- $params = array('title' => $title, 'content' => $content,'filter' => '');
-
- $body = elgg_view_layout("content", $params);
-
- return elgg_view_page($title,$body);
+
+ if ($light_box) {
+ return '<div class="event-calendar-lightbox">'.elgg_view_title($title).$content.'</div>';
+ } else {
+ $params = array('title' => $title, 'content' => $content,'filter' => '');
+
+ $body = elgg_view_layout("content", $params);
+
+ return elgg_view_page($title,$body);
+ }
}
function event_calendar_get_page_content_display_users($event_guid) {
@@ -1744,28 +2094,314 @@ function getLastDayOfMonth($month,$year) {
return idate('d', mktime(0, 0, 0, ($month + 1), 0, $year));
}
-// TODO - this is not quite right across daylight savings time divides
-// Possible solution: convert stored date to server date, do inc and then convert back to GMT
-
-function event_calendar_modify_full_calendar($event_guid,$day_delta,$minute_delta) {
+function event_calendar_modify_full_calendar($event_guid,$day_delta,$minute_delta,$start_time,$resend,$minutes,$iso_date) {
$event = get_entity($event_guid);
if (elgg_instanceof($event,'object','event_calendar') && $event->canEdit()) {
- $event->start_date = strtotime("$day_delta days",$event->start_date)+60*$minute_delta;
- if ($event->end_date) {
- $event->end_date = strtotime("$day_delta days",$event->end_date);
+ if ($event->is_event_poll) {
+ if (elgg_is_active_plugin('event_poll')) {
+ elgg_load_library('elgg:event_poll');
+ return event_poll_change($event_guid,$day_delta,$minute_delta,$start_time,$resend,$minutes,$iso_date);
+ } else {
+ return FALSE;
+ }
+ } else {
+ $event->start_date = strtotime("$day_delta days",$event->start_date)+60*$minute_delta;
+ if ($event->end_date) {
+ $event->end_date = strtotime("$day_delta days",$event->end_date);
+ }
+ $times = elgg_get_plugin_setting('times','event_calendar');
+ //$inc = 24*60*60*$day_delta+60*$minute_delta;
+
+ //$event->real_end_time += $inc;
+ $event->real_end_time = strtotime("$day_delta days",$event->real_end_time)+60*$minute_delta;
+ if ($times != 'no') {
+ $event->start_time += $minute_delta;
+ if ($event->end_time) {
+ $event->end_time += $minute_delta;
+ }
+ }
+ $dow = array('monday','tuesday','wednesday','thursday','friday','saturday','sunday');
+ $week_repeats = array();
+ $weekday_delta = (($day_delta % 7) + 7) % 7; // Imagine delta is -12: ((-12 % 7) + 7 % 7) = +2 (thursdays are saturdays)
+ foreach ($dow as $i => $w) {
+ $v = 'event-calendar-repeating-'.$w.'-value';
+ $new_day = $dow[($i+$weekday_delta)%7];
+ $week_repeats[$new_day] = $event->$v;
+ }
+ foreach ($week_repeats as $w => $value) {
+ $v = 'event-calendar-repeating-'.$w.'-value';
+ $event->$v = $value;
+ }
+ return TRUE;
}
- $times = elgg_get_plugin_setting('times','event_calendar');
- //$inc = 24*60*60*$day_delta+60*$minute_delta;
-
- //$event->real_end_time += $inc;
- $event->real_end_time = strtotime("$day_delta days",$event->real_end_time)+60*$minute_delta;
- if ($times != 'no') {
- $event->start_time += $minute_delta;
- if ($event->end_time) {
- $event->end_time += $minute_delta;
+ }
+ 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';
+ $polls_supported = elgg_is_active_plugin('event_poll');
+ foreach($events as $e) {
+ $event = $e['event'];
+ $event_data = $e['data'];
+ $c = count($event_data);
+ foreach($event_data as $ed) {
+ $event_item = array(
+ 'guid' => $event->guid,
+ 'title' => $event->title,
+ 'start' => date('c',$ed['start_time']),
+ 'end' => date('c',$ed['end_time']),
+ );
+ if (!$times_supported || ($event->schedule_type == 'all_day')) {
+ $event_item['allDay'] = TRUE;
+ } else {
+ $event_item['allDay'] = FALSE;
}
+
+ if ($polls_supported && isset($e['is_event_poll']) && $e['is_event_poll']) {
+ $event_item['className'] = 'event-poll-class';
+ $event_item['title'] .= ' '.elgg_echo('event_calendar:poll_suffix');
+ $event_item['is_event_poll'] = TRUE;
+ $event_item['url'] = elgg_get_site_url().'event_poll/vote/'.$event->guid;
+ $event_item['minutes'] = $ed['minutes'];
+ $event_item['iso_date'] = $ed['iso_date'];
+ } else {
+ $event_item['id'] = $event->guid;
+ $event_item['is_event_poll'] = FALSE;
+ $event_item['url'] = elgg_get_site_url().'event_calendar/view/'.$event->guid;
+ }
+
+ $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;
+}
+
+function event_calendar_queue_reminders() {
+ // game plan - get all events up to 60 days ahead
+ // with no reminder sent
+ // compute reminder period
+ // if <= current time, set reminder_queued flag and queue the
+ // notification message using the message_queue plugin
+ if (elgg_plugin_exists('message_queue')) {
+ $now = time();
+ // oops - this does not work for repeated events
+ // need extra stuff for that
+ /*$options = array(
+ 'type' => 'object',
+ 'subtype' => 'event_calendar',
+ 'metadata_name_value_pairs' => array(
+ array('name' => 'reminder_queued', 'value' => 'no'),
+ array('name' => 'send_reminder', 'value' => 1),
+ array('name' => 'start_date', 'value' => $now + 60*24*60*60, 'operand' => '>='),
+ ),
+ 'limit' => 0,
+ );
+ $events = elgg_get_entities_from_metadata($options);
+ */
+ $event_list = event_calendar_get_events_between($now,$now + 60*24*60*60,FALSE,0);
+
+ foreach($event_list as $es) {
+ $e = $es['event'];
+ if ($e->send_reminder) {
+ $reminder_period = 60*$e->reminder_interval*$e->reminder_number;
+ if ($e->repeats) {
+ // repeated events require more complex handing
+ foreach($es['data'] as $d) {
+ // if event falls in the reminder period
+ if ($d->start_time - $reminder_period >= $now) {
+ // and the reminder has not already been queued
+ if (!event_calendar_repeat_reminder_logged($e,$d->start_time)) {
+ // set the reminder queued flag
+ event_calendar_repeat_reminder_log($e,$d->start_time);
+ // queue the reminder for sending
+ event_calendar_queue_reminder($e);
+ }
+ break;
+ }
+ }
+ } else {
+ // if this is just a normal non-repeated event, then we just need to set a flag and queue the reminder
+ if (($e->reminder_queued != 'yes') && ($e->start_date - $now <= $reminder_period)) {
+ $e->reminder_queued = 'yes';
+ event_calendar_queue_reminder($e);
+ }
+ }
+ }
+ }
+ }
+}
+
+function event_calendar_repeat_reminder_log($e,$start) {
+ // this simple log just uses annotations on the event
+ // TODO - remove log entries for past events
+ create_annotation($e->guid, 'repeat_reminder_log_item', $start, '',0,ACCESS_PUBLIC);
+}
+
+function event_calendar_repeat_reminder_logged($e,$start) {
+ $options = array(
+ 'guid' => $e->guid,
+ 'annotation_name' => 'repeat_reminder_log_item',
+ 'annotation_value' => $start,
+ 'limit' => 1
+ );
+
+ if (elgg_get_annotations($options)) {
return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+function event_calendar_queue_reminder($e) {
+ elgg_load_library('elgg:message_queue');
+ $subject = elgg_echo('event_calendar:reminder:subject',array($e->title));
+ $time_string = event_calendar_get_formatted_time($e);
+ $body = elgg_echo('event_calendar:reminder:body',array($e->title,$time_string,$e->getURL()));
+ $m = message_queue_create_message($subject,$body);
+ if ($m) {
+ $users = event_calendar_get_users_for_event($e->guid,0);
+ foreach($users as $u) {
+ message_queue_add($m->guid,$u->guid);
+ }
+ message_queue_set_for_sending($m->guid);
+ }
+}
+
+function event_calendar_create_bbb_conf($event) {
+ $bbb_security_salt = elgg_get_plugin_setting('bbb_security_salt','event_calendar');
+ $bbb_server_url = rtrim(elgg_get_plugin_setting('bbb_server_url','event_calendar'), '/') . '/';
+ if ($bbb_security_salt) {
+ $day_in_minutes = 60*24;
+ $duration = (int)(($event->real_end_time-$event->start_date)/60)+$day_in_minutes;
+ $title = urlencode($event->title);
+ $params = "name=$title&meetingID={$event->guid}&duration=$duration";
+ $checksum = sha1('create'.$params.$bbb_security_salt);
+ $params .= "&checksum=$checksum";
+
+ // create curl resource
+ $ch = curl_init();
+
+ // set url
+ curl_setopt($ch, CURLOPT_URL, $bbb_server_url.'api/create?'.$params);
+
+ //return the transfer as a string
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+
+ // $output contains the output string
+ $output = curl_exec($ch);
+
+ // close curl resource to free up system resources
+ curl_close($ch);
+
+ /*error_log("BBB create request:");
+ error_log($bbb_server_url.'api/create?'.$params);
+
+ error_log("BBB create response:");
+ error_log($output);*/
+
+ $xml = new SimpleXMLElement($output);
+ if ($xml->returncode == 'SUCCESS') {
+ $event->bbb_attendee_password = (string) $xml->attendeePW;
+ $event->bbb_moderator_password = (string) $xml->moderatorPW;
+ } else {
+ register_error(elgg_echo('event_calendar:bbb_create_error',array($xml->message)));
+ }
+ } else {
+ register_error(elgg_echo('event_calendar:bbb_settings_error'));
+ }
+}
+
+function event_calendar_get_join_bbb_url($event) {
+ $bbb_security_salt = elgg_get_plugin_setting('bbb_security_salt','event_calendar');
+ $bbb_server_url = rtrim(elgg_get_plugin_setting('bbb_server_url','event_calendar'), '/') . '/';
+ $user = elgg_get_logged_in_user_entity();
+ $full_name = urlencode($user->name);
+ if ($event->canEdit()) {
+ $password = urlencode($event->bbb_moderator_password);
+ } else {
+ $password = urlencode($event->bbb_attendee_password);
+ }
+ $params = "fullName=$full_name&meetingID={$event->guid}&userID={$user->username}&password=$password";
+ $checksum = sha1('join'.$params.$bbb_security_salt);
+ $params .= "&checksum=$checksum";
+ $url = $bbb_server_url.'api/join?'.$params;
+ return $url;
+}
+
+// returns TRUE if the given user can add an event to the given calendar
+// if group_guid is 0, this is assumed to be the site calendar
+function event_calendar_can_add($group_guid=0,$user_guid=0) {
+ if (!$user_guid) {
+ if (elgg_is_logged_in()) {
+ $user_guid = elgg_get_logged_in_user_guid();
+ } else {
+ return FALSE;
+ }
}
+ if ($group_guid) {
+ if (!event_calendar_activated_for_group($group_guid)) {
+ return FALSE;
+ }
+ $group = get_entity($group_guid);
+ if (elgg_instanceof($group,'group')) {
+ $group_calendar = elgg_get_plugin_setting('group_calendar', 'event_calendar');
+ if (!$group_calendar || $group_calendar == 'members') {
+ return $group->canWriteToContainer($user_guid);
+ } else if ($group_calendar == 'admin') {
+ if ($group->canEdit($user_guid)) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ }
+ } else {
+ return FALSE;
+ }
+ } else {
+ $site_calendar = elgg_get_plugin_setting('site_calendar', 'event_calendar');
+ if (!$site_calendar || $site_calendar == 'admin') {
+ // only admins can post directly to the site-wide calendar
+ return elgg_is_admin_user($user_guid);
+ } else if ($site_calendar == 'loggedin') {
+ // any logged-in user can post to the site calendar
+ return TRUE;
+ }
+ }
+
return FALSE;
}
diff --git a/start.php b/start.php
index e838194f5..752646a3e 100644
--- a/start.php
+++ b/start.php
@@ -16,6 +16,8 @@ elgg_register_event_handler('init','system','event_calendar_init');
function event_calendar_init() {
elgg_register_library('elgg:event_calendar', elgg_get_plugins_path() . 'event_calendar/models/model.php');
+
+ elgg_register_plugin_hook_handler('cron', 'fiveminute', 'event_calendar_handle_reminders_cron',400);
// Register a page handler, so we can have nice URLs
elgg_register_page_handler('event_calendar','event_calendar_page_handler');
@@ -26,6 +28,8 @@ function event_calendar_init() {
// Register granular notification for this type
register_notification_object('object', 'event_calendar', elgg_echo('event_calendar:new_event'));
+ elgg_extend_view('css/elements/forms', 'css/elements/forms/datepicker_multi');
+
// Set up site menu
$site_calendar = elgg_get_plugin_setting('site_calendar', 'event_calendar');
if (!$site_calendar || $site_calendar != 'no') {
@@ -64,14 +68,14 @@ function event_calendar_init() {
elgg_extend_view('css/elgg', 'event_calendar/css');
$event_calendar_listing_format = elgg_get_plugin_setting('listing_format', 'event_calendar');
- if ($event_calendar_listing_format == 'full') {
+ if (elgg_is_active_plugin('event_poll') || ($event_calendar_listing_format == 'full')) {
elgg_extend_view('css/elgg', 'fullcalendar/css');
$plugin_js = elgg_get_simplecache_url('js', 'event_calendar/fullcalendar');
elgg_register_js('elgg.full_calendar', $plugin_js);
}
//add a widget
- elgg_register_widget_type('event_calendar',elgg_echo("event_calendar:widget_title"),elgg_echo('event_calendar:widget:description'));
+ elgg_register_widget_type('event_calendar',elgg_echo("event_calendar:widget_title"),elgg_echo('event_calendar:widget:description'), 'all,groups');
// add the event calendar group tool option
$event_calendar_group_default = elgg_get_plugin_setting('group_default', 'event_calendar');
@@ -188,6 +192,7 @@ function event_calendar_page_handler($page) {
case 'manage_users':
echo event_calendar_get_page_content_manage_users($page[1]);
break;
+ case 'schedule':
case 'add':
if (isset($page[1])) {
group_gatekeeper();
@@ -196,7 +201,7 @@ function event_calendar_page_handler($page) {
gatekeeper();
$group_guid = 0;
}
- echo event_calendar_get_page_content_edit($page_type,$group_guid);
+ echo event_calendar_get_page_content_edit($page_type,$group_guid,$page[2]);
break;
case 'edit':
gatekeeper();
@@ -265,6 +270,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;
}
@@ -284,6 +292,16 @@ function event_calendar_entity_menu_setup($hook, $type, $return, $params) {
if ($handler != 'event_calendar') {
return $return;
}
+ if (elgg_is_active_plugin('event_poll') && $entity->canEdit() && $entity->schedule_type == 'poll') {
+ $options = array(
+ 'name' => 'schedule',
+ 'text' => elgg_echo('event_poll:schedule_button'),
+ 'title' => elgg_echo('event_poll:schedule_button'),
+ 'href' => 'event_poll/vote/'.$entity->guid,
+ 'priority' => 150,
+ );
+ $return[] = ElggMenuItem::factory($options);
+ }
$user_guid = elgg_get_logged_in_user_guid();
if ($user_guid) {
$calendar_status = event_calendar_personal_can_manage($entity,$user_guid);
@@ -365,3 +383,32 @@ function event_calendar_entity_menu_prepare($hook, $type, $return, $params) {
return $return;
}
+
+function event_calendar_handle_join($event, $object_type, $object) {
+ elgg_load_library('elgg:event_calendar');
+ $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) {
+ elgg_load_library('elgg:event_calendar');
+ $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_handle_reminders_cron() {
+ elgg_load_library('elgg:event_calendar');
+ event_calendar_queue_reminders();
+}
diff --git a/views/default/css/elements/forms/datepicker_multi.php b/views/default/css/elements/forms/datepicker_multi.php
new file mode 100644
index 000000000..4a18bdad1
--- /dev/null
+++ b/views/default/css/elements/forms/datepicker_multi.php
@@ -0,0 +1,39 @@
+<?php
+
+?>
+
+.ui-datepicker.ui-datepicker-multi {
+ width: auto;
+}
+.ui-datepicker-multi .ui-datepicker-group {
+ float: left;
+}
+.ui-datepicker-multi .ui-datepicker-group table {
+ margin-bottom: 0.4em;
+ margin-left: auto;
+ margin-right: auto;
+ margin-top: 0;
+ width: 95%;
+}
+.ui-datepicker-multi-2 .ui-datepicker-group {
+ width: 50%;
+}
+.ui-datepicker-multi-3 .ui-datepicker-group {
+ width: 33.3%;
+}
+.ui-datepicker-multi-4 .ui-datepicker-group {
+ width: 25%;
+}
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header {
+ border-left-width-ltr-source: physical;
+ border-left-width-rtl-source: physical;
+ border-left-width-value: 0;
+}
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header {
+ border-left-width-ltr-source: physical;
+ border-left-width-rtl-source: physical;
+ border-left-width-value: 0;
+}
+.ui-datepicker-multi .ui-datepicker-buttonpane {
+ clear: left;
+}
diff --git a/views/default/event_calendar/conference_button.php b/views/default/event_calendar/conference_button.php
new file mode 100644
index 000000000..f6fedf4f6
--- /dev/null
+++ b/views/default/event_calendar/conference_button.php
@@ -0,0 +1,32 @@
+<?php
+// A non-admin / non-event-creator only sees the button if they have the event on his/her personal calendar
+// and it is at most 15 minutes before the conference starts.
+
+// The button is removed for everyone (even admins) one day after the conference ends.
+
+$event = $vars['event'];
+
+if ($event) {
+ elgg_load_library('elgg:event_calendar');
+ $user_guid = elgg_get_logged_in_user_guid();
+ $termination_time = $event->real_end_time + 60*60*24;
+ if ($termination_time < time()) {
+ $in_time_window = FALSE;
+ } else if ($event->canEdit()) {
+ $in_time_window = TRUE;
+ } else if (event_calendar_has_personal_event($event->guid, $user_guid) && ($event->start_date - 15*60) >= time()) {
+ $in_time_window = TRUE;
+ } else {
+ $in_time_window = FALSE;
+ }
+ if ( $in_time_window ) {
+ $button = elgg_view('output/url', array(
+ 'href' => event_calendar_get_join_bbb_url($event),
+ 'text' => elgg_echo('event_calendar:join_conf_button'),
+ 'class' => 'elgg-button elgg-button-action',
+ 'target' => '_blank',
+ ));
+
+ echo '<div class="event-calendar-conf-join-button">'.$button.'</div>';
+ }
+}
diff --git a/views/default/event_calendar/container.php b/views/default/event_calendar/container.php
new file mode 100644
index 000000000..cb5c8620c
--- /dev/null
+++ b/views/default/event_calendar/container.php
@@ -0,0 +1,28 @@
+<?php
+elgg_load_library('elgg:event_calendar');
+$site_calendar = elgg_get_plugin_setting('site_calendar', 'event_calendar');
+$group_calendar = elgg_get_plugin_setting('group_calendar', 'event_calendar');
+$admin = elgg_is_admin_logged_in();
+$containers = array();
+if (($site_calendar != 'no') && ($admin || !$site_calendar || ($site_calendar == 'loggedin'))) {
+ $containers[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..00cfd6cbb 100644
--- a/views/default/event_calendar/css.php
+++ b/views/default/event_calendar/css.php
@@ -38,6 +38,10 @@ ul#calendarmenu li a:hover, ul#calendarmenu li.sys_selected a{
background: <?php echo $highlight_colour; ?>;
}
+.event-calendar-ical {
+ width: 200px;
+}
+
td.ui-datepicker-unselectable {
background-color: #FFFFFF !important;
color: #888888 !important;
@@ -171,8 +175,90 @@ li.event-calendar-filter-menu-show-only {
margin-right: 10px;
}
-.event-calendar-date-time-setter label {
- float: left;
- width: 50px;
+fieldset > legend {
+ font-weight: bold;
+ font-size: 1.2em;
+ line-height: 1.1em;
+ padding-bottom: 5px;
+}
+.event-calendar-repeating-wrapper {
+ padding: 0;
margin-top: 5px;
-} \ No newline at end of file
+}
+.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;
+ display: none;
+}
+
+.event-calendar-edit-reminder-wrapper {
+ margin-top: 10px;
+ display: none;
+}
+
+.event-calendar-edit-form-membership-block, .event-calendar-edit-form-share-block {
+ display: none;
+}
+
+.event-calendar-description {
+ display: none;
+}
+
+.event-calendar-edit-bottom {
+ clear: both;
+ margin-bottom: 5px;
+}
+
+.event-calendar-date-selected {
+ background-color: #DDDDFF;
+}
diff --git a/views/default/event_calendar/datetime_edit.php b/views/default/event_calendar/datetime_edit.php
new file mode 100644
index 000000000..2e0830167
--- /dev/null
+++ b/views/default/event_calendar/datetime_edit.php
@@ -0,0 +1,46 @@
+<?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("input/date", array(
+ 'class'=>'event-calendar-compressed-date',
+ 'name' => 'start_date',
+ 'value'=>$vars['start_date'],
+ ));
+ $body .= '<span id="event-calendar-start-time-wrapper">';
+ $body .= elgg_view("input/timepicker",array('name' => 'start_time','value'=>$vars['start_time']));
+ $body .= '</span>';
+ if ($event_calendar_hide_end != 'yes') {
+ $body .= '</p><p id="event-calendar-to-time-wrapper"><label>'.elgg_echo('event_calendar:to_label').'</label>';
+ $body .= elgg_view("input/date", array(
+ 'class'=>'event-calendar-compressed-date',
+ 'name' => 'end_date',
+ 'value'=>$vars['end_date'],
+ ));
+ $body .= '<span id="event-calendar-end-time-wrapper">';
+ $body .= elgg_view("input/timepicker",array('name' => 'end_time','value'=>$vars['end_time']));
+ $body .= '</span>';
+ }
+ $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 id="event-calendar-to-time-wrapper"><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/filter_menu.php b/views/default/event_calendar/filter_menu.php
index 369d09e5f..1364902a8 100644
--- a/views/default/event_calendar/filter_menu.php
+++ b/views/default/event_calendar/filter_menu.php
@@ -15,19 +15,22 @@ $tabs = array(
'selected' => ($filter_context == 'all'),
'priority' => 200,
),
- 'mine' => array(
+);
+
+if (elgg_is_logged_in()) {
+ $tabs ['mine'] = array(
'text' => elgg_echo('event_calendar:show_mine'),
'href' => "$url_start/mine",
'selected' => ($filter_context == 'mine'),
'priority' => 300,
- ),
- 'friend' => array(
+ );
+ $tabs['friend'] = array(
'text' => elgg_echo('event_calendar:show_friends'),
'href' => "$url_start/friends",
'selected' => ($filter_context == 'friends'),
'priority' => 400,
- ),
-);
+ );
+}
$tab_rendered = array();
@@ -56,13 +59,10 @@ foreach ($tabs as $name => $tab) {
//echo elgg_view_menu('filter', array('sort_by' => 'priority', 'class' => 'elgg-menu-hz'));
-$text_bit = '<li class="event-calendar-filter-menu-show-only">'.elgg_echo('event_calendar:show_only').'</li>';
-
$menu = <<<__MENU
<ul class="elgg-menu elgg-menu-filter elgg-menu-hz elgg-menu-filter-default">
{$tab_rendered['open']}
{$tab_rendered['all']}
- $text_bit
{$tab_rendered['mine']}
{$tab_rendered['friend']}
</ul>
diff --git a/views/default/event_calendar/forms/add_to_group.php b/views/default/event_calendar/forms/add_to_group.php
index f9640733c..2c8fdec53 100644
--- a/views/default/event_calendar/forms/add_to_group.php
+++ b/views/default/event_calendar/forms/add_to_group.php
@@ -72,5 +72,3 @@ if ($add_options || $remove_options) {
}
echo '</div>';
}
-
-?> \ No newline at end of file
diff --git a/views/default/event_calendar/forms/delete_confirm.php b/views/default/event_calendar/forms/delete_confirm.php
deleted file mode 100644
index 37134e695..000000000
--- a/views/default/event_calendar/forms/delete_confirm.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-$body = '<p class="description">'.sprintf(elgg_echo('event_calendar:delete_confirm_description'),$vars['title']).'</p>';
-
-$body .= '<form action="'.$vars['url'].'action/event_calendar/manage" method="post" >';
-$body .= elgg_view('input/securitytoken');
-$body .= elgg_view('input/hidden',array('internalname'=>'event_action', 'value'=>'delete_event'));
-$body .= elgg_view('input/hidden',array('internalname'=>'event_id', 'value'=>$vars['event_id']));
-$body .= elgg_view('input/submit', array('internalname'=>'submit','value'=>elgg_echo('event_calendar:submit')));
-$body .= '</form>';
-
-echo elgg_view('page_elements/contentwrapper', array('body'=>$body));
-?> \ No newline at end of file
diff --git a/views/default/event_calendar/forms/manage_event.php b/views/default/event_calendar/forms/manage_event.php
deleted file mode 100644
index f9d78e3f4..000000000
--- a/views/default/event_calendar/forms/manage_event.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-/**
- * Elgg manage event view
- *
- * @package event_calendar
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Kevin Jardine <kevin@radagast.biz>
- * @copyright Radagast Solutions 2008
- * @link http://radagast.biz/
- *
- */
-
-elgg_extend_view('metatags','event_calendar/metatags');
-
-$body = elgg_view('event_calendar/forms/manage_event_content',$vars);
-
-$body .= elgg_view('input/submit', array('internalname'=>'submit','value'=>elgg_echo('event_calendar:submit')));
-$form = elgg_view('input/form',array('action'=>$vars['url'].'action/event_calendar/manage','body'=>$body));
-
-print elgg_view('page_elements/contentwrapper',array('body'=>$form));
-?> \ No newline at end of file
diff --git a/views/default/event_calendar/forms/manage_event_content.php b/views/default/event_calendar/forms/manage_event_content.php
deleted file mode 100644
index f28788132..000000000
--- a/views/default/event_calendar/forms/manage_event_content.php
+++ /dev/null
@@ -1,254 +0,0 @@
-<?php
-$event = $vars['event'];
-$event_id = $vars['event_id'];
-$event_calendar_times = get_plugin_setting('times', 'event_calendar');
-$event_calendar_region_display = get_plugin_setting('region_display', 'event_calendar');
-$event_calendar_type_display = get_plugin_setting('type_display', 'event_calendar');
-$event_calendar_spots_display = get_plugin_setting('spots_display', 'event_calendar');
-$event_calendar_add_users = get_plugin_setting('add_users', 'event_calendar');
-$event_calendar_hide_access = get_plugin_setting('hide_access', 'event_calendar');
-$event_calendar_hide_end = get_plugin_setting('hide_end', 'event_calendar');
-$event_calendar_more_required = get_plugin_setting('more_required', 'event_calendar');
-
-if ($event_calendar_more_required == 'yes') {
- $required_fields = array('title','venue','start_date','start_time',
- 'brief_description','region','event_type','fees','contact','organiser',
- 'event_tags','spots');
-} else {
- $required_fields = array('title','venue','start_date');
-}
-$all_fields = array('title','venue','start_time','start_date','end_time','end_date',
- 'brief_description','region','event_type','fees','contact','organiser','event_tags',
- 'long_description','spots');
-$prefix = array();
-foreach ($all_fields as $fn) {
- if (in_array($fn,$required_fields)) {
- $prefix[$fn] = elgg_echo('event_calendar:required').' ';
- } else {
- $prefix[$fn] = elgg_echo('event_calendar:optional').' ';
- }
-}
-
-if ($event) {
- $title = $event->title;
- $brief_description = $event->description;
- $venue = $event->venue;
- if ($event->form_data) {
- // this is a form redisplay, so take the values as submitted
- $start_date = $event->start_date;
- $end_date = $event->end_date;
- } else {
- // the values are from the database,
- // so convert
- $start_date = date("l, F j, Y",$event->start_date);
- if ($event->end_date) {
- $end_date = date("l, F j, Y",$event->end_date);
- } else {
- $end_date = '';
- }
- }
-
- if ($event_calendar_region_display) {
- $region = $event->region;
- if (!$region) {
- $region = '-';
- }
- }
-
- if ($event_calendar_spots_display) {
- $spots = trim($event->spots);
- }
- if ($event_calendar_type_display) {
- $event_type = $event->event_type;
- if (!$event_type) {
- $event_type = '-';
- }
- }
- $fees = $event->fees;
- $contact = $event->contact;
- $organiser = $event->organiser;
- $event_tags = $event->event_tags;
- $long_description = $event->long_description;
- $access = $event->access_id;
- if ($event_calendar_times == 'yes') {
- $start_time = $event->start_time;
- $end_time = $event->end_time;
- }
- $event_action = 'manage_event';
-} else {
- $event_id = 0;
- $title = '';
- $brief_description = '';
- $venue = '';
- $start_date = '';
- $end_date = '';
- $fees = '';
- if ($event_calendar_spots_display) {
- $spots = '';
- }
- if ($event_calendar_region_display) {
- $region = '-';
- }
- if ($event_calendar_type_display) {
- $event_type = '-';
- }
- $contact = '';
- $organiser = '';
- $event_tags = '';
- $long_description = '';
- $access = get_default_access();
- if ($event_calendar_times == 'yes') {
- $start_time = '';
- $end_time = '';
- }
- $event_action = 'add_event';
-}
-$body = '';
-
-$body .= elgg_view('input/hidden',array('internalname'=>'event_action', 'value'=>$event_action));
-$body .= elgg_view('input/hidden',array('internalname'=>'event_id', 'value'=>$event_id));
-$body .= elgg_view('input/hidden',array('internalname'=>'group_guid', 'value'=>$vars['group_guid']));
-
-$body .= '<p><label>'.elgg_echo("event_calendar:title_label").'<br />';
-$body .= elgg_view("input/text",array('internalname' => 'title','value'=>$title));
-$body .= '</label></p>';
-$body .= '<p class="description">'.$prefix['title'].elgg_echo('event_calendar:title_description').'</p>';
-
-$body .= '<p><label>'.elgg_echo("event_calendar:venue_label").'<br />';
-$body .= elgg_view("input/text",array('internalname' => 'venue','value'=>$venue));
-$body .= '</label></p>';
-$body .= '<p class="description">'.$prefix['venue'].elgg_echo('event_calendar:venue_description').'</p>';
-
-if ($event_calendar_times != 'no') {
- $body .= '<p><label>'.elgg_echo("event_calendar:start_time_label").'</label><br />';
- $body .= elgg_view("input/timepicker",array('internalname' => 'start_time','value'=>$start_time));
- $body .= '</p>';
- $body .= '<p class="description">'.$prefix['start_time'].elgg_echo('event_calendar:start_time_description').'</p>';
-}
-
-$body .= '<p><label>'.elgg_echo("event_calendar:start_date_label").'<br />';
-$body .= elgg_view("input/datepicker_popup",array('internalname' => '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') {
- if ($event_calendar_times != 'no') {
- $body .= '<p><label>'.elgg_echo("event_calendar:end_time_label").'</label><br />';
- $body .= elgg_view("input/timepicker",array('internalname' => 'end_time','value'=>$end_time));
- $body .= '</p>';
- $body .= '<p class="description">'.$prefix['end_time'].elgg_echo('event_calendar:end_time_description').'</p>';
- }
-
- $body .= '<p><label>'.elgg_echo("event_calendar:end_date_label").'<br />';
- $body .= elgg_view("input/datepicker_popup",array('internalname' => 'end_date','value'=>$end_date));
- $body .= '</label></p>';
- $body .= '<p class="description">'.$prefix['end_date'].elgg_echo('event_calendar:end_date_description').'</p>';
-}
-
-if ($event_calendar_spots_display == 'yes') {
- $body .= '<p><label>'.elgg_echo("event_calendar:spots_label").'<br />';
- $body .= elgg_view("input/text",array('internalname' => 'spots','value'=>$spots));
- $body .= '</label></p>';
- $body .= '<p class="description">'.$prefix['spots'].elgg_echo('event_calendar:spots_description').'</p>';
-}
-
-if ($event_calendar_add_users == 'yes') {
- $body .= '<p><label>'.elgg_echo("event_calendar:add_user_label").'<br />';
- $body .= elgg_view("input/adduser",array('internalname' => 'adduser','internalid' => 'do_adduser','width'=> 200, 'minChars'=>2));
- $body .= '</label></p><br /><br />';
- $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('internalname' => 'brief_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('internalname' => '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('internalname' => '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('internalname' => '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('internalname' => '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('internalname' => 'organiser','value'=>$organiser));
-$body .= '</label></p>';
-$body .= '<p class="description">'.$prefix['organiser'].elgg_echo('event_calendar:organiser_description').'</p>';
-
-$body .= '<p><label>'.elgg_echo("event_calendar:event_tags_label").'<br />';
-$body .= elgg_view("input/tags",array('internalname' => 'event_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('internalname' => 'long_description','value'=>$long_description));
-$body .= '</label></p>';
-$body .= '<p class="description">'.$prefix['long_description'].elgg_echo('event_calendar:long_description_description').'</p>';
-
-if($event_calendar_hide_access == 'yes') {
- $event_calendar_default_access = get_plugin_setting('default_access', 'event_calendar');
- if($event_calendar_default_access) {
- $body .= elgg_view("input/hidden",array('internalname' => 'access','value'=>$event_calendar_default_access));
- } else {
- $body .= elgg_view("input/hidden",array('internalname' => 'access','value'=>ACCESS_PRIVATE));
- }
-} else {
- $body .= '<p><label>'.elgg_echo("access").'<br />';
- $body .= elgg_view("input/access",array('internalname' => 'access','value'=>$access));
- $body .= '</label></p>';
-}
-
-print $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..1a58321b5 100644
--- a/views/default/event_calendar/full_calendar_view.php
+++ b/views/default/event_calendar/full_calendar_view.php
@@ -1,56 +1,82 @@
<?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);
+$timeformat = elgg_get_plugin_setting('timeformat', 'event_calendar') == 24 ? 'H(:mm)' : 'h(:mm)t';
// TODO: is there an easy way to avoid embedding JS?
?>
<script>
+var goToDateFlag = 0;
+
handleEventClick = function(event) {
if (event.url) {
window.location.href = event.url;
- return false;
+ event.preventDefault();
}
};
-handleEventDrop = function(event,dayDelta,minuteDelta,allDay,revertFunc) {
+handleDayClick = function(date,allDay,jsEvent,view) {
+ var iso = getISODate(date);
+ var link = $('.elgg-menu-item-event-calendar-0add').find('a').attr('href');
+ var ss = link.split('/');
+ var link = $('.elgg-menu-item-event-calendar-0add').find('a').attr('href');
+ var ss = link.split('/');
+ var last_ss = ss[ss.length-1];
+ var group_guid;
+ if (last_ss == 'add') {
+ group_guid = 0;
+ } else if (last_ss.split('-').length == 3) {
+ group_guid = ss[ss.length-2];
+ } else {
+ group_guid = last_ss;
+ }
+ var url = elgg.get_site_url();
+ $('.fc-widget-content').removeClass('event-calendar-date-selected');
+ var current_iso = $('#event-calendar-selected-date').val();
+ if (current_iso == iso) {
+ // deselect
+ $('#event-calendar-selected-date').val("");
+ $('.elgg-menu-item-event-calendar-0add').find('a').attr('href',url+'event_calendar/add/'+group_guid);
+ $('.event-calendar-button-add').attr('href',url+'event_calendar/add/'+group_guid);
+ $('.elgg-menu-item-event-calendar-1schedule').find('a').attr('href',url+'event_calendar/schedule/'+group_guid);
+ } else {
+ $('#event-calendar-selected-date').val(iso);
+ $('.elgg-menu-item-event-calendar-0add').find('a').attr('href',url+'event_calendar/add/'+group_guid+'/'+iso);
+ $('.event-calendar-button-add').attr('href',url+'event_calendar/add/'+group_guid+'/'+iso);
+ $('.elgg-menu-item-event-calendar-1schedule').find('a').attr('href',url+'event_calendar/schedule/'+group_guid+'/'+iso);
+
+ $(this).addClass('event-calendar-date-selected');
+ }
+}
- if (!confirm("Are you sure about this change?")) {
+handleEventDrop = function(event,dayDelta,minuteDelta,allDay,revertFunc) {
+
+ if (!event.is_event_poll && !confirm("<?php echo elgg_echo('event_calendar:are_you_sure'); ?>")) {
revertFunc();
} else {
+ if (event.is_event_poll) {
+ if (confirm("<?php echo elgg_echo('event_calendar:resend_poll_invitation'); ?>")) {
+ var resend = 1;
+ } else {
+ resend = 0;
+ }
+ var data = {event_guid: event.guid, startTime: event.start.toISOString(), dayDelta: dayDelta, minuteDelta: minuteDelta, resend: resend, minutes: event.minutes, iso_date: event.iso_date};
+ } else {
+ data = {event_guid: event.guid, startTime: event.start.toISOString(), dayDelta: dayDelta, minuteDelta: minuteDelta};
+ }
elgg.action('event_calendar/modify_full_calendar',
{
- data: {event_guid: event.guid,dayDelta: dayDelta, minuteDelta: minuteDelta},
+ data: data,
success: function (res) {
var success = res.success;
var msg = res.message;
if (!success) {
elgg.register_error(msg,2000);
revertFunc()
+ } else {
+ event.minutes = res.minutes;
+ event.iso_date = res.iso_date;
}
}
}
@@ -58,32 +84,117 @@ 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.getDate();
+ day = day < 10 ? '0' + day : day;
+ return year +"-"+month+"-"+day;
+}
+
+handleEventRender = function(event, element, view) {
+ /*if (event.is_event_poll) {
+ element.draggable = false;
+ }*/
+}
+
+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);
+ }
+ });
+ // reset date links and classes
+ //$('.fc-widget-content').removeClass('event-calendar-date-selected');
+ var link = $('.elgg-menu-item-event-calendar-0add').find('a').attr('href');
+ if (link != undefined) {
+ var ss = link.split('/');
+ var last_ss = ss[ss.length-1];
+ var group_guid;
+ if (last_ss == 'add') {
+ group_guid = 0;
+ } else if (last_ss.split('-').length == 3) {
+ group_guid = ss[ss.length-2];
+ } else {
+ group_guid = last_ss;
+ }
+ var url = elgg.get_site_url();
+ $('.elgg-menu-item-event-calendar-0add').find('a').attr('href',url+'event_calendar/add/'+group_guid);
+ $('.elgg-menu-item-event-calendar-1schedule').find('a').attr('href',url+'event_calendar/schedule/'+group_guid);
+ }
+}
+
+handleViewDisplay = function(view) {
+ // TODO: finish this, need to highlight selected date if any
+ var current_iso = $('#event-calendar-selected-date').val();
+ if (view == 'month') {
+ goToDateFlag = 0;
+ } else if (goToDateFlag == 0 && current_iso != "") {
+ goToDateFlag = 1;
+ var a = current_iso.split("-");
+ $('#calendar').fullCalendar('gotoDate',parseInt(a[0],10),parseInt(a[1],10)-1,parseInt(a[2],10));
+ //$('.fc-widget-content').removeClass('event-calendar-date-selected');
+ //$(".fc-widget-content[data-date='"+ciso+"']").addClass('event-calendar-date-selected');
+ }
+
+ //$(".fc-widget-content[data-date='20120105']")
+}
+
+fullcalendarInit = function() {
+
+ var loadFullCalendar = function() {
+ var locale = $.datepicker.regional[elgg.get_language()];
+ if (!locale) {
+ locale = $.datepicker.regional[''];
+ }
+ $('#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,
+ eventRender: handleEventRender,
+ eventDrop: handleEventDrop,
+ eventClick: handleEventClick,
+ dayClick: handleDayClick,
+ events: handleGetEvents,
+ viewDisplay: handleViewDisplay,
+
+ isRTL: locale.isRTL,
+ firstDay: locale.firstDay,
+ monthNames: locale.monthNames,
+ monthNamesShort: locale.monthNamesShort,
+ dayNames: locale.dayNames,
+ dayNamesShort: locale.dayNamesShort,
+ buttonText: {
+ today: locale.currentText,
+ month: elgg.echo('event_calendar:month_label'),
+ week: elgg.echo('event_calendar:week_label'),
+ day: elgg.echo('event_calendar:day_label')
+ },
+ timeFormat: "<?php echo $timeformat; ?>",
});
}
- $('#calendar').fullCalendar({
- header: {
- left: 'prev,next today',
- center: 'title',
- right: 'month,agendaWeek,agendaDay'
- },
- editable: true,
- slotMinutes: 15,
- eventDrop: handleEventDrop,
- eventClick: handleEventClick,
- events: cal_events
+ elgg.get({
+ url: elgg.config.wwwroot + 'vendors/jquery/i18n/jquery.ui.datepicker-'+ elgg.get_language() +'.js',
+ dataType: "script",
+ cache: true,
+ success: loadFullCalendar,
+ error: loadFullCalendar, // english language is already loaded.
});
-});
+}
+
+elgg.register_hook_handler('init', 'system', fullcalendarInit);
+
</script>
<div id='calendar'></div>
+<input type="hidden" id="event-calendar-selected-date" />
diff --git a/views/default/event_calendar/groupprofile_calendar.php b/views/default/event_calendar/groupprofile_calendar.php
index 7ee09104f..c71780be8 100644
--- a/views/default/event_calendar/groupprofile_calendar.php
+++ b/views/default/event_calendar/groupprofile_calendar.php
@@ -26,10 +26,8 @@ if (event_calendar_activated_for_group($page_owner_entity)) {
if (is_array($events) && sizeof($events) > 0) {
foreach($events as $event) {
- echo elgg_view("object/event_calendar",array('entity' => $event));
+ echo elgg_view("object/event_calendar",array('entity' => $event['event']));
}
}
}
-
-?> \ No newline at end of file
diff --git a/views/default/event_calendar/input/date_local.php b/views/default/event_calendar/input/date_local.php
index f4cb48d11..a0ce7f4d3 100644
--- a/views/default/event_calendar/input/date_local.php
+++ b/views/default/event_calendar/input/date_local.php
@@ -44,7 +44,6 @@ if ($timestamp) {
$vars['class'] = "{$vars['class']} elgg-input-timestamp";
$vars['id'] = $vars['name'];
unset($vars['name']);
- unset($vars['internalname']);
}
// convert timestamps to text for display
diff --git a/views/default/event_calendar/input/longtext.php b/views/default/event_calendar/input/longtext.php
deleted file mode 100644
index 86b0f3fc4..000000000
--- a/views/default/event_calendar/input/longtext.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
- /**
- * Elgg long text input
- * Displays a long text input field
- *
- * @package Elgg
- * @subpackage Core
-
- * @author Curverider Ltd
-
- * @link http://elgg.org/
- *
- * @uses $vars['value'] The current value, if any
- * @uses $vars['js'] Any Javascript to enter into the input tag
- * @uses $vars['internalname'] The name of the input field
- *
- */
-
- $class = $vars['class'];
- if (!$class) $class = "input-textarea";
-
-?>
-
-<textarea class="<?php echo $class; ?>" name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['internalid'])) echo "id=\"{$vars['internalid']}\""; ?> <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?>><?php echo htmlentities($vars['value'], ENT_QUOTES, 'UTF-8'); ?></textarea> \ No newline at end of file
diff --git a/views/default/event_calendar/personal_manage_section.php b/views/default/event_calendar/personal_manage_section.php
new file mode 100644
index 000000000..9e03db0ab
--- /dev/null
+++ b/views/default/event_calendar/personal_manage_section.php
@@ -0,0 +1,20 @@
+<?php
+$fd = $vars['form_data'];
+$event_calendar_personal_manage = elgg_get_plugin_setting('personal_manage', 'event_calendar');
+$body = '';
+
+if ($event_calendar_personal_manage == 'by_event') {
+ $personal_manage_options = array(
+ 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',
+ );
+ $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'=>$fd['personal_manage'],'options'=>$personal_manage_options));
+ //$body .= '<p class="event-calendar-description">'.$prefix['personal_manage'].elgg_echo('event_calendar:personal_manage:description').'</p>';
+ $body .= '<br clear="both" />';
+ $body .= '</div>';
+}
+
+echo $body;
diff --git a/views/default/event_calendar/reminder_section.php b/views/default/event_calendar/reminder_section.php
new file mode 100644
index 000000000..fffa6d065
--- /dev/null
+++ b/views/default/event_calendar/reminder_section.php
@@ -0,0 +1,28 @@
+<?php
+$fd = $vars['form_data'];
+$event_calendar_reminders = elgg_get_plugin_setting('reminders', 'event_calendar');
+$body = '';
+if ($event_calendar_reminders == 'yes') {
+ $body .= '<div class="event-calendar-edit-reminder-wrapper">';
+ if ($fd['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'=>$fd['reminder_number']));
+ $body .= elgg_view('input/dropdown',array('name'=>'reminder_interval','options_values'=>$intervals,'value'=>$fd['reminder_interval']));
+ $body .= elgg_echo('elgg_calendar:send_reminder_before');
+ $body .= '</div>';
+}
+echo $body;
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..5de858caf
--- /dev/null
+++ b/views/default/event_calendar/repeat_form_element.php
@@ -0,0 +1,32 @@
+<?php
+$event = $vars['event'];
+$fd = $vars['form_data'];
+$days = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');
+
+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');
+
+echo '<div class="event-calendar-repeating-wrapper">';
+
+foreach($days as $day) {
+ $label = elgg_echo("event_calendar:day_abbrev:$day");
+ echo <<<HTML
+<a id="event-calendar-repeating-$day" href="javascript:void(0);" class="event-calendar-repeating-unselected">
+ $label
+</a>
+HTML;
+
+}
+
+echo '</div>';
+
+foreach($days as $day) {
+ echo elgg_view('input/hidden', array('name' => "event-calendar-repeating-$day-value", 'value' => $fd["event-calendar-repeating-$day-value"]));
+} \ No newline at end of file
diff --git a/views/default/event_calendar/schedule_section.php b/views/default/event_calendar/schedule_section.php
new file mode 100644
index 000000000..3a74dc789
--- /dev/null
+++ b/views/default/event_calendar/schedule_section.php
@@ -0,0 +1,22 @@
+<?php
+$event = $vars['event'];
+$fd = $vars['form_data'];
+$event_calendar_repeated_events = elgg_get_plugin_setting('repeated_events', 'event_calendar');
+
+$body = '<div class="event-calendar-edit-date-wrapper">';
+$body .= elgg_view('event_calendar/datetime_edit',
+ array(
+ 'start_date' => $fd['start_date'],
+ 'end_date' => $fd['end_date'],
+ 'start_time' => $fd['start_time'],
+ 'end_time' => $fd['end_time'],
+ 'prefix' => $vars['prefix'],
+));
+if ($event_calendar_repeated_events == 'yes') {
+ $body .= elgg_view('event_calendar/repeat_form_element',$vars);
+}
+
+$body .= elgg_view('event_calendar/reminder_section',$vars);
+$body .= '</div>';
+
+echo $body;
diff --git a/views/default/event_calendar/share_section.php b/views/default/event_calendar/share_section.php
new file mode 100644
index 000000000..c4f6cf45f
--- /dev/null
+++ b/views/default/event_calendar/share_section.php
@@ -0,0 +1,26 @@
+<?php
+$fd = $vars['form_data'];
+$event_calendar_hide_access = elgg_get_plugin_setting('hide_access', 'event_calendar');
+$body = '<fieldset>';
+$body .= '<legend>'.elgg_echo('event_calendar:permissions:header').'</legend>';
+if($event_calendar_hide_access == 'yes') {
+ $event_calendar_default_access = elgg_get_plugin_setting('default_access', 'event_calendar');
+ if($event_calendar_default_access) {
+ $body .= elgg_view("input/hidden",array('name' => 'access_id','value'=>$event_calendar_default_access));
+ } else {
+ $body .= elgg_view("input/hidden",array('name' => 'access_id','value'=>ACCESS_DEFAULT));
+ }
+} else {
+ $body .= '<p><label>'.elgg_echo('event_calendar:read_access').'</label>';
+ $body .= elgg_view("input/access",array('name' => 'access_id','value'=>$fd['access_id']));
+ $body .= '</p>';
+}
+if (elgg_plugin_exists('entity_admins')) {
+ $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'=>$vars['event']));
+}
+$body .= '</fieldset>';
+
+echo $body;
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..d45fb387b 100644
--- a/views/default/forms/event_calendar/edit.php
+++ b/views/default/forms/event_calendar/edit.php
@@ -2,21 +2,24 @@
$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',
+$schedule_options = array(
+ elgg_echo('event_calendar:all_day_label') => 'all_day',
+ elgg_echo('event_calendar:schedule_type:fixed')=>'fixed',
);
-$event_calendar_times = elgg_get_plugin_setting('times', 'event_calendar');
+if (elgg_plugin_exists('event_poll')) {
+ $schedule_options = array_merge(array(elgg_echo('event_calendar:schedule_type:poll')=>'poll'),$schedule_options);
+}
+
+$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_bbb_server_url = elgg_get_plugin_setting('bbb_server_url', 'event_calendar');
if ($event_calendar_more_required == 'yes') {
$required_fields = array('title','venue','start_date','start_time',
@@ -39,237 +42,192 @@ foreach ($all_fields as $fn) {
}
if ($event) {
- $title = $event->title;
- $brief_description = $event->description;
- $venue = $event->venue;
- // this is a form redisplay, so take the values as submitted
- $start_date = $event->start_date;
- $end_date = $event->end_date;
-
- if ($event_calendar_region_display) {
- $region = $event->region;
- if (!$region) {
- $region = '-';
- }
- }
-
- if ($event_calendar_spots_display) {
- $spots = trim($event->spots);
- }
- if ($event_calendar_type_display) {
- $event_type = $event->event_type;
- if (!$event_type) {
- $event_type = '-';
- }
- }
- $fees = $event->fees;
- $contact = $event->contact;
- $organiser = $event->organiser;
- $event_tags = $event->event_tags;
- $long_description = $event->long_description;
- $access = $event->access_id;
- if ($event_calendar_times != 'no') {
- $start_time = $event->start_time;
- $end_time = $event->end_time;
- }
- if ($event_calendar_personal_manage == 'by_event') {
- $personal_manage = $event->personal_manage;
- 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'];
+
+$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'];
+$schedule_type = $fd['schedule_type'];
+$long_description = $fd['long_description'];
+
+$body = '<div>';
$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 .= '<fieldset>';
+$body .= '<legend>' . elgg_echo('event_calendar:basic:header') . '</legend>';
-$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', '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', 'value' => $venue));
+$body .= '</p>';
+$body .= '<p class="event-calendar-description">'.$prefix['venue'].elgg_echo('event_calendar:venue_description').'</p>';
+
+if ($event_calendar_fewer_fields != 'yes') {
+ $body .= '<p><label>'.elgg_echo("event_calendar:brief_description_label").'</label>';
+ $body .= elgg_view("input/text",array('name' => 'description', 'value' => $brief_description));
$body .= '</p>';
- $body .= '</div>';
+ $body .= '<p class="event-calendar-description">'.$prefix['brief_description'].elgg_echo('event_calendar:brief_description_description').'</p>';
+
} else {
+ $body .= '<label>'.elgg_echo("event_calendar:long_description_label").'</label>';
+ $body .= elgg_view("input/longtext",array('name' => 'long_description', 'value' => $long_description));
+ $body .= '<p class="event-calendar-description">'.$prefix['long_description'].elgg_echo('event_calendar:long_description_description').'</p>';
+}
- $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 .= '<p><label>'.elgg_echo("event_calendar:event_tags_label").'</label>';
+$body .= elgg_view("input/tags",array('name' => 'tags', 'value' => $event_tags));
+$body .= '</p>';
+$body .= '<p class="event-calendar-description">'.$prefix['event_tags'].elgg_echo('event_calendar:event_tags_description').'</p>';
+
+if ($event || !$vars['group_guid']) {
+ $body .= '<p><label>'.elgg_echo("event_calendar:calendar_label").'</label>';
+ $body .= elgg_view('event_calendar/container',array('container_guid'=>$vars['group_guid']));
+ $body .= '</p>';
+ $body .= '<p class="event-calendar-description">'.$prefix['calendar'].elgg_echo('event_calendar:calendar_description').'</p>';
+} else {
+ $body .= elgg_view('input/hidden',array('name'=>'group_guid', 'value'=>$vars['group_guid']));
+}
+
+if($event_calendar_bbb_server_url) {
+ $body .= '<p>';
+ if ($fd['web_conference']) {
+ $body .= elgg_view('input/checkbox',array('name'=>'web_conference','value'=>1,'checked'=>'checked'));
+ } else {
+ $body .= elgg_view('input/checkbox',array('name'=>'web_conference','value'=>1));
}
+ $body .= elgg_echo('event_calendar:web_conference_label');
+ $body .= '</p>';
}
+$body .= '</fieldset>';
+
+$body .= '<fieldset>';
+$body .= '<legend>'.elgg_echo('event_calendar:schedule:header').'</legend>';
+$body .= elgg_view('input/radio',array('name'=>'schedule_type','value'=>$schedule_type,'options'=>$schedule_options));
+
+$vars['prefix'] = $prefix;
+
+$body .= elgg_view('event_calendar/schedule_section',$vars);
+
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', '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>';
}
-// the following feature has been superceded by the manage subscribers feature
+$body .= '<div class="event-calendar-edit-bottom"></div>';
+$body .= '</fieldset>';
-/*if ($event_calendar_add_users == 'yes') {
- $body .= '<p><label>'.elgg_echo("event_calendar:add_user_label").'<br />';
- $body .= elgg_view("input/adduser",array('name' => 'adduser','internalid' => 'do_adduser','width'=> 200, 'minChars'=>2));
- $body .= '</label></p><br /><br />';
- $body .= '<p class="description">'.elgg_echo('event_calendar:add_user_description').'</p>';
-}*/
+$body .= elgg_view('event_calendar/personal_manage_section',$vars);
-$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>';
+$body .= elgg_view('event_calendar/share_section',$vars);
-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;
+if ($event_calendar_region_display == 'yes' || $event_calendar_type_display == 'yes' || $event_calendar_fewer_fields != 'yes') {
+ $body .= '<fieldset>';
+
+ 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>';
}
- $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;
- }
+
+ 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>';
}
- $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 .= 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><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>';
-
-if($event_calendar_hide_access == 'yes') {
- $event_calendar_default_access = elgg_get_plugin_setting('default_access', 'event_calendar');
- if($event_calendar_default_access) {
- $body .= elgg_view("input/hidden",array('name' => 'access_id','value'=>$event_calendar_default_access));
- } else {
- $body .= elgg_view("input/hidden",array('name' => 'access_id','value'=>ACCESS_PRIVATE));
+
+ if ($event_calendar_fewer_fields != 'yes') {
+
+ $body .= '<p><label>'.elgg_echo("event_calendar:fees_label").'</label>';
+ $body .= elgg_view("input/text",array('name' => 'fees', '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', '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', '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', 'value' => $long_description));
+ $body .= '</p>';
+ $body .= '<p class="event-calendar-description">'.$prefix['long_description'].elgg_echo('event_calendar:long_description_description').'</p>';
}
-} else {
- $body .= '<p><label>'.elgg_echo("access").'<br />';
- $body .= elgg_view("input/access",array('name' => 'access_id','value'=>$access));
- $body .= '</label></p>';
+
+ $body .= '</fieldset>';
}
$body .= elgg_view('input/submit', array('name'=>'submit','value'=>elgg_echo('event_calendar:submit')));
+$body .= '</div>';
+
echo $body;
diff --git a/views/default/input/datepicker_inline.php b/views/default/input/datepicker_inline.php
index 1d0a0689d..3fd9c37af 100644
--- a/views/default/input/datepicker_inline.php
+++ b/views/default/input/datepicker_inline.php
@@ -65,7 +65,6 @@ $("#<?php echo $vars['name']; ?>").datepicker({
document.location.href = "<?php echo $link_bit; ?>".replace('%s', date.substring(0,10));
},
dateFormat: "yy-mm-dd",
- <?php echo $vars['range_bit']; ?>
defaultDate: "<?php echo $vars['start_date'] .' - '.$vars['end_date']; ?>",
beforeShowDay: highlightWeek
});
@@ -76,7 +75,7 @@ if ("<?php echo $vars['mode'] ?>" == "month") {
end_date += 1;
}
$("#<?php echo $vars['name']; ?>").datepicker("setDate", start_date, end_date);
-var done_loading = true;
+done_loading = true;
});
</script>
diff --git a/views/default/input/datepicker_popup.php b/views/default/input/datepicker_popup.php
deleted file mode 100644
index 0daeb7307..000000000
--- a/views/default/input/datepicker_popup.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-/**
- * JQuery data picker
- *
- * @package event_calendar
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Kevin Jardine <kevin@radagast.biz>
- * @copyright Radagast Solutions 2008
- * @link http://radagast.biz/
- *
- */
-
-if ($vars['dateformat']) {
- $date_format = $vars['dateformat'];
-} else {
- $date_format = "yy/mm/dd";
-}
-?>
-
-<script language="javascript">
-$(document).ready(function(){
-$("#<?php echo $vars['internalname']; ?>").datepicker({
- dateFormat: "<?php echo $date_format; ?>",
- showOn: "both",
- buttonImage: "<?php echo $vars['url']; ?>mod/event_calendar/images/calendar.gif",
- buttonImageOnly: true
-})
-});
-</script>
-<input type="text" size="30" value="<?php echo $vars['value']; ?>" name="<?php echo $vars['internalname']; ?>" id="<?php echo $vars['internalname']; ?>"/> \ No newline at end of file
diff --git a/views/default/input/timepicker.php b/views/default/input/timepicker.php
index d7df04699..2cc95ced7 100644
--- a/views/default/input/timepicker.php
+++ b/views/default/input/timepicker.php
@@ -1,5 +1,4 @@
<?php
-
$time_format = elgg_get_plugin_setting('timeformat', 'event_calendar');
if (!$time_format) {
$time_format = '24';
@@ -9,45 +8,44 @@ $value = $vars['value'];
if (is_numeric($value)) {
$hour = floor($value/60);
$minute = ($value -60*$hour);
- $time = $hour*60+$minute;
} else {
- $time = '-';
+ $hour = 0;
+ $minute = 0;
}
-$dates = array();
-$dates['-'] = '-';
+$hours = array();
+$minutes = array();
if ($time_format == '12') {
- for($h=0;$h<=12;$h++) {
- $ht = sprintf("%02d",$h);
- for($m=0;$m<60;$m=$m+15) {
- $mt = sprintf("%02d",$m);
- $t = $h*60+$m;
- if ($h < 12) {
- $dates[$t] = "$ht:$mt am";
- } else {
- $dates[$t] = "$ht:$mt pm";
- }
- }
+ $meridians = array('am'=>'am','pm'=>'pm');
+ if ($hour == 0) {
+ $hour = 12;
+ $meridian = 'am';
+ } else if ($hour == 12) {
+ $meridian = 'pm';
+ } else if ($hour < 12) {
+ $meridian = 'am';
+ } else {
+ $hour -= 12;
+ $meridian = 'pm';
}
- for($h=1;$h<12;$h++) {
- $ht = sprintf("%02d",$h);
- for($m=0;$m<60;$m=$m+15) {
- $mt = sprintf("%02d",$m);
- $t = 12*60+$h*60+$m;
- $dates[$t] = "$ht:$mt pm";
- }
+ for($h=1;$h<=12;$h++) {
+ $hours[$h] = $h;
}
} else {
- for($h=0;$h<24;$h++) {
- $ht = sprintf("%02d",$h);
- for($m=0;$m<60;$m=$m+15) {
- $mt = sprintf("%02d",$m);
- $t = $h*60+$m;
- $dates[$t] = "$ht:$mt";
- }
+ for($h=0;$h<=23;$h++) {
+ $hours[$h] = $h;
}
-}
+}
-echo elgg_view('input/dropdown',array('name'=>$vars['name'],'value'=>$time,'options_values'=>$dates));
+for($m=0;$m<60;$m=$m+5) {
+ $mt = sprintf("%02d",$m);
+ $minutes[$m] = $mt;
+}
+echo elgg_view('input/dropdown',array('name'=>$vars['name'].'_hour','value'=>$hour,'options_values'=>$hours));
+echo " <b>:</b> ";
+echo elgg_view('input/dropdown',array('name'=>$vars['name'].'_minute','value'=>$minute,'options_values'=>$minutes));
+if ($time_format == '12') {
+ echo elgg_view('input/dropdown',array('name'=>$vars['name'].'_meridian','value'=>$meridian,'options_values'=>$meridians));
+}
diff --git a/views/default/js/event_calendar/event_calendar.php b/views/default/js/event_calendar/event_calendar.php
index 8c4e735a6..efa1dc1dd 100644
--- a/views/default/js/event_calendar/event_calendar.php
+++ b/views/default/js/event_calendar/event_calendar.php
@@ -6,6 +6,102 @@ 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);
+ $('input.elgg-input-radio[name="schedule_type"]').click(elgg.event_calendar.handleScheduleType);
+ elgg.event_calendar.handleScheduleType();
+
+ var all_day_field = $('[name="all_day"][type="checkbox"]');
+ if (all_day_field.is(':checked')) {
+ //$('[name="start_time"]').val(0);
+ $('#event-calendar-start-time-wrapper').attr('disabled','disabled');
+ //$('[name="end_time"]').val(0);
+ $('#event-calendar-end-time-wrapper').attr('disabled','disabled');
+ }
+ all_day_field.change(elgg.event_calendar.handleAllDayField);
+
+ $('.elgg-input-date[name="start_date"], .elgg-input-date[name="end_date"]').datepicker({
+ dateFormat: 'yy-mm-dd',
+ numberOfMonths: 3,
+ onSelect: elgg.event_calendar.handleDateRangeSelect,
+ });
+}
+
+elgg.event_calendar.handleScheduleType = function(e) {
+ var st = $('input.elgg-input-radio[name="schedule_type"]:checked').val();
+ if (st == 'poll') {
+ $(".event-calendar-edit-date-wrapper").hide();
+ $(".event-calendar-edit-reminder-wrapper").hide();
+ $(".event-calendar-edit-form-membership-block").hide();
+ $(".event-calendar-edit-form-share-block").hide();
+ } else {
+ $(".event-calendar-edit-date-wrapper").show();
+ $(".event-calendar-edit-reminder-wrapper").show();
+ $(".event-calendar-edit-form-membership-block").show();
+ $(".event-calendar-edit-form-share-block").show();
+ if (st == 'all_day') {
+ $("#event-calendar-start-time-wrapper").hide();
+ $("#event-calendar-end-time-wrapper").hide();
+ } else {
+ $("#event-calendar-start-time-wrapper").show();
+ $("#event-calendar-end-time-wrapper").show();
+ }
+ }
+}
+
+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.handleDateRangeSelect = function(selectedDate) {
+ if (this.name == 'start_date') {
+ $('.elgg-input-date[name="end_date"]').datepicker("option", "minDate", selectedDate);
+ } else {
+ $('.elgg-input-date[name="start_date"]').datepicker("option", "maxDate", selectedDate);
+ }
+}
+
+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) {
@@ -14,9 +110,8 @@ elgg.event_calendar.handleRegionChange = function(e) {
}
elgg.event_calendar.handleIcalPopup = function(e) {
- var message = elgg.echo('event_calendar:ical_popup_message')+"\n"+this.href;
- alert(message);
- return false;
+ this.href = '#event-calendar-ical';
+ e.preventDefault();
}
elgg.event_calendar.handlePagedPersonalCalendarToggle = function() {
diff --git a/views/default/object/event_calendar.php b/views/default/object/event_calendar.php
index 717e2803e..5779c004c 100644
--- a/views/default/object/event_calendar.php
+++ b/views/default/object/event_calendar.php
@@ -11,11 +11,17 @@
*
*/
+elgg_load_library('elgg:event_calendar');
+
$event = $vars['entity'];
$full = elgg_extract('full_view', $vars, FALSE);
if ($full) {
$body = elgg_view('event_calendar/strapline',$vars);
+ if ($event->web_conference) {
+ $body .= '<br />';
+ $body .= elgg_view('event_calendar/conference_button',array('event'=>$event));
+ }
$event_items = event_calendar_get_formatted_full_items($event);
$body .= '<br />';
@@ -53,9 +59,17 @@ if ($full) {
} else {
echo '<p>'.$event->description.'</p>';
}
+ if ($vars['light_box'] == TRUE) {
+ $event_calendar_add_users = elgg_get_plugin_setting('add_users', 'event_calendar');
+ if ($event_calendar_add_users == 'yes') {
+ $url = "event_calendar/manage_users/$event->guid";
+ echo '<p>'.elgg_view('output/url',array('text'=> elgg_echo('event_calendar:manage_users:breadcrumb'), 'href'=>$url)).'</p>';
+ }
+ }
if (elgg_get_plugin_setting('add_to_group_calendar', 'event_calendar') == 'yes') {
echo elgg_view('event_calendar/forms/add_to_group',array('event' => $event));
}
+
} else {
$time_bit = event_calendar_get_formatted_time($event);
diff --git a/views/default/plugins/event_calendar/settings.php b/views/default/plugins/event_calendar/settings.php
index 93724484c..db6e00913 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',
@@ -314,7 +358,7 @@ if (!$event_calendar_region_list) {
$body .= elgg_echo('event_calendar:settings:region_list:title');
$body .= '<br />';
-$body .= elgg_view('event_calendar/input/longtext',array('name'=>'params[region_list]','value'=>$event_calendar_region_list));
+$body .= elgg_view('input/plaintext',array('name'=>'params[region_list]','value'=>$event_calendar_region_list));
$body .= '<br />';
@@ -347,7 +391,7 @@ if (!$event_calendar_type_list) {
$body .= elgg_echo('event_calendar:settings:type_list:title');
$body .= '<br />';
-$body .= elgg_view('event_calendar/input/longtext',array('name'=>'params[type_list]','value'=>$event_calendar_type_list));
+$body .= elgg_view('input/plaintext',array('name'=>'params[type_list]','value'=>$event_calendar_type_list));
$body .= '<br />';
@@ -401,4 +445,30 @@ $body .= elgg_echo('event_calendar:ical_auth_file_name:title');
$body .= '<br />';
$body .= elgg_view('input/text',array('name'=>'params[ical_auth_file_name]','value'=>$ical_auth_file_name, 'class'=>'event-calendar-ical-auth-setting'));
+$body .= '<br /><br />';
+
+$event_calendar_bbb_server_url = elgg_get_plugin_setting('bbb_server_url', 'event_calendar');
+
+$body .= elgg_echo('event_calendar:bbb_server_url');
+$body .= '<br />';
+$body .= elgg_view('input/text', array(
+ 'name' => 'params[bbb_server_url]',
+ 'value' => $event_calendar_bbb_server_url,
+ 'class' => 'text_input',
+));
+
+$body .= '<br /><br />';
+
+$event_calendar_bbb_security_salt = elgg_get_plugin_setting('bbb_security_salt', 'event_calendar');
+
+$body .= elgg_echo('event_calendar:bbb_security_salt');
+$body .= '<br />';
+$body .= elgg_view('input/text', array(
+ 'name' => 'params[bbb_security_salt]',
+ 'value' => $event_calendar_bbb_security_salt,
+ 'class' => 'text_input',
+));
+
+$body .= '<br /><br />';
+
echo $body;
diff --git a/views/default/river/object/event_calendar/create.php b/views/default/river/object/event_calendar/create.php
index e74a8f891..515389411 100644
--- a/views/default/river/object/event_calendar/create.php
+++ b/views/default/river/object/event_calendar/create.php
@@ -1,22 +1,13 @@
<?php
-
- /*$performed_by = get_entity($vars['item']->subject_guid);
- $object = get_entity($vars['item']->object_guid);
-
- $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
- $string = sprintf(elgg_echo("event_calendar:river:created"),$url) . " ";
- $string .= elgg_echo("event_calendar:river:create")." <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>";*/
-
/**
- * Event calendar river view.
+ * Event river view.
*/
+elgg_load_library('elgg:event_calendar');
+
$object = $vars['item']->getObjectEntity();
-$excerpt = strip_tags($object->description);
-$vars['excerpt'] = elgg_get_excerpt($excerpt);
-echo elgg_view('page/components/image_block', array(
- 'image' => '<img src="'.$vars['url'] . 'mod/event_calendar/images/event_icon.gif" />',
- 'body' => elgg_view('river/elements/body', $vars),
- 'class' => 'elgg-river-item',
-)); \ No newline at end of file
+echo elgg_view('river/elements/layout', array(
+ 'item' => $vars['item'],
+ 'message' => event_calendar_get_formatted_time($object),
+));
diff --git a/views/default/river/object/event_calendar/update.php b/views/default/river/object/event_calendar/update.php
index f4526cd2a..515389411 100644
--- a/views/default/river/object/event_calendar/update.php
+++ b/views/default/river/object/event_calendar/update.php
@@ -1,16 +1,13 @@
<?php
+/**
+ * Event river view.
+ */
+
+elgg_load_library('elgg:event_calendar');
- /*$performed_by = get_entity($vars['item']->subject_guid);
- $object = get_entity($vars['item']->object_guid);
-
- $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
- $string = sprintf(elgg_echo("event_calendar:river:updated"),$url) . " ";
- $string .= elgg_echo("event_calendar:river:the_event")." <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>";*/
-
$object = $vars['item']->getObjectEntity();
-echo elgg_view('page/components/image_block', array(
- 'image' => '<img src="'.$vars['url'] . 'mod/event_calendar/images/event_icon.gif" />',
- 'body' => elgg_view('river/elements/body', $vars),
- 'class' => 'elgg-river-item',
+echo elgg_view('river/elements/layout', array(
+ 'item' => $vars['item'],
+ 'message' => event_calendar_get_formatted_time($object),
));
diff --git a/views/default/widgets/event_calendar/content.php b/views/default/widgets/event_calendar/content.php
index 329046cb0..eaedb76bd 100644
--- a/views/default/widgets/event_calendar/content.php
+++ b/views/default/widgets/event_calendar/content.php
@@ -20,8 +20,12 @@
$num = 5;
// Get the events
-
- $events = event_calendar_get_personal_events_for_user(elgg_get_page_owner_guid(),$num);
+ $owner = elgg_get_page_owner_entity();
+ if(elgg_instanceof($owner, 'group')) {
+ $events = event_calendar_get_events_for_group(elgg_get_page_owner_guid(),$num);
+ } else {
+ $events = event_calendar_get_personal_events_for_user(elgg_get_page_owner_guid(),$num);
+ }
// If there are any events to view, view them
if (is_array($events) && sizeof($events) > 0) {
diff --git a/views/default/widgets/event_calendar/view.php b/views/default/widgets/event_calendar/view.php
deleted file mode 100644
index 329046cb0..000000000
--- a/views/default/widgets/event_calendar/view.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-/**
- * Elgg event calendar widget
- *
- * @package event_calendar
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Kevin Jardine <kevin@radagast.biz>
- * @copyright Radagast Solutions 2008
- * @link http://radagast.biz/
- *
- */
-
- // Load event calendar model
- elgg_load_library('elgg:event_calendar');
-
- //the number of events to display
- $num = (int) $vars['entity']->num_display;
- if (!$num)
- $num = 5;
-
- // Get the events
-
- $events = event_calendar_get_personal_events_for_user(elgg_get_page_owner_guid(),$num);
-
- // If there are any events to view, view them
- if (is_array($events) && sizeof($events) > 0) {
-
- echo "<div id=\"widget_calendar\">";
-
- foreach($events as $event) {
- echo elgg_view("object/event_calendar",array('entity' => $event));
- }
-
- echo "</div>";
-
- }
-
-?> \ No newline at end of file
diff --git a/views/ical/event_calendar/show_events.php b/views/ical/event_calendar/show_events.php
index 19981596f..d357908b9 100644
--- a/views/ical/event_calendar/show_events.php
+++ b/views/ical/event_calendar/show_events.php
@@ -1,7 +1,7 @@
<?php
if ($vars['events']) {
foreach ($vars['events'] as $entity) {
- echo elgg_view_entity($entity);
+ echo elgg_view_entity($entity['event']);
}
//echo elgg_view_entity_list($vars['events'], $vars['count'], $vars['offset'], $vars['limit'], false, false);
}