assign("MOD", $current_module_strings); $xtpl->assign("APP", $app_strings); $xtpl->assign("IMAGE_PATH", $image_path); $metriclists = getMetricList(); $vtlog->logthis("Metrics :: Successfully got MetricList to be displayed","info"); if(isset($metriclists)) { foreach ($metriclists as $key => $metriclist) { $listquery = getListQuery($metriclist['module']); $oCustomView = new CustomView($metriclist['module']); $metricsql = $oCustomView->getMetricsCvListQuery($metriclist['id'],$listquery,$metriclist['module']); //$vtlog->logthis("Metrics :: Successfully got MetricSQL to be queried","info"); $metricresult = $adb->query($metricsql); if($metricresult) { $rowcount = $adb->fetch_array($metricresult); if(isset($rowcount)) { $metriclists[$key]['count'] = $rowcount['count']; } } } $vtlog->logthis("Metrics :: Successfully build the Metrics","info"); } //print_r($metriclists); // Stick the form header out there. echo get_form_header("Key Metrics", '', false); if(isset($metriclists)) { $oddRow = true; foreach($metriclists as $metriclist) { $metric_fields = array( 'ID' => $metriclist['id'], 'NAME' => $metriclist['name'], 'COUNT' => $metriclist['count'], 'MODULE' => $metriclist['module'] ); $xtpl->assign("CUSTOMVIEW", $metric_fields); if($oddRow) { //todo move to themes $xtpl->assign("ROW_COLOR", 'oddListRow'); } else { //todo move to themes $xtpl->assign("ROW_COLOR", 'evenListRow'); } $oddRow = !$oddRow; $xtpl->parse("main.row"); // Put the rows in. } } $xtpl->parse("main"); if (count($metriclists)>0) $xtpl->out("main"); else echo "".$current_module_strings['NTC_NONE_SCHEDULED'].""; echo "
"; // Stick on the form footer echo get_form_footer(); function getMetricList() { global $adb; $ssql = "select customview.* from customview inner join tab on tab.name = customview.entitytype"; $ssql .= " where customview.setmetrics = 1 order by customview.entitytype"; //echo $ssql; $result = $adb->query($ssql); while($cvrow=$adb->fetch_array($result)) { $metricslist = Array(); $metricslist['id'] = $cvrow['cvid']; $metricslist['name'] = $cvrow['viewname']; $metricslist['module'] = $cvrow['entitytype']; $metricslist['count'] = ''; $metriclists[] = $metricslist; } return $metriclists; } ?>