function display() { extract($_REQUEST); $fields = array(); $fields["period"] = "monthly"; $fields["start_day"] = "01"; $fields["start_month"] = date("m"); $fields["start_year"] = date("Y"); $fields["end_day"] = date("d"); $fields["end_month"] = date("m"); $fields["end_year"] = date("Y"); extract($fields, EXTR_SKIP); $gantt = new Gantt($project_id); $period_fields = array("daily" => "Daily", "weekly" => "Weekly", "monthly" => "Monthly"); $period_sel = "<select name='period' onchange='javascript:document.form.submit()'>"; foreach ($period_fields as $key => $value) { if ($period == $key) { $sel = "selected"; } else { $sel = ""; } $period_sel .= "<option value='{$key}' {$sel}>{$value}</option>"; } $period_sel .= "</select>"; $start_epoch = mktime(0, 0, 0, $start_month, $start_day, $start_year); $end_epoch = mktime(0, 0, 0, $end_month, $end_day, $end_year); if ($period == "monthly") { $gantt_out = $gantt->generate_monthly($start_epoch, $end_epoch); } elseif ($period == "daily") { $gantt_out = $gantt->generate_daily($start_epoch, $end_epoch); } elseif ($period == "weekly") { $gantt_out = $gantt->generate_weekly($start_epoch, $end_epoch); } $OUTPUT = "<center>\n\t<h3>Gantt Chart</h3>\n\t<form method='post' action='" . SELF . "' name='form'>\n\t<input type='hidden' name='key' value='display' />\n\t<input type='hidden' name='project_id' value='{$project_id}' />\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th colspan='4'>Date Range</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>" . mkDateSelect("start", $start_year, $start_month, $start_day) . "</td>\n\t\t\t<td><b>To</b></td>\n\t\t\t<td>" . mkDateSelect("end", $end_year, $end_month, $end_day) . "</td>\n\t\t\t<td><input type='submit' value='Select »' /></td>\n\t\t<tr>\n\t\t\t<th colspan='4'>Display</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='4' align='center'>{$period_sel}</td>\n\t\t</tr>\n\t</table>\n\t<p></p>\n\t<table cellpadding='3' cellspacing='0'>\n\t{$gantt_out}\n\t</table>\n\t</center>"; return $OUTPUT; return $OUTPUT; }
<?php require "gantt.inc.php"; $gant = new Gantt(); print $gant->generate_monthly(1154689997, 1254789997); ?>