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"];
} if (count(@$HTTP_POST_VARS["display_sections"]) < 1) { $HTTP_POST_VARS["display_sections"] = array_keys(Customer_Stats_Report::getDisplaySections()); unset($HTTP_POST_VARS["display_sections"][4]); } $support_levels = array('Aggregate' => 'Aggregate'); $grouped_levels = Customer::getGroupedSupportLevels($prj_id); foreach ($grouped_levels as $level_name => $level_ids) { $support_levels[$level_name] = $level_name; } if (count(@$HTTP_POST_VARS["support_level"]) < 1) { $HTTP_POST_VARS["support_level"] = array('Aggregate'); } // XXX: internal only - Remove all mentions of InnoDB $prj_id = Auth::getCurrentProject(); $tpl->assign(array("has_support_levels" => Customer::doesBackendUseSupportLevels($prj_id), "project_name" => Auth::getCurrentProjectName(), "support_levels" => $support_levels, "support_level" => @$HTTP_POST_VARS["support_level"], "start_date" => $start_date, "end_date" => $end_date, "sections" => Customer_Stats_Report::getDisplaySections(), "display_sections" => $HTTP_POST_VARS["display_sections"], "split_innoDB" => @$HTTP_POST_VARS["split_innoDB"], "include_expired" => @$HTTP_POST_VARS["include_expired"], "graphs" => Customer_Stats_Report::getGraphTypes())); // only set customers if user has role of manager or above if (Auth::getCurrentRole() >= User::getRoleID('manager')) { $tpl->assign(array("customers" => Customer::getAssocList($prj_id), "customer" => @$HTTP_POST_VARS["customer"])); } // loop through display sections $display = array(); foreach ($HTTP_POST_VARS["display_sections"] as $section) { $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") {