Login   Register  
PHP Classes
elePHPant
Icontem

Display Events on Load

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      YourCalendar  >  All threads  >  Display Events on Load  >  (Un) Subscribe thread alerts  
Subject:Display Events on Load
Summary:Can the class display todays events without selecting a date?
Messages:4
Author:Mark Drone
Date:2007-03-01 01:25:52
Update:2007-03-05 11:23:59
 

  1. Display Events on Load   Reply   Report abuse  
Picture of Mark Drone
Mark Drone
2007-03-01 01:25:52
I am working on a project that incorporates the YourCalendar class.

http://209.175.254.232/yourcalendar/

As is, no events display unless the date is selected using the calendar. Is there a way to display "today's" events without user interaction?

-MD

  2. Re: Display Events on Load   Reply   Report abuse  
Picture of Michele Castellucci
Michele Castellucci
2007-03-01 12:28:09 - In reply to message 1 from Mark Drone
Ops.....
no way to do this.
So, I easily added this functionality adding an 8th parameter to the constructor of the class: $startDay.

For your purpose you haven't to specify this parameter because by default it take the current day, and the events of the day will be displayed.

Note that I also added support for english language.
Just call $Calendar->setLanguage('english') and mounth names and day names will be in english.

Have a nice day.

  3. Re: Display Events on Load   Reply   Report abuse  
Picture of Mark Drone
Mark Drone
2007-03-04 03:57:23 - In reply to message 2 from Michele Castellucci
Chris Wherley came up with a way to make it work. On line 34 of YourCalendar.php, replace the following lines:

if (isset($_GET["cal_{$this->tableInfo['name']}_focus"]))
$this->curDate['focus']=$_GET["cal_{$this->tableInfo['name']}_focus"];

With this block:

// *** Chris Wherley's code fix to allow the current date's events ***
// *** to be displayed without user interaction. Thanks Chris! ***

if (isset($_GET["cal_{$this->tableInfo['name']}_focus"]))
{
$this->curDate['focus']=$_GET["cal_{$this->tableInfo['name']}_focus"];
}
else
{
$current_date= date('Y-n-j');
$this->curDate['focus']=$current_date;
}
// *** End of code fix ***

It works great.

  4. Re: Display Events on Load   Reply   Report abuse  
Picture of Michele Castellucci
Michele Castellucci
2007-03-05 11:23:59 - In reply to message 3 from Mark Drone
Yes, that's the same way I've done it.
With the difference that my method use a constructor parameter
instead of taking by default the current date.

Please download last version of the class