Adjust style settings to allow for more control over table.

This commit is contained in:
Andrew Tomaka 2011-11-01 13:12:09 -04:00
parent b36c90d35d
commit d5d6c30442
2 changed files with 28 additions and 5 deletions

View file

@ -49,6 +49,7 @@ class Gantt {
/** /**
* Constructor * Constructor
* @param bool whether or not to define a default set of colors (optional)
**/ **/
function __construct($colors = true) { function __construct($colors = true) {
//add a default set of colors //add a default set of colors
@ -117,15 +118,17 @@ class Gantt {
foreach($this->events as $event) { foreach($this->events as $event) {
$color = $this->get_color(); $color = $this->get_color();
$this->html .= ' <tr>' . "\n"; $this->html .= ' <tr>' . "\n";
$this->html .= ' <td>' . $event->event . '</td>' . "\n"; $this->html .= ' <td class="event">' . $event->event . '</td>' . "\n";
$this->html .= ' <td>' . $event->duration . '</td>' . "\n"; $this->html .= ' <td class="duration">' . $event->duration . '</td>' . "\n";
for($i = 1; $i <= $columns; $i++) { for($i = 1; $i <= $columns; $i++) {
if($i >= $event->start && $i < ($event->start + $event->duration)) { if($i >= $event->start && $i < ($event->start + $event->duration)) {
$style = ' style="background-color:' . $color . '"'; $style = ' style="background-color:' . $color . '"';
$class = ' colored';
} else { } else {
$style = ' style="background-color:#fff"'; $style = '';
$class = ' blank';
} }
$this->html .= ' <td class="colored"'. $style .'>&nbsp;</td>' . "\n"; $this->html .= ' <td class="' . $class . '"'. $style .'>&nbsp;</td>' . "\n";
} }
$this->html .= ' </tr>' . "\n"; $this->html .= ' </tr>' . "\n";
} }

View file

@ -13,12 +13,32 @@
border: 1px solid black; border: 1px solid black;
} }
#gantt tr {
}
#gantt td { #gantt td {
border: 1px solid black; border: 1px solid black;
} }
#gantt td.event {
font-weight: bold;
border: 1px solid black;
}
#gantt td.duration {
text-align: right;
border: 1px solid black;
}
#gantt td.blank {
width: 50px;
background-color: #fff;
}
#gantt td.colored { #gantt td.colored {
width: 18px; width: 50px;
border-left: 0;
border-right: 0;
} }
</style> </style>
</head> </head>