Пример #1
0
 public function gantt_chart()
 {
     $string = "<chart manageResize='1'dateFormat='dd/mm/yyyy' outputDateFormat='ddds mns yy' ganttWidthPercent='40' canvasBorderColor='999999' canvasBorderThickness='0' gridBorderColor='4567aa' gridBorderAlpha='20' ganttPaneDuration='3' ganttPaneDurationUnit='m' ><categories  bgColor='009999'>";
     //gets the Initial date and end date from the table Shipments
     //stores them in the form of an array in the start variable
     //used to make the chart's date timeline
     $start = Shipments::get_Initial();
     //foreach statement cycles through the array $start
     foreach ($start as $starts) {
         //all the initial dates are stored in the array $strt
         $strt = $starts['date1'];
         //formats the initial dates in a proper format
         $start1 = date('d/m/Y', strtotime($strt));
         //stores the end date in a second variable and formats them accordingly
         $startz = $starts['date2'];
         $start2 = date('d/m/Y', strtotime($startz));
         $string .= "<category start='" . $start1 . "' end='" . $start2 . "'  label='Shipment of Vaccine Received'  fontColor='ffffff' fontSize='16' />\n\t\t\t\n\t\t\t</categories>";
         $string .= "<categories  bgColor='4567aa' fontColor='ff0000'><category start='{$start1}' end='{$start2}' label='Months'  alpha='' font='Verdana' fontColor='ffffff' fontSize='16' /></categories>";
     }
     $string .= "<categories  bgColor='ffffff' fontColor='1288dd' fontSize='10' isBold='1' align='center'>";
     //gets the first and last year and month in the shipments table
     //stores them in the start var.
     $start = Shipments::get_min_month_year();
     foreach ($start as $starts) {
         $minmonth = $starts['date1'];
         $minyear = $starts['date2'];
         $maxmonth = $starts['date3'];
         $maxyear = $starts['date4'];
     }
     for ($i = $minyear; $i <= $maxyear; $i++) {
         for ($j = $minmonth; $j <= $maxmonth; $j++) {
             //forming the date
             $start = $i . '/' . '0' . $j . '/' . '1';
             $startz = $start;
             //getting last day of the month
             $today = date("Y-m-d", strtotime("+1month -1 second", strtotime(date("Y-m-1", strtotime($start)))));
             $end = date('d/m/Y', strtotime($today));
             //populating names of the month;
             $monthname = date("F", mktime(0, 0, 0, $j, 1, 2000));
             $start2 = date('d/m/Y', strtotime($startz));
             $string .= "<category start='{$start2}' end='{$end}' label='{$monthname}'/>";
         }
     }
     $string .= "</categories>";
     $string .= "<processes headerText='Task' fontColor='000000' fontSize='11' isAnimated='1' bgColor='4567aa'  headerVAlign='bottom' headerAlign='left' headerbgColor='4567aa' headerFontColor='ffffff' headerFontSize='12'  align='left' isBold='1' bgAlpha='25'>";
     $task_id = Shipments::get_task_name();
     foreach ($task_id as $task_ids) {
         $id = $task_ids['task_id'];
         $id2 = $task_ids['id'];
         $id3 = $task_ids['vaccine_id'];
         $task = tasks::get_task_name($id);
         $vacc_name = Vaccines::get_Name($id3);
         $vacc = $vacc_name["Name"];
         foreach ($task as $tasks) {
             $name = $tasks['name'];
             $part = $name . " for " . $vacc;
             $string .= "<process label='{$part}' id='{$id2}'/>";
         }
     }
     $string .= "</process>";
     $string .= "<dataTable showProcessName='1' nameAlign='left' fontColor='000000' fontSize='10' vAlign='right' align='center' headerVAlign='bottom' headerAlign='left' headerbgColor='4567aa' headerFontColor='ffffff' headerFontSize='12' >";
     //<dataColumn bgColor='eeeeee' headerText='Collins' >";
     $all_dates = Shipments::get_them_dates();
     $string .= "<dataColumn bgColor='eeeeee' headerText='Start'>";
     $all_dates = Shipments::get_them_dates();
     foreach ($all_dates as $dates) {
         $initialx = $dates['expected_end_date'];
         $initial = date('d/m/Y', strtotime($initialx));
         $string .= "<text label='{$initial}'/>";
     }
     $string .= "</dataColumn>";
     $string .= "<dataColumn bgColor='eeeeee' headerText='Finish'>";
     $all_dates = Shipments::get_them_dates();
     foreach ($all_dates as $dates) {
         $initialx = $dates['end_date'];
         $initial = date('d/m/Y', strtotime($initialx));
         $string .= "<text label='{$initial}'/>";
     }
     $string .= "</dataColumn>";
     $string .= "</dataTable>";
     $range = Shipments::get_range();
     foreach ($range as $ranges) {
         $minmonth = $ranges['date1'];
         $max = $ranges['date3'];
     }
     $task_id = Shipments::get_them_dates();
     $string .= "<tasks>";
     foreach ($task_id as $task_id) {
         //stores the id of the task
         @($id = $task_id['id']);
         //stores the date the task was initiated by a user
         @($initialx = $task_id['Initiate_date']);
         @($initial2 = date('d/m/Y', strtotime($initialx)));
         //stores the expected end date for a particular task
         //default duration is currently 7 days
         @($endx = $task_id['expected_end_date']);
         @($end = date('d/m/Y', strtotime($endx)));
         //stores the actual end date of a task
         @($actual = $task_id['end_date']);
         @($actual_end = date('d/m/y', strtotime($actual)));
         //if function to change the color of the bar
         if ($actual_end <= $end) {
             $color_bar = 'EEEEEE';
             $text_bar = 'Actual: On Schedule';
         } else {
             $color_bar = 'ED0909';
             $text_bar = 'Actual: Overdue';
         }
         $string .= "<task label='Planned' processId='{$id}' start='{$initial2}' end='{$end}' id='{$id}-1' color='4567aa' height='22%' topPadding='12%'/>";
         $string .= "<task label='" . $text_bar . "' processId='{$id}' start='{$initial2}' end='{$actual_end}' id='{$id}' color='" . $color_bar . "' alpha='100'  topPadding='40%' height='22%' />";
     }
     $string .= "</tasks>";
     $string .= "\t\n\t\t\t<legend>\n\t\t\t        <item label='Planned' color='4567aa' />\n\t\t\t        <item label='Actual' color='999999' />\n\t\t\t        \n\t\t\t</legend>\n\t\t\t";
     $string .= "\t\n\t\t\t\t<styles>\n\t\t\t\t        <definition>\n\t\t\t\t                <style type='Font' name='legendFont' size='12' />\n\t\t\t\t        </definition>\n\t\t\t\t        <application>\n\t\t\t\t                <apply toObject='LEGEND' styles='legendFont' />\n\t\t\t\t        </application>\n\t\t\t\t</styles>";
     $string .= "</chart>";
     echo $string;
 }
Пример #2
0
				$monthname = date("F", mktime(0, 0, 0, $j, 1, 2000));
 
				
		  $start2= date('d/m/Y', strtotime( $startz));
				
				$string.= "<category start='$start2' end='$end' label='$monthname'/>

";

			}
		}

		$string.= "</categories>";

		$string.= "<processes headerText='Task' fontColor='000000' fontSize='11' isAnimated='1' bgColor='4567aa'  headerVAlign='bottom' headerAlign='left' headerbgColor='4567aa' headerFontColor='ffffff' headerFontSize='12'  align='left' isBold='1' bgAlpha='25'>";
		$task_id = Shipments::get_task_name();
		foreach ($task_id as $task_ids) {
			$id = $task_ids['task_id'];
			$id2 = $task_ids['id'];
			$task = tasks::get_task_name($id);
			foreach ($task as $tasks) {
				$name = $tasks['name'];

				$string.= "<process label='$name' id='$id2'/>";

			}

		}
		$string.= "</process>";

		$string.= "<dataTable showProcessName='1' nameAlign='left' fontColor='000000' fontSize='10' vAlign='right' align='center' headerVAlign='bottom' headerAlign='left' headerbgColor='4567aa' headerFontColor='ffffff' headerFontSize='12' > <dataColumn bgColor='eeeeee' headerText='Expected' >";