Explorar el Código

Add large logo to PPT export

Alan Lam hace 8 años
padre
commit
d632fcc22a

+ 4 - 0
controllers/reports.php

@@ -10,6 +10,10 @@ Core::addBreadcrumb("/account/reports", "Reports");
 $customer = Customer::getForAdmin();
 if(!$customer) throw new Exception("You do not have permission to access this page.");
 
+$customer_slug = Util::slug($customer->name);
+$logo_file_path = ROOT_DIR . "/public/img/customer_logos/{$customer_slug}_logo.png";
+$has_logo = file_exists($logo_file_path);
+
 $page_title = "$customer->name Reports";
 
 Core::addBreadcrumb("/account/reports?customer_id=$customer->id", $page_title);

+ 35 - 10
controllers/reports_presentation.php

@@ -22,16 +22,41 @@ $presentation = new PhpPresentation(); // 960x720
 		  ->setOffsetX(380)
 		  ->setOffsetY(10);
 
-	// Title
-	$shape = $slide->createRichTextShape()
-		  ->setHeight(120)
-		  ->setWidth(940)
-		  ->setOffsetX(10)
-		  ->setOffsetY(315);
-	$shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER );
-	$run = $shape->createTextRun($customer->name . " " . date("F Y") . " Tests");
-	$run->getFont()->setBold(true)
-					   ->setSize(45);
+	$title = $customer->name . " " . $template->name . " " . date("F Y") . " Tests";
+
+	if($has_logo) {
+
+		$shape = $slide->createDrawingShape();
+		$shape->setName("$customer->name logo")
+			->setDescription("$customer->name logo")
+			->setPath($logo_file_path)
+			->setWidth(720)
+			->setOffsetX(120)
+			->setOffsetY(180);
+
+		$shape = $slide->createRichTextShape()
+			->setHeight(60)
+			->setWidth(940)
+			->setOffsetX(120)
+			->setOffsetY(120);
+		$run = $shape->createTextRun($title);
+		$run->getFont()->setBold(true)->setSize(16);
+
+
+	}
+	else {
+		// Title
+		$shape = $slide->createRichTextShape()
+			  ->setHeight(120)
+			  ->setWidth(940)
+			  ->setOffsetX(10)
+			  ->setOffsetY(315);
+		$shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER );
+		$run = $shape->createTextRun($title);
+		$run->getFont()->setBold(true)
+						   ->setSize(24);
+	}
+
 }
 
 $names = [];

BIN
public/img/customer_logos/bacta_logo.png


BIN
public/img/customer_logos/praesepe_logo.png