Through continued perseverance I have determined some code that works.
Using the code below I set the background of a standard detail entry to a
slightly different color than the regular background color of the calendar
so that all detail entries stand out, then if the detail entry contains a
word x in its subject I changed its color to a different color, then if the
subject contains the word y I changed its color to a different color - you
get the picture. If anyone sees an issue with it let me know. It seems to
work great. Try it out and let me know!
#1 - In 'display.php' put in code like this:
...
/* Start off knowing we don't need to close the event
* list. loop through each event for the day
*/
$have_events = false;
$html_events = tag('ul');
while($row = $result->FetchRow($result)) {
$subject = htmlspecialchars(strip_tags(stripslashes(
$row['subject'])));
$event_time = formatted_time_string(
$row['starttime'],
$row['eventtype']);
$findme = 'PTO';
$pos = strpos($subject, $findme);
$findme2 = 'visit';
$pos2 = strpos($subject, $findme2);
if (! $pos === false) {
$curr_class = "p";
$event = tag('li', attributes("class=\"$curr_class\""),
tag('a',
attributes(
"href=\"$phpc_script"
."?action=display&"
."id=$row[id]\""),
($event_time ?
"$event_time - "
: '')
. $subject));
}
elseif (! $pos2 === false) {
$curr_class = "v";
$event = tag('li', attributes("class=\"$curr_class\""),
tag('a',
attributes(
"href=\"$phpc_script"
."?action=display&"
."id=$row[id]\""),
($event_time ?
"$event_time - "
: '')
. $subject));
}
else {
$event = tag('li',
tag('a',
attributes(
"href=\"$phpc_script"
."?action=display&"
."id=$row[id]\""),
($event_time ?
"$event_time - "
: '')
. $subject));
}
$html_events->add($event);
$have_events = true;
}
if($have_events) $html_day->add($html_events);
}
return array_merge(array($html_day), display_days($day_count + 1,
$week_of_month, $month, $year));
}
...
#2 - In 'style.php' put in code like this:
#2a - At the top:
$bgcolore = "#FFFFCC"; // Standard background for each individual
calendar entry
$ptocolor = "#98FB98"; // Pale green
$visitcolor = "#FFD700"; // Gold
#2b - Near the bottom:
...
table.phpc-main ul {
margin: 2px;
padding: 0;
list-style-type: none;
border-color: <?php echo $sepcolor ?>;
border-style: solid;
border-width: 1px 1px 0 1px;
background-color: <?php echo $bgcolore ?>;
}
table.phpc-main li {
font-size: 80%;
font-weight: normal;
padding: 0;
border-color: <?php echo $sepcolor ?>;
border-style: solid;
border-width: 0 0 1px 0;
margin: 0;
}
li.p {
background-color: <?php echo $ptocolor ?>;
}
li.v {
background-color: <?php echo $visitcolor ?>;
}
table.phpc-main li a {
display: block;
text-decoration: none;
padding: 2px;
}
table.phpc-main li a:hover {
background-color: <?php echo $bgcolorh ?>;
color: <?php echo $textcolor2 ?>;
}
...
--
Larry
|