View Single Post
Old 03-16-2009, 02:05 PM   #1 (permalink)
deanr201
The Visitor
 
Join Date: Mar 2009
Posts: 4
Thanks: 0
deanr201 is on a distinguished road
Default Looking for a solution, Have some code, but need a little more help!

*edit re added my problem, sorry for the confusion*

As mentioned in my introduction thread, I'm a designer and not a coder, but have started to expand into the coding thing.

I have a use for calendar script and I wasnt sure where to start so after a bit of googling found a script released under GNU but it did not fit my purpose 100%.

as it stood the script would display a calender and allow me to have a "free" day in one colour and a "busy" day in another, only I needed 3 colours for the free day.

The code does write the calender out into a table, and the following is where the status is set.
PHP Code:
if ($date_status!="1") {
                                
$status_color "669900";
                                
$js_status "0";
                            }

                            
$output .= "<td id=\"$year"."-"."$fmonth"."-"."$fstartdate\" width=$width valign=top align=center onclick=\"calendar_date('$year"."-"."$fmonth"."-"."$fstartdate','$js_status','$username','669900');\" bgcolor=\"#$status_color\"> 
Ideally I need to be able to specify what the colour is via variable, as the code for viewing the calender is.

PHP Code:
require "calendar.php";
echo (
'<div style="float:left; margin:3px">');
print 
calendar("2009""1","user1",1,0);
echo (
'</div>'); 
this would display on the page a single calender for January 2009.


***Partial Solution***
Since this I have managed to get a partial solution which is to was to add in the following.

PHP Code:
                            if ($date_status!="1") {
 switch (
$season):
    case 
"l":
        
$status_color="99CC66";
        break;
    case 
"m":
        
$status_color="FFCC33";
        break;
    case 
"h":
        
$status_color="FF6600";
        break;
    default:
        
$status_color="669900";
endswitch;
$js_status "0";                            }

                            
$output .= "<td id=\"$year"."-"."$fmonth"."-"."$fstartdate\" width=$width valign=top align=center onclick=\"calendar_date('$year"."-"."$fmonth"."-"."$fstartdate','$js_status','$username','669900');\" bgcolor=\"#$status_color\"> 
and on the page to view the calender.

PHP Code:
require "calendar.php";
echo (
'<div style="float:left; margin:3px">');
print 
calendar("2009""1","user1",1,0,"l");
echo (
'</div>'); 
where "l" is the relates to Low, Medium, High, which are defined in the calenders code, this allows me to display more than one calender month on the view page, and display the month with the colour for either "low" "Medium" or "high" colour scheme.

I'm not sure this is the most effective way of achieving this but it works.

Last edited by deanr201 : 03-17-2009 at 08:56 AM.
deanr201 is offline  
Reply With Quote