Guest_imported
New member
- Jan 1, 1970
- 0
I have a unique roject I'm working opn and I'm totally baffled!
It's two calendars, side by side and in reverse order (May/April). First
you enter your Zip Code (have DB set up ewth UPS codes, zones, and
shipping dates), then you click on the date you'd like to have your
borchures delivered by.
A red sphere will appear on the delivery date, preceded two or more days
(depending upon the DB results) with a yellow sphere designatng the
shipping date. 5 days before that, a purple sphere, represnting the date
the press is run. Two days before this, a green sphere represnenting
when you'll receive (and hopefully approve same day) your proof. Back up
two more days and a blue sphere represents the latest date you must
upload your files to the printer.
PROBLEM: ANy sphere falling on a weekend miust be backed up to the
prvious Friday.
Sounds simple, but it's proving otherwise. Maybe I need to start all
over and re-evaluate my approach.
First problem, because of the way I've designed the script, is getting
balls to fall into the previous month if necessary, but I won't worry
about that now.
The BIG problem is getting Saturdays and Sundays ($wday ==0 && $wday
==6) to back up.
Here's a simplifed excerpt of what I've tried so far.
BTW: you can see the work in progress at
#################################################
//$day is ther numerical day of the mopnth and $wday is the
//numerical number of the day of week (Sun-Sat/ 0-6)
if (isset($delivery)){
$shipping = $delivery -2;
$print = $shipping -2;
$proof = $print -5;
$submit = $proof -2;
// bad code:
if(($day == $delivery) && ($wday == 0)){
$delivery = $delivery-2;
}elseif(($day == $delivery) && ($wday == 6)){
$delivery = $delivery-1;
}
// if this worked I'dd add if for each variable
if($day == $delivery){
print "<td><a href=$PHP_SELF?delivery=$day>$day<BR>$red_ball</a></td>;}
elseif($day == $shipping){
print "<td><a href=$PHP_SELF?delivery=$day>n$day<BR>$yellow_ball</a></td>;}
elseif($day == $print){
print "<td><a href=$PHP_SELF?delivery=$day>$day<BR>$green_ball</a></td>";}
elseif($day == $proof){
print "<td><a href=$PHP_SELF?delivery=$day>$day<BR>$purple_ball</a></td>";}
elseif($day == $submit){
print "<td><a href=$PHP_SELF?delivery=$day>$day<BR>$blue_ball</a></td>";
}}
#################################################
Please don't respond by tewlling me what a bonehead I am. I know that.
Obviously this won't work, because it's cycling through each day, it doesn't
know what to do when it comes to a weekend day, so it does nothing, but it will
place the other spheres.
I'm afraid I'll either need to rethink my whole way of omplementing the script
or write complex class.
I'm a fairly cmopetent PHP pscripte, and I've looked at a dozen other calendar
scripts for inspiration, but nothing that covers anyting like this.
Any ideas would be greatly appreciated.
To give you an idea how the script draws the calendar:
#####################################################
$date=getdate();
$month_num=$date["mon"];
$month_name=$date["month"];
$This_Month=$date["month"];
$year=$date["year"];
$date_today=getdate(mktime(0,0,0,$month_num,1,$year));
$first_week_day=$date_today["wday"];
$cont=true;
$today=27;
while(($today<=32)&&($cont)){
$date_today=getdate(mktime(0,0,0,$month_num,$today,$year));
if($date_today["mon"]!=$month_num){
$lastday=$today-1;
$cont=false;
}
$today++;
}
// Here I've omitted calendar 1's header (Month name) and second row with weekday names
$day=1;
$wday=$first_week_day;
$firstweek=true;
while($day<=$lastday){
if($firstweek){
print "<TR>";
if($wday < 6 && $day <= 0){
$colspan = (6-$wday);
print "<TD COLSPAN=\"$colspan\" width=\"20\" background=\"images/BlockRContent.gif\" align=\"center\" Valign=\"middle\">\n<IMG SRC=\"images/BlockRContent.gif\"></td>\n";
}
else{
print "<TD width=\"20\" background=\"images/BlockRContent.gif\" align=\"center\" Valign=\"middle\">\n<IMG SRC=\"images/BlockRContent.gif\"></td>\n";
}
$firstweek=false;
}
if($wday==0){
print "<tr>\n";
}
/////// Omitted problem code shown in beginning
if($wday < 6 && $day >= $lastday){
$colspan = (7-$wday);
print "<TD COLSPAN=\"$colspan\" background=\"images/BlockRContent.gif\" align=\"center\" Valign=\"middle\">\n<IMG SRC=\"images/BlockRContent.gif\"></TD>\n</tr>\n";
}
elseif($wday == 6){
print "</tr>\n";
}
$wday++;
$wday=$wday%7;
$day++;
}
//// Now start calendar two (April)
$first_week_day=$date_today["wday"];
$date_today=getdate(mktime(0,0,0,$month_num,$today,$year));
if($date_today["mon"]!=$month_num){
$lastday=$today-1;
$cont=false;
$today++;
}
It's two calendars, side by side and in reverse order (May/April). First
you enter your Zip Code (have DB set up ewth UPS codes, zones, and
shipping dates), then you click on the date you'd like to have your
borchures delivered by.
A red sphere will appear on the delivery date, preceded two or more days
(depending upon the DB results) with a yellow sphere designatng the
shipping date. 5 days before that, a purple sphere, represnting the date
the press is run. Two days before this, a green sphere represnenting
when you'll receive (and hopefully approve same day) your proof. Back up
two more days and a blue sphere represents the latest date you must
upload your files to the printer.
PROBLEM: ANy sphere falling on a weekend miust be backed up to the
prvious Friday.
Sounds simple, but it's proving otherwise. Maybe I need to start all
over and re-evaluate my approach.
First problem, because of the way I've designed the script, is getting
balls to fall into the previous month if necessary, but I won't worry
about that now.
The BIG problem is getting Saturdays and Sundays ($wday ==0 && $wday
==6) to back up.
Here's a simplifed excerpt of what I've tried so far.
BTW: you can see the work in progress at
#################################################
//$day is ther numerical day of the mopnth and $wday is the
//numerical number of the day of week (Sun-Sat/ 0-6)
if (isset($delivery)){
$shipping = $delivery -2;
$print = $shipping -2;
$proof = $print -5;
$submit = $proof -2;
// bad code:
if(($day == $delivery) && ($wday == 0)){
$delivery = $delivery-2;
}elseif(($day == $delivery) && ($wday == 6)){
$delivery = $delivery-1;
}
// if this worked I'dd add if for each variable
if($day == $delivery){
print "<td><a href=$PHP_SELF?delivery=$day>$day<BR>$red_ball</a></td>;}
elseif($day == $shipping){
print "<td><a href=$PHP_SELF?delivery=$day>n$day<BR>$yellow_ball</a></td>;}
elseif($day == $print){
print "<td><a href=$PHP_SELF?delivery=$day>$day<BR>$green_ball</a></td>";}
elseif($day == $proof){
print "<td><a href=$PHP_SELF?delivery=$day>$day<BR>$purple_ball</a></td>";}
elseif($day == $submit){
print "<td><a href=$PHP_SELF?delivery=$day>$day<BR>$blue_ball</a></td>";
}}
#################################################
Please don't respond by tewlling me what a bonehead I am. I know that.
Obviously this won't work, because it's cycling through each day, it doesn't
know what to do when it comes to a weekend day, so it does nothing, but it will
place the other spheres.
I'm afraid I'll either need to rethink my whole way of omplementing the script
or write complex class.
I'm a fairly cmopetent PHP pscripte, and I've looked at a dozen other calendar
scripts for inspiration, but nothing that covers anyting like this.
Any ideas would be greatly appreciated.
To give you an idea how the script draws the calendar:
#####################################################
$date=getdate();
$month_num=$date["mon"];
$month_name=$date["month"];
$This_Month=$date["month"];
$year=$date["year"];
$date_today=getdate(mktime(0,0,0,$month_num,1,$year));
$first_week_day=$date_today["wday"];
$cont=true;
$today=27;
while(($today<=32)&&($cont)){
$date_today=getdate(mktime(0,0,0,$month_num,$today,$year));
if($date_today["mon"]!=$month_num){
$lastday=$today-1;
$cont=false;
}
$today++;
}
// Here I've omitted calendar 1's header (Month name) and second row with weekday names
$day=1;
$wday=$first_week_day;
$firstweek=true;
while($day<=$lastday){
if($firstweek){
print "<TR>";
if($wday < 6 && $day <= 0){
$colspan = (6-$wday);
print "<TD COLSPAN=\"$colspan\" width=\"20\" background=\"images/BlockRContent.gif\" align=\"center\" Valign=\"middle\">\n<IMG SRC=\"images/BlockRContent.gif\"></td>\n";
}
else{
print "<TD width=\"20\" background=\"images/BlockRContent.gif\" align=\"center\" Valign=\"middle\">\n<IMG SRC=\"images/BlockRContent.gif\"></td>\n";
}
$firstweek=false;
}
if($wday==0){
print "<tr>\n";
}
/////// Omitted problem code shown in beginning
if($wday < 6 && $day >= $lastday){
$colspan = (7-$wday);
print "<TD COLSPAN=\"$colspan\" background=\"images/BlockRContent.gif\" align=\"center\" Valign=\"middle\">\n<IMG SRC=\"images/BlockRContent.gif\"></TD>\n</tr>\n";
}
elseif($wday == 6){
print "</tr>\n";
}
$wday++;
$wday=$wday%7;
$day++;
}
//// Now start calendar two (April)
$first_week_day=$date_today["wday"];
$date_today=getdate(mktime(0,0,0,$month_num,$today,$year));
if($date_today["mon"]!=$month_num){
$lastday=$today-1;
$cont=false;
$today++;
}