$index_spending = 0; foreach ($node->results_prime_vendor_info as $vendor => $vendor_summary) { $open = $index_spending == 0 ? '' : 'open'; //Main table columns $tbl_spending['body']['rows'][$index_spending]['columns'] = array(array('value' => "<a class='showHide " . $open . " expandTwo' ></a>" . $vendor_summary['vendor_name'], 'type' => 'text'), array('value' => custom_number_formatter_format($vendor_summary['current_amount'], 2, '$'), 'type' => 'number'), array('value' => custom_number_formatter_format($vendor_summary['original_amount'], 2, '$'), 'type' => 'number'), array('value' => custom_number_formatter_format($vendor_summary['spent_to_date'], 2, '$'), 'type' => 'number')); if (_getRequestParamValue("datasource") != "checkbook_oge") { $contract_vendor_details = '<div id = "contract_history">'; $nid = 426; $node = node_load($nid); node_build_content($node); $contract_vendor_details .= drupal_render($node->content); $contract_vendor_details .= '</div>'; $spending_vendor_details = '<div id = "spending_transactions">'; $nid = 427; $node = node_load($nid); node_build_content($node); $spending_vendor_details .= drupal_render($node->content); $spending_vendor_details .= '</div>'; } $index_spending++; $tbl_spending['body']['rows'][$index_spending]['embed_node'] = array($contract_vendor_details, $spending_vendor_details); $index_spending++; } $html = "<div class='contracts-spending-top'>" . WidgetUtil::generateTable($tbl_spending) . "</div>"; echo $html; ?>
$tbl['header']['columns'] = array(array('value' => WidgetUtil::generateLabelMappingNoDiv("prime_vendor_name"), 'type' => 'text'), array('value' => $node->widget_count_label, 'type' => 'number'), array('value' => WidgetUtil::generateLabelMappingNoDiv("spent_to_date"), 'type' => 'number'), array('value' => WidgetUtil::generateLabelMappingNoDiv("prime_vendor_address"), 'type' => 'text')); $vendor_cont_count = array(); foreach ($node->vendor_contracts_count as $vendor_cont) { $vendor_cont_count[$vendor_cont['vendor_id']]['count'] = $vendor_cont['count']; $vendor_cont_count[$vendor_cont['vendor_id']]['count'] = $vendor_cont['count']; } $count = 0; if (count($node->vendors_list) > 0) { foreach ($node->vendors_list as $vendor) { $spending_link = "/spending/transactions/vendor/" . $vendor['vendor_id'] . "/datasource/checkbook_oge/newwindow"; if (preg_match("/newwindow/", $_GET['q'])) { $vendor_name = $vendor['vendor_name']; } else { $vendor_name = "<a href='/contracts_landing/status/A/year/" . _getCurrentYearID() . "/yeartype/B/agency/" . $vendor['agency_id'] . "/datasource/checkbook_oge/vendor/" . $vendor['vendor_id'] . "?expandBottomCont=true'>" . $vendor['vendor_name'] . "</a>"; } $spent_to_date_value = custom_number_formatter_format($vendor['check_amount_sum'], 2, '$'); if (preg_match("/newwindow/", $_GET['q'])) { $spent_to_date_link = custom_number_formatter_format($vendor['check_amount_sum'], 2, '$'); } else { $spent_to_date_link = "<a class='new_window' target='_new' href='" . $spending_link . "'>" . custom_number_formatter_format($vendor['check_amount_sum'], 2, '$') . "</a>"; } //Main table columns $tbl['body']['rows'][$count]['columns'] = array(array('value' => $vendor_name, 'type' => 'text'), array('value' => $vendor_cont_count[$vendor['vendor_id']]['count'], 'type' => 'number'), array('value' => $spent_to_date_value, 'type' => 'number_link', 'link_value' => $spent_to_date_link), array('value' => $vendor['address'], 'type' => 'text')); $count++; } } $html = WidgetUtil::generateTable($tbl); echo $html; ?>
static function generateTable($table_definition, $is_main = true) { $html = ''; $border = ""; // $border = 'border: 1px solid black !important; '; $header_title = isset($table_definition["header"]["title"]) ? $table_definition["header"]["title"] : null; $header_columns = isset($table_definition["header"]["columns"]) ? $table_definition["header"]["columns"] : null; $table_body = isset($table_definition["body"]) ? $table_definition["body"] : null; $table_rows = isset($table_definition["body"]["rows"]) ? $table_definition["body"]["rows"] : null; //Title if ($header_title) { $html .= $header_title; } if ($is_main) { $html .= "<table class='dataTable outerTable' style='border: 1px solid #CACACA;'>"; } else { $html .= "<table class='sub-table dataTable'>"; } //Header row if ($header_columns) { $html .= "<thead>"; $html .= "<tr>"; // $html .= "<tr style='border: 1px solid black !important;'>"; $html .= WidgetUtil::generateHeaderColumns($header_columns); $html .= "</tr>"; $html .= "</thead>"; } //Table body if (isset($table_body)) { $html .= "<tbody>"; //Table rows if (isset($table_rows)) { $alternating_row_count = 0; $inner_tbl_count = 0; $outer_table_count = 0; for ($row_index = 0; $row_index < count($table_rows); $row_index++) { if (isset($table_rows[$row_index]['columns'])) { if ($alternating_row_count % 2 == 0) { $class = "even outer"; } else { $class = "odd outer"; } $alternating_row_count++; WidgetUtil::populateMaxColumnLength($table_rows); // $html .= "<tr class='".$class."' style='border: 1px solid black !important;'>"; $html .= "<tr class='" . $class . "' >"; $html .= WidgetUtil::generateColumns($table_rows[$row_index]['columns']); $html .= "</tr>"; } elseif (isset($table_rows[$row_index]['child_tables'])) { $display_main = $outer_table_count > 0 ? "display: none;" : ""; $outer_table_count++; $col_span = count($table_rows[$row_index - 1]['columns']); $html .= "<tr class='showHide' style='" . $display_main . "'>"; $html .= "<td colspan='" . $col_span . "'>"; $html .= "<div>"; for ($tbl_index = 0; $tbl_index < count($table_rows[$row_index]['child_tables']); $tbl_index++) { // $html .= "<tr class='showHide' style='border: 1px solid black !important;'>"; $html .= WidgetUtil::generateTable($table_rows[$row_index]['child_tables'][$tbl_index]); } $html .= "</div>"; $html .= "</td>"; $html .= "</tr>"; } elseif (isset($table_rows[$row_index]['embed_node'])) { $display_main = $outer_table_count > 0 ? "display: none;" : ""; $outer_table_count++; $col_span = count($table_rows[$row_index - 1]['columns']); $html .= "<tr class='showHide' style='" . $display_main . "'>"; $html .= "<td colspan='" . $col_span . "'>"; $html .= "<div>"; for ($tbl_index = 0; $tbl_index < count($table_rows[$row_index]['embed_node']); $tbl_index++) { // $html .= "<tr class='showHide' style='border: 1px solid black !important;'>"; $html .= $table_rows[$row_index]['embed_node'][$tbl_index]; } $html .= "</div>"; $html .= "</td>"; $html .= "</tr>"; } elseif (isset($table_rows[$row_index]['inner_table'])) { $display = $inner_tbl_count > 0 ? "display: none;" : ""; $inner_tbl_count++; $col_span = count($table_rows[$row_index - 1]['columns']); // $html .= "<tr class='showHide' style='".$display." border: 1px solid black !important;'>"; $html .= "<tr class='showHide' style='" . $display . "'>"; $html .= "<td colspan='" . $col_span . "'>"; $html .= "<div class='scroll'>"; $html .= WidgetUtil::generateTable($table_rows[$row_index]['inner_table'], false); $html .= "</div>"; $html .= "</td>"; $html .= "</tr>"; } } } $html .= "</tbody>"; } else { $html .= "<tbody>"; $html .= "<tr class='odd'>"; $html .= "<td class='dataTables_empty' valign='top' colspan='" . count($header_columns) . "'>"; $html .= "<div id='no-records-datatable' class='clearfix'>"; $html .= "<span>No Matching Records Found</span>"; $html .= "</div>"; $html .= "</td>"; $html .= "</tr>"; $html .= "</tbody>"; } $html .= "</table>"; return $html; }