aboutsummaryrefslogtreecommitdiff
path: root/views/default
diff options
context:
space:
mode:
authorKevin Jardine <kevinjardine@yahoo.com>2011-08-29 20:59:54 +0200
committerKevin Jardine <kevinjardine@yahoo.com>2011-08-29 20:59:54 +0200
commit2557245a41579a15dd960e2033f4d5f39ff566ac (patch)
tree15891d7dcef7c4d5da3ae82eb4f6ae9ad10b2521 /views/default
parent52ddfd1b76cb3e5fbb2a31eb5a3c738bb0d61b54 (diff)
downloadelgg-2557245a41579a15dd960e2033f4d5f39ff566ac.tar.gz
elgg-2557245a41579a15dd960e2033f4d5f39ff566ac.tar.bz2
first step in rewrite for Elgg 1.8
Diffstat (limited to 'views/default')
-rw-r--r--views/default/event_calendar/calendar.php19
-rw-r--r--views/default/event_calendar/css.php23
-rw-r--r--views/default/event_calendar/filter_menu.php54
-rw-r--r--views/default/event_calendar/group_module.php43
-rw-r--r--views/default/event_calendar/groupprofile_calendar.php4
-rw-r--r--views/default/event_calendar/show_events.php33
-rw-r--r--views/default/forms/event_calendar/edit.php246
-rw-r--r--views/default/input/datepicker_inline.php44
-rw-r--r--views/default/input/datepicker_popup.php1
-rw-r--r--views/default/object/event_calendar.php66
-rw-r--r--views/default/widgets/event_calendar/view.php4
11 files changed, 473 insertions, 64 deletions
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/<start_date>/<display_mode>/<filter_context>/<region>
+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 .= '<div id="calendarmenucontainer">';
$body .= '<ul id="calendarmenu">';
if ($mode == 'day') {
@@ -42,19 +51,19 @@ if ($mode == 'day') {
} else {
$link_class = '';
}
-$body .= '<li'.$link_class.'><a href="'.$link_bit.'day">'.elgg_echo('event_calendar:day_label').'</a></li>';
+$body .= '<li'.$link_class.'><a href="'.sprintf($link_bit,'day').'">'.elgg_echo('event_calendar:day_label').'</a></li>';
if ($mode == 'week') {
$link_class = ' class="sys_selected"';
} else {
$link_class = '';
}
-$body .= '<li'.$link_class.'><a href="'.$link_bit.'week">'.elgg_echo('event_calendar:week_label').'</a></li>';
+$body .= '<li'.$link_class.'><a href="'.sprintf($link_bit,'week').'">'.elgg_echo('event_calendar:week_label').'</a></li>';
if ($mode == 'month') {
$link_class = ' class="sys_selected sys_calmenu_last"';
} else {
$link_class = ' class="sys_calmenu_last"';
}
-$body .= '<li'.$link_class.'><a href="'.$link_bit.'month">'.elgg_echo('event_calendar:month_label').'</a></li>';
+$body .= '<li'.$link_class.'><a href="'.sprintf($link_bit,'month').'">'.elgg_echo('event_calendar:month_label').'</a></li>';
$body .= '</ul>';
$body .= '</div>';
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: <?php echo $highlight_colour; ?>;
+}
+
.river_object_event_calendar_create {
background: url(<?php echo $vars['url']; ?>mod/event_calendar/images/river_icon_event.gif) no-repeat left -1px;
}
@@ -59,7 +56,7 @@ td.ui-datepicker-unselectable {
background: url(<?php echo $vars['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 @@
+<?php
+// generate a list of filter tabs
+$group_guid = $vars['group_guid'];
+$filter_context = $vars['filter'];
+if ($group_guid) {
+ $url_start = "event_calendar/group/{$group_guid}/{$vars['start_date']}/{$vars['mode']}";
+} else {
+ $url_start = "event_calendar/list/{$vars['start_date']}/{$vars['mode']}";
+}
+
+$tabs = array(
+ 'all' => 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 @@
+<?php
+/**
+ * Group event calendar module
+ */
+
+$group = elgg_get_page_owner_entity();
+
+if ($group->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 = '<p>' . elgg_echo('event_calendar:no_events_found') . '</p>';
+}
+
+$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 = '';
- }
?>
-<table width="100%">
-<tr><td>
-<div id="event_list">
+<div style="width:100%">
+<div id="event_list" style="float:left;">
<?php
-echo $nav.'<br />'.$event_list;
+echo $event_list;
?>
</div>
-</td>
-<td align="right">
+<div style="float:right;">
<?php
echo elgg_view('event_calendar/calendar',$vars);
?>
-</td></tr>
-</table>
+</div>
+</div>
<?php
}
-?> \ 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 @@
+<?php
+$event = $vars['event'];
+$fd = $vars['form_data'];
+
+$event_calendar_times = elgg_get_plugin_setting('times', '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');
+
+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;
+ // 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 .= '<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 .= '<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>';
+
+if ($event_calendar_times == 'yes') {
+ $body .= '<p><label>'.elgg_echo("event_calendar:start_time_label").'</label><br />';
+ $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("input/date",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 == 'yes') {
+ $body .= '<p><label>'.elgg_echo("event_calendar:end_time_label").'</label><br />';
+ $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("input/date",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') {
+ $body .= '<p><label>'.elgg_echo("event_calendar:spots_label").'<br />';
+ $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>';
+}
+
+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 .= '<p><label>'.elgg_echo("event_calendar:brief_description_label").'<br />';
+$body .= elgg_view("input/text",array('name' => 'description','value'=>$brief_description));
+$body .= '</label></p>';
+$body .= '<p class="description">'.$prefix['brief_description'].elgg_echo('event_calendar:brief_description_description').'</p>';
+
+if ($event_calendar_region_display == 'yes') {
+ $region_list = trim(elgg_get_plugin_setting('region_list', 'event_calendar'));
+ $region_list_handles = elgg_get_plugin_setting('region_list_handles', 'event_calendar');
+ // make sure that we are using Unix line endings
+ $region_list = str_replace("\r\n","\n",$region_list);
+ $region_list = str_replace("\r","\n",$region_list);
+ if ($region_list) {
+ $options = array();
+ $options[] = '-';
+ foreach(explode("\n",$region_list) as $region_item) {
+ $region_item = trim($region_item);
+ if ($region_list_handles == 'yes') {
+ $options[$region_item] = elgg_echo('event_calendar:region:'.$region_item);
+ } else {
+ $options[$region_item] = $region_item;
+ }
+ }
+ $body .= '<p><label>'.elgg_echo("event_calendar:region_label").'<br />';
+ $body .= elgg_view("input/pulldown",array('name' => 'region','value'=>$region,'options_values'=>$options));
+ $body .= '</label></p>';
+ $body .= '<p class="description">'.$prefix['region'].elgg_echo('event_calendar:region_description').'</p>';
+ }
+}
+
+if ($event_calendar_type_display == 'yes') {
+ $type_list = trim(elgg_get_plugin_setting('type_list', 'event_calendar'));
+ $type_list_handles = elgg_get_plugin_setting('type_list_handles', 'event_calendar');
+ // make sure that we are using Unix line endings
+ $type_list = str_replace("\r\n","\n",$type_list);
+ $type_list = str_replace("\r","\n",$type_list);
+ if ($type_list) {
+ $options = array();
+ $options[] = '-';
+ foreach(explode("\n",$type_list) as $type_item) {
+ $type_item = trim($type_item);
+ if ($type_list_handles == 'yes') {
+ $options[$type_item] = elgg_echo('event_calendar:type:'.$type_item);
+ } else {
+ $options[$type_item] = $type_item;
+ }
+ }
+ $body .= '<p><label>'.elgg_echo("event_calendar:type_label").'<br />';
+ $body .= elgg_view("input/pulldown",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>';
+
+$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));
+ }
+} else {
+ $body .= '<p><label>'.elgg_echo("access").'<br />';
+ $body .= elgg_view("input/access",array('name' => 'access_id','value'=>$access));
+ $body .= '</label></p>';
+}
+
+$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 <kevin@radagast.biz>
- * @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
?>
<script language="javascript">
+var selectedWeek = "<?php echo $selected_week; ?>";
+highlightWeek = function(d) {
+ if (!selectedWeek) { return [true,''];}
+ //var date = $(this).datepicker('getDate');
+ var dayOfWeek = d.getUTCDay();
+ var weekNumber = $.datepicker.iso8601Week(d);
+ if (dayOfWeek == 6) {
+ weekNumber += 1;
+ }
+
+ if (selectedWeek == weekNumber) {
+ return [true,'week-highlight'];
+ }
+ return [true,''];
+}
$(document).ready(function(){
var done_loading = false;
-$("#<?php echo $vars['internalname']; ?>").datepicker({
+$("#<?php echo $vars['name']; ?>").datepicker({
onChangeMonthYear: function(year, month, inst) {
if(inst.onChangeToday){
day=inst.selectedDay;
@@ -24,19 +51,17 @@ $("#<?php echo $vars['internalname']; ?>").datepicker({
}
if (done_loading) {
// in this case the mode is forced to month
- document.location.href = "<?php echo $vars['url'].'mod/event_calendar/show_events.php?mode=month&group_guid='.$vars['group_guid'].'&start_date='; ?>" + year+'-'+month+'-1';
+ document.location.href = "<?php echo $link_bit; ?>".replace('%s', year+'-'+month+'-1');
}
},
onSelect: function(date) {
// jump to the new page
- document.location.href = "<?php echo $vars['url'].'mod/event_calendar/show_events.php?mode='.$vars['mode'].'&group_guid='.$vars['group_guid'].'&start_date='; ?>" + date.substring(0,10);
+ document.location.href = "<?php echo $link_bit; ?>".replace('%s', date.substring(0,10));
},
dateFormat: "yy-mm-dd",
<?php echo $vars['range_bit']; ?>
- hideIfNoPrevNext: true,
defaultDate: "<?php echo $vars['start_date'] .' - '.$vars['end_date']; ?>",
- <?php if ($vars['mode'] == 'week') echo 'highlightWeek: true,'; ?>
- rangeSelect: true
+ beforeShowDay: highlightWeek
});
var start_date = $.datepicker.parseDate("yy-mm-dd", "<?php echo $vars['start_date']; ?>");
var end_date = $.datepicker.parseDate("yy-mm-dd", "<?php echo $vars['end_date']; ?>");
@@ -44,9 +69,10 @@ var end_date = $.datepicker.parseDate("yy-mm-dd", "<?php echo $vars['end_date'];
if ("<?php echo $vars['mode'] ?>" == "month") {
end_date += 1;
}
-$("#<?php echo $vars['internalname']; ?>").datepicker("setDate", start_date, end_date);
+$("#<?php echo $vars['name']; ?>").datepicker("setDate", start_date, end_date);
var done_loading = true;
});
+
</script>
-<div id="<?php echo $vars['internalname']; ?>" ></div>
+<div style="position:relative;" id="<?php echo $vars['name']; ?>" ></div>
<p style="clear: both;"><!-- See day-by-day example for highlighting days code --></p> \ 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 .= '<div class="contentWrapper" >';
+ $body .= '<br />';
foreach($event_items as $item) {
$value = $item->value;
@@ -28,39 +27,70 @@ if ($vars['full']) {
$body .= "<p class=\"{$even_odd}\"><b>";
$body .= $item->title.':</b> ';
$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 '<p>'.$event->long_description.'</p>';
} else {
echo '<p>'.$event->description.'</p>';
}
- echo '</div>';
- 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 .= '<p><b><a href="'.$event->getUrl().'">'.$event->title.'</a></b>';
- $info .= '<br />'.$time_bit;
+ $icon = '<img src="'.elgg_view("icon/object/event_calendar/small").'" />';
+ $extras = array($time_bit);
if ($event->description) {
- $info .= '<br /><br />'.$event->description;
+ $extras[] = $event->description;
}
- if ($event_calendar_venue_view = get_plugin_setting('venue_view', 'event_calendar') == 'yes') {
- $info .= '<br />'.$event->venue;
+ if ($event_calendar_venue_view = elgg_get_plugin_setting('venue_view', 'event_calendar') == 'yes') {
+ $extras[] = $event->venue;
}
- $info .= '</p>';
+ if ($extras) {
+ $info = "<p>".implode("<br />",$extras)."</p>";
+ } 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) {