/osj-osj2dapplicationsdelete.php
PHP | 649 lines | 482 code | 79 blank | 88 comment | 76 complexity | 565d52c1a2e73e685942ad878780b0b6 MD5 | raw file
Possible License(s): LGPL-2.1, AGPL-1.0
- <?php
- define("EW_PAGE_ID", "delete", TRUE); // Page ID
- define("EW_TABLE_NAME", 'osj-applications', TRUE);
- ?>
- <?php
- session_start(); // Initialize session data
- ob_start(); // Turn on output buffering
- ?>
- <?php include "osj-ewcfg50.php" ?>
- <?php include "osj-ewmysql50.php" ?>
- <?php include "osj-phpfn50.php" ?>
- <?php include "osj-osj2dapplicationsinfo.php" ?>
- <?php include "osj-userfn50.php" ?>
- <?php include "osj-osj2dusersinfo.php" ?>
- <?php
- header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
- header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
- header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1
- header("Cache-Control: post-check=0, pre-check=0", false);
- header("Pragma: no-cache"); // HTTP/1.0
- ?>
- <?php
-
- // Open connection to the database
- $conn = ew_Connect();
- ?>
- <?php
- $Security = new cAdvancedSecurity();
- ?>
- <?php
- if (!$Security->IsLoggedIn()) $Security->AutoLogin();
- $Security->LoadCurrentUserLevel('osj-applications');
- if (!$Security->IsLoggedIn()) {
- $Security->SaveLastUrl();
- Page_Terminate("osj-login.php");
- }
- if (!$Security->CanDelete()) {
- $Security->SaveLastUrl();
- Page_Terminate("osj-osj2dapplicationslist.php");
- }
- if ($Security->IsLoggedIn() && $Security->CurrentUserID() == "") {
- $_SESSION[EW_SESSION_MESSAGE] = "You do not have the right permission to view the page";
- Page_Terminate("osj-login.php");
- }
- ?>
- <?php
-
- // Common page loading event (in userfn*.php)
- Page_Loading();
- ?>
- <?php
-
- // Page load event, used in current page
- Page_Load();
- ?>
- <?php
- $osj2Dapplications->Export = @$_GET["export"]; // Get export parameter
- $sExport = $osj2Dapplications->Export; // Get export parameter, used in header
- $sExportFile = $osj2Dapplications->TableVar; // Get export file, used in header
- ?>
- <?php
-
- // Load Key Parameters
- $sKey = "";
- $bSingleDelete = TRUE; // Initialize as single delete
- $arRecKeys = array();
- $nKeySelected = 0; // Initialize selected key count
- $sFilter = "";
- if (@$_GET["application_id"] <> "") {
- $osj2Dapplications->application_id->setQueryStringValue($_GET["application_id"]);
- if (!is_numeric($osj2Dapplications->application_id->QueryStringValue)) {
- Page_Terminate($osj2Dapplications->getReturnUrl()); // Prevent sql injection, exit
- }
- $sKey .= $osj2Dapplications->application_id->QueryStringValue;
- } else {
- $bSingleDelete = FALSE;
- }
- if ($bSingleDelete) {
- $nKeySelected = 1; // Set up key selected count
- $arRecKeys[0] = $sKey;
- } else {
- if (isset($_POST["key_m"])) { // Key in form
- $nKeySelected = count($_POST["key_m"]); // Set up key selected count
- $arRecKeys = ew_StripSlashes($_POST["key_m"]);
- }
- }
- if ($nKeySelected <= 0) Page_Terminate($osj2Dapplications->getReturnUrl()); // No key specified, exit
-
- // Build filter
- foreach ($arRecKeys as $sKey) {
- $sFilter .= "(";
-
- // Set up key field
- $sKeyFld = $sKey;
- if (!is_numeric($sKeyFld)) {
- Page_Terminate($osj2Dapplications->getReturnUrl()); // Prevent sql injection, exit
- }
- $sFilter .= "`application_id`=" . ew_AdjustSql($sKeyFld) . " AND ";
- if (substr($sFilter, -5) == " AND ") $sFilter = substr($sFilter, 0, strlen($sFilter)-5) . ") OR ";
- }
- if (substr($sFilter, -4) == " OR ") $sFilter = substr($sFilter, 0, strlen($sFilter)-4);
-
- // Set up filter (Sql Where Clause) and get Return Sql
- // Sql constructor in osj2Dapplications class, osj2Dapplicationsinfo.php
-
- $osj2Dapplications->CurrentFilter = $sFilter;
-
- // Get action
- if (@$_POST["a_delete"] <> "") {
- $osj2Dapplications->CurrentAction = $_POST["a_delete"];
- } else {
- $osj2Dapplications->CurrentAction = "I"; // Display record
- }
- switch ($osj2Dapplications->CurrentAction) {
- case "D": // Delete
- $osj2Dapplications->SendEmail = TRUE; // Send email on delete success
- if (DeleteRows()) { // delete rows
- $_SESSION[EW_SESSION_MESSAGE] = "Delete Successful"; // Set up success message
- Page_Terminate($osj2Dapplications->getReturnUrl()); // Return to caller
- }
- }
-
- // Load records for display
- $rs = LoadRecordset();
- $nTotalRecs = $rs->RecordCount(); // Get record count
- if ($nTotalRecs <= 0) { // No record found, exit
- $rs->Close();
- Page_Terminate($osj2Dapplications->getReturnUrl()); // Return to caller
- }
- ?>
- <?php include "osj-header.php" ?>
- <script type="text/javascript">
- <!--
- var EW_PAGE_ID = "delete"; // Page id
- var EW_SHOW_HIGHLIGHT = "Show highlight";
- var EW_HIDE_HIGHLIGHT = "Hide highlight";
-
- //-->
- </script>
- <script language="JavaScript" type="text/javascript">
- <!--
-
- // Write your client script here, no need to add script tags.
- // To include another .js script, use:
- // ew_ClientScriptInclude("my_javascript.js");
- //-->
-
- </script>
- <p><span class="phpmaker">Delete from TABLE: Applications<br><br><a href="<?php echo $osj2Dapplications->getReturnUrl() ?>">Go Back</a></span></p>
- <?php
- if (@$_SESSION[EW_SESSION_MESSAGE] <> "") {
- ?>
- <p><span class="ewmsg"><?php echo $_SESSION[EW_SESSION_MESSAGE] ?></span></p>
- <?php
- $_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message
- }
- ?>
- <form action="osj-osj2dapplicationsdelete.php" method="post">
- <p>
- <input type="hidden" name="a_delete" id="a_delete" value="D">
- <?php foreach ($arRecKeys as $sKey) { ?>
- <input type="hidden" name="key_m[]" id="key_m[]" value="<?php echo ew_HtmlEncode($sKey) ?>">
- <?php } ?>
- <table class="ewTable">
- <tr class="ewTableHeader">
- <td valign="top">User ID</td>
- <td valign="top">Resume</td>
- <td valign="top">Post ID</td>
- <td valign="top">Application Date</td>
- <td valign="top">Application Email</td>
- <td valign="top">Application Comments</td>
- <td valign="top">Application Attachment</td>
- <td valign="top">Application File Name</td>
- </tr>
- <?php
- $nRecCount = 0;
- $i = 0;
- while (!$rs->EOF) {
- $nRecCount++;
-
- // Set row class and style
- $osj2Dapplications->CssClass = "ewTableRow";
- $osj2Dapplications->CssStyle = "";
-
- // Display alternate color for rows
- if ($nRecCount % 2 <> 1) {
- $osj2Dapplications->CssClass = "ewTableAltRow";
- }
-
- // Get the field contents
- LoadRowValues($rs);
-
- // Render row value
- $osj2Dapplications->RowType = EW_ROWTYPE_VIEW; // view
- RenderRow();
- ?>
- <tr<?php echo $osj2Dapplications->DisplayAttributes() ?>>
- <td<?php echo $osj2Dapplications->user_id->CellAttributes() ?>>
- <div<?php echo $osj2Dapplications->user_id->ViewAttributes() ?>><?php echo $osj2Dapplications->user_id->ViewValue ?></div>
- </td>
- <td<?php echo $osj2Dapplications->resume_id->CellAttributes() ?>>
- <div<?php echo $osj2Dapplications->resume_id->ViewAttributes() ?>><?php echo $osj2Dapplications->resume_id->ViewValue ?></div>
- </td>
- <td<?php echo $osj2Dapplications->post_id->CellAttributes() ?>>
- <div<?php echo $osj2Dapplications->post_id->ViewAttributes() ?>><?php echo $osj2Dapplications->post_id->ViewValue ?></div>
- </td>
- <td<?php echo $osj2Dapplications->application_date->CellAttributes() ?>>
- <div<?php echo $osj2Dapplications->application_date->ViewAttributes() ?>><?php echo $osj2Dapplications->application_date->ViewValue ?></div>
- </td>
- <td<?php echo $osj2Dapplications->application_email->CellAttributes() ?>>
- <div<?php echo $osj2Dapplications->application_email->ViewAttributes() ?>><?php echo $osj2Dapplications->application_email->ViewValue ?></div>
- </td>
- <td<?php echo $osj2Dapplications->application_text->CellAttributes() ?>>
- <div<?php echo $osj2Dapplications->application_text->ViewAttributes() ?>><?php echo $osj2Dapplications->application_text->ViewValue ?></div>
- </td>
- <td<?php echo $osj2Dapplications->application_file->CellAttributes() ?>>
- <?php if ($osj2Dapplications->application_file->HrefValue <> "") { ?>
- <?php if (!is_null($osj2Dapplications->application_file->Upload->DbValue)) { ?>
- <a href="<?php echo $osj2Dapplications->application_file->HrefValue ?>" target="_blank"><?php echo $osj2Dapplications->application_file->ViewValue ?></a>
- <?php } ?>
- <?php } else { ?>
- <?php if (!is_null($osj2Dapplications->application_file->Upload->DbValue)) { ?>
- <?php echo $osj2Dapplications->application_file->ViewValue ?>
- <?php } ?>
- <?php } ?>
- </td>
- <td<?php echo $osj2Dapplications->application_file_name->CellAttributes() ?>>
- <div<?php echo $osj2Dapplications->application_file_name->ViewAttributes() ?>><?php echo $osj2Dapplications->application_file_name->ViewValue ?></div>
- </td>
- </tr>
- <?php
- $rs->MoveNext();
- }
- $rs->Close();
- ?>
- </table>
- <p>
- <input type="submit" name="Action" id="Action" value="Confirm Delete">
- </form>
- <script language="JavaScript" type="text/javascript">
- <!--
-
- // Write your table-specific startup script here
- // document.write("page loaded");
- //-->
-
- </script>
- <?php include "osj-footer.php" ?>
- <?php
-
- // If control is passed here, simply terminate the page without redirect
- Page_Terminate();
-
- // -----------------------------------------------------------------
- // Subroutine Page_Terminate
- // - called when exit page
- // - clean up connection and objects
- // - if url specified, redirect to url, otherwise end response
- function Page_Terminate($url = "") {
- global $conn;
-
- // Page unload event, used in current page
- Page_Unload();
-
- // Global page unloaded event (in userfn*.php)
- Page_Unloaded();
-
- // Close Connection
- $conn->Close();
-
- // Go to url if specified
- if ($url <> "") {
- ob_end_clean();
- header("Location: $url");
- }
- exit();
- }
- ?>
- <?php
-
- // ------------------------------------------------
- // Function DeleteRows
- // - Delete Records based on current filter
- function DeleteRows() {
- global $conn, $Security, $osj2Dapplications;
- $DeleteRows = TRUE;
- $sWrkFilter = $osj2Dapplications->CurrentFilter;
- if ($Security->CurrentUserID() <> "" && !$Security->IsAdmin()) { // Non system admin
- $sWrkFilter = $osj2Dapplications->AddUserIDFilter($sWrkFilter, $Security->CurrentUserID()); // Add User ID filter
- }
-
- // Set up filter (Sql Where Clause) and get Return Sql
- // Sql constructor in osj2Dapplications class, osj2Dapplicationsinfo.php
-
- $osj2Dapplications->CurrentFilter = $sWrkFilter;
- $sSql = $osj2Dapplications->SQL();
- $conn->raiseErrorFn = 'ew_ErrorFn';
- $rs = $conn->Execute($sSql);
- $conn->raiseErrorFn = '';
- if ($rs === FALSE) {
- return FALSE;
- } elseif ($rs->EOF) {
- $_SESSION[EW_SESSION_MESSAGE] = "No records found"; // No record found
- $rs->Close();
- return FALSE;
- }
- $conn->BeginTrans();
- WriteAuditTrailDummy("*** batch delete begin ***"); // Batch delete begin
-
- // Clone old rows
- $rsold = ($rs) ? $rs->GetRows() : array();
- if ($rs) $rs->Close();
-
- // Call row deleting event
- if ($DeleteRows) {
- foreach ($rsold as $row) {
- $DeleteRows = $osj2Dapplications->Row_Deleting($row);
- if (!$DeleteRows) break;
- }
- }
- if ($DeleteRows) {
- $sKey = "";
- foreach ($rsold as $row) {
- $sThisKey = "";
- if ($sThisKey <> "") $sThisKey .= EW_COMPOSITE_KEY_SEPARATOR;
- $sThisKey .= $row['application_id'];
- $conn->raiseErrorFn = 'ew_ErrorFn';
- $DeleteRows = $conn->Execute($osj2Dapplications->DeleteSQL($row)); // Delete
- $conn->raiseErrorFn = '';
- if ($DeleteRows === FALSE)
- break;
- if ($sKey <> "") $sKey .= ", ";
- $sKey .= $sThisKey;
- }
- } else {
-
- // Set up error message
- if ($osj2Dapplications->CancelMessage <> "") {
- $_SESSION[EW_SESSION_MESSAGE] = $osj2Dapplications->CancelMessage;
- $osj2Dapplications->CancelMessage = "";
- } else {
- $_SESSION[EW_SESSION_MESSAGE] = "Delete cancelled";
- }
- }
- if ($DeleteRows) {
- $conn->CommitTrans(); // Commit the changes
- if ($DeleteRows) {
- foreach ($rsold as $row) {
- WriteAuditTrailOnDelete($row);
- }
- }
- WriteAuditTrailDummy("*** batch delete success ***"); // Batch delete success
- } else {
- $conn->RollbackTrans(); // Rollback changes
- WriteAuditTrailDummy("*** batch delete rollback ***"); // Batch delete rollback
- }
-
- // Call recordset deleted event
- if ($DeleteRows) {
- foreach ($rsold as $row) {
- $osj2Dapplications->Row_Deleted($row);
- }
- }
- return $DeleteRows;
- }
- ?>
- <?php
-
- // Load recordset
- function LoadRecordset($offset = -1, $rowcnt = -1) {
- global $conn, $osj2Dapplications;
-
- // Call Recordset Selecting event
- $osj2Dapplications->Recordset_Selecting($osj2Dapplications->CurrentFilter);
-
- // Load list page sql
- $sSql = $osj2Dapplications->SelectSQL();
- if ($offset > -1 && $rowcnt > -1) $sSql .= " LIMIT $offset, $rowcnt";
-
- // Load recordset
- $conn->raiseErrorFn = 'ew_ErrorFn';
- $rs = $conn->Execute($sSql);
- $conn->raiseErrorFn = '';
-
- // Call Recordset Selected event
- $osj2Dapplications->Recordset_Selected($rs);
- return $rs;
- }
- ?>
- <?php
-
- // Load row based on key values
- function LoadRow() {
- global $conn, $Security, $osj2Dapplications;
- $sFilter = $osj2Dapplications->SqlKeyFilter();
- if (!is_numeric($osj2Dapplications->application_id->CurrentValue)) {
- return FALSE; // Invalid key, exit
- }
- $sFilter = str_replace("@application_id@", ew_AdjustSql($osj2Dapplications->application_id->CurrentValue), $sFilter); // Replace key value
- if ($Security->CurrentUserID() <> "" && !$Security->IsAdmin()) { // Non system admin
- $sFilter = $osj2Dapplications->AddUserIDFilter($sFilter, $Security->CurrentUserID()); // Add User ID filter
- }
-
- // Call Row Selecting event
- $osj2Dapplications->Row_Selecting($sFilter);
-
- // Load sql based on filter
- $osj2Dapplications->CurrentFilter = $sFilter;
- $sSql = $osj2Dapplications->SQL();
- if ($rs = $conn->Execute($sSql)) {
- if ($rs->EOF) {
- $LoadRow = FALSE;
- } else {
- $LoadRow = TRUE;
- $rs->MoveFirst();
- LoadRowValues($rs); // Load row values
-
- // Call Row Selected event
- $osj2Dapplications->Row_Selected($rs);
- }
- $rs->Close();
- } else {
- $LoadRow = FALSE;
- }
- return $LoadRow;
- }
-
- // Load row values from recordset
- function LoadRowValues(&$rs) {
- global $osj2Dapplications;
- $osj2Dapplications->application_id->setDbValue($rs->fields('application_id'));
- $osj2Dapplications->user_id->setDbValue($rs->fields('user_id'));
- $osj2Dapplications->resume_id->setDbValue($rs->fields('resume_id'));
- $osj2Dapplications->post_id->setDbValue($rs->fields('post_id'));
- $osj2Dapplications->application_date->setDbValue($rs->fields('application_date'));
- $osj2Dapplications->application_email->setDbValue($rs->fields('application_email'));
- $osj2Dapplications->application_text->setDbValue($rs->fields('application_text'));
- $osj2Dapplications->application_file->Upload->DbValue = $rs->fields('application_file');
- $osj2Dapplications->application_file_name->setDbValue($rs->fields('application_file_name'));
- }
- ?>
- <?php
-
- // Render row values based on field settings
- function RenderRow() {
- global $conn, $Security, $osj2Dapplications;
-
- // Call Row Rendering event
- $osj2Dapplications->Row_Rendering();
-
- // Common render codes for all row types
- // user_id
-
- $osj2Dapplications->user_id->CellCssStyle = "";
- $osj2Dapplications->user_id->CellCssClass = "";
-
- // resume_id
- $osj2Dapplications->resume_id->CellCssStyle = "";
- $osj2Dapplications->resume_id->CellCssClass = "";
-
- // post_id
- $osj2Dapplications->post_id->CellCssStyle = "";
- $osj2Dapplications->post_id->CellCssClass = "";
-
- // application_date
- $osj2Dapplications->application_date->CellCssStyle = "";
- $osj2Dapplications->application_date->CellCssClass = "";
-
- // application_email
- $osj2Dapplications->application_email->CellCssStyle = "";
- $osj2Dapplications->application_email->CellCssClass = "";
-
- // application_text
- $osj2Dapplications->application_text->CellCssStyle = "";
- $osj2Dapplications->application_text->CellCssClass = "";
-
- // application_file
- $osj2Dapplications->application_file->CellCssStyle = "";
- $osj2Dapplications->application_file->CellCssClass = "";
-
- // application_file_name
- $osj2Dapplications->application_file_name->CellCssStyle = "";
- $osj2Dapplications->application_file_name->CellCssClass = "";
- if ($osj2Dapplications->RowType == EW_ROWTYPE_VIEW) { // View row
-
- // user_id
- $osj2Dapplications->user_id->ViewValue = $osj2Dapplications->user_id->CurrentValue;
- $osj2Dapplications->user_id->CssStyle = "";
- $osj2Dapplications->user_id->CssClass = "";
- $osj2Dapplications->user_id->ViewCustomAttributes = "";
-
- // resume_id
- if (!is_null($osj2Dapplications->resume_id->CurrentValue)) {
- $sSqlWrk = "SELECT `resume_title` FROM `osj-resumes` WHERE `resume_id` = " . ew_AdjustSql($osj2Dapplications->resume_id->CurrentValue) . "";
- $sSqlWrk .= " AND (" . "`user_id` = ".CurrentUserID()."" . ")";
- $sSqlWrk .= " ORDER BY `resume_title` Asc";
- $rswrk = $conn->Execute($sSqlWrk);
- if ($rswrk) {
- if (!$rswrk->EOF) {
- $osj2Dapplications->resume_id->ViewValue = $rswrk->fields('resume_title');
- }
- $rswrk->Close();
- } else {
- $osj2Dapplications->resume_id->ViewValue = $osj2Dapplications->resume_id->CurrentValue;
- }
- } else {
- $osj2Dapplications->resume_id->ViewValue = NULL;
- }
- $osj2Dapplications->resume_id->CssStyle = "";
- $osj2Dapplications->resume_id->CssClass = "";
- $osj2Dapplications->resume_id->ViewCustomAttributes = "";
-
- // post_id
- $osj2Dapplications->post_id->ViewValue = $osj2Dapplications->post_id->CurrentValue;
- $osj2Dapplications->post_id->CssStyle = "";
- $osj2Dapplications->post_id->CssClass = "";
- $osj2Dapplications->post_id->ViewCustomAttributes = "";
-
- // application_date
- $osj2Dapplications->application_date->ViewValue = $osj2Dapplications->application_date->CurrentValue;
- $osj2Dapplications->application_date->ViewValue = ew_FormatDateTime($osj2Dapplications->application_date->ViewValue, 6);
- $osj2Dapplications->application_date->CssStyle = "";
- $osj2Dapplications->application_date->CssClass = "";
- $osj2Dapplications->application_date->ViewCustomAttributes = "";
-
- // application_email
- $osj2Dapplications->application_email->ViewValue = $osj2Dapplications->application_email->CurrentValue;
- $osj2Dapplications->application_email->CssStyle = "";
- $osj2Dapplications->application_email->CssClass = "";
- $osj2Dapplications->application_email->ViewCustomAttributes = "";
-
- // application_text
- $osj2Dapplications->application_text->ViewValue = $osj2Dapplications->application_text->CurrentValue;
- if (!is_null($osj2Dapplications->application_text->ViewValue)) $osj2Dapplications->application_text->ViewValue = str_replace("\n", "<br>", $osj2Dapplications->application_text->ViewValue);
- $osj2Dapplications->application_text->CssStyle = "";
- $osj2Dapplications->application_text->CssClass = "";
- $osj2Dapplications->application_text->ViewCustomAttributes = "";
-
- // application_file
- if (!is_null($osj2Dapplications->application_file->Upload->DbValue)) {
- $osj2Dapplications->application_file->ViewValue = "Application Attachment";
- } else {
- $osj2Dapplications->application_file->ViewValue = "";
- }
- $osj2Dapplications->application_file->CssStyle = "";
- $osj2Dapplications->application_file->CssClass = "";
- $osj2Dapplications->application_file->ViewCustomAttributes = "";
-
- // application_file_name
- $osj2Dapplications->application_file_name->ViewValue = $osj2Dapplications->application_file_name->CurrentValue;
- $osj2Dapplications->application_file_name->CssStyle = "";
- $osj2Dapplications->application_file_name->CssClass = "";
- $osj2Dapplications->application_file_name->ViewCustomAttributes = "";
-
- // user_id
- $osj2Dapplications->user_id->HrefValue = "";
-
- // resume_id
- $osj2Dapplications->resume_id->HrefValue = "";
-
- // post_id
- $osj2Dapplications->post_id->HrefValue = "";
-
- // application_date
- $osj2Dapplications->application_date->HrefValue = "";
-
- // application_email
- $osj2Dapplications->application_email->HrefValue = "";
-
- // application_text
- $osj2Dapplications->application_text->HrefValue = "";
-
- // application_file
- if (!is_null($osj2Dapplications->application_file->Upload->DbValue)) {
- $osj2Dapplications->application_file->HrefValue = "osj-osj2dapplications_application_file_bv.php?application_id=" . $osj2Dapplications->application_id->CurrentValue;
- if ($osj2Dapplications->Export <> "") $osj2Dapplications->application_file->HrefValue = ew_ConvertFullUrl($osj2Dapplications->application_file->HrefValue);
- } else {
- $osj2Dapplications->application_file->HrefValue = "";
- }
-
- // application_file_name
- $osj2Dapplications->application_file_name->HrefValue = "";
- } elseif ($osj2Dapplications->RowType == EW_ROWTYPE_ADD) { // Add row
- } elseif ($osj2Dapplications->RowType == EW_ROWTYPE_EDIT) { // Edit row
- } elseif ($osj2Dapplications->RowType == EW_ROWTYPE_SEARCH) { // Search row
- }
-
- // Call Row Rendered event
- $osj2Dapplications->Row_Rendered();
- }
- ?>
- <?php
-
- // Write Audit Trail start/end for grid update
- function WriteAuditTrailDummy($typ) {
- $table = 'osj-applications';
-
- // Write Audit Trail
- $filePfx = "log";
- $curDate = date("Y/m/d");
- $curTime = date("H:i:s");
- $id = ew_ScriptName();
- $user = CurrentUserID();
- $action = $typ;
- ew_WriteAuditTrail($filePfx, $curDate, $curTime, $id, $user, $action, $table, "", "", "", "");
- }
- ?>
- <?php
-
- // Write Audit Trail (delete page)
- function WriteAuditTrailOnDelete(&$rs) {
- global $osj2Dapplications;
- $table = 'osj-applications';
-
- // Get key value
- $key = "";
- if ($key <> "") $key .= EW_COMPOSITE_KEY_SEPARATOR;
- $key .= $rs['application_id'];
-
- // Write Audit Trail
- $filePfx = "log";
- $curDate = date("Y/m/d");
- $curTime = date("H:i:s");
- $id = ew_ScriptName();
- $user = CurrentUserID();
- $action = "D";
- $newvalue = "";
- foreach (array_keys($rs) as $fldname) {
- if ($osj2Dapplications->fields[$fldname]->FldDataType <> EW_DATATYPE_BLOB) { // Ignore Blob Field
- $oldvalue = ($osj2Dapplications->fields[$fldname]->FldDataType == EW_DATATYPE_MEMO) ? "<MEMO>" : $rs[$fldname]; // Memo Field
- ew_WriteAuditTrail($filePfx, $curDate, $curTime, $id, $user, $action, $table, $fldname, $key, $oldvalue, $newvalue);
- }
- }
- }
- ?>
- <?php
-
- // Page Load event
- function Page_Load() {
-
- //echo "Page Load";
- }
-
- // Page Unload event
- function Page_Unload() {
-
- //echo "Page Unload";
- }
- ?>