function DisplayYear($year, $type, $modality, $studysite) { /* generate a color gradient in an array (green to yellow) */ $startR = 0xFF; $startG = 0xFF; $startB = 0x00; $endR = 0x00; $endG = 0xFF; $endB = 0x00; $total = 50; for ($i=0; $i<=$total; $i++) { $percentSR = ($i/$total)*$startR; $percentER = (1-($i/$total))*$endR; $colorR = $percentSR + $percentER; $percentSG = ($i/$total)*$startG; $percentEG = (1-($i/$total))*$endG; $colorG = $percentSG + $percentEG; $percentSB = ($i/$total)*$startB; $percentEB = (1-($i/$total))*$endB; $colorB = $percentSB + $percentEB; $color = sprintf("%02X%02X%02X", $colorR, $colorG, $colorB); $colors[] = $color; } /* generate gradient from yellow to red */ $startR = 0xFF; $startG = 0x33; $startB = 0x33; $endR = 0xFF; $endG = 0xFF; $endB = 0x00; for ($i=0; $i<=$total; $i++) { $percentSR = ($i/$total)*$startR; $percentER = (1-($i/$total))*$endR; $colorR = $percentSR + $percentER; $percentSG = ($i/$total)*$startG; $percentEG = (1-($i/$total))*$endG; $colorG = $percentSG + $percentEG; $percentSB = ($i/$total)*$startB; $percentEB = (1-($i/$total))*$endB; $colorB = $percentSB + $percentEB; $color = sprintf("%02X%02X%02X", $colorR, $colorG, $colorB); $colors[$i+50] = $color; } ?> <table width="100%" cellpadding="10"> <tr> <td colspan="2"> <?php echo $type; ?> per day for <b><?php echo $year; ?> </b> </td> <td colspan="2"> <table cellspacing="0"> <tr> <td><b>Key:</b> </td> <td>few </td> <? for ($i=0; $i<40; $i++) { $percent = round(($i/40)*100); $color = $colors[$percent]; ?> <td bgcolor="<?php echo $color; ?> " style="font-size: 8pt"> </td> <? } ?> <td> a lot</td> </tr> </table> </td> </tr> <tr> <td width="25%" valign="top"><? DisplayMonth(1, $year, $colors, $type, $modality, $studysite); ?></td> <td width="25%" valign="top"><? DisplayMonth(2, $year, $colors, $type, $modality, $studysite); ?></td> <td width="25%" valign="top"><? DisplayMonth(3, $year, $colors, $type, $modality, $studysite); ?></td> <td width="25%" valign="top"><? DisplayMonth(4, $year, $colors, $type, $modality, $studysite); ?></td> </tr> <tr> <td width="25%" valign="top"><? DisplayMonth(5, $year, $colors, $type, $modality, $studysite); ?></td> <td width="25%" valign="top"><? DisplayMonth(6, $year, $colors, $type, $modality, $studysite); ?></td> <td width="25%" valign="top"><? DisplayMonth(7, $year, $colors, $type, $modality, $studysite); ?></td> <td width="25%" valign="top"><? DisplayMonth(8, $year, $colors, $type, $modality, $studysite); ?></td> </tr> <tr> <td width="25%" valign="top"><? DisplayMonth(9, $year, $colors, $type, $modality, $studysite); ?></td> <td width="25%" valign="top"><? DisplayMonth(10, $year, $colors, $type, $modality, $studysite); ?></td> <td width="25%" valign="top"><? DisplayMonth(11, $year, $colors, $type, $modality, $studysite); ?></td> <td width="25%" valign="top"><? DisplayMonth(12, $year, $colors, $type, $modality, $studysite); ?></td> </tr> </table> <? }
function DisplayYear($year, $currentcal) { ?> <table width="100%" cellpadding="10"> <tr> <td width="25%" valign="top"><?php DisplayMonth(1, $year); ?> </td> <td width="25%" valign="top"><?php DisplayMonth(2, $year); ?> </td> <td width="25%" valign="top"><?php DisplayMonth(3, $year); ?> </td> <td width="25%" valign="top"><?php DisplayMonth(4, $year); ?> </td> </tr> <tr> <td width="25%" valign="top"><?php DisplayMonth(5, $year); ?> </td> <td width="25%" valign="top"><?php DisplayMonth(6, $year); ?> </td> <td width="25%" valign="top"><?php DisplayMonth(7, $year); ?> </td> <td width="25%" valign="top"><?php DisplayMonth(8, $year); ?> </td> </tr> <tr> <td width="25%" valign="top"><?php DisplayMonth(9, $year); ?> </td> <td width="25%" valign="top"><?php DisplayMonth(10, $year); ?> </td> <td width="25%" valign="top"><?php DisplayMonth(11, $year); ?> </td> <td width="25%" valign="top"><?php DisplayMonth(12, $year); ?> </td> </tr> </table> <?php }