Auth::checkAuthentication(APP_COOKIE); if (Auth::getCurrentRole() <= User::getRoleID("Customer")) { echo "Invalid role"; exit; } /** * Customer Statistics Graphs. Will Graph different items, depending on what is passed to this page. */ $data = Session::get("customer_stats_data"); if (empty($data)) { echo "Unable to load data"; exit; } $colors = array("#c0c0c0", "#0033ff", "#99ccff", "#00ff66", "#33ffcc", "#ffff66", "#ffffcc", "#ff3333", "#ff9191"); $color_index = 0; $graph_types = Customer_Stats_Report::getGraphTypes(); $graph_id = $HTTP_GET_VARS["graph_id"]; $plots = array(); $max_title_len = 0; foreach ($data as $index => $info) { if (strlen($info["title"]) > $max_title_len) { $max_title_len = strlen($info["title"]); } // go through data and convert into something plottable $plottable = array(); switch ($graph_id) { case 1: $plottable["Customer Count"] = $info["customer_counts"]["customer_count"]; $plottable["Issues"] = $info["issue_counts"]["total"]; $plottable["Emails by Staff"] = $info["email_counts"]["developer"]["total"]; $plottable["Emails by Customers"] = $info["email_counts"]["customer"]["total"];
$display[$section] = 1; } $tpl->assign("display", $display); if (@$HTTP_POST_VARS["cat"] == "Generate") { if ($start_date == "0000-00-00") { $start_date = ''; } if ($end_date == "0000-00-00") { $end_date = ''; } // set the date range msg if (!empty($start_date) && !empty($end_date)) { $date_msg_text = "Date Range: {$start_date} - {$end_date}"; $tpl->assign(array("date_msg_text" => $date_msg_text, "date_msg" => "<div align=\"center\" style=\"font-family: Verdana, Arial, Helvetica, sans-serif;font-style: normal;font-weight: bold; margin: 3px\">\n {$date_msg_text}\n </div>")); } $csr = new Customer_Stats_Report($prj_id, @$HTTP_POST_VARS["support_level"], @$HTTP_POST_VARS["customer"], $start_date, $end_date); if (@$HTTP_POST_VARS["split_innoDB"] == 1) { $csr->splitByInnoDB(true); } if (@$HTTP_POST_VARS["include_expired"] == 1) { $csr->excludeExpired(false); } else { $csr->excludeExpired(true); } $data = $csr->getData(); $tpl->assign("data", $data); $tpl->assign("time_tracking_categories", $csr->getTimeTrackingCategories()); $tpl->assign("row_label", $csr->getRowLabel()); Session::set("customer_stats_data", $data); } function formatValue($value, $all_value, $round_places = false, $alternate_value = false)