[PHP] Calendar Logic Help

2010-10-20 Thread Floyd Resler
I'm having problems getting my head around some login for a calendar.  
Specifically, the problem is drawing weekly views for events that span multiple 
days.  I've gotten it so that if an event starts in the week being viewed, the 
days draw correctly for the remainder of the week.  However, if the event goes 
into the next week, its start date is now outside my date range and so it 
doesn't display.  I know how to say the logic, I'm not sure how to write it!  
The logic would be: if any date between the start and end dates of the event 
are within the week being displayed, show the event.  I'd like to put the logic 
into my MySQL query so I don't have to get all events from the calendar to see 
what should be displayed.  Any ideas?

Thanks!
Floyd


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Calendar Logic Help

2010-10-20 Thread Tommy Pham
 -Original Message-
 From: Floyd Resler [mailto:fres...@adex-intl.com]
 Sent: Wednesday, October 20, 2010 9:17 AM
 To: PHP
 Subject: [PHP] Calendar Logic Help
 
 I'm having problems getting my head around some login for a calendar.
 Specifically, the problem is drawing weekly views for events that span
 multiple days.  I've gotten it so that if an event starts in the week
being
 viewed, the days draw correctly for the remainder of the week.  However,
if
 the event goes into the next week, its start date is now outside my date
 range and so it doesn't display.  I know how to say the logic, I'm not
sure
 how to write it!  The logic would be: if any date between the start and
end
 dates of the event are within the week being displayed, show the event.
I'd
 like to put the logic into my MySQL query so I don't have to get all
events
 from the calendar to see what should be displayed.  Any ideas?
 
 Thanks!
 Floyd
 

It's hard to give you hints without knowing some actual PHP code and SQL
table columns but here goes:

PHP logic: $event['startDate'] = $weekEnd  $event['endDate'] =
$weekStart

Query logic: SELECT * FROM event_table WHERE `start_date` = @weekEnd and
`end_date` = @weekStart

week* is the week being viewed.  You may have to use the DateTime class or
one of the date_* functions to compare the date for the PHP logic.  @ is the
input query parameter.  This assumes you have table columns for the event:
start_date  end_date.  Adjust the query as needed for multi table joins.

Regards,
Tommy


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar Logic Help

2010-10-20 Thread Floyd Resler

On Oct 20, 2010, at 12:47 PM, Tommy Pham wrote:

 -Original Message-
 From: Floyd Resler [mailto:fres...@adex-intl.com]
 Sent: Wednesday, October 20, 2010 9:17 AM
 To: PHP
 Subject: [PHP] Calendar Logic Help
 
 I'm having problems getting my head around some login for a calendar.
 Specifically, the problem is drawing weekly views for events that span
 multiple days.  I've gotten it so that if an event starts in the week
 being
 viewed, the days draw correctly for the remainder of the week.  However,
 if
 the event goes into the next week, its start date is now outside my date
 range and so it doesn't display.  I know how to say the logic, I'm not
 sure
 how to write it!  The logic would be: if any date between the start and
 end
 dates of the event are within the week being displayed, show the event.
 I'd
 like to put the logic into my MySQL query so I don't have to get all
 events
 from the calendar to see what should be displayed.  Any ideas?
 
 Thanks!
 Floyd
 
 
 It's hard to give you hints without knowing some actual PHP code and SQL
 table columns but here goes:
 
 PHP logic: $event['startDate'] = $weekEnd  $event['endDate'] =
 $weekStart
 
 Query logic: SELECT * FROM event_table WHERE `start_date` = @weekEnd and
 `end_date` = @weekStart
 
 week* is the week being viewed.  You may have to use the DateTime class or
 one of the date_* functions to compare the date for the PHP logic.  @ is the
 input query parameter.  This assumes you have table columns for the event:
 start_date  end_date.  Adjust the query as needed for multi table joins.
 
 Regards,
 Tommy
 

That worked perfect! 

Thanks!
Floyd


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] calendar libs

2010-07-13 Thread Ricardo Martinez
Hi!

i'm looking for a good calendar libs, want ask, if anyone knows a good
library.


thx!

Ricardo


Re: [PHP] calendar libs

2010-07-13 Thread David Hutto
On Tue, Jul 13, 2010 at 2:04 PM, Ricardo Martinez harisel...@gmail.com wrote:
 Hi!

 i'm looking for a good calendar libs, want ask, if anyone knows a good
 library.


 thx!

 Ricardo


This may hel, it's just a simple search for 'php calendar' :

http://www.php-calendar.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] calendar libs

2010-07-13 Thread David Hutto
On Tue, Jul 13, 2010 at 2:10 PM, David Hutto smokefl...@gmail.com wrote:
 On Tue, Jul 13, 2010 at 2:04 PM, Ricardo Martinez harisel...@gmail.com 
 wrote:
 Hi!

 i'm looking for a good calendar libs, want ask, if anyone knows a good
 library.


 thx!

 Ricardo


 This may hel, it's just a simple search for 'php calendar' :

 http://www.php-calendar.com/

This might help better as a reference:

http://www.w3schools.com/php/php_ref_calendar.asp
Not to say there isn't a builtin function, or.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] calendar libs

2010-07-13 Thread David Hutto
On Tue, Jul 13, 2010 at 2:14 PM, David Hutto smokefl...@gmail.com wrote:
 On Tue, Jul 13, 2010 at 2:10 PM, David Hutto smokefl...@gmail.com wrote:
 On Tue, Jul 13, 2010 at 2:04 PM, Ricardo Martinez harisel...@gmail.com 
 wrote:
 Hi!

 i'm looking for a good calendar libs, want ask, if anyone knows a good
 library.


 thx!

 Ricardo


 This may hel, it's just a simple search for 'php calendar' :

 http://www.php-calendar.com/

 This might help better as a reference:

 http://www.w3schools.com/php/php_ref_calendar.asp
 Not to say there isn't a builtin function, or.

minus the : Not to say there isn't a builtin function, or.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar tutorial

2009-09-08 Thread tedd

At 8:47 PM -0700 9/7/09, Haig Davis wrote:

Dear PHP List Members,

First off I am well aware that I can go online and download a PHP script to
make a Calendar, it's not that I'm too cheap to buy the script it is that I
want to work through and fully understand what I have so that I am
intimately aware of every aspect of my project. What I really would like is
a tutorial that will teach me to write the script for a calendar (or at
least get me started) that will allow me to schedule various multi day
events and write the requests to a mySQL database. I would prefer something
that is PHP/ mySQL, HTML and CSS no flash or Java. If any one knows of a
site on the web I could find such a tutorial please let me know.

Many Thanks

Haig Vancouver BC


Haig:

The best tutorial I would think would be to review code that 
someone already did. That way not only do you get a working example, 
you can also learn and improve it on your own.


Check out:

http://www.php-calendar.com/

Here's an example of it working:

http://php1.net/my-php-calendar/

I've had good luck with it and have been able to change things as I wanted.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Calendar tutorial

2009-09-07 Thread Haig Davis
Dear PHP List Members,

First off I am well aware that I can go online and download a PHP script to
make a Calendar, it's not that I'm too cheap to buy the script it is that I
want to work through and fully understand what I have so that I am
intimately aware of every aspect of my project. What I really would like is
a tutorial that will teach me to write the script for a calendar (or at
least get me started) that will allow me to schedule various multi day
events and write the requests to a mySQL database. I would prefer something
that is PHP/ mySQL, HTML and CSS no flash or Java. If any one knows of a
site on the web I could find such a tutorial please let me know.

Many Thanks

Haig Vancouver BC


Re: [PHP] Calendar tutorial

2009-09-07 Thread viraj
On Tue, Sep 8, 2009 at 9:17 AM, Haig Davislevel...@gmail.com wrote:
 Dear PHP List Members,
 least get me started) that will allow me to schedule various multi day
 events and write the requests to a mySQL database. I would prefer something
 that is PHP/ mySQL, HTML and CSS no flash or Java. If any one knows of a
 site on the web I could find such a tutorial please let me know.

i have googled a lot to find out a good tutorial on this topic,
finally decided to start coding it.

it's just a bunch of while loops and mysql views. the schema and the
classes and methods are totally up to the developer and heavily
depends on the specific requirements.

date_parse and strtotime were very useful php functions.

~viraj


 Many Thanks

 Haig Vancouver BC


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar Problem

2009-08-12 Thread tedd

At 4:08 PM -0400 8/11/09, Robert Cummings wrote:

tedd wrote:

Hi gang:

I want to show the dates for all Fridays +-30 days from a specific date.

For example, given today's date (8/11/2009) the Fridays that fall 
+-30 days are July 17, July 24, July 31, Aug 7, Aug 14, Aug 21, Aug 
28, and Sept 4.


I'm curious, how would you guys solve this?


?php

$fridays = array();
for( $i = -30; $i = 30; $i++ )
{
$mod = $i  0 ? $i : '+'.$i;

$time = strtotime( $mod.' day' );

if( date( 'D', $time ) == 'Fri' )
{
$fridays[] = date( 'Y-m-d', $time );
}
}

print_r( $fridays );

?

Cheers,
Rob.


Rob:

That's slick -- you never let me down with your simplicity and creativity.

My solution was to find the next Friday and then cycle through +-28 
days (four weeks) from that date, like so:


?php
$fridays = array();

for( $i = 1; $i = 7; $i++ )
   {
   $time = strtotime( $i . ' day' );
   if( date( 'D', $time ) == 'Fri' )
  {
  $start = 28 - $i;
  $end = 28 + $i;
  }
   }

for( $i = -$start; $i = $end; $i += 7 )
   {
   $time = strtotime( $i . ' day' );
   $fridays[] = date( 'Y-m-d', $time );
   }

print_r( $fridays );
?

Your solution had 61 iterations (for loop) while mind had only 21, so 
mine's a bit faster. Here's the comparison:


http://php1.net/b/fridays/

But I'll use your solution -- it's more elegant.

Thanks for the code,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar Problem

2009-08-12 Thread Robert Cummings



tedd wrote:

At 4:08 PM -0400 8/11/09, Robert Cummings wrote:

tedd wrote:

Hi gang:

I want to show the dates for all Fridays +-30 days from a specific date.

For example, given today's date (8/11/2009) the Fridays that fall 
+-30 days are July 17, July 24, July 31, Aug 7, Aug 14, Aug 21, Aug 
28, and Sept 4.


I'm curious, how would you guys solve this?

?php

$fridays = array();
for( $i = -30; $i = 30; $i++ )
{
$mod = $i  0 ? $i : '+'.$i;

$time = strtotime( $mod.' day' );

if( date( 'D', $time ) == 'Fri' )
{
$fridays[] = date( 'Y-m-d', $time );
}
}

print_r( $fridays );

?

Cheers,
Rob.


Rob:

That's slick -- you never let me down with your simplicity and creativity.

My solution was to find the next Friday and then cycle through +-28 
days (four weeks) from that date, like so:


?php
$fridays = array();

for( $i = 1; $i = 7; $i++ )
{
$time = strtotime( $i . ' day' );
if( date( 'D', $time ) == 'Fri' )
   {
   $start = 28 - $i;
   $end = 28 + $i;
   }
}

for( $i = -$start; $i = $end; $i += 7 )
{
$time = strtotime( $i . ' day' );
$fridays[] = date( 'Y-m-d', $time );
}

print_r( $fridays );
?

Your solution had 61 iterations (for loop) while mind had only 21, so 
mine's a bit faster. Here's the comparison:


http://php1.net/b/fridays/

But I'll use your solution -- it's more elegant.

Thanks for the code,

tedd


I think Shawn McKenzie's is the best. It seems his would take at most 12 
iterations.


Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar Problem

2009-08-12 Thread tedd

At 4:08 PM -0400 8/11/09, Robert Cummings wrote:


I think Shawn McKenzie's is the best. It seems his would take at 
most 12 iterations.


Cheers,
Rob.


Rob:

For some reason I did not see/consider Shawn's solutions -- sorry Shawn.

However, it appears that mine is still the fastest in most test. Check this:

http://php1.net/b/fridays/

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar Problem

2009-08-12 Thread Martin Scotta
On Wed, Aug 12, 2009 at 10:25 AM, Robert Cummings rob...@interjinn.comwrote:



 tedd wrote:

 At 4:08 PM -0400 8/11/09, Robert Cummings wrote:

 tedd wrote:

 Hi gang:

 I want to show the dates for all Fridays +-30 days from a specific date.

 For example, given today's date (8/11/2009) the Fridays that fall +-30
 days are July 17, July 24, July 31, Aug 7, Aug 14, Aug 21, Aug 28, and Sept
 4.

 I'm curious, how would you guys solve this?

 ?php

 $fridays = array();
 for( $i = -30; $i = 30; $i++ )
 {
$mod = $i  0 ? $i : '+'.$i;

$time = strtotime( $mod.' day' );

if( date( 'D', $time ) == 'Fri' )
{
$fridays[] = date( 'Y-m-d', $time );
}
 }

 print_r( $fridays );

 ?

 Cheers,
 Rob.


 Rob:

 That's slick -- you never let me down with your simplicity and creativity.

 My solution was to find the next Friday and then cycle through +-28 days
 (four weeks) from that date, like so:

 ?php
 $fridays = array();

 for( $i = 1; $i = 7; $i++ )
{
$time = strtotime( $i . ' day' );
if( date( 'D', $time ) == 'Fri' )
   {
   $start = 28 - $i;
   $end = 28 + $i;
   }
}

 for( $i = -$start; $i = $end; $i += 7 )
{
$time = strtotime( $i . ' day' );
$fridays[] = date( 'Y-m-d', $time );
}

 print_r( $fridays );
 ?

 Your solution had 61 iterations (for loop) while mind had only 21, so
 mine's a bit faster. Here's the comparison:

 http://php1.net/b/fridays/

 But I'll use your solution -- it's more elegant.

 Thanks for the code,

 tedd


 I think Shawn McKenzie's is the best. It seems his would take at most 12
 iterations.

 Cheers,
 Rob.
 --
 http://www.interjinn.com
 Application and Templating Framework for PHP

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



Hi all

This is my point of view.
I try to stay the most legible and simple as possible.

@tedd: can you benchmark this script too? usualy legibility  performance

?php

$fridays = array(); # I'll store the friday here
$day = strtotime('-1 month', time() ); # let's start at one month ago

while( 5 != date('w', $day)) # advance to a friday
$day = strtotime('+1 day', $day);

# I'll stop when $day where ahead one month from today
$end = strtotime( '+1 month', time() );

do{
$friday[] = date('Y-m-d', $day); # store the friday
$day = strtotime('+1 week', $day); # advance one week
} while( $day  $end );

# job's done!
print_r( $friday );


-- 
Martin Scotta


Re: [PHP] Calendar Problem

2009-08-12 Thread Stuart
2009/8/12 tedd tedd.sperl...@gmail.com:
 At 4:08 PM -0400 8/11/09, Robert Cummings wrote:

 I think Shawn McKenzie's is the best. It seems his would take at most 12
 iterations.

 Cheers,
 Rob.

 Rob:

 For some reason I did not see/consider Shawn's solutions -- sorry Shawn.

 However, it appears that mine is still the fastest in most test. Check this:

 http://php1.net/b/fridays/

Bit late to this party, but give this a whizz...

http://dev.stut.net/php/fridays.php

-Stuart

-- 
http://stut.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar Problem

2009-08-12 Thread tedd

At 11:03 AM -0300 8/12/09, Martin Scotta wrote:

Hi all

This is my point of view.
I try to stay the most legible and simple as possible.

@tedd: can you benchmark this script too? usualy legibility  performance

?php

$fridays = array(); # I'll store the friday here
$day = strtotime('-1 month', time() ); # let's start at one month ago

while( 5 != date('w', $day)) # advance to a friday
$day = strtotime('+1 day', $day);

# I'll stop when $day where ahead one month from today
$end = strtotime( '+1 month', time() );

do{
$friday[] = date('Y-m-d', $day); # store the friday
$day = strtotime('+1 week', $day); # advance one week
} while( $day  $end );

# job's done!
print_r( $friday );

--
Martin Scotta



Martin:

It's included here:

http://php1.net/b/fridays/

Works great -- thanks.

As Shawn said Many ways to skin a cat

As Jeff Foxworthy added But he ain't going to like any of them!

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar Problem

2009-08-12 Thread Shawn McKenzie
tedd wrote:
 
 Your solution had 61 iterations (for loop) while mind had only 21, so
 mine's a bit faster. Here's the comparison:
 
 http://php1.net/b/fridays/
 
 But I'll use your solution -- it's more elegant.
 
 Thanks for the code,
 
 tedd
 

Actually, if you refresh your page you have different winners.  When I
first visited the page yours was fastest by approximately .001, but on
refresh yours is slower by .001. You need to execute the test let's say
100 or 1000 times or more (more is better) and take either the average
or I would say the minimum.

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar Problem

2009-08-12 Thread tedd

At 3:26 PM +0100 8/12/09, Stuart wrote:

2009/8/12 tedd tedd.sperl...@gmail.com:

 At 4:08 PM -0400 8/11/09, Robert Cummings wrote:


 I think Shawn McKenzie's is the best. It seems his would take at most 12
 iterations.

 Cheers,
 Rob.


 Rob:

 For some reason I did not see/consider Shawn's solutions -- sorry Shawn.

 However, it appears that mine is still the fastest in most test. Check this:

 http://php1.net/b/fridays/


Bit late to this party, but give this a whizz...

http://dev.stut.net/php/fridays.php

-Stuart


It's included here:

http://php1.net/b/fridays/

Looks like your solution is the fastest.

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar Problem

2009-08-12 Thread tedd

At 9:50 AM -0500 8/12/09, Shawn McKenzie wrote:

tedd wrote:


 Your solution had 61 iterations (for loop) while mind had only 21, so
 mine's a bit faster. Here's the comparison:

 http://php1.net/b/fridays/

 But I'll use your solution -- it's more elegant.

 Thanks for the code,

 tedd



Actually, if you refresh your page you have different winners.  When I
first visited the page yours was fastest by approximately .001, but on
refresh yours is slower by .001. You need to execute the test let's say
100 or 1000 times or more (more is better) and take either the average
or I would say the minimum.

--
Thanks!



But of course -- no one try is definitive, you need many.

For example, I wrote a script to show that PHP's rounding function 
had an upward bias, which it does, but it took thousands of 
iterations to see it. Not worth the effort to correct.


In any event, it's interesting to see how we all approached the 
problem from different directions.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar Problem

2009-08-12 Thread Martin Scotta
On Wed, Aug 12, 2009 at 12:07 PM, tedd tedd.sperl...@gmail.com wrote:

 At 9:50 AM -0500 8/12/09, Shawn McKenzie wrote:

 tedd wrote:


  Your solution had 61 iterations (for loop) while mind had only 21, so
  mine's a bit faster. Here's the comparison:

  http://php1.net/b/fridays/

  But I'll use your solution -- it's more elegant.

  Thanks for the code,

  tedd


 Actually, if you refresh your page you have different winners.  When I
 first visited the page yours was fastest by approximately .001, but on
 refresh yours is slower by .001. You need to execute the test let's say
 100 or 1000 times or more (more is better) and take either the average
 or I would say the minimum.

 --
 Thanks!



 But of course -- no one try is definitive, you need many.

 For example, I wrote a script to show that PHP's rounding function had an
 upward bias, which it does, but it took thousands of iterations to see it.
 Not worth the effort to correct.

 In any event, it's interesting to see how we all approached the problem
 from different directions.

 Cheers,

 tedd

 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


Well, this was a nice experiment.
What do we must learn about this? performance  legibility
Stuart solutions look that's the faster, but in the other hand Shawn's
solution 2 looks the most legible (so far).

-- 
Martin Scotta


[PHP] Calendar Problem

2009-08-11 Thread tedd

Hi gang:

I want to show the dates for all Fridays +-30 days from a specific date.

For example, given today's date (8/11/2009) the Fridays that fall 
+-30 days are July 17, July 24, July 31, Aug 7, Aug 14, Aug 21, Aug 
28, and Sept 4.


I'm curious, how would you guys solve this?

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar Problem

2009-08-11 Thread Robert Cummings

tedd wrote:

Hi gang:

I want to show the dates for all Fridays +-30 days from a specific date.

For example, given today's date (8/11/2009) the Fridays that fall 
+-30 days are July 17, July 24, July 31, Aug 7, Aug 14, Aug 21, Aug 
28, and Sept 4.


I'm curious, how would you guys solve this?


?php

$fridays = array();
for( $i = -30; $i = 30; $i++ )
{
$mod = $i  0 ? $i : '+'.$i;

$time = strtotime( $mod.' day' );

if( date( 'D', $time ) == 'Fri' )
{
$fridays[] = date( 'Y-m-d', $time );
}
}

print_r( $fridays );

?

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar Problem

2009-08-11 Thread Jim Lucas
Robert Cummings wrote:
 tedd wrote:
 Hi gang:

 I want to show the dates for all Fridays +-30 days from a specific date.

 For example, given today's date (8/11/2009) the Fridays that fall +-30
 days are July 17, July 24, July 31, Aug 7, Aug 14, Aug 21, Aug 28, and
 Sept 4.

 I'm curious, how would you guys solve this?
 
 ?php
 
 $fridays = array();
 for( $i = -30; $i = 30; $i++ )
 {
 $mod = $i  0 ? $i : '+'.$i;

man, please use some parenthesis...

my translation of the above would be the following:

$mod = (($i  0) ? $i : ('+'.$i));

would that be correct?

 
 $time = strtotime( $mod.' day' );
 
 if( date( 'D', $time ) == 'Fri' )
 {
 $fridays[] = date( 'Y-m-d', $time );
 }
 }
 
 print_r( $fridays );
 
 ?
 
 Cheers,
 Rob.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar Problem

2009-08-11 Thread Robert Cummings



Jim Lucas wrote:

Robert Cummings wrote:

tedd wrote:

Hi gang:

I want to show the dates for all Fridays +-30 days from a specific date.

For example, given today's date (8/11/2009) the Fridays that fall +-30
days are July 17, July 24, July 31, Aug 7, Aug 14, Aug 21, Aug 28, and
Sept 4.

I'm curious, how would you guys solve this?

?php

$fridays = array();
for( $i = -30; $i = 30; $i++ )
{
$mod = $i  0 ? $i : '+'.$i;


man, please use some parenthesis...

my translation of the above would be the following:

$mod = (($i  0) ? $i : ('+'.$i));

would that be correct?


Yes... in a superfluous hold-my-hand sort of way :)

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar Problem

2009-08-11 Thread Paul M Foster
On Tue, Aug 11, 2009 at 03:53:58PM -0400, tedd wrote:

 Hi gang:

 I want to show the dates for all Fridays +-30 days from a specific date.

 For example, given today's date (8/11/2009) the Fridays that fall
 +-30 days are July 17, July 24, July 31, Aug 7, Aug 14, Aug 21, Aug
 28, and Sept 4.

 I'm curious, how would you guys solve this?

Convert to julian days, then add or subtract days as desired. Then
convert back to gregorian.

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar

2009-06-21 Thread Ashley Sheridan
On Sat, 2009-06-20 at 10:26 -0400, tedd wrote:
 At 7:58 PM +0100 6/19/09, Ashley Sheridan wrote:
 On Fri, 2009-06-19 at 15:30 +0530, Sudheer Satyanarayana wrote:
   salmarayan wrote:
Does Any body please have the code of A Java Script Calendar 
 that works with
a PHP Html  Form..
if yes can you please send it as i have one but does not work that
Efficiently.
   
Thanks in advance
 
   This might help if you are looking for a date picker
 
   http://techchorus.net/add-cool-date-picker-2-lines-javascript
 
 
   --
 
   With warm regards,
   Sudheer. S
   Business: http://binaryvibes.co.in, Tech stuff: 
 http://techchorus.net, Personal: http://sudheer.net
 
 
 I've always used Tigra calendar, and it's been very flexible for me for
 a lot of sites. Don't know whether or not it is still maintained, as I
 keep using the same source I picked up a couple of years back! If you
 have trouble finding it, give me a shout.
 
 Thanks
 Ash
 
 Ash et al:
 
 I like to roll and maintain my own. While it's not javascript, it works.
 
 http://webbytedd.com//tedd-php-calendar/  -- code is there
 
 And it's fairly easy to hook up to a database, such as seen here:
 
 http://php1.net/my-php-calendar/
 
 The original code for the db version can be found in the php-calendar 
 (http://php-calendar.com).
 
 Cheers,
 
 tedd
 
 -- 
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com
 
Tedd, as you ought to know by now, I rolled my own of those a while back
too, it's come up on these lists a few times! :p The op just asked for a
calendar that was javascript based for a user to add a data into a form

Thanks
Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar

2009-06-20 Thread tedd

At 7:58 PM +0100 6/19/09, Ashley Sheridan wrote:

On Fri, 2009-06-19 at 15:30 +0530, Sudheer Satyanarayana wrote:

 salmarayan wrote:
  Does Any body please have the code of A Java Script Calendar 
that works with

  a PHP Html  Form..
  if yes can you please send it as i have one but does not work that
  Efficiently.
 
  Thanks in advance
   
 This might help if you are looking for a date picker


 http://techchorus.net/add-cool-date-picker-2-lines-javascript


 --

 With warm regards,
 Sudheer. S
 Business: http://binaryvibes.co.in, Tech stuff: 
http://techchorus.net, Personal: http://sudheer.net




I've always used Tigra calendar, and it's been very flexible for me for
a lot of sites. Don't know whether or not it is still maintained, as I
keep using the same source I picked up a couple of years back! If you
have trouble finding it, give me a shout.

Thanks
Ash


Ash et al:

I like to roll and maintain my own. While it's not javascript, it works.

http://webbytedd.com//tedd-php-calendar/  -- code is there

And it's fairly easy to hook up to a database, such as seen here:

http://php1.net/my-php-calendar/

The original code for the db version can be found in the php-calendar 
(http://php-calendar.com).


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar

2009-06-19 Thread Tom Chubb
http://lmgtfy.com/?q=javascript+calendar

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar

2009-06-19 Thread Sudheer Satyanarayana

salmarayan wrote:

Does Any body please have the code of A Java Script Calendar that works with
a PHP Html  Form.. 
if yes can you please send it as i have one but does not work that

Efficiently.

Thanks in advance
  

This might help if you are looking for a date picker

http://techchorus.net/add-cool-date-picker-2-lines-javascript


--

With warm regards,
Sudheer. S
Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, 
Personal: http://sudheer.net


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar

2009-06-19 Thread Ashley Sheridan
On Fri, 2009-06-19 at 15:30 +0530, Sudheer Satyanarayana wrote:
 salmarayan wrote:
  Does Any body please have the code of A Java Script Calendar that works with
  a PHP Html  Form.. 
  if yes can you please send it as i have one but does not work that
  Efficiently.
 
  Thanks in advance

 This might help if you are looking for a date picker
 
 http://techchorus.net/add-cool-date-picker-2-lines-javascript
 
 
 -- 
 
 With warm regards,
 Sudheer. S
 Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, 
 Personal: http://sudheer.net
 
 
I've always used Tigra calendar, and it's been very flexible for me for
a lot of sites. Don't know whether or not it is still maintained, as I
keep using the same source I picked up a couple of years back! If you
have trouble finding it, give me a shout.

Thanks
Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Calendar

2009-06-18 Thread salmarayan

Does Any body please have the code of A Java Script Calendar that works with
a PHP Html  Form.. 
if yes can you please send it as i have one but does not work that
Efficiently.

Thanks in advance
-- 
View this message in context: 
http://www.nabble.com/Calendar-tp24099681p24099681.html
Sent from the PHP - General mailing list archive at Nabble.com.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar

2009-06-18 Thread Daniel Brown
On Thu, Jun 18, 2009 at 18:16, salmarayansalmara...@gmail.com wrote:

 Does Any body please have the code of A Java Script Calendar that works with
 a PHP Html  Form..

No.

 if yes can you please send it as i have one but does not work that
 Efficiently.

No.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar/Date

2009-03-18 Thread Robert Cummings
On Tue, 2009-03-17 at 20:52 -0700, Jason Todd Slack-Moehrle wrote:
 Hi All,
 
 Does anyone have code and/or advice for how to get get the current  
 week (with a passed current day, say) and what then end date is at  
 Saturday.
 
 So take today: Tuesday March 17, 2009
 
 I want to get:
 Sunday March 15, 2009
 Monday March 16, 2009
 Tuesday March 17, 2009
 Wednesday March 18, 2009
 Thursday March 19, 2009
 Friday March 20, 2009
 Saturday March 21, 2009

A sprinkle of math + a sprinkle of time + a sprinkle of PHP:

?php

$dates = array();
$offset = (int)date( 'w' ) - 6;
for( $i = 0; $i  7; $i++ )
{
$dates[] = date( 'l F j, Y', strtotime( '+'.($offset + $i).'
days' ) );
}
 
print_r( $dates );

?

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Calendar/Date

2009-03-18 Thread Bob McConnell
From: Paul M Foster
 On Tue, Mar 17, 2009 at 08:52:11PM -0700, Jason Todd Slack-Moehrle
wrote:
 
 Hi All,

 Does anyone have code and/or advice for how to get get the current
 week (with a passed current day, say) and what then end date is at
 Saturday.

 So take today: Tuesday March 17, 2009

 I want to get:
 Sunday March 15, 2009
 Monday March 16, 2009
 Tuesday March 17, 2009
 Wednesday March 18, 2009
 Thursday March 19, 2009
 Friday March 20, 2009
 Saturday March 21, 2009
 
 I just answered a question similar to this. You might check the
 archives. In this case, you'll need to use the getdate() function (see
 php.net/manual/en/ for details) to get the array of values for today
 (like the day of the month, month number, year, etc.). The getdate()
 function returns an array, one of whose members is 'wday', which is
the
 day of the week, starting with 0 for Sunday. Use that number to
 determine how many days to go back from today. Then use mktime() to
get
 the timestamps for each day in turn. You feed mktime() values from the
 getdate() call. Then you can use strftime() or something else to print
 out the dates in whatever format, given the timestamps you got.
 
 Be careful in feeding values to mktime(). If your week spans a
 month or year boundary, you'll need to compensate for it when giving
 mktime() month numbers, day numbers and year numbers.

You also need to be aware that on 32 bit Unix and Linux systems the
behavior of mktime() on dates after Jan 18, 2038 is undefined. The 32
bit counter overflows early on the 19th, so any value returned is
invalid. This is not a problem on 64 bit systems.

We ran into this recently because Support was defining never expire as
Today plus 30 years. A couple of sites started reporting problems about
two months ago.

Bob McConnell

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Calendar/Date

2009-03-18 Thread Robert Cummings
On Wed, 2009-03-18 at 11:46 -0400, Bob McConnell wrote:
 From: Paul M Foster
  On Tue, Mar 17, 2009 at 08:52:11PM -0700, Jason Todd Slack-Moehrle
 wrote:
  
  Hi All,
 
  Does anyone have code and/or advice for how to get get the current
  week (with a passed current day, say) and what then end date is at
  Saturday.
 
  So take today: Tuesday March 17, 2009
 
  I want to get:
  Sunday March 15, 2009
  Monday March 16, 2009
  Tuesday March 17, 2009
  Wednesday March 18, 2009
  Thursday March 19, 2009
  Friday March 20, 2009
  Saturday March 21, 2009
  
  I just answered a question similar to this. You might check the
  archives. In this case, you'll need to use the getdate() function (see
  php.net/manual/en/ for details) to get the array of values for today
  (like the day of the month, month number, year, etc.). The getdate()
  function returns an array, one of whose members is 'wday', which is
 the
  day of the week, starting with 0 for Sunday. Use that number to
  determine how many days to go back from today. Then use mktime() to
 get
  the timestamps for each day in turn. You feed mktime() values from the
  getdate() call. Then you can use strftime() or something else to print
  out the dates in whatever format, given the timestamps you got.
  
  Be careful in feeding values to mktime(). If your week spans a
  month or year boundary, you'll need to compensate for it when giving
  mktime() month numbers, day numbers and year numbers.
 
 You also need to be aware that on 32 bit Unix and Linux systems the
 behavior of mktime() on dates after Jan 18, 2038 is undefined. The 32
 bit counter overflows early on the 19th, so any value returned is
 invalid. This is not a problem on 64 bit systems.
 
 We ran into this recently because Support was defining never expire as
 Today plus 30 years. A couple of sites started reporting problems about
 two months ago.

But the solution doesn't even require mktime().

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar/Date

2009-03-18 Thread Paul M Foster
On Wed, Mar 18, 2009 at 11:46:31AM -0400, Bob McConnell wrote:

 From: Paul M Foster

snip

 
 You also need to be aware that on 32 bit Unix and Linux systems the
 behavior of mktime() on dates after Jan 18, 2038 is undefined. The 32
 bit counter overflows early on the 19th, so any value returned is
 invalid. This is not a problem on 64 bit systems.
 
 We ran into this recently because Support was defining never expire as
 Today plus 30 years. A couple of sites started reporting problems about
 two months ago.

This is why I normally never use the time functions in PHP. Instead, I
wrote a date class that uses Julian days internally and doesn't consult
PHP time functions. When I need some odd thing (like the date for the
end of the week), I just add it as a member to the date class. Plus,
PHP's date objects are woefully unfeatureful. If someone asks on the
list for a solution, I can use the PHP time functions for advising them,
but I don't personally use them.

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Calendar/Date

2009-03-18 Thread Bob McConnell
From: Paul M Foster
 On Wed, Mar 18, 2009 at 11:46:31AM -0400, Bob McConnell wrote:
 
 You also need to be aware that on 32 bit Unix and Linux systems the
 behavior of mktime() on dates after Jan 18, 2038 is undefined. The 32
 bit counter overflows early on the 19th, so any value returned is
 invalid. This is not a problem on 64 bit systems.
 
 We ran into this recently because Support was defining never expire
as
 Today plus 30 years. A couple of sites started reporting problems
about
 two months ago.
 
 This is why I normally never use the time functions in PHP. Instead, I
 wrote a date class that uses Julian days internally and doesn't
consult
 PHP time functions. When I need some odd thing (like the date for the
 end of the week), I just add it as a member to the date class. Plus,
 PHP's date objects are woefully unfeatureful. If someone asks on the
 list for a solution, I can use the PHP time functions for advising
them,
 but I don't personally use them.

Unfortunately, this code was initially inherited from another project
and already had mktime() based date calculations throughout (in 19 of
162 files). I'm the fourth programmer to work with this project and now
have to correct these problems. There are several other programmers who
have to correct it in their projects as well. None of us wrote the
original code, so we are all in the same boat. No matter what we want,
we can't just replace code wholesale because of the testing overhead and
other task priorities. We can only fix it after it becomes recognized as
a problem.

The other issue is that I don't do OOP. After 30 years of writing
procedural code, mostly assembler, PL/M and C, I simply don't see the
point of OO, nor can I justify the additional overhead. I have written
functions that others converted into methods, and occasionally re-use
functions that were written as methods, but have never used a whole
class.

Bob McConnell

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar/Date

2009-03-18 Thread Paul M Foster
On Wed, Mar 18, 2009 at 12:57:39PM -0400, Bob McConnell wrote:

 From: Paul M Foster
  On Wed, Mar 18, 2009 at 11:46:31AM -0400, Bob McConnell wrote:
  
  You also need to be aware that on 32 bit Unix and Linux systems the
  behavior of mktime() on dates after Jan 18, 2038 is undefined. The 32
  bit counter overflows early on the 19th, so any value returned is
  invalid. This is not a problem on 64 bit systems.
  
  We ran into this recently because Support was defining never expire
 as
  Today plus 30 years. A couple of sites started reporting problems
 about
  two months ago.
  
  This is why I normally never use the time functions in PHP. Instead, I
  wrote a date class that uses Julian days internally and doesn't
 consult
  PHP time functions. When I need some odd thing (like the date for the
  end of the week), I just add it as a member to the date class. Plus,
  PHP's date objects are woefully unfeatureful. If someone asks on the
  list for a solution, I can use the PHP time functions for advising
 them,
  but I don't personally use them.
 
 Unfortunately, this code was initially inherited from another project
 and already had mktime() based date calculations throughout (in 19 of
 162 files). I'm the fourth programmer to work with this project and now
 have to correct these problems. There are several other programmers who
 have to correct it in their projects as well. None of us wrote the
 original code, so we are all in the same boat. No matter what we want,
 we can't just replace code wholesale because of the testing overhead and
 other task priorities. We can only fix it after it becomes recognized as
 a problem.

I feel your pain. Been there, done that. T-shirt in drawer.

 
 The other issue is that I don't do OOP. After 30 years of writing
 procedural code, mostly assembler, PL/M and C, I simply don't see the
 point of OO, nor can I justify the additional overhead. I have written
 functions that others converted into methods, and occasionally re-use
 functions that were written as methods, but have never used a whole
 class.
 

You know, I'm gonna start a programmer blog to talk about things like
this (as soon as I finish the blog software, in progress now). I'm
sympathetic. I also come from a procedural background, and frankly don't
see that the OO hype has lived up to its promise.

I see two reasons to use OO under select circumstances: First,
namespaces. The more routines you have in a given program, the more
likely you are to have function name collisions. OO helps with that. The
other thing that comes to mind is that objects can have embedded value
members which get shared between the various class methods. Meaning I
don't have the overhead and hassle of having to pass those values around
to all the functions involved. I don't know that objects have any
noticeable overhead versus functions. But I'm pretty judicious about the
use of objects-- only if that's the best solution for a given problem
(best in *my* opinion).

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar/Date

2009-03-18 Thread Hans Åhlin
Weeks in a year is 52 or 53
Days in a year is 365 and if a leap year 366

If (

(365 (Days Of a year) * (Years From 1940)) + (Number of leap years
since 1940, (Years From 1940 / 4)  (if its a Leap year -1)) + ((Days
From 01-01) + 1) % 7 = (0-6 where 0 = Monday)

) is less then 3 (Thursday) then its in week nr 01 else if equal to 4
(Friday) its week 53 else its week 52

http://threesides.kronan-net.com/2008/08/04/date-calculation-algorithm/
-- 
MvH / Hans Åhlin - www.kronan-net.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Calendar/Date

2009-03-17 Thread Jason Todd Slack-Moehrle

Hi All,

Does anyone have code and/or advice for how to get get the current  
week (with a passed current day, say) and what then end date is at  
Saturday.


So take today: Tuesday March 17, 2009

I want to get:
Sunday March 15, 2009
Monday March 16, 2009
Tuesday March 17, 2009
Wednesday March 18, 2009
Thursday March 19, 2009
Friday March 20, 2009
Saturday March 21, 2009

Thanks!
-Jason

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar/Date

2009-03-17 Thread Paul M Foster
On Tue, Mar 17, 2009 at 08:52:11PM -0700, Jason Todd Slack-Moehrle wrote:

 Hi All,

 Does anyone have code and/or advice for how to get get the current
 week (with a passed current day, say) and what then end date is at
 Saturday.

 So take today: Tuesday March 17, 2009

 I want to get:
 Sunday March 15, 2009
 Monday March 16, 2009
 Tuesday March 17, 2009
 Wednesday March 18, 2009
 Thursday March 19, 2009
 Friday March 20, 2009
 Saturday March 21, 2009

I just answered a question similar to this. You might check the
archives. In this case, you'll need to use the getdate() function (see
php.net/manual/en/ for details) to get the array of values for today
(like the day of the month, month number, year, etc.). The getdate()
function returns an array, one of whose members is 'wday', which is the
day of the week, starting with 0 for Sunday. Use that number to
determine how many days to go back from today. Then use mktime() to get
the timestamps for each day in turn. You feed mktime() values from the
getdate() call. Then you can use strftime() or something else to print
out the dates in whatever format, given the timestamps you got.

Be careful in feeding values to mktime(). If your week spans a
month or year boundary, you'll need to compensate for it when giving
mktime() month numbers, day numbers and year numbers.

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Calendar Date Help

2008-05-28 Thread Mark Weaver

Hi all,

I've put this off as long as possible, however I think I've reached an 
impasse.


I've got an application that I've been writing. One of the modules for 
this app is an event calendar. I've got the calendar to the place where 
it displays the current month as well as previous and future months. The 
 place I'm stuck is it will only show months in the past or the future 
that are months in the current year.


Basically the method I'm using to move backward and forward is with Unix 
timestamps.


1. When the calendar first loads the what is checked for;
// passed in via $_GET
$what == current, prev, or next
  a. current is the default
$now = time()
$prev = date('n',$now)-1
$next = date('n',$now)+1
  b. Timestamp values are then stored in an array and then
sent to client in session cookie which is then accessed
upon each subsequent request to display the event calendar.

My question/boggle is why, when the calendar advances to 
December(current year) it will display January, but of the current year. 
The same happens in reverse.


Once I reach the end of the year either in the past or future the month 
increases or decreases accordingly, but the year doesn't change. Since 
the year value isn't changing the month calendar days that are displayed 
simply repeat themselves.


I know there's something I'm missing, but I am definitely not seeing 
what it is...


/** code below /

$cal = new Calendar;
$calpos = array();

// check incoming values
if ($what === current){
$cal-setCal(0,0,0,date('n'),1);
$now = time();
$prev = $cal-getStamp(date('n',$now)-1,1);
$next = $cal-getStamp(date('n',$now)+1,1);
$calpos['curr'] = $now;
$calpos['prev'] = $prev;
$calpos['next'] = $next;
$_SESSION['calendar'] = $calpos;
}   
elseif($what === prev){
$peek = $_SESSION['calendar'];
$now = $peek['prev'];
$cal-setCal(0,0,0,date('n',$now),1);
$prev = $cal-getStamp(date('n',$now)-1,1);
$next = $cal-getStamp(date('n',$now)+1,1);
$calpos['curr'] = $now;
$calpos['prev'] = $prev;
$calpos['next'] = $next;
$_SESSION['calendar'] = $calpos;
}
elseif($what === next){
$peek = $_SESSION['calendar'];
$now = $peek['next'];
$cal-setCal(0,0,0,date('n',$now),1);
$prev = $cal-getStamp(date('n',$now)-1,1);
$next = $cal-getStamp(date('n',$now)+1,1);
$calpos['curr'] = $now;
$calpos['prev'] = $prev;
$calpos['next'] = $next;
$_SESSION['calendar'] = $calpos;
}


function setCal($h=0,$m=0,$s=0,$offset,$dayVal=1){  
  $stamp = date('U',mktime($h,$m,$s, $offset,$dayVal,date('Y')));
  // Using the stamp the various necessary properties are set for the
  // object

function getStamp($dateStr,$dayVal=1){
  return date('U',mktime(0,0,0, $dateStr,$dayVal,date('Y')));
}

--

Mark
-
the rule of law is good, however the rule of tyrants just plain sucks!
Real Tax Reform begins with getting rid of the IRS.
==
Powered by CentOS5 (RHEL5)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar Date Help

2008-05-28 Thread Robert Cummings

On Wed, 2008-05-28 at 14:27 -0400, Mark Weaver wrote:
 Hi all,
 
 I've put this off as long as possible, however I think I've reached an 
 impasse.
 
 I've got an application that I've been writing. One of the modules for 
 this app is an event calendar. I've got the calendar to the place where 
 it displays the current month as well as previous and future months. The 
   place I'm stuck is it will only show months in the past or the future 
 that are months in the current year.
 
 Basically the method I'm using to move backward and forward is with Unix 
 timestamps.
 
 1. When the calendar first loads the what is checked for;
   // passed in via $_GET
   $what == current, prev, or next
a. current is the default
   $now = time()
   $prev = date('n',$now)-1
   $next = date('n',$now)+1
b. Timestamp values are then stored in an array and then
   sent to client in session cookie which is then accessed
   upon each subsequent request to display the event calendar.
 
 My question/boggle is why, when the calendar advances to 
 December(current year) it will display January, but of the current year. 
 The same happens in reverse.
 
 Once I reach the end of the year either in the past or future the month 
 increases or decreases accordingly, but the year doesn't change. Since 
 the year value isn't changing the month calendar days that are displayed 
 simply repeat themselves.
 
 I know there's something I'm missing, but I am definitely not seeing 
 what it is...
 
 /** code below /
 
 $cal = new Calendar;
 $calpos = array();
   
 // check incoming values
 if ($what === current){
   $cal-setCal(0,0,0,date('n'),1);
   $now = time();
   $prev = $cal-getStamp(date('n',$now)-1,1);
   $next = $cal-getStamp(date('n',$now)+1,1);
   $calpos['curr'] = $now;
   $calpos['prev'] = $prev;
   $calpos['next'] = $next;
   $_SESSION['calendar'] = $calpos;
 } 
 elseif($what === prev){
   $peek = $_SESSION['calendar'];
   $now = $peek['prev'];
   $cal-setCal(0,0,0,date('n',$now),1);
   $prev = $cal-getStamp(date('n',$now)-1,1);
   $next = $cal-getStamp(date('n',$now)+1,1);
   $calpos['curr'] = $now;
   $calpos['prev'] = $prev;
   $calpos['next'] = $next;
   $_SESSION['calendar'] = $calpos;
 }
 elseif($what === next){
   $peek = $_SESSION['calendar'];
   $now = $peek['next'];
   $cal-setCal(0,0,0,date('n',$now),1);
   $prev = $cal-getStamp(date('n',$now)-1,1);
   $next = $cal-getStamp(date('n',$now)+1,1);
   $calpos['curr'] = $now;
   $calpos['prev'] = $prev;
   $calpos['next'] = $next;
   $_SESSION['calendar'] = $calpos;
 }
 
 
 function setCal($h=0,$m=0,$s=0,$offset,$dayVal=1){
$stamp = date('U',mktime($h,$m,$s, $offset,$dayVal,date('Y')));
^
^
^
You don't want the current year. Fix this to a request year.

// Using the stamp the various necessary properties are set for the
// object
 
 function getStamp($dateStr,$dayVal=1){
return date('U',mktime(0,0,0, $dateStr,$dayVal,date('Y')));
 }
^
^
^
Similarly.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar Date Help

2008-05-28 Thread Mark Weaver

Robert Cummings wrote:

function getStamp($dateStr,$dayVal=1){
   return date('U',mktime(0,0,0, $dateStr,$dayVal,date('Y')));
}

^
^
^
Similarly.

Cheers,
Rob.


Hi Rob,

Changing:
function setCal($h=0,$m=0,$s=0,$offset,$dayVal=1){  
   $stamp = date('U',mktime($h,$m,$s, $offset,$dayVal,date('Y')));

To:
function setCal($h=0,$m=0,$s=0,$offset,$dayVal=1){
  if (date('Y')  date('Y',date('U',mktime($h,$m,$s,
 $offset,$dayVal,date('Y')
  {
 $stamp = date('U',mktime($h,$m,$s, $offset,$dayVal,date('Y')+1));
  }
  else
  {
 $stamp = date('U',mktime($h,$m,$s, $offset,$dayVal,date('Y')));
  }

Makes no change. Strange condition still exists. I was rather hoping
that if date('U',mktime($h,$m,$s, $offset,$dayVal,date('Y')))
is smart enough to know to increase or decrease the month value that it
would do the same to the year value accordingly.

$offset contain either date('n',$timestamp)-1  or  date('n',$timestamp)+1

The $timestamp value comes from the array being stored in the
$_SESSION['calendar'] as either 'current', 'prev', or 'next'.

--

Mark
-
the rule of law is good, however the rule of tyrants just plain sucks!
Real Tax Reform begins with getting rid of the IRS.
==
Powered by CentOS5 (RHEL5)


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar

2007-12-06 Thread Richard Heyes

On Dec 5, 2007 6:09 AM, Richard Heyes [EMAIL PROTECTED] wrote:

There is not much simple about a calendar, especially when you start
dealing with recurring events. How far into the future your calendar
allow events to recur will depend at least in part on how you intend
to store them. For instance, you can store them in a database where
you create a separate event row for each occurrence (though still be
linked by a common ID as you said), but you'll probably set your
limits based on storage to prevent adding a daily event for the next
10 years.

Stipulating an event to be daily could be as simple as a 0 or 1 flag. So
where's the storage concern?


The storage concern comes if you opt to store one copy of the event
for every day for as long as the event recurs. Why? Perhaps you want
to provide the ability to alter the time of a specific instance of a
recurring event (or delete one instance altogether) without changing
the other instances.


So you could have a table which contains events, and a table which 
contains exceptions. Simple and minimal storage requirements. Since 
exceptions will be, as their name suggests, exceptional, storage 
requirements will be small.


--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar

2007-12-05 Thread Andrew Ballard
On Dec 5, 2007 6:09 AM, Richard Heyes [EMAIL PROTECTED] wrote:
  There is not much simple about a calendar, especially when you start
  dealing with recurring events. How far into the future your calendar
  allow events to recur will depend at least in part on how you intend
  to store them. For instance, you can store them in a database where
  you create a separate event row for each occurrence (though still be
  linked by a common ID as you said), but you'll probably set your
  limits based on storage to prevent adding a daily event for the next
  10 years.

 Stipulating an event to be daily could be as simple as a 0 or 1 flag. So
 where's the storage concern?

The storage concern comes if you opt to store one copy of the event
for every day for as long as the event recurs. Why? Perhaps you want
to provide the ability to alter the time of a specific instance of a
recurring event (or delete one instance altogether) without changing
the other instances.

   You could also store a single event record that includes the
  rules for recurrence and then calculate the dates of each instance as
  needed, but that could get pretty CPU intensive. (I'm assuming you
  want to stick with simple periodic recursion, not more complex
  things like the date for Easter or events that don't have any set
  pattern.)

 I really don't see anything CPU intensive about this. At most you're
 going to be storing some set dates that the event should occur on.
 Nothing CPU intensive about that.


If you are only storing a single row for an recurring event rather
than one row for each instance, then you have to evaluate your rule
for each event inside the view you are displaying (month, year, etc.)
to determine the dates for the event. I'm not talking grinding a
server to a halt, but depending on how many events have to be
calculated and how many users you have at a given moment, it could
become noticable.

  I know this probably muddies your original question even further, but
  I'll say again -- there is not much simple when it comes to
  calendars.

 Calendars can be simple, or they can account for a lot and be complex.

 --
 Richard Heyes
 http://www.websupportsolutions.co.uk

 Knowledge Base and HelpDesk software
 that can cut the cost of online support

 ** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **


Calendars themselves aren't that much to build. Even simple one-time
events are pretty easy. Beyond that, all I'm saying is that you have
to make a design decision based on your needs as to whether you store
a lot to avoid repeating calculations or calculate more to store less.
In any event, the biggest troublemaker I've had to deal with when it
comes to calendars have been related to time zones and daylight saving
time.

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar

2007-12-05 Thread Richard Heyes

There is not much simple about a calendar, especially when you start
dealing with recurring events. How far into the future your calendar
allow events to recur will depend at least in part on how you intend
to store them. For instance, you can store them in a database where
you create a separate event row for each occurrence (though still be
linked by a common ID as you said), but you'll probably set your
limits based on storage to prevent adding a daily event for the next
10 years.


Stipulating an event to be daily could be as simple as a 0 or 1 flag. So 
where's the storage concern?


 You could also store a single event record that includes the

rules for recurrence and then calculate the dates of each instance as
needed, but that could get pretty CPU intensive. (I'm assuming you
want to stick with simple periodic recursion, not more complex
things like the date for Easter or events that don't have any set
pattern.)


I really don't see anything CPU intensive about this. At most you're 
going to be storing some set dates that the event should occur on. 
Nothing CPU intensive about that.



I know this probably muddies your original question even further, but
I'll say again -- there is not much simple when it comes to
calendars.


Calendars can be simple, or they can account for a lot and be complex.

--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar

2007-12-04 Thread Børge Holen
On Monday 03 December 2007 13:37:45 Emil Edeholt wrote:
 Hi,


was this a mathematical question? Yes, someone on this list, can probably help 
you to do some finesse, but I like it mathematical and clean code

 I'm about to add some simple calendar functions to my application, and
 I'm thinking of how I should implement recurring events. Are there one 
 standard way most people use that works well? 

a timestamp

 I guess you have some kind 
 of emitter event that creates the recurring events and a group id that
 holds the events together.

a timestamp + a year ahead as an example, a week, a day, a week + two days, 
it's all very simple to add up with php.

 How long forward does one usually create the 
 events. Two-three years...?

chaa... What event except birthdays weddings  and maby elections are we 
talking about here? I cannot tell what I'm supposed to do next week and it 
seems kind'a hard to grasp at what youre thinkin of


 Sorry if I'm a bit blury. But any ideas on recurring events are welcome.
 I guess I could just hack something together, but it would be fun to do
 it right.

wee bit blurry.


 Regards Emil



-- 
---
Børge Holen
http://www.arivene.net

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar

2007-12-04 Thread Andrew Ballard
On Dec 3, 2007 7:37 AM, Emil Edeholt [EMAIL PROTECTED] wrote:
 Hi,

 I'm about to add some simple calendar functions to my application, and
 I'm thinking of how I should implement recurring events. Are there one
 standard way most people use that works well? I guess you have some kind
 of emitter event that creates the recurring events and a group id that
 holds the events together. How long forward does one usually create the
 events. Two-three years...?

 Sorry if I'm a bit blury. But any ideas on recurring events are welcome.
 I guess I could just hack something together, but it would be fun to do
 it right.

 Regards Emil


Emil,

There is not much simple about a calendar, especially when you start
dealing with recurring events. How far into the future your calendar
allow events to recur will depend at least in part on how you intend
to store them. For instance, you can store them in a database where
you create a separate event row for each occurrence (though still be
linked by a common ID as you said), but you'll probably set your
limits based on storage to prevent adding a daily event for the next
10 years. You could also store a single event record that includes the
rules for recurrence and then calculate the dates of each instance as
needed, but that could get pretty CPU intensive. (I'm assuming you
want to stick with simple periodic recursion, not more complex
things like the date for Easter or events that don't have any set
pattern.)  Your decision will also be affected by whether you want to
be able to modify a specific instance of a recurring event -- say to
move your monthly meeting from 1:00 to 2:30 for next month only or to
cancel your weekly card game 3 weeks from now without altering other
instances of the same events -- will impact how you approach your
design.

And none of this takes into account the fun you get if you have to
deal with multiple time zones and/or daylight saving time. For
instance, if you store events in local time, you have to store the
time zone with the record so you can convert from one time zone to
another. If you store events in UTC, you usually have to account for
shifts in daylight saving time so that your weekly 2:00 staff meetings
don't suddenly change to 1:00. Then there are the occasional changes
to the beginning/ending dates for DST like happened this year for the
US.

I know this probably muddies your original question even further, but
I'll say again -- there is not much simple when it comes to
calendars.

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar

2007-12-03 Thread Richard Heyes
I'm about to add some simple calendar functions to my application, and 
I'm thinking of how I should implement recurring events. Are there one 
standard way most people use that works well? I guess you have some kind 
of emitter event that creates the recurring events and a group id that 
holds the events together. How long forward does one usually create the 
events. Two-three years...?


Sorry if I'm a bit blury. But any ideas on recurring events are welcome. 
I guess I could just hack something together, but it would be fun to do 
it right.


If you're on Unix you will need a cron job that runs every x minutes. 
That could check a database for jobs/tasks that need running, using the 
current time and an option like run this job every 10 minutes to 
determine what needs running, (ie in that case if the current time isn't 
divisible by ten then don't run it).


--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Calendar

2007-12-03 Thread Emil Edeholt

Hi,

I'm about to add some simple calendar functions to my application, and 
I'm thinking of how I should implement recurring events. Are there one 
standard way most people use that works well? I guess you have some kind 
of emitter event that creates the recurring events and a group id that 
holds the events together. How long forward does one usually create the 
events. Two-three years...?


Sorry if I'm a bit blury. But any ideas on recurring events are welcome. 
I guess I could just hack something together, but it would be fun to do 
it right.


Regards Emil

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar booking form in PHP/MySQL

2007-07-08 Thread Zareef Ahmed

Hi Murphy,
I think till now you got the idea why you did't got replies for query.
Please do a simple google search and you will find something. using
sourceforge is also good idea.

People are here to solve and discuss the programming problems of each
others, NOT to do work for each other  :)

Zareef Ahmed

On 7/3/07, Timothy Murphy [EMAIL PROTECTED] wrote:


I'm looking for a PHP/MySQL calendar booking form,
which I am sure must have been done a million times.

This will show a calendar on the web mirroring a MySQL table.
Each entry in the MySQL table will show two dates, Start and End.
The dates between these should be shown in red on the calendar.

Any pointers or scipts or suggestions gratefully received.

--
Timothy Murphy
e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie
tel: +353-86-2336090, +353-1-2842366
s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
Thanks and Regards
Zareef Ahmed
===
PHP Developer India http://www.zareef.net


[PHP] Calendar booking form in PHP/MySQL

2007-07-03 Thread Timothy Murphy
I'm looking for a PHP/MySQL calendar booking form,
which I am sure must have been done a million times.

This will show a calendar on the web mirroring a MySQL table.
Each entry in the MySQL table will show two dates, Start and End.
The dates between these should be shown in red on the calendar.

Any pointers or scipts or suggestions gratefully received.

-- 
Timothy Murphy  
e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie
tel: +353-86-2336090, +353-1-2842366
s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar

2007-06-14 Thread Richard Lynch
On Wed, June 13, 2007 4:27 pm, Jim Lucas wrote:
 Richard Lynch wrote:
 On Wed, June 13, 2007 12:50 pm, Clint Tredway wrote:

 Oh, and here's the source I've been using for one web calendar for
 over a decade:
 http://uncommonground.com/events.phps

 It's got some stuff you don't need, and is a one-off script rather
 than a fancy full packaged widget to handle every possible calendar
 output known to mankind, but you might be able to use it.

 YMMV

 BTW: I like the Printer Friendly PDF output.  Do you generate that on
 the fly?

Yes.

Here's the source for that:

http://uncommonground.com/events_pdf.phps

Actually, funny story with that one...

The owner used to print up about 200 of these monthly calendars to
hand out, much like that PDF, only different.

I walked into his office one day, and he was sitting there cussing and
copying and pasting and typing, and I asked him what the heck he was
doing.

I had never even thought about how he actually got those printouts... :-(

He's like Every dang month, I have to re-type the whole calendar in
this stupid program and format it and adjust it.  It blows my whole
day, cuz it takes about 4 hours...

I told him: Finish it for this month, but you'll never have to do it
again.

He didn't believe me, until I added that little button to his website.
:-)

Now 4 hours a month may not seem like a lot, but it does add up to a
full work-week a year, and sometimes getting that paper calendar out
on time was pretty inconvenient while trying to run a restaurant. 
It's not like it can be put off a week or two.

Well, actually, sometimes it was put off a week, like when the A/C
breaks down, or the wind slams the door and breaks out the glass, or
the dishwasher breaks or...  You'd be amazed how many things can go
wrong when you run a restaurant.

Then of course, with no calendars handy, we had way too many staff
running around asking where the dang things were, and some cranky
customers who wanted to plan their nights out.  That's bad.

We also saved a fair chunk of change every month by weaning people off
the idea of taking a paper copy from us and just printing their own
from the website.

First we stopped putting the paper calendars out in three strategic
locations throughout the restaurant, and just had the hostess handing
them out at the entrance hostess stand.

We then trained her to say I'm all out, but you can print them at
home if you visit our website  If the customer expressed any dismay
(or even just displeasure) at that (no computer, no 'net, no printer,
whatever) she'd rummage around in the hostess stand and find one
(from the MUCH smaller stack we printed up)

It took a few months, maybe even half a year, but...

These days, we print up 6 each month, and hang one by each phone, one
at the hostess stand, and one by the sound booth, and that's it.

And I had fun writing up the little phrases to label the button. :-)

A customer needs one we printed up so infrequently, we just give them
one of our reference copies and print another when it happens, maybe
once a Quarter.

Granted, my computer hacks to shrink font size aren't as pretty as his
human judgement as what to leave off, but still...

Plus he didn't have the energy to do a thumbnail image for every
artist, so that's a win :-)

So, all in all, that little button saved him quite a bit of money in
the long run, and only took me a few hours to implement.  Okay, and a
few days to fine-tune and the occasional maintenance patch (like today
for the SQL injection, oops).

I suppose I should fix the reliance on register_globals, but I've
always been the thou shalt initialize all variables kinda guy with
E_NOTICE on so I'm not as concerned about that bit.

Anyway, the point is that you can often analyze a process and make a
significant savings in the stupidest simplest thing.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Calendar

2007-06-13 Thread Clint Tredway

Is there a decent free calendar? I just need to show a few events on a
calendar.

--
I am not a diabetic, I have diabetes
my blog - http://grumpee.instantspot.com/blog

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Calendar

2007-06-13 Thread Jim Moseby
 
 Is there a decent free calendar? I just need to show a few events on a
 calendar.

You could try your bank.  They usually have free calendars, coffee mugs,
pencils, etc.  ;-)

Seriously though, type 'php calendar' into google and see what happens.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Calendar

2007-06-13 Thread Jim Moseby

 I did that and either they are not free or suck... dont appreciate the
comment

 
 On 6/13/07, Jim Moseby [EMAIL PROTECTED] wrote:
  
   Is there a decent free calendar? I just need to show a few events on a
   calendar.
 
  You could try your bank.  They usually have free calendars, coffee mugs,
  pencils, etc.  ;-)
 
  Seriously though, type 'php calendar' into google and see what happens.

1) Please don't top-post.
2) Please include the list in  your replies.
3) Please search dictionary.com for 'humor', and learn to recognize it.
hint: A winkie ';-)' is a clue!

You will likely get a more useful response from the list members if you
include enough information.  For instance, what do you mean by 'decent'?
(One man's 'decent' is another man's 'sucks') What do you mean by
'calendar'?  Do you mean a full-blown scheduling system, or do you just want
to display a one month calendar?  Do you need a database back end, or will
the content be static?  What is the problem you are trying to solve?  etc...

Just trying to help.

JM

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 12:50 pm, Clint Tredway wrote:
 Is there a decent free calendar? I just need to show a few events on a
 calendar.

Having looked at a LOT of web calendars (for touring musicians) I can
say with certainty that if you only have a FEW events, a month-like
layout with boxes for every day looks really silly/ugly when there's
only one or two events in it...

A simple listing, in order, nicely formatted, will serve much better.

Oh, and here's the source I've been using for one web calendar for
over a decade:
http://uncommonground.com/events.phps

It's got some stuff you don't need, and is a one-off script rather
than a fancy full packaged widget to handle every possible calendar
output known to mankind, but you might be able to use it.

YMMV

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Calendar

2007-06-13 Thread Daevid Vincent
 -Original Message-
 From: Richard Lynch [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, June 13, 2007 12:05 PM

 On Wed, June 13, 2007 12:50 pm, Clint Tredway wrote:
  Is there a decent free calendar? I just need to show a few 
 events on a
  calendar.
 
 Having looked at a LOT of web calendars (for touring musicians) I can
 say with certainty that if you only have a FEW events, a month-like
 layout with boxes for every day looks really silly/ugly when there's
 only one or two events in it...
 
 A simple listing, in order, nicely formatted, will serve much better.

Here's one I wrote and use:
http://www.rollinballzcrew.com/nextparty.phtml

I even implemented iCal compatible events. :)

If interested, I could send you the page,etc.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] calendar Q

2006-08-12 Thread Richard Lynch
On Fri, August 11, 2006 12:23 am, William Stokes wrote:
 One more question. I have dates as a datetime in DB. Like 2006-08-11
 08:20:00 and I'm playing only with date part in the calendar
 2006-08-11. So
 how to compare this date to the datetime info in DB? Do I need to use
 DATE_FORMAT or someting like this in the query?

One easy way would be to type-cast it to date in your query:

where convert(whatdate, 'date') = '2006-08-11'

However, not all SQL engines do data type conversion the same way...

If you never ever need the time part, then you could just change the
schema to use only 'date' and not 'timestamp'

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] calendar Q

2006-08-11 Thread Jef Sullivan
I like using mktime() whenever I pull dates from a database.
Get your date from the query, store it to a value:

$val = mktime($qval);

Then you can compare any part of the date you want by using
date(). 

if( date( m, date(now)) == date( m, $val ))

m = month



Jef
-Original Message-
From: William Stokes [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 10, 2006 11:23 PM
To: php-general@lists.php.net
Subject: Re: [PHP] calendar Q

Ok. Thanks.

One more question. I have dates as a datetime in DB. Like 2006-08-11 
08:20:00 and I'm playing only with date part in the calendar 2006-08-11. So 
how to compare this date to the datetime info in DB? Do I need to use 
DATE_FORMAT or someting like this in the query?

Thanks
-Will



Richard Lynch [EMAIL PROTECTED] kirjoitti 
viestissä:[EMAIL PROTECTED]
 On Thu, August 10, 2006 12:14 pm, William Stokes wrote:
 I have a calendar script that displays a simple mini calendar view one
 month
 at a time. User can click any date and the calendar opens another page
 that
 displays that date's events. I would like to highlight to the mini
 calendar
 view dates that have an event in database. So what would be a simple
 way to
 check for events while the selected months days are printed to screen?

 Depending on the number of records, the PHP-MySQL connection speed,
 and the indexes or lack thereof on your date column...

 1. You could do a query for each date like:
 select count(*) from events where whatdate = '$date'

 2. You could pre-fill an array with dates that have an event:
 select whatdate from events
 where whatdate = '$month/1/$year'
 and whatdate  '{$month+1}/1/$year' /*might need something better here*/
 group by whatdate
 order by whatdate
 while (list($whatdate) = mysql_fetch_row($result)){
  $event_date[$whatdate] = true;
 }
 Then, while filling out the calendar, just check:
 if (isset($event_date[$date])){
  //color it as having events
 }

 -- 
 Like Music?
 http://l-i-e.com/artists.htm 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] calendar Q

2006-08-10 Thread William Stokes
Hello,

I have a calendar script that displays a simple mini calendar view one month 
at a time. User can click any date and the calendar opens another page that 
displays that date's events. I would like to highlight to the mini calendar 
view dates that have an event in database. So what would be a simple way to 
check for events while the selected months days are printed to screen?

Thanks
-Will 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] calendar Q

2006-08-10 Thread Brad Bonkoski

Really depends on how you display the calendar...
if you go day by day building the table cells, then it should be easy 
enough because you should already have the date you are working with...
so a query like select count(*) from events where date='date' and if 
count is  0 then display it differently.
On the other hand if you are using pre-canned functions to dump out the 
entire month, then it would prove more difficult.


-B

William Stokes wrote:

Hello,

I have a calendar script that displays a simple mini calendar view one month 
at a time. User can click any date and the calendar opens another page that 
displays that date's events. I would like to highlight to the mini calendar 
view dates that have an event in database. So what would be a simple way to 
check for events while the selected months days are printed to screen?


Thanks
-Will 

  


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] calendar Q

2006-08-10 Thread Richard Lynch
On Thu, August 10, 2006 12:14 pm, William Stokes wrote:
 I have a calendar script that displays a simple mini calendar view one
 month
 at a time. User can click any date and the calendar opens another page
 that
 displays that date's events. I would like to highlight to the mini
 calendar
 view dates that have an event in database. So what would be a simple
 way to
 check for events while the selected months days are printed to screen?

Depending on the number of records, the PHP-MySQL connection speed,
and the indexes or lack thereof on your date column...

1. You could do a query for each date like:
select count(*) from events where whatdate = '$date'

2. You could pre-fill an array with dates that have an event:
select whatdate from events
where whatdate = '$month/1/$year'
and whatdate  '{$month+1}/1/$year' /*might need something better here*/
group by whatdate
order by whatdate
while (list($whatdate) = mysql_fetch_row($result)){
  $event_date[$whatdate] = true;
}
Then, while filling out the calendar, just check:
if (isset($event_date[$date])){
  //color it as having events
}

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] calendar Q

2006-08-10 Thread William Stokes
Ok. Thanks.

One more question. I have dates as a datetime in DB. Like 2006-08-11 
08:20:00 and I'm playing only with date part in the calendar 2006-08-11. So 
how to compare this date to the datetime info in DB? Do I need to use 
DATE_FORMAT or someting like this in the query?

Thanks
-Will



Richard Lynch [EMAIL PROTECTED] kirjoitti 
viestissä:[EMAIL PROTECTED]
 On Thu, August 10, 2006 12:14 pm, William Stokes wrote:
 I have a calendar script that displays a simple mini calendar view one
 month
 at a time. User can click any date and the calendar opens another page
 that
 displays that date's events. I would like to highlight to the mini
 calendar
 view dates that have an event in database. So what would be a simple
 way to
 check for events while the selected months days are printed to screen?

 Depending on the number of records, the PHP-MySQL connection speed,
 and the indexes or lack thereof on your date column...

 1. You could do a query for each date like:
 select count(*) from events where whatdate = '$date'

 2. You could pre-fill an array with dates that have an event:
 select whatdate from events
 where whatdate = '$month/1/$year'
 and whatdate  '{$month+1}/1/$year' /*might need something better here*/
 group by whatdate
 order by whatdate
 while (list($whatdate) = mysql_fetch_row($result)){
  $event_date[$whatdate] = true;
 }
 Then, while filling out the calendar, just check:
 if (isset($event_date[$date])){
  //color it as having events
 }

 -- 
 Like Music?
 http://l-i-e.com/artists.htm 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php calendar

2006-06-20 Thread Ahmed Saad

On 19/06/06, Ryan A [EMAIL PROTECTED] wrote:

guess i am using special version of google...


an iGoogle? ;)

/ahmed

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] php calendar

2006-06-19 Thread weetat

Hi all ,

 Any php calendar out there, search google , most of them are 
javascript calendar ?


Thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php calendar

2006-06-19 Thread Ryan A
Strange... all I wrote was php calender on google
and i got a whole bunch of results... 

guess i am using special version of google...

-Ryan

--- weetat [EMAIL PROTECTED] wrote:

 Hi all ,
 
   Any php calendar out there, search google , most
 of them are 
 javascript calendar ?
 
 Thanks
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Calendar script

2006-03-02 Thread tedd

I have been trolling through hotscripts.com and google all night and
have tried out a couple of promising-looking PHP-based calendar
scripts with no luck, so I'm turning to the collective wisdom of the
list to help me out. I'm looking for a calendar script that I can plug
into a web site that can support color-coded categories and multiple
calendars per installation. Single user is fine, I just need something
that a web novice can use to enter in dates that properties are either
available or not available with color codes indicating tentative
reservations and confirmed reservations. I'm about ready to start
rolling my own, but before I do that, I'm hoping that one of you knows
of a script that is out there (preferably for free, but at least less
than $50) that I could use. Thanks, in advance, for your help!!

--
Robin Hastings


Robin:

I'm not representative of the collective wisdom of this group, but 
you might like to review:


http://www.weberdev.com/get_example-3306.html

http://www.weberdev.com/get_example-3133.html

http://www.weberdev.com/get_example-1780.html

tedd
--

http://sperling.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP Calendar script

2006-03-01 Thread Robin Hastings
I have been trolling through hotscripts.com and google all night and
have tried out a couple of promising-looking PHP-based calendar
scripts with no luck, so I'm turning to the collective wisdom of the
list to help me out. I'm looking for a calendar script that I can plug
into a web site that can support color-coded categories and multiple
calendars per installation. Single user is fine, I just need something
that a web novice can use to enter in dates that properties are either
available or not available with color codes indicating tentative
reservations and confirmed reservations. I'm about ready to start
rolling my own, but before I do that, I'm hoping that one of you knows
of a script that is out there (preferably for free, but at least less
than $50) that I could use. Thanks, in advance, for your help!!

--
Robin Hastings
[EMAIL PROTECTED]
http://www.rhastings.net

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar program like on php.net

2005-08-01 Thread Burhan Khalid


On Aug 1, 2005, at 5:45 AM, Roger Thomas wrote:


Quoting Jim Moseby [EMAIL PROTECTED]:


I'd repost the link for you, but I've already deleted it.  Sorry.  
Look back through the archives.


JM




I searched for 'Jim Moseby calendar' in the general and Dev mailing  
list but no go. Anty clue?


It was a plane hack of mine from a couple of years ago with a couple of
additions since.  You are welcome to grab it from CVS.  See
http://cvs.php.net/phpweb/ and look at cal.php

-Rasmus


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Calendar program like on php.net

2005-07-31 Thread Roger Thomas
Quoting Jim Moseby [EMAIL PROTECTED]:

 I'd repost the link for you, but I've already deleted it.  Sorry. Look back 
 through the archives.
 
 JM
 

I searched for 'Jim Moseby calendar' in the general and Dev mailing list but no 
go. Anty clue?

--
Roger




---
Sign Up for free Email at http://ureg.home.net.my/
---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Calendar program like on php.net

2005-07-29 Thread Reuben D. Budiardja

Hello,
Anyone knows a simple calendar program that will let people to add event, and 
then after the event is approved by webmaster / moderator, the event would be 
added to the calendar ? 

Just like the calendar for Upcoming Events on www.php.net. What program is 
that ? 

I've looked at PHPGroupware and Horde but they seems to be more complicated 
than what I need. I just need something simple and straightforward for my 
organization.

Thank you for any help
RDB 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Calendar program like on php.net

2005-07-29 Thread Jim Moseby
 Hello,
 Anyone knows a simple calendar program that will let people 
 to add event, and 
 then after the event is approved by webmaster / moderator, 
 the event would be 
 added to the calendar ? 
 
 Just like the calendar for Upcoming Events on www.php.net. 
 What program is 
 that ? 
 
 I've looked at PHPGroupware and Horde but they seems to be 
 more complicated 
 than what I need. I just need something simple and 
 straightforward for my 
 organization.
 

The author of the calendar program on php.net answered this question, and
gave you a link to download the very code in use there. I'd repost the link
for you, but I've already deleted it.  Sorry. Look back through the
archives.

JM

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Calendar program like on php.net

2005-07-28 Thread Reuben D. Budiardja

Hello,
Anyone knows a simple calendar program that will let people to add event, and 
then after the event is approved by webmaster / moderator, the event would be 
added to the calendar ? 

Just like the calendar for Upcoming Events on www.php.net. What program is 
that ? 

I've looked at PHPGroupware and Horde but they seems to be more complicated 
than what I need. I just need something simple and straightforward for my 
organization.

Thank you for any help
RDB 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar program like on php.net

2005-07-28 Thread Rasmus Lerdorf
Reuben D. Budiardja wrote:
 Hello,
 Anyone knows a simple calendar program that will let people to add event, and 
 then after the event is approved by webmaster / moderator, the event would be 
 added to the calendar ? 
 
 Just like the calendar for Upcoming Events on www.php.net. What program is 
 that ? 

It was a plane hack of mine from a couple of years ago with a couple of
additions since.  You are welcome to grab it from CVS.  See
http://cvs.php.net/phpweb/ and look at cal.php

-Rasmus

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Calendar Script

2004-12-29 Thread Joe Harman



Hello,

I just finished 
writing a basic calendar script... I wanted to pass it out to everyone here... 
maybe someone could use it... or, even better optimize it.. .and maybe share 
that with me.

?php

function 
Cal_Month(){// Get Today's 
Date$todays_date = 
getdate();// Determine what month to 
displayif(isset($_GET['month'])){$resolve_time 
= "1 ".$_GET['month']." 
".$_GET['year'];$resolve_first_day_of_month = 
strtotime($resolve_time);$resolved_date = 
getdate($resolve_first_day_of_month);}else{$resolved_date 
= $todays_date;}// if this is the current 
month - say it's okay to mark today on the 
calendarif($todays_date['year'] == $resolved_date['year'] 
 $todays_date['month'] == 
$resolved_date['month']){ 
$mark_today_on_calendar = TRUE;}

// HOW 
MANY DAYS ARE IN THIS MONTH$days_in_current_month = 
cal_days_in_month(CAL_GREGORIAN, $resolved_date['mon'], 
$resolved_date['year']);// STRING TO START THE 
CALENDAR ON THE FIRST DAY OF THE MONTH$show_month = 
$resolved_date['month'];$show_year = 
$resolved_date['year'];// Get Info for Current 
Displayed Month$string_time = "1 ".$show_month." 
".$show_year;$first_day_of_month = 
strtotime($string_time);$first_day = 
getdate($first_day_of_month); 
//**$the_first_day_of_the_month = 
getdate($first_day_of_month); // Starts from the 
1st$num_days_week = 
7;$num_days_in_month = cal_days_in_month(CAL_GREGORIAN, 
$resolved_date['mon'], 
$resolved_date['year']);// Get info for NEXT 
month$show_next = strtotime("+1 Month", 
$first_day_of_month); $show_next_month_first_day = 
getdate($show_next);// Get info for PREV 
month$show_prev = strtotime("-1 Month", 
$first_day_of_month); $show_prev_month_first_day = 
getdate($show_prev);$next_month = 
$show_next_month_first_day['month'];$next_year = 
$show_next_month_first_day['year'];$prev_month = 
$show_prev_month_first_day['month'];$prev_year = 
$show_prev_month_first_day['year'];$link_next_month 
= "a href="" Month 
/a";$link_prev_month = "a 
href="" Month 
/a";// Table Size Variables... will be 
moved to CSS eventually$table_align = 
"center";$table_width = 
500;$table_height = 50;$cell_width = 
$table_width/7;// Start HTML for Building 
Calendar$cal_generated .= 
"center".$link_prev_month." 
".$link_next_month."/center";$cal_generated 
.= "table width=\"".$table_width."\" border=\"1\" 
align=\"".$table_align."\"";$cal_generated 
.= "trtd 
colspan=\"7\"center".$the_first_day_of_the_month['month']." 
".$the_first_day_of_the_month['year']."/center/td/tr";$cal_generated 
.= "trtd width=\"".$cell_width."\"Sun/tdtd 
width=\"".$cell_width."\"Mon/td";$cal_generated 
.= "td width=\"".$cell_width."\"Tue/tdtd 
width=\"".$cell_width."\"Wed/tdtd 
width=\"".$cell_width."\"Thu/td";$cal_generated 
.= "td width=\"".$cell_width."\"Fri/tdtd 
width=\"".$cell_width."\"Sat/td/tr";// 
Initial Calendar Buildin Variables$first_week_marked 
= FALSE;$month_day_count = 
1;$week_day_count = 0;

// Start 
The Calendar Loopdo 
{if($mark_today_on_calendar == TRUE 
 $todays_date['mday'] == 
$month_day_count){$highlight_today_open 
= "font color=\"#99\""; 
$highlight_today_close = 
"/font";}else{$highlight_today_open 
= "font color=\"#00\""; 
$highlight_today_close = 
"/font";}// 
If it is the first day of the week open a 
ROWif($week_day_count == 
0){$cal_generated 
.= 
"tr";}if 
($first_week_marked == 
FALSE){$blank_cell 
= 0; do 
{if($the_first_day_of_the_month['wday'] 
 
$blank_cell){$cal_generated 
.= "td height=\"".$table_height."\" 
valign=\"top\"/td";$blank_cell++;}else{$cal_generated 
.= "td height=\"".$table_height."\" 
valign=\"top\"".$highlight_today_open 
."".$month_day_count."".$highlight_today_close."/td";$first_week_marked 
= 
TRUE;}$week_day_count 
= 
$the_first_day_of_the_month['wday'];} 
while ($first_week_marked == 
FALSE);}else{$cal_generated 
.= "td height=\"".$table_height."\" 
valign=\"top\"".$highlight_today_open 
."".$month_day_count."".$highlight_today_close."/td";}$month_day_count++;// 
If it is the last day of the week close 
ROWif($week_day_count == 
6){$cal_generated 
.= 
"/tr";}$week_day_count++;// 
Countingsif($week_day_count 
== 
7){$week_day_count=0;}} 
while ($month_day_count = $num_days_in_month);// End Calendar 
Loop$cal_generated .= 
"/table";return 
$cal_generated;}

echo 
Cal_Month();
?

Joe Harman

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Calendar Script

2004-12-29 Thread Joe Harman




Hello,

I just finished 
writing a basic calendar script... I wanted to pass it out to everyone here... 
maybe someone could use it... or, even better optimize it.. .and maybe share 
that with me.

?php

function 
Cal_Month(){// Get Today's 
Date$todays_date = 
getdate();// Determine what month to 
displayif(isset($_GET['month'])){$resolve_time 
= "1 ".$_GET['month']." 
".$_GET['year'];$resolve_first_day_of_month = 
strtotime($resolve_time);$resolved_date = 
getdate($resolve_first_day_of_month);}else{$resolved_date 
= $todays_date;}// if this is the current 
month - say it's okay to mark today on the 
calendarif($todays_date['year'] == $resolved_date['year'] 
 $todays_date['month'] == 
$resolved_date['month']){ 
$mark_today_on_calendar = TRUE;}

// HOW 
MANY DAYS ARE IN THIS MONTH$days_in_current_month = 
cal_days_in_month(CAL_GREGORIAN, $resolved_date['mon'], 
$resolved_date['year']);// STRING TO START THE 
CALENDAR ON THE FIRST DAY OF THE MONTH$show_month = 
$resolved_date['month'];$show_year = 
$resolved_date['year'];// Get Info for Current 
Displayed Month$string_time = "1 ".$show_month." 
".$show_year;$first_day_of_month = 
strtotime($string_time);$first_day = 
getdate($first_day_of_month); 
//**$the_first_day_of_the_month = 
getdate($first_day_of_month); // Starts from the 
1st$num_days_week = 
7;$num_days_in_month = cal_days_in_month(CAL_GREGORIAN, 
$resolved_date['mon'], 
$resolved_date['year']);// Get info for NEXT 
month$show_next = strtotime("+1 Month", 
$first_day_of_month); $show_next_month_first_day = 
getdate($show_next);// Get info for PREV 
month$show_prev = strtotime("-1 Month", 
$first_day_of_month); $show_prev_month_first_day = 
getdate($show_prev);$next_month = 
$show_next_month_first_day['month'];$next_year = 
$show_next_month_first_day['year'];$prev_month = 
$show_prev_month_first_day['month'];$prev_year = 
$show_prev_month_first_day['year'];$link_next_month 
= "a href="" Month 
/a";$link_prev_month = "a 
href="" Month 
/a";// Table Size Variables... will be 
moved to CSS eventually$table_align = 
"center";$table_width = 
500;$table_height = 50;$cell_width = 
$table_width/7;// Start HTML for Building 
Calendar$cal_generated .= 
"center".$link_prev_month." 
".$link_next_month."/center";$cal_generated 
.= "table width=\"".$table_width."\" border=\"1\" 
align=\"".$table_align."\"";$cal_generated 
.= "trtd 
colspan=\"7\"center".$the_first_day_of_the_month['month']." 
".$the_first_day_of_the_month['year']."/center/td/tr";$cal_generated 
.= "trtd width=\"".$cell_width."\"Sun/tdtd 
width=\"".$cell_width."\"Mon/td";$cal_generated 
.= "td width=\"".$cell_width."\"Tue/tdtd 
width=\"".$cell_width."\"Wed/tdtd 
width=\"".$cell_width."\"Thu/td";$cal_generated 
.= "td width=\"".$cell_width."\"Fri/tdtd 
width=\"".$cell_width."\"Sat/td/tr";// 
Initial Calendar Buildin Variables$first_week_marked 
= FALSE;$month_day_count = 
1;$week_day_count = 0;

// Start 
The Calendar Loopdo 
{if($mark_today_on_calendar == TRUE 
 $todays_date['mday'] == 
$month_day_count){$highlight_today_open 
= "font color=\"#99\""; 
$highlight_today_close = 
"/font";}else{$highlight_today_open 
= "font color=\"#00\""; 
$highlight_today_close = 
"/font";}// 
If it is the first day of the week open a 
ROWif($week_day_count == 
0){$cal_generated 
.= 
"tr";}if 
($first_week_marked == 
FALSE){$blank_cell 
= 0; do 
{if($the_first_day_of_the_month['wday'] 
 
$blank_cell){$cal_generated 
.= "td height=\"".$table_height."\" 
valign=\"top\"/td";$blank_cell++;}else{$cal_generated 
.= "td height=\"".$table_height."\" 
valign=\"top\"".$highlight_today_open 
."".$month_day_count."".$highlight_today_close."/td";$first_week_marked 
= 
TRUE;}$week_day_count 
= 
$the_first_day_of_the_month['wday'];} 
while ($first_week_marked == 
FALSE);}else{$cal_generated 
.= "td height=\"".$table_height."\" 
valign=\"top\"".$highlight_today_open 
."".$month_day_count."".$highlight_today_close."/td";}$month_day_count++;// 
If it is the last day of the week close 
ROWif($week_day_count == 
6){$cal_generated 
.= 
"/tr";}$week_day_count++;// 
Countingsif($week_day_count 
== 
7){$week_day_count=0;}} 
while ($month_day_count = $num_days_in_month);// End Calendar 
Loop$cal_generated .= 
"/table";return 
$cal_generated;}

echo 
Cal_Month();
?

Joe Harman


Joe Harman

eInternet Design
Biz Ph: 269.983.7627


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] PHP Calendar/Planner Project

2004-08-10 Thread PHP Junkie
Ave,

I'm working to create a sophisticated PHP Calendar/Planner application for
my company's web server. I was wondering if there is a nice powerful
calendar/planner application out there which could help me in guidance
towards building my project. What I'm looking for is something sophisticated
with features of users/groups, private/public calendars etcetera.

I'd really appreciate if someone can point to an existing application which
I can get.

Thanks,
Ave.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Calendar math .... how to count in week days....?

2004-05-06 Thread Anthony
I've run into a bit of a problem, that I know has been dealt with before,
but I don't know how to deal with it.  Very simple, I have an application
that needs to do calendar math and do it specifically on business days.  I
need to be able to add and subtract a number of days to only Monday though
Friday.  Seems simple enough, but I can't figure out how to do it.  The only
think I've come up with so far is to build a function that counts every day
and checks to see if it's a weekend or not.  This wouldn't be all that hard
to do, but I'm wondering if there is a better way to do it?  Anyone have a
really efficient function to do this, I need to figure out a LOT of dates in
this app.

- Anthony

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] calendar class

2004-02-24 Thread John Taylor-Johnston
Anyone recommend a good calendar class at phpclasses.org or elsewhere?
Something I can install with ease and teach someone else to use and update using, oh 
say phpmyadmin?
Thanks,
John

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP Calendar.

2004-01-15 Thread Carles Xavier Munyoz Bald
Hi,
Is there any PHP function or set of PHP files that allows me to print the 
current month in calendar format ?

Greetings.
---
Carles Xavier Munyoz Baldó
[EMAIL PROTECTED]
http://www.unlimitedmail.net/
---

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Calendar.

2004-01-15 Thread Nathan Taylor
No, but HotScripts.com and PHPClasses.org () will have classes to do them.  I'm a 
fan of BosDates (can be found on HotScripts.com), but I think it might cost something 
to get it.

Cheers,
Nathan Taylor
  - Original Message - 
  From: Carles Xavier Munyoz Baldó 
  To: [EMAIL PROTECTED] 
  Sent: Thursday, January 15, 2004 9:27 AM
  Subject: [PHP] PHP Calendar.


  Hi,
  Is there any PHP function or set of PHP files that allows me to print the 
  current month in calendar format ?

  Greetings.
  ---
  Carles Xavier Munyoz Baldó
  [EMAIL PROTECTED]
  http://www.unlimitedmail.net/
  ---

  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP Calendar.

2004-01-15 Thread nabil
catch the out put of Linux

exec('cal');
and for the year
exec('cal 2004');

regards


Carles Xavier Munyoz Baldó [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi,
Is there any PHP function or set of PHP files that allows me to print the
current month in calendar format ?

Greetings.
---
Carles Xavier Munyoz Baldó
[EMAIL PROTECTED]
http://www.unlimitedmail.net/
---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP Calendar.

2004-01-15 Thread nabil
?php
passthru('/usr/bin/cal') or die('error');
?



Carles Xavier Munyoz Baldó [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi,
Is there any PHP function or set of PHP files that allows me to print the
current month in calendar format ?

Greetings.
---
Carles Xavier Munyoz Baldó
[EMAIL PROTECTED]
http://www.unlimitedmail.net/
---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Calendar.

2004-01-15 Thread Lowell Allen
 Hi,
 Is there any PHP function or set of PHP files that allows me to print the
 current month in calendar format ?
 

You should write one. Here's mine, which I'm sure could be improved:

HTH

--
Lowell Allen


function display_calendar($mon, $year) {
// find current date and day of the month for comparison
$today = getdate();
$current_mon = $today['mon'];
$current_mday = $today['mday'];
$current_year = $today['year'];

// if no arguments provided with function call
if ((!isset($mon)) || ($mon == )) {
$mon = $today['mon'];
}
if ((!isset($year)) || ($year == )) {
$year = $today['year'];
}

// establish timestamp values from arguments provided
$cal_date = getdate(mktime(0, 0, 0, $mon, 1, $year));
$month = $cal_date['month'];
$weekday = $cal_date['weekday'];

// find position of first day of month, 0 thru 6 for Sun. thru Sat.
$firstdayposition = $cal_date['wday'];

// find day of year of first day of month
$firstday_yearday = $cal_date['yday'];

$lastday = getdate(mktime(0, 0, 0, $mon + 1, 0, $year));

// find position of last day of month
$lastdayposition = $lastday['wday'];

// find day of year of last day of month
$lastday_yearday = $lastday['yday'];

// find number of days in current month
$numdays = $lastday_yearday - $firstday_yearday + 1;

// find last day date of previous month
$prevmonlastday = getdate(mktime(0, 0, 0, $mon, 0));
$prevmonlastdaydate = $prevmonlastday['mday'];

// html layout for month

if ($firstdayposition != 0) {
$caldate = $prevmonlastdaydate - $firstdayposition + 1;
$color = #666;
} else {
$caldate = 1;
$color = #333;
}
?
h4?=$month? ?=$year?/h4
table cellpadding=4 cellspacing= 0 style=border: solid 1px
#cc;
tr
td class=dayslabel width=14%S/td
td class=dayslabel width=14%M/td
td class=dayslabel width=14%T/td
td class=dayslabel width=14%W/td
td class=dayslabel width=14%T/td
td class=dayslabel width=14%F/td
td class=dayslabel width=14%S/td
/tr
tr
?
$i = 1;

while ($i = ($numdays + $firstdayposition + 6 - $lastdayposition)) {
if (($i % 7 == 0)  ($i != ($numdays + $firstdayposition + 6 -
$lastdayposition))) {
if (($caldate == $current_mday)  ($mon == $current_mon) 
($year == $current_year)  ($color == #333)) {
echo(td class=\calendar\ style=\color:
#600;\strong . $caldate . /strong/td\n/tr\ntr\n);
} else {
echo(td class=\calendar\ style=\color:  . $color .
;\ . $caldate . /td\n/tr\ntr\n);
}
} else {
if (($caldate == $current_mday)  ($mon == $current_mon) 
($year == $current_year)  ($color == #333)) {
echo(td class=\calendar\ style=\color:
#600;\strong . $caldate . /strong/td\n);
} else {
echo(td class=\calendar\ style=\color:  . $color .
;\ . $caldate . /td\n);
}
}
$i = $i + 1;
if ($i - 1 == $firstdayposition) {
$caldate = 1;
$color = #333;
} elseif (($i - 1) == ($numdays + $firstdayposition)) {
$caldate = 1;
$color = #666;
} else {
$caldate = $caldate + 1;
}
}
?
/tr
/table
?
}

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Calendar.

2004-01-15 Thread Brian V Bonini
On Thu, 2004-01-15 at 09:27, Carles Xavier Munyoz Baldó wrote:
 Hi,
 Is there any PHP function or set of PHP files that allows me to print the 
 current month in calendar format ?
 

I've seen many classes floating around that do this. Google should turn
up something.

-- 
BrianGnuPG - KeyID: 0x04A4F0DC | URL: www.gfx-design.com/keys
  Key Server: pgp.mit.edu
==
gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
GnuPG: http://gnupg.org
http://www.biglumber.com/x/web?qs=0x2C35011004A4F0DC
Linux Registered User #339825 at http://counter.li.org


signature.asc
Description: This is a digitally signed message part


Re: [PHP] PHP Calendar.

2004-01-15 Thread Carles Xavier Munyoz Bald
El Jueves, 15 de Enero de 2004 16:42, Brian V Bonini escribió:
 On Thu, 2004-01-15 at 09:27, Carles Xavier Munyoz Baldó wrote:
  Hi,
  Is there any PHP function or set of PHP files that allows me to print the
  current month in calendar format ?

 I've seen many classes floating around that do this. Google should turn
 up something.

Yes, but Google can not return me the users experience whith this classes for 
this reason I ask here ;-)

Greetings.
---
Carles Xavier Munyoz Baldó
[EMAIL PROTECTED]
http://www.unlimitedmail.net/
---

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Calendar.

2004-01-15 Thread Jason Wong
On Thursday 15 January 2004 23:49, Carles Xavier Munyoz Baldó wrote:

  I've seen many classes floating around that do this. Google should turn
  up something.

 Yes, but Google can not return me the users experience whith this classes
 for this reason I ask here ;-)

The only user experience that really counts is *yours*. Try them and find one 
that *you* like.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Life is like a buffet; it's not good but there's plenty of it.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Calendar

2003-11-13 Thread Boaz Yahav
Check this out : 
http://www.weberdev.com/AdvancedSearch.php?searchtype=titlesort=titles
earch=calendar

Sincerely
 
berber
 
Visit http://www.weberdev.com/  http://www.weberblog.com/ Today!!!
To see where PHP might take you tomorrow.
Share your code : http://addexample.weberdev.com
Search for PHP Code from your browser http://toolbar.weberdev.com
Share your thoughts :
http://www.weberblog.com/submit.php?type=storytopic=PHP_Web_Logs


-Original Message-
From: Steve Marquez [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 12, 2003 8:50 PM
To: PHP eMail List
Subject: [PHP] Calendar


Hi,

I am looking for a simple easy to edit php calendar program. Does anyone
know where I can find one?

Thanks for your help.

--

Steve Marquez
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Calendar

2003-11-12 Thread Steve Marquez
Hi,

I am looking for a simple easy to edit php calendar program. Does anyone
know where I can find one?

Thanks for your help.

--

Steve Marquez
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Calendar

2003-11-12 Thread Jay Blanchard
[snip]
I am looking for a simple easy to edit php calendar program. Does anyone
know where I can find one?
[/snip]

Several

http://www.google.com/search?hl=enie=UTF-8oe=UTF-8q=PHP+calendar

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Calendar

2003-11-12 Thread Pablo Gosse
On Wednesday, November 12, 2003 10:50 AM, Steve wrote:

 I am looking for a simple easy to edit php calendar program. Does
anyone
 know where I can find one?

Pear is always a good place to start:

http://pear.php.net/package/Calendar

Cheers,
Pablo

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Calendar

2003-11-12 Thread Dave G
Steve,
I'm a complete beginner, and I just finished building my own
calendar.
I tried using some pre-built ones, like this one:
http://www.cascade.org.uk/software/php/calendar/index.php
... but I found that trying to figure out how to use their
features was a whole new learning curve, and made customizing more of a
hassle.
So I highly recommend you go through a tutorial and build a
calendar step by step. That way you have mastery over every part of the
calendar and can customize every aspect of it.
The one I used was here:
http://www.devshed.com/Server_Side/PHP/MilesToGo/page1.html

-- 
Cheers!
Dave G
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Calendar Script

2003-10-29 Thread Vijay Killu
Dear PHP,

Where can I find the Calendar script that has been used on the PHP.net site.
I believe I can use it on my website since it is open source :-)

Thanks  Regards, 
___ 
PHPLover
 
*  : [EMAIL PROTECTED] 

Göd döësn't pläy dícë. 
- Älbërt Ëínstëín



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Calendar Script

2003-10-29 Thread Leif K-Brooks
Vijay Killu wrote:

Where can I find the Calendar script that has been used on the PHP.net site.
I believe I can use it on my website since it is open source :-)
I don't seeany calendar, but you should be able to use the show source 
link whereever it is.

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Calendar Script

2003-10-29 Thread Evan Nemerson
On Wednesday 29 October 2003 12:01 am, Vijay Killu wrote:
 Dear PHP,

 Where can I find the Calendar script that has been used on the PHP.net
 site. I believe I can use it on my website since it is open source :-)

From php.net. There is a show source link on the bottom of every page, plus 
the entire web site is in the CVS repository. Look at php.net/anoncvs.php and 
cvs.php.net and you should be able to figure it out. If you're not familiar 
with CVS, you can always use that show source link.

 Thanks  Regards,
 ___
 PHPLover

 *  : [EMAIL PROTECTED]

 Göd döësn't pläy dícë.
 - Älbërt Ëínstëín

-- 
Evan Nemerson
[EMAIL PROTECTED]

--
The people are the only sure reliance for preservation of our liberty.

-Thomas Jefferson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar Script

2003-10-29 Thread David T-G
Vijay --

...and then Vijay Killu said...
% 
% Where can I find the Calendar script that has been used on the PHP.net site.
% I believe I can use it on my website since it is open source :-)

I don't know about (or where to find) that one, but I've been fairly
happy with WebCalender [sic] from http://webcalendar.sourceforge.net.
It's not my dream calendar, but it works and it was a quick and easy
install.


% 
% Thanks  Regards, 
% ___ 
% PHPLover
%  
% *  : [EMAIL PROTECTED] 


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] Calendar Tool

2003-10-28 Thread Matt Palermo
Hey everyone.  I am the creater of a PHP script called TotalCalendar
(http://sweetphp.com/TotalCalendar/) and I am looking for a little advice
and suggestions about making a tool for it.  I want to build an application
that users can download and install on their local machines which connects
to a site's calendar (that site obviously would have to have TotalCalendar
installed on it).  This client application would connect to the site's
calendar and retrieve all necessary info about different events located
inside the calendar.  Anyway, the advice I am looking for is where to start
the application.  PHP-GTK has been brought to my attention as a useful tool
to build something like this, however, I have absolutely no experience with
it.  I was wondering if anyone could point me in the right direction for a
detailed tutorial or applications that would help me build something like
this.  I have found a couple tutorials that show really simple things like
creating buttons, but not much more than that.  Please let me know if anyone
can help me out with this.  I am open for any type of suggestions for this
building this tool.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calendar Tool

2003-10-28 Thread Payne
Matt Palermo wrote:

Hey everyone.  I am the creater of a PHP script called TotalCalendar
(http://sweetphp.com/TotalCalendar/) and I am looking for a little advice
and suggestions about making a tool for it.  I want to build an application
that users can download and install on their local machines which connects
to a site's calendar (that site obviously would have to have TotalCalendar
installed on it).  This client application would connect to the site's
calendar and retrieve all necessary info about different events located
inside the calendar.  Anyway, the advice I am looking for is where to start
the application.  PHP-GTK has been brought to my attention as a useful tool
to build something like this, however, I have absolutely no experience with
it.  I was wondering if anyone could point me in the right direction for a
detailed tutorial or applications that would help me build something like
this.  I have found a couple tutorials that show really simple things like
creating buttons, but not much more than that.  Please let me know if anyone
can help me out with this.  I am open for any type of suggestions for this
building this tool.
 

I hope it not just me but the site doesn't come up.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


  1   2   >