/* Decoded by unphp.net */ ?>hasPermission('456', $_SESSION[SESSION_VAR_NAME]['role'])) { if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { $index_master_id = $_REQUEST['master_id']; $Data_Table = new data_table($db); $aColumns = array('r.id', 'r.name', 'rt.report_type', 'r.trigger_field', 'r.period', 'r.period_duration', 'r.index_master_fields', 'r.index_group_id', 'r.index_group_fields'); $Data_Table->set_aColumns($aColumns); $cnt = count($matches_record); if ($cnt > 0) { for ($col = 0; $col < count($matches_record); $col++) { array_push($Custom_Columns, $matches_record[$col]); } } /* Indexed column (used for fast and accurate table cardinality) */ $sIndexColumn = "id "; $Data_Table->set_sIndexColumn($sIndexColumn); /* DB table to use */ $sTable = "index_master_report"; $Data_Table->set_sTable($sTable); $Data_Table->set_sIndexColumn($sIndexColumn); $Data_Table->set_sEcho($_GET['sEcho']); $Data_Table->set_iDisplayStart($_GET['iDisplayStart']); $Data_Table->set_iDisplayLength($_GET['iDisplayLength']); $Data_Table->set_iSortCol_0($_GET['iSortCol_0']); $Data_Table->set_iSortingCols($_GET['iSortingCols']); $rResult = array(); $Data_Table->sLimit = ""; if (isset($Data_Table->iDisplayStart) && $Data_Table->iDisplayLength != '-1') { $Data_Table->sLimit = "LIMIT " . intval($Data_Table->iDisplayStart) . ", " . intval($Data_Table->iDisplayLength); } //echo $Data_Table->sLimit; //* * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //* * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * $sOrder = ""; if (isset($_GET['iSortCol_0'])) { $sOrder = "ORDER BY "; for ($i = 0; $i < intval($_GET['iSortingCols']); $i++) { if ($_GET['bSortable_' . intval($_GET['iSortCol_' . $i])] == "true") { if ($aColumns[intval($_GET['iSortCol_' . $i])] == 'p.doc_id') { $sOrder .= 'INET_ATON(' . $aColumns[intval($_GET['iSortCol_' . $i])] . ") " . ($_GET['sSortDir_' . $i] === 'asc' ? 'asc' : 'desc') . ", "; } else { $sOrder .= $aColumns[intval($_GET['iSortCol_' . $i])] . " " . ($_GET['sSortDir_' . $i] === 'asc' ? 'asc' : 'desc') . ", "; } } } $sOrder = substr_replace($sOrder, "", -2); if ($sOrder == "ORDER BY") { $sOrder = " "; } } $Data_Table->set_sOrder($sOrder); //* * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //* * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * $sWhere = ""; if (isset($_GET['sSearch']) && $_GET['sSearch'] != "") { $sWhere = " AND ("; for ($i = 0; $i < count($aColumns); $i++) { if (isset($_GET['bSearchable_' . $i]) && $_GET['bSearchable_' . $i] == "true") { $sWhere .= $aColumns[$i] . " LIKE '%" . $_GET['sSearch'] . "%' OR "; } } $sWhere = substr_replace($sWhere, "", -3); $sWhere .= ')'; } /* Individual column filtering */ for ($i = 0; $i < count($aColumns); $i++) { if (isset($_GET['bSearchable_' . $i]) && $_GET['bSearchable_' . $i] == "true" && $_GET['sSearch_' . $i] != '') { if ($sWhere == "") { $sWhere = "WHERE "; } else { $sWhere .= " AND "; } $sWhere .= $aColumns[$i] . " LIKE '%" . $_GET['sSearch_' . $i] . "%' "; } } //echo $sWhere; //* * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //* * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * $Data_Table->set_sWhere($sWhere); $Index_Master = new index_master($db); $imaster_report = new Imaster_Report($db); $Index_Group = new index_group($db); $report_details = $imaster_report->getReport_dataTable($aColumns, $index_master_id, $Data_Table->sWhere, $Data_Table->sOrder, $Data_Table->sLimit); if (APP_DB == "MSSQL") { $report_details1 = $imaster_report->getReport_dataTable_all_optimizer($aColumns, $index_master_id, $Data_Table->sWhere, $Data_Table->sOrder, $Data_Table->sLimit); } $rResult = array_merge($rResult, $report_details); // $rResult = array_map("unserialize", array_unique(array_map("serialize", $rResult))); $Data_Table->rResult = $rResult; $sQuery = "SELECT FOUND_ROWS() as FOUND_ROWS"; $rResultFilterTotal = $Data_Table->DataTable_Query($sQuery); if (APP_DB == "MSSQL") { $Data_Table->iFilteredTotal = $report_details1[0]["count_1"]; // $Data_Table->iFilteredTotal = $rResult1[0]['count_1']; // $record_new = count($report_details1); } else { $Data_Table->iFilteredTotal = $rResultFilterTotal[0]['FOUND_ROWS']; } // $Data_Table->iFilteredTotal = $rResultFilterTotal[0]['FOUND_ROWS']; $output = array( "sEcho" => intval($Data_Table->sEcho), "iTotalRecords" => $Data_Table->DataTable_iTotal(), "iTotalDisplayRecords" => $Data_Table->iFilteredTotal, "aaData" => array() ); $Custom_Columns = array('id', 'name', 'report_type', 'period', 'period_duration', 'index_master_fields', 'index_group_id', 'index_group_fields', 'action'); for ($x = 0; $x < count($Data_Table->rResult); $x++) { $row = array(); $record_id = $Data_Table->rResult[$x]['id']; $imaster_report->setId($record_id); $record_details = $imaster_report->getReportById(); for ($i = 0; $i < count($Custom_Columns); $i++) { $cur_column = $Custom_Columns[$i]; $cur_row_data = $Data_Table->rResult[$x][$cur_column]; if ($cur_column == "id") { ob_start(); include '../index_master/im_report_data_first.php'; $action_data = ob_get_contents(); ob_end_clean(); $row[] = $action_data; } else if ($cur_column == "name") { $Imaster_Report_1 = new Imaster_Report($db); $Imaster_Report_1->setId($Data_Table->rResult[$x]['id']); $Imaster_Report_Details_1 = $Imaster_Report_1->getReportById(); $status = ''; if ($Imaster_Report_Details_1[0]['schedule_status'] == 'Running') { $status = '' . $Imaster_Report_Details_1[0]['schedule_status']."; Every ".$Imaster_Report_Details_1[0]['scheduler_period_duration']." ". $Imaster_Report_Details_1[0]['scheduler_period']. ''; } else if ($Imaster_Report_Details_1[0]['schedule_status'] == 'Stopped') { $status = '' . $Imaster_Report_Details_1[0]['schedule_status'] . ''; } else { $status = '' . 'Not Scheduled' . ''; } $row[] = $cur_row_data . '
' . $status; } else if ($cur_column == "report_type") { $row[] = $cur_row_data; } // else if ($cur_column == "trigger_field") { // $row[] = $cur_row_data; // } else if ($cur_column == "period") { if ($cur_row_data != "") { $row[] = $cur_row_data; } else { $row[] = 'NA'; } } else if ($cur_column == "period_duration") { // if ($cur_row_data != 0) { // // $row[] = $cur_row_data; // } else { // $row[] = 'NA'; // } if ($cur_row_data == 0 && $Data_Table->rResult[$x]['period'] == 'Days') { $row[] = 'Today'; } else if ($cur_row_data != 0) { $row[] = $cur_row_data; } else { $row[] = 'NA'; } } else if ($cur_column == "index_master_fields") { $fields_display = array(); $field_id = explode(',', $cur_row_data); for ($f = 0; $f < count($field_id); $f++) { $field_details = $Index_Master->getIndexField_ById($field_id[$f]); array_push($fields_display, $field_details[0]['field_name']); } $row[] = @join(',', $fields_display); } else if ($cur_column == "index_group_id") { $index_group_details = $Index_Group->getIndexGroup_ById($cur_row_data); if (empty($index_group_details)) { // $row[] = 'NA'; } else { //$row[] = $index_group_details[0]['index_group']; } } else if ($cur_column == "index_group_fields") { $index_fields_display = array(); if ($record_details[0]['report_type'] != 7) { $index_field_id = explode(',', $cur_row_data); for ($f1 = 0; $f1 < count($index_field_id); $f1++) { $index_field_details = $Index_Group->getIndexField_ById($index_field_id[$f1]); array_push($index_fields_display, $index_field_details[0]['field_name']); } if ($cur_row_data != "") { // $row[] = @join(',', $index_fields_display); } else { // $row[] = 'NA'; } } else { $field_id = explode(',', $cur_row_data); for ($f1 = 0; $f1 < count($field_id); $f1++) { $field_details = $Index_Group->getDropDownValue($field_id[$f1]); array_push($index_fields_display, $field_details[0]['field_values']); } if ($cur_row_data != "") { //$row[] = @join(',', $index_fields_display); } else { //$row[] = 'NA'; } } } else if ($cur_column == "action") { $id = $record_id; ob_start(); include '../index_master/im_report_action.php'; $action_data = ob_get_contents(); ob_end_clean(); $row[] = $action_data; } } $output['aaData'][] = $row; } echo json_encode($output); } else { echo "You are not authorised to view"; } } else { $page_ctl->log_indirect_access(); include("../error_403.php"); } } ?>