dwh/log_proses_ajax.php

118 lines
4.1 KiB
PHP
Raw Normal View History

2023-10-02 10:26:17 +00:00
<?php
$PARENT_SCRIPTNAME='log_proses.php';
include_once 'script_auth.php';
include_once 'class/PregReplaceCallbackClass.php';
include_once 'init/initialisation_parameter.php';
include_once 'headerFile.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();
}
initAjaxParamTemplate($_REQUEST['action']);
if ($_REQUEST['action'] == "getList") {
2024-01-12 08:25:44 +00:00
$result = getList($ora_obj);
2023-10-02 10:26:17 +00:00
} else {
$result = -1;
}
echo $result;
unset($_SESSION['TEMPLATE_ARRAY_ADDR']);
if ($ora_obj->conn) {
$ora_obj->ORA_Close();
#echo "connection closed.<br>";
}
function initAjaxParamTemplate($action) {
if ($action == "getList") {
$ajaxParamTemplate['HEADLIST'] = <<< params
<table width="100%" cellpadding="2" cellspacing="1" border="0" style="layout:auto">
<tr class="table_form_header">
<th width=35 align=center>No.</th>
<th align=center>Job<BR>ID</th>
<th align=center>User<BR>Process</th>
<th align=center>IP<BR>Address</th>
<th align=center>Start<BR>Process</th>
<th align=center>Status</th>
<th align=center>End<BR>Process</th>
<th align=left>Message</th>
</tr>
<<LIST>>
</table>
params;
$ajaxParamTemplate['ELEMENT'] = <<< params
2024-01-12 08:25:44 +00:00
<tr id="tr<<COUNTER>>" class="font11" onmouseover="changeColor(this,'#FFFF99');" onmouseout="changeColor(this,'#F7F7F7');">
2023-10-02 10:26:17 +00:00
<td width=35 align=right valign=top><<COUNTER>>.</td>
<td align=right valign=top><<JOB_ID>></td>
<td align=center valign=top><<USER_POSTING>><BR><<NAMA_USER>></td>
<td align=center nowrap valign=top><<IPNUM>></td>
<td align=center nowrap valign=top><<DATE_POSTING>><BR><<TIME_POSTING>></td>
<td align=center nowrap valign=top><<STATUS>></td>
<td align=center nowrap valign=top><<DATE_FINISHED>><BR><<TIME_FINISHED>></td>
<td align=left valign=top><<ERR_MSG>></td>
</tr>
params;
$ajaxParamTemplate['ELEMENT_NORESULT'] = <<< params
<tr>
<td colspan="4" class="font12BRed" align=center>NO DATA FOUND</td>
</tr>
params;
}
$_SESSION['TEMPLATE_ARRAY_ADDR'] = &$ajaxParamTemplate;
}
2024-01-12 08:25:44 +00:00
function getList(&$ora_obj){
2023-10-02 10:26:17 +00:00
$templObj = new PregReplaceCallbackClass('');
$templObj->SetTemplateArray('TEMPLATE_ARRAY_ADDR');
$paramSQL = <<< sql
2024-01-12 08:25:44 +00:00
SELECT job_id, user_posting, ipnum,
to_char(date_posting, 'DD-MM-YYYY') date_posting,
to_char(date_posting, 'HH24:MI:SS') time_posting,
(CASE WHEN status=0 THEN 'PROCESSING' WHEN status=1 THEN 'DONE' ELSE 'FAILED' END) status,
to_char(date_finished, 'DD-MM-YYYY') date_finished,
to_char(date_finished, 'HH24:MI:SS') time_finished,
(SELECT nama_user FROM v_prm_user WHERE kd_user = user_posting) nama_user,
err_msg
2023-10-02 10:26:17 +00:00
FROM transaction_job t, transaction_id g
WHERE t.process_id = g.process_id
2024-01-12 08:25:44 +00:00
AND g.process_id = {$_REQUEST['PROCESS_ID']}
ORDER BY t.job_id desc
2023-10-02 10:26:17 +00:00
sql;
2024-01-12 08:25:44 +00:00
$paramArray = $ora_obj->ORA_SelectData($paramSQL,null,null,OCI_FETCHSTATEMENT_BY_ROW);
2023-10-02 10:26:17 +00:00
$_SESSION['ARRAY_ADDR_VAR'] = &$variable_array;
2024-01-12 08:25:44 +00:00
2023-10-02 10:26:17 +00:00
if ($ora_obj->nrows>0) {
foreach ($paramArray as $pkey => $pval) {
2024-01-12 08:25:44 +00:00
$variable_array['COUNTER']++;
2023-10-02 10:26:17 +00:00
foreach ($pval as $tkey => $tval) {
$variable_array[$tkey] = htmlspecialchars($tval);
}
$templObj->SetFormatName('ELEMENT');
$list .= $templObj->PregReplaceCallback();
}
2024-01-12 08:25:44 +00:00
$variable_array['LIST'] = $list;
2023-10-02 10:26:17 +00:00
$templObj->SetFormatName('HEADLIST');
$result = $templObj->PregReplaceCallback();
} else {
$templObj->SetFormatName('ELEMENT_NORESULT');
$list = $templObj->PregReplaceCallback();
$variable_array['LIST'] = $list;
$templObj->SetFormatName('HEADLIST');
$result = $templObj->PregReplaceCallback();
}
return $result;
}
2024-01-12 08:25:44 +00:00
?>