//Here's a portion of the code that was used as part of the GANT Calendar project... <?php //ERROR REPORTING ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(E_ALL); require_once('projectpageclass.php'); require_once('model_class.php'); $new_page= new ProjectPage; $page_title="South Area Network Development Project List"; $new_date=new DateCalc; $current_row=""; if(!isset($_GET['year'])) { $this_year=date("Y"); } else { $this_year=$_GET['year']; } $the_date=$this_year; $the_date.="-01-01"; $year_one_calc = date('c', strtotime("$the_date - 1 year")); $year_one=date("Y", strtotime($year_one_calc)); $year_two=$this_year; $year_three_calc = date('c', strtotime("$the_date + 1 year")); $year_three=date("Y", strtotime($year_three_calc)); $dayNumber = date("z") + 1; include('mssql_db_cred.php'); $mssql_pdo = new PDO("dblib:host=".$mssql_cred_data['server'].";dbname=".$mssql_cred_data['dbname'],$mssql_cred_data['user'],$mssql_cred_data['pw']); $mssql_pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); if(!$mssql_pdo) { echo "no connection"; } include("gant_header.php"); //here's the sql that gives you all of your content //this is putting the dates that are being displayed on the calendar into a code friendly format //week one is calculated based on whether or not there's a $_GET['week'] value in the URL. That's accomplished on line 89-105 on the gant_header.php $week_one_data = date('c', strtotime("$this_week - 6 weeks")); $week_one=date("m/d/Y", strtotime($week_one_data)); //echo $week_one; //week twelve comes from line 134 of the gant_header.php page $week_twelve_code_obj = date('c', strtotime("$week_twelve + 5 days")); $week_twelve_code_display_obj = date('c', strtotime("$week_twelve + 6 days")); $week_twelve=date("m/d/Y", strtotime($week_twelve_code_obj)); $query = "EXECUTE stp_Select_REPORT_DevelopeProjects_Gantt :DataDisplay_Start, :DataDisplay_End"; $stpro = $mssql_pdo->prepare($query); $stpro->bindParam(':DataDisplay_Start', $week_one, PDO::PARAM_STR); $stpro->bindParam(':DataDisplay_End', $week_twelve, PDO::PARAM_STR); // call the stored procedure $stpro->execute(); $results = $stpro->fetchALL(PDO::FETCH_ASSOC); /* $number=1; foreach($results as $row) { echo $number.') '.$row['str_ProjectName'].' | '.$row['dte_DateStarted'].'<br>'; $number=$number+1; } */ define('NCOLS', 83); $current_row = 1; $col = -1; $the_colspan=0; $body.="<tr>"; /*this is golden - this is your template, right here foreach($results as $row) { if($current_row_number<>$row['DataDisplay_Row']) { $body.="</tr><tr>"; } $body.="<td>"; $body.=$row['DataDisplay_Row']; $body.="</td>"; $current_row_number=$row['DataDisplay_Row']; } */ foreach($results as $row) { if ($current_row != $row['DataDisplay_Row']) { if ($current_row != 0) { // FINISH OFF THE ROW; while($col++ < NCOLS) { include("cell_formatting.php"); $body.=">"; $body .= ""; $body.="</td>"; } $body .= "</tr>\n<tr>"; } // MOVE OUR ROW MARKER $current_row = $row['DataDisplay_Row']; // RESET COL COUNT $col = -1; // TODO: HANDLE MISSED ROWS HERE } if($row['DataDisplay_EndCell']=="" OR $row['DataDisplay_EndCell']<0) { continue; } if($row['DataDisplay_StartCell']=="") { if($row['DataDisplay_EndCell']>83) { $the_cell=0; } else { $the_cell=$row['DataDisplay_EndCell']; } } else { $the_cell=$row['DataDisplay_StartCell']; } while($col++ < ($the_cell-1)) { include("cell_formatting.php"); $body.=">"; //$body.=""; //$body .= $col; $body.="</td>"; } //here is where you've got data //in the rare instance of a submitted_date exceeding the range of the page, you've got to handle that so the page as a whole isn't compromised if(strtotime($row['dte_DateSubmitted']) >strtotime($week_twelve)) { continue; } if($row['TotalCellSpan']>1 OR ($row['DataDisplay_EndCell']>83 AND $row['DataDisplay_StartCell']=="")) { //there are situations where have a TotalCellSpan that is greater than 0, but it belongs to an event that began before the timeframe that's being currently viewed (the DataDisplay_StartCell is 0). That being the case, your colspan will be the DataDisplay_EndCell - DataDisplay_StartCell +1) if($row['TotalCellSpan']>1 AND $row['DataDisplay_StartCell']==0) { include("cell_formatting_multiple_zero.php"); include("cell_content_multiple.php"); } else { //cell_formatting_multiple.php has a closing tag for the cell include("cell_formatting_multiple.php"); //this next section is what displays your content in the context of a conventional multi-day event include("cell_content_multiple.php"); } } else { include("cell_formatting.php"); $body.=">"; $body.="<a href=\"#\" onclick=\"javascript:void window.open('event_description.php?id="; $body.=$row['int_DEVELOPERS_Project_Id']; $body.="&project_type="; $body.=$row['str_ProjectType']; $body.="&developer="; $body.=stripslashes($row['str_Full_Name_Developer']); $body.="&submitted_by="; $body.=stripslashes($row['str_Full_Name_Submitter']); $body.="&status="; $body.=stripslashes($row['str_ProjectStatus']); $body.="&effort="; $body.=stripslashes($row['str_LevelOfEffort']); $body.="','1435862141298','width=610,height=560,toolbar=0,menubar=0,location=0,status=0,scrollbars=0,resizable=1,left=0,top=0');return false;\" class=\"tooltip\">"; include("cell_formatting_single.php"); $body.="<span><img class=\"callout_area\" src=\"images/callout.gif\" alt=\"callout\" />"; $body.="<b>tool:</b> "; $body.=stripslashes($row['str_Tool']); $body.="<br><b>project name:</b> "; $body.=stripslashes($row['str_ProjectName']); $body.="<br><b>submitted date:</b> "; $body.=date("n/d/Y", strtotime($row['dte_DateSubmitted'])); $body.="<br><b>target UAT date: </b>"; if($row['dte_TargetCompletionDate']=="" or $row['dte_TargetCompletionDate']==" " OR is_null($row['dte_TargetCompletionDate'])) { $body.="not documented"; } else { $body.=date("n/d/Y", strtotime($row['dte_TargetCompletionDate'])); } $body.="<br><b>percentage completed:</b> "; $body.=$row['dec_PercentageCompleted']*100; $body.="%</span></a>"; //$body.=$col; $body.="</td>"; } } while($col++ < NCOLS) { include("cell_formatting.php"); $body.=">"; //$body .= ""; //$body.=$col; $body.="</td>"; } $body .= "</tr>\n"; $body.=" <!-- this last row is just for aesthetics so there's a little room at the bottom of the page. It also gurantees a certain with for all of the \"daily\" cells -->"; include("spacer_single.php"); $body.=" </table><br><br>"; $new_page->setBody($body); echo $new_page->display(); ?>