dwh/external_table_plugin.php

151 lines
5.4 KiB
PHP
Raw Normal View History

2023-10-02 10:26:17 +00:00
<?php
$PARENT_SCRIPTNAME='external_table.php';
include_once 'script_auth.php';
include_once 'class/PregReplaceCallbackClass.php';
include_once 'init/initialisation_parameter.php';
$ora_obj = new ORAConnectionClass('init/ORA_INIT.php');
$ora_res = $ora_obj->ORA_PConnect();
if (!$ora_res){
echo "<BR>Error : " . htmlspecialchars($ora_obj->last_error_msg) . "<br>";
exit();
}
initParamTemplate();
$result = getList($ora_obj);
echo $result;
unset($_SESSION['TEMPLATE_ARRAY_ADDR']);
if ($ora_obj->conn) {
$ora_obj->ORA_Close();
#echo "connection closed.<br>";
}
function initParamTemplate(){
$paramTemplate['ELEMENT'] = <<< params
<tr id="tr<<COUNTER>>" class="font11" onmouseover="changeColor(this,'#FFFF99');" onmouseout="changeColor(this,'#F7F7F7');">
<td width=35 align=right><<COUNTER>>.</td>
<td align=left><<TAB_NAME>></td>
<td align=left><<MODUL>></td>
<td align=left><<METHOD>></td>
<td align=left><<PURGING_TYPE>></td>
<td align=left><<PURGING_FIELD>></td>
<td align=left><<PURGING_DATA_TYPE>></td>
</tr>
params;
$paramTemplate['CONTAINER'] = <<< params
<table width="100%" cellpadding="2" cellspacing="1" border="0" style="layout:auto">
<tr>
<td align=left class="orangetitle" nowrap>Informasi External Tabel</td>
<td align=right>
<button id="PRINT_BTN" name="printData" class="print">
<img src="images/icon_printer.gif" width="12" height="12">
<span id="AddBtnLink" class="font10">&nbsp;Print&nbsp;</span>
</button>
<input type="hidden" name="ACTION">
</td>
</tr>
<tr>
<table width="100%" cellpadding="2" cellspacing="1" border="0" style="layout:auto">
<tr class="table_form_header">
<th align=left width=35>No.</th>
<th align=left>Nama Table</th>
<th align=left>Modul</th>
<th align=left>Methode Posting</th>
<th align=left>Purging</th>
<th align=left>Field untuk Purging</th>
<th align=left>Tipe Data Field untuk Purging</th>
</tr>
<<LIST>>
</table>
</tr>
</table>
params;
$paramTemplate['NORESULT'] = <<< params
<table width="100%" cellpadding="2" cellspacing="1" border="0" style="layout:auto">
<tr>
<td align=left class="orangetitle" nowrap>Informasi External Tabel</td>
<td align=right>
<button id="ADD_BTN" name="addData" onclick="javascript:newData();">
<img src="images/button_add_icon.gif" width="12" height="12">
<span id="AddBtnLink" class="font7b">&nbsp;Add New</span>
</button>
<input type="hidden" name="ACTION">
</td>
</tr>
<tr>
<table width="100%" cellpadding="2" cellspacing="1" border="0" style="layout:auto">
<tr class="table_form_header">
<th align=left width=35>No.</th>
<th align=left>Nama Table</th>
<th align=left>Modul</th>
<th align=left>Methode Posting</th>
<th align=left>Purging</th>
<th align=left>Field untuk Purging</th>
<th align=left>Tipe Data Field untuk Purging</th>
</tr>
<tr>
<td colspan="3" class="font12BRed" align=center>NO DATA FOUND</td>
</tr>
</table>
</tr>
</table>
params;
$_SESSION['TEMPLATE_ARRAY_ADDR'] = &$paramTemplate;
}
function getList(&$ora_obj){
$templObj = new PregReplaceCallbackClass('');
$templObj->SetTemplateArray('TEMPLATE_ARRAY_ADDR');
$paramSQL = <<< sql
SELECT i.tab_name,
(CASE WHEN i.modul = 'AB2' THEN 'AB2'
WHEN i.modul = 'TSY' THEN 'Treasury'
WHEN i.modul = 'GL' THEN 'GL AB2'
ELSE ''
END ) modul,
(CASE WHEN i.method = 'I' THEN 'Insert'
WHEN i.method = 'TI' THEN 'Truncate Insert'
WHEN i.method = 'IU' THEN 'Insert Update'
ELSE ''
END ) method,
DECODE(i.purging_type, 'Y', 'Ya', 'Tidak') purging_type,
i.purging_field,
(CASE WHEN i.purging_data_type = 'N' THEN 'Numeric'
WHEN i.purging_data_type = 'C' THEN 'Character'
WHEN i.purging_data_type = 'D' THEN 'Date'
ELSE ''
END ) purging_data_type,
i.purging_filter
FROM external_data_tab i
WHERE i.modul != 'SE'
ORDER BY i.modul, i.tab_name
sql;
$paramArray = $ora_obj->ORA_SelectData($paramSQL,null,null,OCI_FETCHSTATEMENT_BY_ROW);
$_SESSION['ARRAY_ADDR_VAR'] = &$variable_array;
if ($ora_obj->nrows>0) {
foreach ($paramArray as $pkey => $pval) {
$variable_array['COUNTER']++;
foreach ($pval as $tkey => $tval) {
$variable_array[$tkey] = htmlspecialchars($tval);
}
$templObj->SetFormatName('ELEMENT');
$list .= $templObj->PregReplaceCallback();
}
$variable_array['LIST'] = $list;
$templObj->SetFormatName('CONTAINER');
$result = $templObj->PregReplaceCallback();
} else {
$templObj->SetFormatName('NORESULT');
$result = $templObj->PregReplaceCallback();
}
return $result;
}
?>