Procházet zdrojové kódy

Rename Performance to Reports

Alan Lam před 8 roky
rodič
revize
9fbea0068e

+ 1 - 1
controllers/account.php

@@ -23,7 +23,7 @@ if(Core::$user->level >= User::LEVEL_ADMIN) {
 }
 
 if(Core::$user->level >= User::LEVEL_CUSTOMER) {
-	$links["/account/performance"] = "Performance";
+	$links["/account/reports"] = "Reports";
 	$links["/account/projects"] = "Projects";
 	$links["/account/locations"] = "Locations";
 	$links["/account/templates"] = "Templates";

+ 9 - 9
controllers/performance.php → controllers/reports.php

@@ -2,17 +2,17 @@
 
 Core::addScript("public/js/Chart.bundle.min.js");
 Core::addScript("public/js/chartjs-plugin-datalabels.min.js");
-Core::addScript("public/js/app-performance.js");
+Core::addScript("public/js/app-reports.js");
 
 Core::addBreadcrumb("/account", "Account");
-Core::addBreadcrumb("/account/performance", "Performance");
+Core::addBreadcrumb("/account/reports", "Reports");
 
 $customer = Customer::getForAdmin();
 if(!$customer) throw new Exception("You do not have permission to access this page.");
 
-$page_title = "$customer->name Performance";
+$page_title = "$customer->name Reports";
 
-Core::addBreadcrumb("/account/performance?customer_id=$customer->id", $page_title);
+Core::addBreadcrumb("/account/reports?customer_id=$customer->id", $page_title);
 
 $date_range = http::value("date_range");
 if(!$date_range) $date_range = "ytd";
@@ -505,7 +505,7 @@ if($submit) {
 		$charts[] = $chart;
 
 		// Pass Rate Period
-		$performance = array_values(array_map(function($d) {
+		$pass_rates = array_values(array_map(function($d) {
 			if($d->testCount == 0) return 0;
 			return round(($d->passCount / $d->testCount) * 100);
 		}, $data));
@@ -515,7 +515,7 @@ if($submit) {
 		$chart->setType("bar");
 		$chart->setTitle("Pass Rate by $resolution_name");
 		$chart->setLabels($x_data_labels);
-		$chart->addDataset("Pass Rate (%)", $performance, [
+		$chart->addDataset("Pass Rate (%)", $pass_rates, [
 			"background_colours" => "#2196F3"
 		]);
 		$chart->setDatalabelSuffixes("%");
@@ -534,7 +534,7 @@ if($submit) {
 		$chart->addYAxis("linear", "left", "y-axis-1", true, ["min" => 0, "max" => ceil(max($test_counts) / 10) * 10]);
 		$chart->addYAxis("linear", "right", "y-axis-2", false, ["min" => 0, "max" => 100]);
 
-		$chart->addDataset("Pass Rate (%)", $performance, [
+		$chart->addDataset("Pass Rate (%)", $pass_rates, [
 			"border_colours" => "#FFEB3B",
 			"background_colours" => "transparent",
 			"type" => "line",
@@ -779,7 +779,7 @@ if($submit) {
 			case "export-pptx":
 			case "export-odp":
 
-				require "performance_presentation.php";
+				require "reports_presentation.php";
 
 				break;
 			default:
@@ -791,7 +791,7 @@ if($submit) {
 
 
 View::includeOnce("header", compact("page_title"));
-View::include("performance", compact("customer", "date_range", "from_quarter", "to_quarter", "date_resolution", "all_projects", "project_ids", "charts", "data", "total_data", "locations_missing_region", "locations_missing_area_manager", "region_data", "area_manager_data"));
+View::include("reports", compact("customer", "date_range", "from_quarter", "to_quarter", "date_resolution", "all_projects", "project_ids", "charts", "data", "total_data", "locations_missing_region", "locations_missing_area_manager", "region_data", "area_manager_data"));
 View::includeOnce("footer");
 
 ?>

+ 0 - 0
controllers/performance_presentation.php → controllers/reports_presentation.php


+ 0 - 0
public/js/app-performance.js → public/js/app-reports.js


+ 3 - 3
routes.php

@@ -120,9 +120,9 @@ $routes = [
 	// Submit ID
 	"/^account\/submit-id$/" => ["controller" => "submit_id", "require_user_level" => User::LEVEL_REGISTERED],
 
-	// Performance
-	"/^account\/performance$/" => ["controller" => "performance", "require_user_level" => User::LEVEL_VENUE],
-	"/^account\/performance\/(export-odp|export-pptx)$/" => ["controller" => "performance", "params" => ["action"], "require_user_level" => User::LEVEL_VENUE],
+	// Reports
+	"/^account\/reports$/" => ["controller" => "reports", "require_user_level" => User::LEVEL_VENUE],
+	"/^account\/reports\/(export-odp|export-pptx)$/" => ["controller" => "reports", "params" => ["action"], "require_user_level" => User::LEVEL_VENUE],
 
 
 ];

+ 2 - 2
views/performance.php → views/reports.php

@@ -19,7 +19,7 @@ $date_range_custom_style = ($date_range == "custom") ? "" : "display: none";
 <div class="container">
 	<div class="row d-print-none">
 		<div class="col">
-			<h2><?=htmlspecialchars($customer->name)?> Performance</h2>
+			<h2><?=htmlspecialchars($customer->name)?> Reports</h2>
 		</div>
 		<div class="col-auto">
 			<?php
@@ -305,7 +305,7 @@ $date_range_custom_style = ($date_range == "custom") ? "" : "display: none";
 		<?php
 		foreach(["pptx", "odp"] as $format) {
 			?>
-			<form id="form-<?=$format?>" method="post" action="/account/performance/export-<?=$format?>" data-rendered="0">
+			<form id="form-<?=$format?>" method="post" action="/account/reports/export-<?=$format?>" data-rendered="0">
 				<input type="hidden" name="submit" value="<?=htmlspecialchars($_SESSION["csrf_token"])?>" />
 				<input type="hidden" name="customer_id" value="<?=intval($customer->id)?>" />
 				<input type="hidden" name="date_range" value="<?=htmlspecialchars($date_range)?>" />