switch ($chartId) { case REPORTS_PER_ANDROID_VERSION_PIE_CHART_ID: $arr = DBHelper::selectRows(TBL_REPORTS, null, null, REPORT_ANDROID_VERSION . ', COUNT(*)', REPORT_ANDROID_VERSION, null, false); if ($arr != null) { $data = ChartHelper::convertMySQLArrToPieChartJSON($arr); } else { $message = 'No data yet recorded.|'; } break; case REPORTS_PER_APPLICATION_PIE_CHART_ID: $arr = DBHelper::selectRows(TBL_REPORTS, null, null, REPORT_PACKAGE_NAME . ',COUNT(*)', REPORT_PACKAGE_NAME, null, false); if ($arr != null) { for ($i = 0; $i < sizeof($arr); ++$i) { $arr[$i][0] = ReportHelper::formatPackageName($arr[$i][0], true); } $data = ChartHelper::convertMySQLArrToPieChartJSON($arr); } else { $message = 'No data yet recorded.|'; } break; case REPORTS_EVOLUTION_LINE_CHART_ID: $projection = 'DATE(NOW()-INTERVAL ' . INC_VALUE . ' DAY) date, ' . 'DATE_FORMAT(DATE(NOW()-INTERVAL ' . INC_VALUE . ' DAY),"%m-%d") formatted_date, ' . '(SELECT COUNT(*) FROM ' . TBL_REPORTS . ' WHERE DATE(user_crash_date)=date) reports,' . '(SELECT COUNT(*) FROM ' . TBL_ISSUES . ' WHERE DATE(issue_datetime)=date) issues, ' . '(SELECT count(*)/DAYOFYEAR(DATE_FORMAT(' . REPORT_CRASH_DATE . ', "%Y-%m-%d")) FROM ' . TBL_REPORTS . ' WHERE DATE_FORMAT(' . REPORT_CRASH_DATE . ',"%Y")=\'' . date('Y') . '\') avg_per_day_current_year'; $orderby = 'inc ASC LIMIT 15'; $arr = DBHelper::selectRows(TBL_INCREMENTS, null, $orderby, $projection, null, null, true); if ($arr != null && count($arr) > 0) { $data = ChartHelper::convertMySQLArrToReportsEvolChartJSON($arr); } else { $message = 'No data yet recorded.|'; } break; default:
}); </script> <?php } ?> </div> <!-- ////// SALES PER APPLICATION ////// --> <div class="span4 app-stat-box" > <h4>Sales per Application</h4> <div id="salesPerApp" style="width:400px; height:200px;" ></div> <?php $salesPerApp = DbHelper::selectRows(TBL_SALES . ' LEFT JOIN ' . TBL_APPLICATIONS . ' ON ' . APP_ID . '=' . SALE_APP_ID, null, SALE_ORDER_CHARGED_TIMESTAMP . ' ASC', APP_NAME . ', COUNT(*) count', SALE_APP_ID, null, false); ?> <script type="text/javascript" >$(function() { drawPieChart('#salesPerApp', <?php echo ChartHelper::convertMySQLArrToPieChartJSON($salesPerApp, false); ?> , false); });</script> </div> </div> <div class="row" > <div id="salesEvolutionLegend" class="span4" style="" ></div> </div> <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="libs/flot/excanvas.min.js"></script><![endif]--> <script language="javascript" type="text/javascript" src="libs/flot/jquery.flot.min.js"></script> <script language="javascript" type="text/javascript" src="libs/flot/jquery.flot.pie.min.js"></script> <script language="javascript" type="text/javascript" src="libs/flot/jquery.flot.time.min.js"></script> <script language="javascript" type="text/javascript" src="libs/flot/jquery.flot.stack.min.js"></script>