aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
Diffstat (limited to 'views')
-rw-r--r--views/default/event_calendar/css.php11
-rw-r--r--views/default/event_calendar/full_calendar_view.php22
-rw-r--r--views/default/forms/event_calendar/edit.php41
-rw-r--r--views/default/input/timepicker.php61
-rw-r--r--views/default/input/timepicker_old.php38
-rw-r--r--views/default/plugins/event_calendar/settings.php13
6 files changed, 136 insertions, 50 deletions
diff --git a/views/default/event_calendar/css.php b/views/default/event_calendar/css.php
index 469f72de8..a2437e065 100644
--- a/views/default/event_calendar/css.php
+++ b/views/default/event_calendar/css.php
@@ -164,4 +164,15 @@ li.event-calendar-filter-menu-show-only {
padding-top:.4em;
background:#fff;
margin:0 -.3em 0 1.5em;
+}
+
+.event-calendar-compressed-date {
+ width: 150px !important;
+ margin-right: 10px;
+}
+
+.event-calendar-date-time-setter label {
+ float: left;
+ width: 50px;
+ margin-top: 5px;
} \ 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 d4e85724e..58aefe741 100644
--- a/views/default/event_calendar/full_calendar_view.php
+++ b/views/default/event_calendar/full_calendar_view.php
@@ -9,7 +9,9 @@ $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,
);
@@ -28,13 +30,14 @@ $json_events_string = json_encode($event_array);
?>
<script>
-handleEventDrop = function(event,dayDelta,minuteDelta,allDay,revertFunc) {
+handleEventClick = function(event) {
+ if (event.url) {
+ window.location.href = event.url;
+ return false;
+ }
+};
- alert(
- event.title + "(" + event.guid + ") was moved " +
- dayDelta + " days and " +
- minuteDelta + " minutes."
- );
+handleEventDrop = function(event,dayDelta,minuteDelta,allDay,revertFunc) {
if (!confirm("Are you sure about this change?")) {
revertFunc();
@@ -53,7 +56,8 @@ handleEventDrop = function(event,dayDelta,minuteDelta,allDay,revertFunc) {
}
);
}
-}
+};
+
$(document).ready(function() {
var events = <?php echo $json_events_string; ?>;
var cal_events = [];
@@ -61,6 +65,7 @@ $(document).ready(function() {
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
@@ -74,8 +79,9 @@ $(document).ready(function() {
right: 'month,agendaWeek,agendaDay'
},
editable: true,
- slotMinutes: 5,
+ slotMinutes: 15,
eventDrop: handleEventDrop,
+ eventClick: handleEventClick,
events: cal_events
});
});
diff --git a/views/default/forms/event_calendar/edit.php b/views/default/forms/event_calendar/edit.php
index 7613a79f1..3526627a7 100644
--- a/views/default/forms/event_calendar/edit.php
+++ b/views/default/forms/event_calendar/edit.php
@@ -128,29 +128,32 @@ $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 .= '<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));
- $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("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') {
- if ($event_calendar_times != 'no') {
- $body .= '<p><label>'.elgg_echo("event_calendar:end_time_label").'</label><br />';
+ 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>';
- $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("event_calendar/input/date_local",array('timestamp'=>TRUE,'autocomplete'=>'off','name' => 'end_date','value'=>$end_date));
+ $body .= '</p>';
+ $body .= '</div>';
+} else {
+
+ $body .= '<p><label>'.elgg_echo("event_calendar:start_date_label").'<br />';
+ $body .= elgg_view("event_calendar/input/date_local",array('timestamp'=>TRUE, 'autocomplete'=>'off','name' => 'start_date','value'=>$start_date));
$body .= '</label></p>';
- $body .= '<p class="description">'.$prefix['end_date'].elgg_echo('event_calendar:end_date_description').'</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>';
+ }
}
if ($event_calendar_spots_display == 'yes') {
diff --git a/views/default/input/timepicker.php b/views/default/input/timepicker.php
index faadd6450..d7df04699 100644
--- a/views/default/input/timepicker.php
+++ b/views/default/input/timepicker.php
@@ -2,37 +2,52 @@
$time_format = elgg_get_plugin_setting('timeformat', 'event_calendar');
if (!$time_format) {
- $time_format = 24;
+ $time_format = '24';
}
$value = $vars['value'];
if (is_numeric($value)) {
$hour = floor($value/60);
- $minute = ($value -60*$hour);
-
- // add 1 to avoid pulldown 0 bug
- $hour++;
- $minute++;
+ $minute = ($value -60*$hour);
+ $time = $hour*60+$minute;
} else {
- $hour = '-';
- $minute = '-';
+ $time = '-';
}
-$hours = array();
-$hours['-'] = '-';
-
-for($i=0;$i<$time_format;$i++) {
- $hours[$i+1] = $i;
-}
-
-$minutes = array();
-$minutes['-'] = '-';
-
-for($i=0;$i<60;$i=$i+5) {
- $minutes[$i+1] = sprintf("%02d",$i);
+$dates = array();
+$dates['-'] = '-';
+
+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";
+ }
+ }
+ }
+ 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";
+ }
+ }
+} 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";
+ }
+ }
}
-echo elgg_view('input/dropdown',array('name'=>$vars['name'].'_h','value'=>$hour,'options_values'=>$hours));
-echo elgg_view('input/dropdown',array('name'=>$vars['name'].'_m','value'=>$minute,'options_values'=>$minutes));
+echo elgg_view('input/dropdown',array('name'=>$vars['name'],'value'=>$time,'options_values'=>$dates));
-?> \ No newline at end of file
diff --git a/views/default/input/timepicker_old.php b/views/default/input/timepicker_old.php
new file mode 100644
index 000000000..1d2156cda
--- /dev/null
+++ b/views/default/input/timepicker_old.php
@@ -0,0 +1,38 @@
+<?php
+
+$time_format = elgg_get_plugin_setting('timeformat', 'event_calendar');
+if (!$time_format) {
+ $time_format = 24;
+}
+
+$value = $vars['value'];
+if (is_numeric($value)) {
+ $hour = floor($value/60);
+ $minute = ($value -60*$hour);
+
+ // add 1 to avoid pulldown 0 bug
+ $hour++;
+ $minute++;
+} else {
+ $hour = '-';
+ $minute = '-';
+}
+
+$hours = array();
+$hours['-'] = '-';
+
+for($i=0;$i<$time_format;$i++) {
+ $hours[$i+1] = $i;
+}
+
+$minutes = array();
+$minutes['-'] = '-';
+
+for($i=0;$i<60;$i=$i+15) {
+ $minutes[$i+1] = sprintf("%02d",$i);
+}
+
+echo elgg_view('input/dropdown',array('name'=>$vars['name'].'_h','value'=>$hour,'options_values'=>$hours));
+echo elgg_view('input/dropdown',array('name'=>$vars['name'].'_m','value'=>$minute,'options_values'=>$minutes));
+
+?> \ No newline at end of file
diff --git a/views/default/plugins/event_calendar/settings.php b/views/default/plugins/event_calendar/settings.php
index 42ac601e5..93724484c 100644
--- a/views/default/plugins/event_calendar/settings.php
+++ b/views/default/plugins/event_calendar/settings.php
@@ -3,6 +3,8 @@ $yn_options = array(elgg_echo('event_calendar:settings:yes')=>'yes',
elgg_echo('event_calendar:settings:no')=>'no',
);
+$time_format_options = array(elgg_echo('event_calendar:time_format:12hour')=>'12',elgg_echo('event_calendar:time_format:24hour')=>'24');
+
$membership_options = array(
elgg_echo('event_calendar:personal_manage:open') => 'open' ,
elgg_echo('event_calendar:personal_manage:closed') => 'closed',
@@ -88,6 +90,17 @@ $body .= elgg_view('input/radio',array('name'=>'params[times]','value'=>$event_c
$body .= '<br />';
+$event_calendar_time_format = elgg_get_plugin_setting('timeformat', 'event_calendar');
+if (!$event_calendar_time_format) {
+ $event_calendar_time_format = '24';
+}
+
+$body .= elgg_echo('event_calendar:settings:timeformat:title');
+$body .= '<br />';
+$body .= elgg_view('input/radio',array('name'=>'params[timeformat]','value'=>$event_calendar_time_format,'options'=>$time_format_options));
+
+$body .= '<br />';
+
$event_calendar_autopersonal = elgg_get_plugin_setting('autopersonal', 'event_calendar');
if (!$event_calendar_autopersonal) {
$event_calendar_autopersonal = 'yes';