Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: Events Display
Zeeke75
Member

Posts: 11
Registered: 12/15/2005
Location: Rochester, MN
Member Is Offline
posted on 2/4/2006 at 08:46 PM Reply With Quote
Events Display


Ok, it doesn't seem like this program is being supported very much judging by the lack of responses from the moderators, but I'm going to try asking for help anyway.

I'm currently evaluating how well the calendar will work for my website (and willing to purchase it if it fits). I've found a couple of bugs (minor) and some things that either aren't documented or are incorrectly documented. At some point I'll report them officially but right now I'm just trying to see the full scope of functionality.

I love the ability to display all of the events for a particular day, but I also want to be able to display all events for an entire month and the entire year but I can't seem to find any option for being able to get it working.

I've been able to display an entire month in a large format (like the one used in the Control Panel), but that's not quite what I'm looking for. I want an actual list of events, not a calendar grid.

Is this possible or am I asking too much from the current program?
View User's Profile View All Posts By User U2U Member
cweaver
Junior Member

Posts: 3
Registered: 2/13/2006
Member Is Offline
posted on 2/13/2006 at 09:14 AM Reply With Quote

Nothing there yet, shouldn't be too hard to change it to do whatever you want though, take a look at show_event and show_month in calendar.php.
Just need to loop through the month like show_month does and display it like show_event does.

Even better while you are at it, do a RSS feed style output for the events... (I'll get around to this if I stick with this program)

Here is what I have so far fr show_event_week that you can add into calendar.php:
/*
function show_event_week
input parameters:
none
used parameters:
$a_selected_date, $a_template, $s_calendar_index
used methods:
events_class->read_items, read_file
action:
make and return to the browser formatted event list
*/
function show_event_week() {
$head = $this->read_file('header');
$head = str_replace('$date', date ('d M, Y',mktime(0,0,0,$this->a_selected_date['m'],$this->a_selected_date['d'],$this->a_selected_date['y'])), $head);
echo $head;
$cw = date('W',mktime(0, 0, 0, $this->a_selected_date['m'], $this->a_selected_date['d'], $this->a_selected_date['y']))+1;
$dwf = date('w',mktime(0, 0, 0, 1, 1, $this->a_selected_date['y']));
if($this->a_template['is_american'] != 1) $dwf or $dwf = 7;
$cd = ($cw-1)*7 - $dwf + 1 + !$this->a_template['is_american'];
$c = 0;
for($i = $cd;$i < $cd+7;$i++){
$dates[$c]['d'] = date('d',mktime(0, 0, 0, 1, $i, $this->a_selected_date['y']));
$m = date('m',mktime(0, 0, 0, 1, $i, $this->a_selected_date['y']));
$items[$c] = $this->events_class->read_items($dates[$c++]['d'], $m, $this->a_selected_date['y']);
$items = $this->events_class->read_items($this->a_selected_date['d'], $this->a_selected_date['m'], $this->a_selected_date['y']);
if(is_array($items)){
uasort($items,array('calendar','sort_by_time_start'));
foreach($items as $k => $v) {
if($v->title){
if($v->is_time){
if($this->a_template['time_format'])
$time = ($v->time_start['h']>11?($v->time_start['h']-12).':'.$v->time_start['m']." pm":$v->time_start['h'].':'.$v->time_start['m']." am").' -'.($v->time_end['h']>11?($v->time_end['h']-12).':'.$v->time_end['m']." pm":$v->time_end['h'].':'.$v->time_end['m']." am");
else $time = $v->time_start['h'].':'.$v->time_start['m'].' - '.$v->time_end['h'].':'.$v->time_end['m'];
}
else $time = '&nbsp';
$c = $this->a_template['event_list_templ'];
$c = str_replace('$num', ++$i, $c);
$c = str_replace('$time', $time, $c);
$c = str_replace('$title', $v->title, $c);
echo str_replace('$body', $v->body, $c);
}
}
}
}
echo $this->read_file('footer','_'.$this->s_calendar_index.'.html');
}
View User's Profile View All Posts By User U2U Member
Zeeke75
Member

Posts: 11
Registered: 12/15/2005
Location: Rochester, MN
Member Is Offline
posted on 2/20/2006 at 02:18 AM Reply With Quote

Thank you for the help cweaver! I took your code and finished it for what I wanted it to do. I even added a feature that scrolls week by week through the events list. Below is the finished function:

/*
function show_event_week
input parameters:
none
used parameters:
$a_selected_date, $a_template, $s_calendar_index
used methods:
events_class->read_items, read_file
action:
make and return to the browser formatted event list
*/
function show_event_week() {
if ($_GET['nw'] != ''){
$cw = $_GET['nw'];
}
else
{
$cw = date('W',mktime(0, 0, 0, $this->a_selected_date['m'], $this->a_selected_date['d'], $this->a_selected_date['y']))+1;
}

$dwf = date('w',mktime(0, 0, 0, 1, 1, $this->a_selected_date['y']));
$cd = ($cw-1)*7 - $dwf + 1 + !$this->a_template['is_american'];
$dates[$c]['d'] = date('d',mktime(0, 0, 0, 1, $cd-7, $this->a_selected_date['y']));
$m = date('m',mktime(0, 0, 0, 1, $cd, $this->a_selected_date['y']));
$header_date = date('d', mktime(0,0,0,$m,$dates[$c]['d'],$this->a_selected_date['y']));

$head = $this->read_file('header');
$head = str_replace('$date', date ('M d',mktime(0,0,0,$m,$header_date,$this->
a_selected_date['y'])).' - '. date('M d',mktime(0,0,0,$m,$header_date+6,$this->
a_selected_date['y'])), $head);
echo $head;
if($this->a_template['is_american'] != 1) $dwf or $dwf = 7;
$cd = ($cw-1)*7 - $dwf + 1 + !$this->a_template['is_american'];
$c = 0;
for($i = $cd;$i < $cd+7;$i++){
$dates[$c]['d'] = date('d',mktime(0, 0, 0, 1, $i, $this->a_selected_date['y']));
$m = date('m',mktime(0, 0, 0, 1, $i, $this->a_selected_date['y']));
$items = $this->events_class->read_items($dates[$c]['d'], $m, $this->a_selected_date['y']);
if(is_array($items)){
uasort($items,array('calendar','sort_by_time_start'));
foreach($items as $k => $v) {
if($v->title){
if($v->is_time){
if($this->a_template['time_format'])
$time = ($v->time_start['h']>11?($v->time_start['h']-12).':'.$v->time_start['m']." pm":$v->
time_start['h'].':'.$v->time_start['m']." am").' -'.($v->time_end['h']>11?($v->time_end['h']-
12).':'.$v->time_end['m']." pm":$v->time_end['h'].':'.$v->time_end['m']." am");
else $time = $v->time_start['h'].':'.$v->time_start['m'].' - '.$v->time_end['h'].':'.$v->time_end
['m'];
}
else $time = '&nbsp';
$c = $this->a_template['event_list_templ'];
$c = str_replace('$day', date('D M d',mktime(0, 0, 0, 1, $i, $this->a_selected_date['y'])), $c);
$c = str_replace('$time', $time, $c);
$c = str_replace('$title', str_replace("\'", "'", $v->title), $c);
echo str_replace('$body', nl2br(str_replace("\'", "'", $v->body)), $c);
}
}
}
else echo '<tr><td align=center width=50>'.date('D M d',mktime(0, 0, 0, 1, $i, $this->a_selected_date['y'])).'</td><td
colspan=3 align=center>No events scheduled!</td></tr>';
}
echo $this->read_file('footer','_'.$this->s_calendar_index.'.html');
echo '<table border=0 cellpadding=0 cellspacing=0 align=center width=100%><tr><td colspan=2>&nbsp</td></tr><tr><td align=center><a href=YOUR LINK HERE?nw='.($cw+1).'>Show events for the next week</a></td><td align=center><a href=YOUR LINK HERE?nw='.($cw-1).'>Show events for the previous week</a></td></tr><tr><td colspan=2>&nbsp</td></tr></table>';
}
View User's Profile View All Posts By User U2U Member
ifoam
Newbie

Posts: 1
Registered: 3/31/2006
Member Is Offline
posted on 3/31/2006 at 04:51 PM Reply With Quote

can anyone explain how to call these functions from a link?

i need to do what you guys are saying, but i need it to happen with a click of a link
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page
Product Demonstrations Live Demos
Free/Trial Script Download Free Download
Product Documentation Documentation
Documentation page
Change Log
Support Forum Support Forum
Order Now ORDER NOW!
Add to Cart
View Cart
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004