| Pages: 1 2 |
williamkusumo
Newbie
Posts: 1
Registered: 7/22/2004
Member Is Offline
|
| posted on 7/22/2004 at 01:35 AM |
|
|
Display monthly events
Is it possible to display all the events in a month? I know a bit PHP but I need some clue which piece of code needs to be modified. Please help.
Thanks in advance,
William
|
|
|
texasaggie
Member
Posts: 11
Registered: 7/26/2004
Member Is Offline
|
| posted on 8/6/2004 at 05:47 PM |
|
|
Display monthly events
I was able to do this for monthly and annual events. The changes you'll need to make are in calendar.php and db.php.
In db.php, I found it easiest and quickest to create 2 new functions, one to read all monthly events and one to read all annual events. You just add
iteration over 31 days and 12 months, respectively.
In calendar.php, I duplicated show_event and made new functions for displaying all events for a month and all for a year. I also had to modify the
show_h and show_v to make the month name and year name in the calendar title a link to display monthly and annual.
In the end, I have 3 .php pages, one for daily, one for monthly and one for annual. Each calls a different function.
|
|
|
alain100
Junior Member
Posts: 4
Registered: 7/23/2004
Member Is Offline
|
| posted on 8/16/2004 at 05:55 PM |
|
|
Hi,
this is awesome man. Would it be possible to post the code you use and where to do the changes.
thanks
|
|
|
texasaggie
Member
Posts: 11
Registered: 7/26/2004
Member Is Offline
|
| posted on 8/17/2004 at 12:36 AM |
|
|
Display monthly events
I was asked not to post the files in their entirety by SC but I did offer them back the code to include in the next version. I will post some
snippets that should get most of what you need:
In db.php:
Copy the read_items function and call it read_monthly_items and make it take only 2 arguments - month and year. Then add a temp variable (I called
it $l) and initialize it to 1. This is a counter to hold the index for all the events. Then wrap the if () check as follows:
for ($d = 1; $d <= 31; $d++) {
if (.....) {
$res[$l]=$v;
$l++;
}
}
It doesn't matter that you iterate over 31 days in months that don't have 31 days - you just don't find events. It simplifies the
processing. You also have to not forget to increment the index, or else you end up overwriting things.
You can abstract things the same way for a read_items_yearly() type function. Just have an outer for loop that iterates the months ($m) from 1 to 12
and the inner loop the same as the monthly function.
Since I need a school/Scouting year calendar as well, I will probably sit down soon and write something that lets you choose a month and year and
iterates from one to the other and gets all events in that range. I don't see it being that complicated.
The calendar.php changes were a bit more involved. I copied the show_event function and created 2 other methods as before. Take the arguments out
and set up for loops as above to iterate.
Since you don't have a day in the month view to get the title, use a '1' place holder for the event date:
$event_date = date ('M, Y',mktime(0,0,0,$CLm,'1',$CLy));
Don't forget to delete the declaration and initialization for the days variable in the month function:
delete: $dp="CLd".$G_C;
delete: if(${$dp})$CLd=${$dp};
For the annual view, do the same thing that you did for the days to the month variables. The other trick is that I wanted to have a subheader in the
table to break each month. To do this, in the yearly function that you create, inside the outer for loop for the months, set a variable as below to
indicate it you used the month yet:
for ($m = 1; $m <= 12; $m++) {
$event_month_date = date ('M',mktime(0,0,0,$m,'1',$CLy));
$month_used=false;
Then inside the inner for loop, I added a link to that you could click on the month name and navigate to the month view of the calendar:
if(!$month_used) {
echo "<th colspan='4' align='left'><a
href='pack_events_month.php?CLm=$m&CLy=$CLy'><span
class='header1'>$event_month_date</span></a></th>";
$month_used=true;
}
I also changed the show_v and show_h functions to link the month and year in the header of the calendar to the pages that displayed those events.
Those are not hard. Just copy the code that creates a link and set the URL to your other PHP page that processes the monthly or annual calendar view.
Alternatively, you can have a header link that links to this.
If you email me directly, I'd be happy to answer any other questions in detail.
|
|
|
alain100
Junior Member
Posts: 4
Registered: 7/23/2004
Member Is Offline
|
| posted on 8/17/2004 at 04:08 PM |
|
|
Thank you very much, I hope you don't get in trouble with SC because of me. They should hire you!!! You rock!!!
I'll try to set it up now. I hope I can make it work
thank again!!!!
Alain
|
|
|
BFG
Junior Member
Posts: 5
Registered: 12/21/2004
Member Is Offline
|
| posted on 1/4/2005 at 03:27 PM |
|
|
The demo looks brilliant. This is exactly what I need.
I had a look at modiflying the code to do this, and nothing seems to match. Was this a mod on an older version of event calendar?
|
|
|
DigitalOldschool
Junior Member
Posts: 4
Registered: 12/29/2004
Member Is Offline
|
| posted on 1/12/2005 at 08:30 PM |
|
|
I was wondering the same thing.
Has anyone managed to get this working with the latest version of PHP Event Calendar?
|
|
|
Vitoto
Junior Member
Posts: 5
Registered: 3/18/2005
Location: Chile
Member Is Offline
|
| posted on 3/18/2005 at 03:35 PM |
|
|
Display in Roll-Over
Hi. man.
you can contrib by that file modifed for Display in Roll-Over Events ?
Thank you.
|
|
|
rdub
Member
Posts: 13
Registered: 3/2/2005
Member Is Offline
|
| posted on 3/30/2005 at 12:13 AM |
|
|
Has anyone gotten this to work. It would be great.
|
|
|
texasaggie
Member
Posts: 11
Registered: 7/26/2004
Member Is Offline
|
| posted on 3/30/2005 at 04:52 PM |
|
|
Display monthly events
My mods were on the old version but I am working on extending those to the new version. The new version was a bit easier to deal with because the
month display for the calendar days itself was done - all that was needed was to pull an event list together. I will post something when I get it
done and take suggestions.
|
|
|
texasaggie
Member
Posts: 11
Registered: 7/26/2004
Member Is Offline
|
| posted on 4/1/2005 at 06:32 PM |
|
|
Display monthly events
I was able to get the changes to display monthly events working with the new 1.5.1 version. I also have permission from SoftComplex to post these
here (thanks!). I still haven't completely finished what I want to get changed, but here's what I have so far. If you want to see how this works,
see http://www.pack3040.org/calendar151/pack_events.php .
I put the calendar.php file here if you want to download it and view the changes. All of the changes are commented, so you can find them.
http://www.hollenshead.org/calendar151/calendar.php
For your month page, you will need to do the following to display the month view:
<?
$calendar->init('CalendarName');
$calendar->is_month_view = true;
$calendar->show_month();
?>
<?
$calendar->show_event_monthly();
?>
The annual view of events shouldn't be much harder but I haven't done it yet since the calendar display for the whole year takes up the entire
screen and I'm not sure how I want to make it work. I currently use this on my annual page to display the full year calendar:
<?
$calendar->init('CalendarName');
$calendar->show_year();
?>
Changes:
* Display all events for a month, sorted by day.
* Change month and year title to be hyperlinked - month will take you to month display - year will take you to the year display
* Added variable to calendar to allow the admin/control panel to display the month differently
* New preferences to control alignment of cells when not in admin view
* Workaround for off by one bug in the annual display - the first month of the year in the SC year view for some reason decrements the year by 1 (i.e.
reads Jan 2004 instead of Jan 2005)
* Fix typo in show_year() function
Limitations:
* Different web page/PHP page for monthly display vs. daily display vs. annual display (would be nice to get to one controlled by a parameter)
* Monthly and annual page names are not properties (yet!)
* New properties cannot be set in the control panel (yet!)
* Hyperlinks in events themselves are not working right. Something is prepending the URL of the site even though I have explicit markup in the event.
|
|
|
GMeagle86
Junior Member
Posts: 3
Registered: 3/19/2005
Member Is Offline
|
| posted on 4/2/2005 at 03:02 AM |
|
|
Thanks!
|
|
|
bathory
Newbie
Posts: 1
Registered: 4/8/2005
Member Is Offline
|
| posted on 4/8/2005 at 06:43 AM |
|
|
Hey Texasaggie,
Your fix worked beautifully and did exactly what I need, except the time/date replacement bit has made it so that they are merged together.
You can see my set up here http://idoru.ca/calendar.php
Ideally where it says the date bit (apr 25, etc) it should have a line break and then display the time, or at least a space. I tried tweaking this but
I'm clearly not familiar enough with php to make it happen. Can you suggest something?
If there's any way to get it to say "Mon, Apr 25" as well that would amazing... I just don't read the code very well. Thank you :)
|
|
|
texasaggie
Member
Posts: 11
Registered: 7/26/2004
Member Is Offline
|
| posted on 4/8/2005 at 07:45 PM |
|
|
Display monthly events
I looked and I noticed that you still need to change the references to my pages ("calendar151/pack_events_monthly.php" and
"calendar151/pack_events_annual.php") to "calendar.php". Otherwise, if you click on the month or year on the top of the calendar, it gives you a
page not found.
As for the space, search calendar.php for "$time = date ('M d', $specific_date)" and add a space or <br> or whatever you need after the 'M
d' --> 'M d ' or 'M d<br>'.
Let me know if that doesn't work.
|
|
|
con4mity
Junior Member
Posts: 8
Registered: 5/1/2005
Location: Cleveland OH
Member Is Offline
|
| posted on 5/2/2005 at 07:20 PM |
|
|
Hmm...
Couple of things here, first, what exactly do you get when you add a space or break tag in the position you specified? I would think the answer would
be nothing.
Instead you might try adding the blank space of the break in the concantenation string itself. For example:
Change this:
if($this->a_template['time_format'])
$time = date ('M d', $specific_date).($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 = date ('M d', $specific_date).$v->time_start['h'].':'.$v->time_start['m'].' -
'.$v->time_end['h'].':'.$v->time_end['m'];
}
to this:
if($this->a_template['time_format'])
$time = date ('M d', $specific_date).' '.($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 = date ('M d', $specific_date).' '.$v->time_start['h'].':'.$v->time_start['m'].' -
'.$v->time_end['h'].':'.$v->time_end['m'];
}
You'll notice I added a blank space after date ('M d', $specific_date).'blankspace'.$v->
Oh by the way, this was a great help to me. Do you know why my quotes inside the event listing are escaped and messing up the system? Is it magic
quotes?
|
|
|
cregy
Junior Member
Posts: 3
Registered: 5/1/2005
Location: Lostwithiel Cornwall England
Member Is Offline
|
| posted on 5/3/2005 at 05:45 AM |
|
|
Hi
I have used the monthly events list at:
<http://pulaski.cregy.net/calendar/index.php>
However, it is not listing the date. Could anybody tell me why?
I also seem unable to switch of the background colour to the table?!?
Thanks
Rich
|
|
|
dhender02
Member
Posts: 10
Registered: 5/1/2005
Member Is Offline
|
| posted on 5/3/2005 at 07:17 PM |
|
|
Change your event template to display time, rather than one of the other variables (i.e. num, body, etc.). Then it will display both time &
date...... However, if you want it to look neat, you will have to modify the montly function to concatenate a space between date & time..... see
http://cityofalexander.org/html/calender.phtml for example..
Good Luck.... Now if some one will help me with my question regarding admin password not working anymore...
David H.
|
|
|
wjthomas9
Junior Member
Posts: 3
Registered: 10/4/2005
Member Is Offline
|
| posted on 11/11/2005 at 05:51 PM |
|
|
having some trouble
here's what I get after making the commented changes:
Warning: Unterminated comment starting line 517 in /home/oasisoo/public_html/php_event_calendar/cl_files/calendar.php on line 517
Parse error: parse error, unexpected $, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in
/home/oasisoo/public_html/php_event_calendar/cl_files/calendar.php on line 517
i can't seem to find what it's referring to. here's the address of the calendar page: http://www.oasisoo.com . I had a daily view working beautifully, but at a request I am trying to display monthly view. Just
wondering what I did wrong. I appreciate your help with this.
jt
|
|
|
spinsane
Newbie
Posts: 1
Registered: 2/16/2006
Member Is Offline
|
| posted on 2/16/2006 at 08:52 PM |
|
|
Month / Year Links
Quick Question,
I am using the displayed calendar on an html page and I wish to remove the links from the month and year that are displayed at the top of the
calendar. Any Suggestions?
|
|
|
stealthboy
Junior Member
Posts: 2
Registered: 2/27/2006
Location: Singapore
Member Is Offline
|
| posted on 2/27/2006 at 03:20 AM |
|
|
Cheader font very small
I've input ur codes into my calendar and it works alright but it seems that the font size for the Cheader which is the "Month - Year" is very
small. Where exactly do i go to edit the font size of the Cheader. I have tried including CSS styles to the page where i display my calendar but it
seems that all the other attributes have their fonts altered except for the Cheader. Please help!
|
|
|
lintguy
Junior Member
Posts: 4
Registered: 5/9/2006
Member Is Offline
|
| posted on 8/21/2006 at 11:19 AM |
|
|
| Quote: | Originally posted by spinsane
Quick Question,
I am using the displayed calendar on an html page and I wish to remove the links from the month and year that are displayed at the top of the
calendar. Any Suggestions? |
1. Open "calendar.php"
2. Search for: function show_header()
3. Within that function, replace this code:
<?echo $this->put_href($this->make_date($this->a_selected_date['m'],$this->a_selected_date
['y'],"M"),'/~chialpha/pack_events_monthly.php','',"CLy".$this->s_calendar_index."=".($this->a_selected_date
['y'])."&CLm".$this->s_calendar_index."=".($this->a_selected_date['m']),'',1,'header')?> -
<?echo $this->put_href($this->make_date($this->a_selected_date['m'],$this->a_selected_date
['y'],"Y"),'/~chialpha/pack_events_annual.php','',"CLy".$this->s_calendar_index."=".($this->a_selected_date
['y']),'',1,'header')?>
with this (from the original file):
<?echo $this->make_date($this->a_selected_date['m'],$this->a_selected_date['y'],$this->a_template['title_format'])?>
Good luck
|
|
|
XTinitus
Junior Member
Posts: 7
Registered: 9/23/2006
Location: Montreal
Member Is Offline
|
| posted on 10/3/2006 at 06:54 PM |
|
|
Broken link to information
| Quote: | Message original : texasaggie
I was able to get the changes to display monthly events working with the new 1.5.1 version. I also have permission from SoftComplex to post these
here (thanks!). I still haven't completely finished what I want to get changed, but here's what I have so far. If you want to see how this works,
see http://www.pack3040.org/calendar151/pack_events.php .
I put the calendar.php file here if you want to download it and view the changes. All of the changes are commented, so you can find them.
http://www.hollenshead.org/calendar151/calendar.php
|
Unfortunately, this link is broken. Is someone knows the code or owns the file? All I need is the function show_event for the month
(show_event_monthly) part. I will really appreciate any help.
Thank's a lot.
Richard
|
|
|
XTinitus
Junior Member
Posts: 7
Registered: 9/23/2006
Location: Montreal
Member Is Offline
|
| posted on 10/6/2006 at 10:53 PM |
|
|
Broken link to get some information
Y'a personne?
Nobody in here?
|
|
|
XTinitus
Junior Member
Posts: 7
Registered: 9/23/2006
Location: Montreal
Member Is Offline
|
| posted on 10/14/2006 at 06:03 AM |
|
|
Statistically, there have been 5510 visits to this page at the moment, and not only one answer or comment. His a solution even exists?
|
|
|
misty
Junior Member
Posts: 7
Registered: 4/13/2007
Location: New York, NY
Member Is Offline
|
| posted on 4/21/2007 at 04:49 AM |
|
|
Yes, I would like to see the function for the show_event_monthly as well. Can some post the function? Because unfortunately the link above to the
source is broken.
|
|
|
| Pages: 1 2 |