dwh/index_ajax.php
Daeng Deni Mardaeni 5321a5434b first commit
2023-10-02 17:26:17 +07:00

67 lines
1.9 KiB
PHP

<?php
header("Cache-Control: no-cache, must-revalidate");
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
include_once 'class/ORAConnectionClass.php';
include_once 'init/initialisation_parameter.php';
include_once 'class/PregReplaceCallbackClass.php';
include_once 'template/index_ajax_template.php';
$_SESSION['TEMPLATE_ARRAY_ADDR'] = &$index_ajax_template_array;
$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();
}
if ($_REQUEST['action'] == "getData") {
$result = retrieve_data($ora_obj, $_REQUEST['status']);
} else {
$result = -1;
}
echo $result;
if ($ora_obj->conn) {
$ora_obj->ORA_Close();
#echo "connection closed.<br>";
}
function retrieve_data(&$ora_obj,$status){
$templObj = new PregReplaceCallbackClass('');
$templObj->SetTemplateArray('TEMPLATE_ARRAY_ADDR');
$str_query = <<< sql
SELECT a.n_resultkey, a.rep_id, a.pagename, a.rep_param, a.rep_name,
TO_CHAR(a.date_created,'DD Month YYYY HH24:MI:SS','NLS_DATE_LANGUAGE=INDONESIAN') as tgl_cetak
FROM rep_archive a
WHERE a.kd_user = '{$_SESSION["KD_USER"]}'
ORDER BY a.rep_id, a.n_resultkey DESC
sql;
$result_array=$ora_obj->ORA_SelectData($str_query,null,null,OCI_FETCHSTATEMENT_BY_ROW);
if ($ora_obj->nrows>0){
foreach ($result_array as $pkey => $pval){
$status_array2[] = array($pval['REP_ID'], $pval['REP_NAME'], $pval['PAGENAME'], $pval['TGL_CETAK']);
}
}
if (is_array($status_array2)) {
$rep_id = '';
foreach ($status_array2 as $s_key => $s_val) {
if ($rep_id != $status_arrat2[0]) {
}
}
$templObj->SetFormatName('RESULT');
$result .= $templObj->PregReplaceCallback();
}
return $result;
}
?>