From 2557245a41579a15dd960e2033f4d5f39ff566ac Mon Sep 17 00:00:00 2001 From: Kevin Jardine Date: Mon, 29 Aug 2011 20:59:54 +0200 Subject: first step in rewrite for Elgg 1.8 --- views/default/event_calendar/calendar.php | 19 +- views/default/event_calendar/css.php | 23 +- views/default/event_calendar/filter_menu.php | 54 +++++ views/default/event_calendar/group_module.php | 43 ++++ .../event_calendar/groupprofile_calendar.php | 4 +- views/default/event_calendar/show_events.php | 33 +-- views/default/forms/event_calendar/edit.php | 246 +++++++++++++++++++++ views/default/input/datepicker_inline.php | 44 +++- views/default/input/datepicker_popup.php | 1 + views/default/object/event_calendar.php | 66 ++++-- views/default/widgets/event_calendar/view.php | 4 +- 11 files changed, 473 insertions(+), 64 deletions(-) create mode 100644 views/default/event_calendar/filter_menu.php create mode 100644 views/default/event_calendar/group_module.php create mode 100644 views/default/forms/event_calendar/edit.php (limited to 'views') diff --git a/views/default/event_calendar/calendar.php b/views/default/event_calendar/calendar.php index ebf4aa589..ea12ff603 100644 --- a/views/default/event_calendar/calendar.php +++ b/views/default/event_calendar/calendar.php @@ -4,7 +4,15 @@ if ($vars['mode']) { } else { $mode = 'month'; } -$link_bit = $vars['url'].'mod/event_calendar/show_events.php?start_date='.$vars['original_start_date'].'&group_guid='.$vars['group_guid'].'&filter='.$vars['filter'].'&mode='; + +# event_calendar/list//// +if ($vars['group_guid']) { + $link_bit = $vars['url']."event_calendar/group/{$vars['group_guid']}/{$vars['original_start_date']}/%s"; +} else { + $link_bit = $vars['url']."event_calendar/list/{$vars['original_start_date']}/%s/{$vars['filter']}"; +} + +#$link_bit = "event_calendar/show_events.php?start_date='.$vars['original_start_date'].'&group_guid='.$vars['group_guid'].'&filter='.$vars['filter'].'&mode='; $range_bit = ''; $first_date = $vars['first_date']; @@ -27,7 +35,7 @@ if ($first_date || $last_date) { $body .= elgg_view("input/datepicker_inline", array( - 'internalname' => 'my_datepicker', + 'name' => 'my_datepicker', 'mode' => $vars['mode']?$vars['mode']:'month', 'start_date' => $vars['start_date'], 'end_date' => $vars['end_date'], @@ -35,6 +43,7 @@ $body .= elgg_view("input/datepicker_inline", 'range_bit' => $range_bit, ) ); + $body .= '
'; $body .= ''; $body .= '
'; echo $body; diff --git a/views/default/event_calendar/css.php b/views/default/event_calendar/css.php index 359fd1e13..7e399c547 100644 --- a/views/default/event_calendar/css.php +++ b/views/default/event_calendar/css.php @@ -6,18 +6,9 @@ $background_colour = '#F5F5F5'; $highlight_colour = '#3874B7'; ?> -/* hide Today as it is not working as expected */ -.ui-datepicker-current { visibility:hidden } - -div#calendarmenucontainer { - position: relative; -} - -ul#calendarmenu { - list-style: none; - position: absolute; - top: 0px; - left: -15px; +#calendarmenucontainer { + position:relative; + left: 40px; } ul#calendarmenu li { @@ -52,6 +43,12 @@ td.ui-datepicker-unselectable { color: #888888 !important; } +#my_datepicker .week-highlight a { + text-decoration: none; + color: #FFFFFF; + background: ; +} + .river_object_event_calendar_create { background: url(mod/event_calendar/images/river_icon_event.gif) no-repeat left -1px; } @@ -59,7 +56,7 @@ td.ui-datepicker-unselectable { background: url(mod/event_calendar/images/river_icon_event.gif) no-repeat left -1px; } #event_list { - width:440px; + width:510px; margin:0; float:left; padding:5px 0 0 0; diff --git a/views/default/event_calendar/filter_menu.php b/views/default/event_calendar/filter_menu.php new file mode 100644 index 000000000..62d38939b --- /dev/null +++ b/views/default/event_calendar/filter_menu.php @@ -0,0 +1,54 @@ + array( + 'text' => elgg_echo('all'), + 'href' => "$url_start/all", + 'selected' => ($filter_context == 'all'), + 'priority' => 200, + ), + 'mine' => array( + 'text' => elgg_echo('mine'), + 'href' => "$url_start/mine", + 'selected' => ($filter_context == 'mine'), + 'priority' => 300, + ), + 'friend' => array( + 'text' => elgg_echo('friends'), + 'href' => "$url_start/friends", + 'selected' => ($filter_context == 'friends'), + 'priority' => 400, + ), +); + +$event_calendar_spots_display = elgg_get_plugin_setting('spots_display', 'event_calendar'); +if ($event_calendar_spots_display == "yes") { + $tabs['open'] = array( + 'text' => elgg_echo('event_calendar:open'), + 'href' => "$url_start/open", + 'selected' => ($filter_context == 'open'), + 'priority' => 100, + ); +} + +foreach ($tabs as $name => $tab) { + $tab['name'] = $name; + + elgg_register_menu_item('filter', $tab); +} + +echo elgg_view_menu('filter', array('sort_by' => 'priority', 'class' => 'elgg-menu-hz')); + +$event_calendar_region_display = elgg_get_plugin_setting('region_display', 'event_calendar'); +if ($event_calendar_region_display == 'yes') { + $url_start .= "/$filter_context"; + echo elgg_view('event_calendar/region_select',array('url_start'=>$url_start,'region'=>$vars['region'])); +} \ No newline at end of file diff --git a/views/default/event_calendar/group_module.php b/views/default/event_calendar/group_module.php new file mode 100644 index 000000000..5fc644e8b --- /dev/null +++ b/views/default/event_calendar/group_module.php @@ -0,0 +1,43 @@ +event_calendar_enable == "no") { + return true; +} + +$all_link = elgg_view('output/url', array( + 'href' => "event_calendar/group/$group->guid/all", + 'text' => elgg_echo('link:view:all'), +)); + +elgg_push_context('widgets'); +$options = array( + 'type' => 'object', + 'subtype' => 'event_calendar', + 'container_guid' => elgg_get_page_owner_guid(), + 'limit' => 6, + 'full_view' => false, + 'pagination' => false, +); +$content = elgg_list_entities($options); +elgg_pop_context(); + +if (!$content) { + $content = '

' . elgg_echo('event_calendar:no_events_found') . '

'; +} + +$new_link = elgg_view('output/url', array( + 'href' => "event_calendar/add/$group->guid", + 'text' => elgg_echo('event_calendar:new'), +)); + +echo elgg_view('groups/profile/module', array( + 'title' => elgg_echo('event_calendar:group'), + 'content' => $content, + 'all_link' => $all_link, + 'add_link' => $new_link, +)); diff --git a/views/default/event_calendar/groupprofile_calendar.php b/views/default/event_calendar/groupprofile_calendar.php index 175098e0c..826fafa67 100644 --- a/views/default/event_calendar/groupprofile_calendar.php +++ b/views/default/event_calendar/groupprofile_calendar.php @@ -11,7 +11,9 @@ * */ -$page_owner_entity = page_owner_entity(); +elgg_load_library('elgg:event_calendar'); + +$page_owner_entity = elgg_get_page_owner_entity(); if (event_calendar_activated_for_group($page_owner_entity)) { $num = 5; diff --git a/views/default/event_calendar/show_events.php b/views/default/event_calendar/show_events.php index 31771f43d..580fb5a45 100644 --- a/views/default/event_calendar/show_events.php +++ b/views/default/event_calendar/show_events.php @@ -13,13 +13,22 @@ $listing_format = $vars['listing_format']; if ($vars['events']) { - if (get_plugin_setting('agenda_view', 'event_calendar') == 'yes') { + if (elgg_get_plugin_setting('agenda_view', 'event_calendar') == 'yes') { $event_list = elgg_view('event_calendar/agenda_view',$vars); } else { if ($listing_format == 'paged') { $event_list = elgg_view('event_calendar/paged_view',$vars); } else { - $event_list = elgg_view_entity_list($vars['events'], $vars['count'], $vars['offset'], $vars['limit'], false, false); + $options = array( + 'list_class' => 'elgg-list-entity', + 'full_view' => FALSE, + 'pagination' => TRUE, + 'list_type' => 'listing', + 'list_type_toggle' => FALSE, + 'offset' => $vars['offset'], + 'limit' => $vars['limit'], + ); + $event_list = elgg_view_entity_list($vars['events'], $options); } } } else { @@ -28,26 +37,18 @@ if ($vars['events']) { if ($listing_format == 'paged') { echo $event_list; } else { - if (isloggedin()) { - $nav = elgg_view('event_calendar/nav',$vars); - } else { - $nav = ''; - } ?> - - - -
-
+
+
'.$event_list; +echo $event_list; ?>
-
+
-
+ + \ No newline at end of file diff --git a/views/default/forms/event_calendar/edit.php b/views/default/forms/event_calendar/edit.php new file mode 100644 index 000000000..25062e2df --- /dev/null +++ b/views/default/forms/event_calendar/edit.php @@ -0,0 +1,246 @@ +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 == 'yes') { + $start_time = $event->start_time; + $end_time = $event->end_time; + } + $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 == 'yes') { + $start_time = $fd['start_time']; + $end_time = $fd['end_time']; + } + $event_action = 'add_event'; + $event_guid = 0; +} +$body = ''; + +$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 .= '

'; +$body .= '

'.$prefix['title'].elgg_echo('event_calendar:title_description').'

'; + +$body .= '

'; +$body .= '

'.$prefix['venue'].elgg_echo('event_calendar:venue_description').'

'; + +if ($event_calendar_times == 'yes') { + $body .= '


'; + $body .= elgg_view("input/timepicker",array('name' => 'start_time','value'=>$start_time)); + $body .= '

'; + $body .= '

'.$prefix['start_time'].elgg_echo('event_calendar:start_time_description').'

'; +} + +$body .= '

'; +$body .= '

'.$prefix['start_date'].elgg_echo('event_calendar:start_date_description').'

'; + +if ($event_calendar_hide_end != 'yes') { + if ($event_calendar_times == 'yes') { + $body .= '


'; + $body .= elgg_view("input/timepicker",array('name' => 'end_time','value'=>$end_time)); + $body .= '

'; + $body .= '

'.$prefix['end_time'].elgg_echo('event_calendar:end_time_description').'

'; + } + + $body .= '

'; + $body .= '

'.$prefix['end_date'].elgg_echo('event_calendar:end_date_description').'

'; +} + +if ($event_calendar_spots_display == 'yes') { + $body .= '

'; + $body .= '

'.$prefix['spots'].elgg_echo('event_calendar:spots_description').'

'; +} + +if ($event_calendar_add_users == 'yes') { + $body .= '



'; + $body .= '

'.elgg_echo('event_calendar:add_user_description').'

'; +} + +$body .= '

'; +$body .= '

'.$prefix['brief_description'].elgg_echo('event_calendar:brief_description_description').'

'; + +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 .= '

'; + $body .= '

'.$prefix['region'].elgg_echo('event_calendar:region_description').'

'; + } +} + +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 .= '

'; + $body .= '

'.$prefix['event_type'].elgg_echo('event_calendar:type_description').'

'; + } +} + +$body .= '

'; +$body .= '

'.$prefix['fees'].elgg_echo('event_calendar:fees_description').'

'; + +$body .= '

'; +$body .= '

'.$prefix['contact'].elgg_echo('event_calendar:contact_description').'

'; + +$body .= '

'; +$body .= '

'.$prefix['organiser'].elgg_echo('event_calendar:organiser_description').'

'; + +$body .= '

'; +$body .= '

'.$prefix['event_tags'].elgg_echo('event_calendar:event_tags_description').'

'; + +$body .= '

'; +$body .= '

'.$prefix['long_description'].elgg_echo('event_calendar:long_description_description').'

'; + +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)); + } +} else { + $body .= '

'; +} + +$body .= elgg_view('input/submit', array('name'=>'submit','value'=>elgg_echo('event_calendar:submit'))); + +echo $body; diff --git a/views/default/input/datepicker_inline.php b/views/default/input/datepicker_inline.php index 560074a2d..69520b9ef 100644 --- a/views/default/input/datepicker_inline.php +++ b/views/default/input/datepicker_inline.php @@ -6,16 +6,43 @@ * @package event_calendar * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Kevin Jardine - * @copyright Radagast Solutions 2008 + * @copyright Radagast Solutions 2008 -2011 * @link http://radagast.biz/ * */ +if ($vars['group_guid']) { + $link_bit = $vars['url']."event_calendar/group/{$vars['group_guid']}/%s/{$vars['mode']}"; +} else { + $link_bit = $vars['url']."event_calendar/list/%s/{$vars['mode']}/{$vars['filter']}"; +} + +if ($vars['mode'] == 'week') { + $selected_week = date('W',strtotime($vars['start_date']))+1; +} else { + $selected_week = ''; +} +// TODO - figure out how to move this JavaScript ?> -
+

\ No newline at end of file diff --git a/views/default/input/datepicker_popup.php b/views/default/input/datepicker_popup.php index 8e1120ce7..5ed431e71 100644 --- a/views/default/input/datepicker_popup.php +++ b/views/default/input/datepicker_popup.php @@ -10,6 +10,7 @@ * @link http://radagast.biz/ * */ + if ($vars['dateformat']) { $date_format = $vars['dateformat']; } else { diff --git a/views/default/object/event_calendar.php b/views/default/object/event_calendar.php index 70560bd2d..97829e7c2 100644 --- a/views/default/object/event_calendar.php +++ b/views/default/object/event_calendar.php @@ -13,11 +13,10 @@ $event = $vars['entity']; - if ($vars['full']) { $body = elgg_view('event_calendar/strapline',$vars); $event_items = event_calendar_get_formatted_full_items($event); - $body .= '
'; + $body .= '
'; foreach($event_items as $item) { $value = $item->value; @@ -28,39 +27,70 @@ if ($vars['full']) { $body .= "

"; $body .= $item->title.': '; $body .= $item->value; - } } + $metadata = elgg_view_menu('entity', array( + 'entity' => $event, + 'handler' => 'event_calendar', + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', + )); + + $tags = elgg_view('output/tags', array('tags' => $event->event_tags)); + + $params = array( + 'entity' => $event, + 'metadata' => $metadata, + 'tags' => $tags, + 'title' => false, + ); + $list_body = elgg_view('object/elements/summary', $params); + echo $list_body; echo $body; if ($event->long_description) { echo '

'.$event->long_description.'

'; } else { echo '

'.$event->description.'

'; } - echo '
'; - if (get_plugin_setting('add_to_group_calendar', 'event_calendar') == 'yes') { + 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); - $icon = elgg_view( - "graphics/icon", array( - 'entity' => $vars['entity'], - 'size' => 'small', - ) - ); - $info .= '

'.$event->title.''; - $info .= '
'.$time_bit; + $icon = ''; + $extras = array($time_bit); if ($event->description) { - $info .= '

'.$event->description; + $extras[] = $event->description; } - if ($event_calendar_venue_view = get_plugin_setting('venue_view', 'event_calendar') == 'yes') { - $info .= '
'.$event->venue; + if ($event_calendar_venue_view = elgg_get_plugin_setting('venue_view', 'event_calendar') == 'yes') { + $extras[] = $event->venue; } - $info .= '

'; + if ($extras) { + $info = "

".implode("
",$extras)."

"; + } else { + $info = ''; + } + + $metadata = elgg_view_menu('entity', array( + 'entity' => $event, + 'handler' => 'event_calendar', + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', + )); + + $tags = elgg_view('output/tags', array('tags' => $event->event_tags)); + + $params = array( + 'entity' => $event, + 'metadata' => $metadata, + 'subtitle' => $info, + 'tags' => $tags, + ); + $list_body = elgg_view('object/elements/summary', $params); - echo elgg_view_listing($icon, $info); + echo elgg_view_image_block($icon, $list_body); } ?> \ No newline at end of file diff --git a/views/default/widgets/event_calendar/view.php b/views/default/widgets/event_calendar/view.php index 12fff6d60..329046cb0 100644 --- a/views/default/widgets/event_calendar/view.php +++ b/views/default/widgets/event_calendar/view.php @@ -12,7 +12,7 @@ */ // Load event calendar model - require_once(dirname(dirname(dirname(dirname(dirname(__FILE__)))))."/models/model.php"); + elgg_load_library('elgg:event_calendar'); //the number of events to display $num = (int) $vars['entity']->num_display; @@ -21,7 +21,7 @@ // Get the events - $events = event_calendar_get_personal_events_for_user(page_owner(),$num); + $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) { -- cgit v1.2.3