Adjust style settings to allow for more control over table.
This commit is contained in:
parent
b36c90d35d
commit
d5d6c30442
2 changed files with 28 additions and 5 deletions
11
Gantt.php
11
Gantt.php
|
@ -49,6 +49,7 @@ class Gantt {
|
|||
|
||||
/**
|
||||
* Constructor
|
||||
* @param bool whether or not to define a default set of colors (optional)
|
||||
**/
|
||||
function __construct($colors = true) {
|
||||
//add a default set of colors
|
||||
|
@ -117,15 +118,17 @@ class Gantt {
|
|||
foreach($this->events as $event) {
|
||||
$color = $this->get_color();
|
||||
$this->html .= ' <tr>' . "\n";
|
||||
$this->html .= ' <td>' . $event->event . '</td>' . "\n";
|
||||
$this->html .= ' <td>' . $event->duration . '</td>' . "\n";
|
||||
$this->html .= ' <td class="event">' . $event->event . '</td>' . "\n";
|
||||
$this->html .= ' <td class="duration">' . $event->duration . '</td>' . "\n";
|
||||
for($i = 1; $i <= $columns; $i++) {
|
||||
if($i >= $event->start && $i < ($event->start + $event->duration)) {
|
||||
$style = ' style="background-color:' . $color . '"';
|
||||
$class = ' colored';
|
||||
} else {
|
||||
$style = ' style="background-color:#fff"';
|
||||
$style = '';
|
||||
$class = ' blank';
|
||||
}
|
||||
$this->html .= ' <td class="colored"'. $style .'> </td>' . "\n";
|
||||
$this->html .= ' <td class="' . $class . '"'. $style .'> </td>' . "\n";
|
||||
}
|
||||
$this->html .= ' </tr>' . "\n";
|
||||
}
|
||||
|
|
|
@ -13,12 +13,32 @@
|
|||
border: 1px solid black;
|
||||
}
|
||||
|
||||
#gantt tr {
|
||||
|
||||
}
|
||||
|
||||
#gantt td {
|
||||
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 {
|
||||
width: 18px;
|
||||
width: 50px;
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
|
Loading…
Reference in a new issue