|
@@ -164,6 +164,88 @@ foreach($charts_b64 as $index => $b64) {
|
|
|
$names[] = $name;
|
|
$names[] = $name;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// Region/Area Manager Stats
|
|
|
|
|
+
|
|
|
|
|
+foreach([0, 1] as $mode) {
|
|
|
|
|
+
|
|
|
|
|
+ switch($mode) {
|
|
|
|
|
+ case 0:
|
|
|
|
|
+ $current_data = $region_data;
|
|
|
|
|
+ $mode_text = "Region";
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 1:
|
|
|
|
|
+ $current_data = $area_manager_data;
|
|
|
|
|
+ $mode_text = "Area Manager";
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ foreach($current_data as $data_id => $rows) {
|
|
|
|
|
+
|
|
|
|
|
+ $slide = $presentation->createSlide();
|
|
|
|
|
+
|
|
|
|
|
+ // Title
|
|
|
|
|
+ $shape = $slide->createRichTextShape()
|
|
|
|
|
+ ->setHeight(120)->setWidth(940)
|
|
|
|
|
+ ->setOffsetX(30)->setOffsetY(30);
|
|
|
|
|
+ $run = $shape->createTextRun("$mode_text: $data_id");
|
|
|
|
|
+ $run->getFont()->setSize(36);
|
|
|
|
|
+
|
|
|
|
|
+ // Table
|
|
|
|
|
+
|
|
|
|
|
+ $shape = $slide->createTableShape(5)
|
|
|
|
|
+ ->setWidth(900)
|
|
|
|
|
+ ->setOffsetX(30)
|
|
|
|
|
+ ->setOffsetY(110);
|
|
|
|
|
+ // Create header row
|
|
|
|
|
+ $row = $shape->createRow();
|
|
|
|
|
+ $row->setHeight(20);
|
|
|
|
|
+
|
|
|
|
|
+ foreach(["Period", "Tests", "Passes", "Fails", "Rate"] as $label) {
|
|
|
|
|
+ $cell = $row->nextCell();
|
|
|
|
|
+ $cell->getActiveParagraph()->getAlignment()
|
|
|
|
|
+ ->setMarginBottom(4)
|
|
|
|
|
+ ->setMarginLeft(4)
|
|
|
|
|
+ ->setMarginRight(4)
|
|
|
|
|
+ ->setMarginTop(4);
|
|
|
|
|
+ $cell->createTextRun($label)
|
|
|
|
|
+ ->getFont()->setBold(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $index = 0;
|
|
|
|
|
+
|
|
|
|
|
+ foreach($rows as $key => $data) {
|
|
|
|
|
+ $rate = ($data->testCount == 0) ? "0.00" : number_format(($data->passCount * 100) / $data->testCount, 2);
|
|
|
|
|
+ $label = $key_labels[$index];
|
|
|
|
|
+
|
|
|
|
|
+ $values = [$data->testCount, $data->passCount, $data->failCount, "$rate%"];
|
|
|
|
|
+
|
|
|
|
|
+ $row = $shape->createRow();
|
|
|
|
|
+ $row->setHeight(20);
|
|
|
|
|
+ $cell = $row->nextCell();
|
|
|
|
|
+ $cell->getActiveParagraph()->getAlignment()
|
|
|
|
|
+ ->setMarginBottom(4)
|
|
|
|
|
+ ->setMarginLeft(4)
|
|
|
|
|
+ ->setMarginRight(4)
|
|
|
|
|
+ ->setMarginTop(4);
|
|
|
|
|
+ $cell->createTextRun($label)
|
|
|
|
|
+ ->getFont()->setBold(true);
|
|
|
|
|
+ foreach($values as $value) {
|
|
|
|
|
+ $cell = $row->nextCell();
|
|
|
|
|
+ $cell->getActiveParagraph()->getAlignment()
|
|
|
|
|
+ ->setHorizontal(Alignment::HORIZONTAL_RIGHT)
|
|
|
|
|
+ ->setMarginBottom(4)
|
|
|
|
|
+ ->setMarginLeft(4)
|
|
|
|
|
+ ->setMarginRight(4)
|
|
|
|
|
+ ->setMarginTop(4);
|
|
|
|
|
+ $cell->createTextRun($value);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $index++;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
if($action == "export-pptx") {
|
|
if($action == "export-pptx") {
|
|
|
header("Content-Type: application/vnd.openxmlformats-officedocument.presentationml.presentation");
|
|
header("Content-Type: application/vnd.openxmlformats-officedocument.presentationml.presentation");
|
|
|
$pptx_writer = IOFactory::createWriter($presentation, "PowerPoint2007");
|
|
$pptx_writer = IOFactory::createWriter($presentation, "PowerPoint2007");
|