public function repairReportsTypes($reportid = "") { $adb = PearDatabase::getInstance(); global $default_charset; $queryDebug = false; $queryDebug = true; $where = ""; if ($reportid != "") { $where = " WHERE its4you_reports4you.reports4youid = ? "; $params[] = $reportid; } $ssql = "SELECT \n reports4youid, \n reporttype,\n its4you_reports4you_sortcol.sortcolid, \n its4you_reports4you_sortcol.timeline_type, \n its4you_reports4you_sortcol.columnname columnname_sc , \n its4you_reports4you_selectcolumn.columnname columnname_dt \n \n FROM its4you_reports4you \n \n LEFT JOIN its4you_reports4you_sortcol ON its4you_reports4you_sortcol.reportid = its4you_reports4you.reports4youid AND its4you_reports4you_sortcol.columnname!= 'none' AND its4you_reports4you_sortcol.sortcolid!= '4' \n LEFT JOIN its4you_reports4you_summaries ON its4you_reports4you_summaries.reportsummaryid = its4you_reports4you.reports4youid \n LEFT JOIN its4you_reports4you_selectcolumn ON its4you_reports4you_selectcolumn.queryid = its4you_reports4you.reports4youid\n \n {$where} \n \n GROUP BY \n its4you_reports4you.reports4youid , \n its4you_reports4you_sortcol.columnname\n \n ORDER BY \n its4you_reports4you.reports4youid ASC, \n its4you_reports4you_sortcol.sortcolid ASC, \n its4you_reports4you_selectcolumn.columnname ASC "; //WHERE its4you_reports4you.reports4youid IN (57, 58, 4, 11, 15, 34, 9, 36, 30, 32) $params = array(); if ($reportid != "") { $ssql .= ' WHERE queryid = ? '; $params[] = $reportid; } $result = $adb->pquery($ssql, $params); $noOfColumns = $adb->num_rows($result); $check_array = array(); if ($noOfColumns > 0) { while ($reportrow = $adb->fetchByAssoc($result)) { $reporttype = ""; $reportid = $reportrow["reports4youid"]; $timeline_type = $reportrow["timeline_type"]; $columnname_sc = $reportrow["columnname_sc"]; $columnname_dt = $reportrow["columnname_dt"]; if ($columnname_sc != "") { $check_array[$reportid]["columnname_sc"][] = $columnname_sc; } if ($columnname_dt != "") { $check_array[$reportid]["columnname_dt"][] = $columnname_dt; } if ($timeline_type != "") { $check_array[$reportid]["timeline_type"][] = $timeline_type; } } if (!empty($check_array)) { foreach ($check_array as $reportid => $report_array) { $timeline_type = $report_array["timeline_type"]; $columnname_dt = $report_array["columnname_dt"]; $columnname_sc = $report_array["columnname_sc"]; /* ITS4YouReports::sshow("START TYPIZATION"); ITS4YouReports::sshow($reportid); ITS4YouReports::sshow($report_array); */ if (empty($timeline_type)) { // tabular $reporttype = "tabular"; //ITS4YouReports::sshow($reporttype); ITS4YouReports::repairReportType($reportid, $reporttype); continue; } if (count($timeline_type) == 1 && !empty($columnname_dt)) { $reporttype = "summaries_w_details"; //ITS4YouReports::sshow($reporttype); ITS4YouReports::repairReportType($reportid, $reporttype); continue; } if (in_array("cols", $timeline_type)) { $reporttype = "summaries_matrix"; //ITS4YouReports::sshow($reporttype); ITS4YouReports::repairReportType($reportid, $reporttype); continue; } $reporttype = "summaries"; //ITS4YouReports::sshow($reporttype); ITS4YouReports::repairReportType($reportid, $reporttype); } } } return true; }