PHP Classes

Modifying Month and Year Nav links

Recommend this page to a friend!

      Active Calendar  >  All threads  >  Modifying Month and Year Nav links  >  (Un) Subscribe thread alerts  
Subject:Modifying Month and Year Nav links
Summary:Modifying Month and Year Nav links
Messages:3
Author:John Fugate
Date:2005-03-04 17:54:39
Update:2005-03-15 21:20:11
 

  1. Modifying Month and Year Nav links   Reply   Report abuse  
Picture of John Fugate John Fugate - 2005-03-04 17:54:39
Great work on this class. It is exactly what I needed.

I have a question regarding modifying the month and year nav links. I understand that I can change the text that is displayed in the link... Example:

$cal->monthNavForw = "&gt&gt";
$cal->monthNavBack = "&lt&lt";

(I understand that you can also use images here? How?)

My question is can I use an existing style to do something like change the background of these links? I have modified the main CSS file to include the following styles.

.plcomplete {
color: #CC0000;
background-color: #88FF88;
font-size: 11px;
font-weight: bolder;
}
.plincomplete {
color: #CC0000;
background-color: #FF8888;
font-size: 11px;
font-weight: bolder;
}

I made these to allow me to change the background on days that have imcomplete and complete tasks. Can I use these two styles on the month and year navs as well to show, for example, if the previous month contains any incomplete tasks?

Thanks again!

  2. Re: Modifying Month and Year Nav links   Reply   Report abuse  
Picture of Giorgos Giorgos - 2005-03-05 09:44:25 - In reply to message 1 from John Fugate
Thank you for using the Active Calendar class. I am glad that it may be useful for your work!

1. Setting images for the navigation links:

Letīs say you want to use the following images for your navigation links:
(make sure, there are XHTML conform)
$backArrow="<img src=\"images/left.gif\" border=\"0\" alt=\"&lt&lt\" />";
$forwArrow="<img src=\"images/right.gif\" border=\"0\" alt=\"&gt&gt\" />";

There are 2 ways of setting them (e.g month view):
a.
$cal->monthNavBack = $backArrow;
$cal->monthNavForw = $forwArrow
b.
$cal->enableMonthNav($_SERVER['PHP_SELF'], $backArrow, $forwArrow);

2. Modifying the layout of the links:

Well, I suppose there are 2 ways of setting the layout of the navigation links, depending if the previous or next month contain incomplete tasks or not:

a. Use a different image link, if a month contains incomplete tasks e.g:
$backArrowIncompl="<img src=\"images/leftincompl.gif\" border=\"0\" alt=\"&lt&lt\" />";
(set the image link, as shown above)

b. Use different CSS
This method would be a bit more complicated, as the class currently generates the same CSS class for the back and forward link (default: var $cssMonthNav = "monthnavigation"). So the code needs to be a bit hacked...

You should modify the code by first setting e.g:
var $cssMonthNavBack="monthnavigation";
var $cssMonthNavForw="monthnavigation";

Then you should modify the private method mkMonthTitle():
line: $out="<tr><td class=\"".$this->cssMonthNav."\" colspan=\"2\">";
to: $out="<tr><td class=\"".$this->cssMonthNavBack."\" colspan=\"2\">";
line: $out.="<td class=\"".$this->cssMonthNav."\" colspan=\"2\">";
to: $out.="<td class=\"".$this->cssMonthNavForw."\" colspan=\"2\">";

So. now you could set e.g:
$cal->cssMonthNavBack="plincomplete";
(if the previous month contains incompleted tasks)

I hope I could help you. Please inform me, if you have further questions or if my suggestions would not work...

Giorgos

  3. Re: Modifying Month and Year Nav links   Reply   Report abuse  
Picture of John Fugate John Fugate - 2005-03-15 21:20:11 - In reply to message 2 from Giorgos
This works perfectly... Tried it both with images, and CSS...

Thank you!
JF