PageRenderTime 105ms CodeModel.GetById 1ms RepoModel.GetById 1ms app.codeStats 0ms

/osj-osj2duser_detaildelete.php

http://osjobber.googlecode.com/
PHP | 595 lines | 434 code | 76 blank | 85 comment | 62 complexity | 951999354eb8c727dd24d4368fdd8d21 MD5 | raw file
Possible License(s): LGPL-2.1, AGPL-1.0
  1. <?php
  2. define("EW_PAGE_ID", "delete", TRUE); // Page ID
  3. define("EW_TABLE_NAME", 'osj-user_detail', TRUE);
  4. ?>
  5. <?php
  6. session_start(); // Initialize session data
  7. ob_start(); // Turn on output buffering
  8. ?>
  9. <?php include "osj-ewcfg50.php" ?>
  10. <?php include "osj-ewmysql50.php" ?>
  11. <?php include "osj-phpfn50.php" ?>
  12. <?php include "osj-osj2duser_detailinfo.php" ?>
  13. <?php include "osj-userfn50.php" ?>
  14. <?php include "osj-osj2dusersinfo.php" ?>
  15. <?php
  16. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
  17. header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
  18. header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1
  19. header("Cache-Control: post-check=0, pre-check=0", false);
  20. header("Pragma: no-cache"); // HTTP/1.0
  21. ?>
  22. <?php
  23. // Open connection to the database
  24. $conn = ew_Connect();
  25. ?>
  26. <?php
  27. $Security = new cAdvancedSecurity();
  28. ?>
  29. <?php
  30. if (!$Security->IsLoggedIn()) $Security->AutoLogin();
  31. $Security->LoadCurrentUserLevel('osj-user_detail');
  32. if (!$Security->IsLoggedIn()) {
  33. $Security->SaveLastUrl();
  34. Page_Terminate("osj-login.php");
  35. }
  36. if (!$Security->CanDelete()) {
  37. $Security->SaveLastUrl();
  38. Page_Terminate("osj-osj2duser_detaillist.php");
  39. }
  40. if ($Security->IsLoggedIn() && $Security->CurrentUserID() == "") {
  41. $_SESSION[EW_SESSION_MESSAGE] = "You do not have the right permission to view the page";
  42. Page_Terminate("osj-login.php");
  43. }
  44. ?>
  45. <?php
  46. // Common page loading event (in userfn*.php)
  47. Page_Loading();
  48. ?>
  49. <?php
  50. // Page load event, used in current page
  51. Page_Load();
  52. ?>
  53. <?php
  54. $osj2Duser_detail->Export = @$_GET["export"]; // Get export parameter
  55. $sExport = $osj2Duser_detail->Export; // Get export parameter, used in header
  56. $sExportFile = $osj2Duser_detail->TableVar; // Get export file, used in header
  57. ?>
  58. <?php
  59. // Load Key Parameters
  60. $sKey = "";
  61. $bSingleDelete = TRUE; // Initialize as single delete
  62. $arRecKeys = array();
  63. $nKeySelected = 0; // Initialize selected key count
  64. $sFilter = "";
  65. if (@$_GET["user_detail_id"] <> "") {
  66. $osj2Duser_detail->user_detail_id->setQueryStringValue($_GET["user_detail_id"]);
  67. if (!is_numeric($osj2Duser_detail->user_detail_id->QueryStringValue)) {
  68. Page_Terminate($osj2Duser_detail->getReturnUrl()); // Prevent sql injection, exit
  69. }
  70. $sKey .= $osj2Duser_detail->user_detail_id->QueryStringValue;
  71. } else {
  72. $bSingleDelete = FALSE;
  73. }
  74. if ($bSingleDelete) {
  75. $nKeySelected = 1; // Set up key selected count
  76. $arRecKeys[0] = $sKey;
  77. } else {
  78. if (isset($_POST["key_m"])) { // Key in form
  79. $nKeySelected = count($_POST["key_m"]); // Set up key selected count
  80. $arRecKeys = ew_StripSlashes($_POST["key_m"]);
  81. }
  82. }
  83. if ($nKeySelected <= 0) Page_Terminate($osj2Duser_detail->getReturnUrl()); // No key specified, exit
  84. // Build filter
  85. foreach ($arRecKeys as $sKey) {
  86. $sFilter .= "(";
  87. // Set up key field
  88. $sKeyFld = $sKey;
  89. if (!is_numeric($sKeyFld)) {
  90. Page_Terminate($osj2Duser_detail->getReturnUrl()); // Prevent sql injection, exit
  91. }
  92. $sFilter .= "`user_detail_id`=" . ew_AdjustSql($sKeyFld) . " AND ";
  93. if (substr($sFilter, -5) == " AND ") $sFilter = substr($sFilter, 0, strlen($sFilter)-5) . ") OR ";
  94. }
  95. if (substr($sFilter, -4) == " OR ") $sFilter = substr($sFilter, 0, strlen($sFilter)-4);
  96. // Set up filter (Sql Where Clause) and get Return Sql
  97. // Sql constructor in osj2Duser_detail class, osj2Duser_detailinfo.php
  98. $osj2Duser_detail->CurrentFilter = $sFilter;
  99. // Get action
  100. if (@$_POST["a_delete"] <> "") {
  101. $osj2Duser_detail->CurrentAction = $_POST["a_delete"];
  102. } else {
  103. $osj2Duser_detail->CurrentAction = "I"; // Display record
  104. }
  105. switch ($osj2Duser_detail->CurrentAction) {
  106. case "D": // Delete
  107. $osj2Duser_detail->SendEmail = TRUE; // Send email on delete success
  108. if (DeleteRows()) { // delete rows
  109. $_SESSION[EW_SESSION_MESSAGE] = "Delete Successful"; // Set up success message
  110. Page_Terminate($osj2Duser_detail->getReturnUrl()); // Return to caller
  111. }
  112. }
  113. // Load records for display
  114. $rs = LoadRecordset();
  115. $nTotalRecs = $rs->RecordCount(); // Get record count
  116. if ($nTotalRecs <= 0) { // No record found, exit
  117. $rs->Close();
  118. Page_Terminate($osj2Duser_detail->getReturnUrl()); // Return to caller
  119. }
  120. ?>
  121. <?php include "osj-header.php" ?>
  122. <script type="text/javascript">
  123. <!--
  124. var EW_PAGE_ID = "delete"; // Page id
  125. var EW_SHOW_HIGHLIGHT = "Show highlight";
  126. var EW_HIDE_HIGHLIGHT = "Hide highlight";
  127. //-->
  128. </script>
  129. <script language="JavaScript" type="text/javascript">
  130. <!--
  131. // Write your client script here, no need to add script tags.
  132. // To include another .js script, use:
  133. // ew_ClientScriptInclude("my_javascript.js");
  134. //-->
  135. </script>
  136. <p><span class="phpmaker">Delete from TABLE: User Details<br><br><a href="<?php echo $osj2Duser_detail->getReturnUrl() ?>">Go Back</a></span></p>
  137. <?php
  138. if (@$_SESSION[EW_SESSION_MESSAGE] <> "") {
  139. ?>
  140. <p><span class="ewmsg"><?php echo $_SESSION[EW_SESSION_MESSAGE] ?></span></p>
  141. <?php
  142. $_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message
  143. }
  144. ?>
  145. <form action="osj-osj2duser_detaildelete.php" method="post">
  146. <p>
  147. <input type="hidden" name="a_delete" id="a_delete" value="D">
  148. <?php foreach ($arRecKeys as $sKey) { ?>
  149. <input type="hidden" name="key_m[]" id="key_m[]" value="<?php echo ew_HtmlEncode($sKey) ?>">
  150. <?php } ?>
  151. <table class="ewTable">
  152. <tr class="ewTableHeader">
  153. <td valign="top">detail_id</td>
  154. <td valign="top">user id</td>
  155. <td valign="top">detail edit date</td>
  156. <td valign="top">First Name</td>
  157. <td valign="top">Last Name</td>
  158. <td valign="top">Description</td>
  159. <td valign="top">Company</td>
  160. </tr>
  161. <?php
  162. $nRecCount = 0;
  163. $i = 0;
  164. while (!$rs->EOF) {
  165. $nRecCount++;
  166. // Set row class and style
  167. $osj2Duser_detail->CssClass = "ewTableRow";
  168. $osj2Duser_detail->CssStyle = "";
  169. // Display alternate color for rows
  170. if ($nRecCount % 2 <> 1) {
  171. $osj2Duser_detail->CssClass = "ewTableAltRow";
  172. }
  173. // Get the field contents
  174. LoadRowValues($rs);
  175. // Render row value
  176. $osj2Duser_detail->RowType = EW_ROWTYPE_VIEW; // view
  177. RenderRow();
  178. ?>
  179. <tr<?php echo $osj2Duser_detail->DisplayAttributes() ?>>
  180. <td<?php echo $osj2Duser_detail->user_detail_id->CellAttributes() ?>>
  181. </td>
  182. <td<?php echo $osj2Duser_detail->user_id->CellAttributes() ?>>
  183. <div<?php echo $osj2Duser_detail->user_id->ViewAttributes() ?>><?php echo $osj2Duser_detail->user_id->ViewValue ?></div>
  184. </td>
  185. <td<?php echo $osj2Duser_detail->user_detail_edit_date->CellAttributes() ?>>
  186. </td>
  187. <td<?php echo $osj2Duser_detail->user_first_name->CellAttributes() ?>>
  188. <div<?php echo $osj2Duser_detail->user_first_name->ViewAttributes() ?>><?php echo $osj2Duser_detail->user_first_name->ViewValue ?></div>
  189. </td>
  190. <td<?php echo $osj2Duser_detail->user_last_name->CellAttributes() ?>>
  191. <div<?php echo $osj2Duser_detail->user_last_name->ViewAttributes() ?>><?php echo $osj2Duser_detail->user_last_name->ViewValue ?></div>
  192. </td>
  193. <td<?php echo $osj2Duser_detail->user_description->CellAttributes() ?>>
  194. <div<?php echo $osj2Duser_detail->user_description->ViewAttributes() ?>><?php echo $osj2Duser_detail->user_description->ViewValue ?></div>
  195. </td>
  196. <td<?php echo $osj2Duser_detail->user_company->CellAttributes() ?>>
  197. <div<?php echo $osj2Duser_detail->user_company->ViewAttributes() ?>><?php echo $osj2Duser_detail->user_company->ViewValue ?></div>
  198. </td>
  199. </tr>
  200. <?php
  201. $rs->MoveNext();
  202. }
  203. $rs->Close();
  204. ?>
  205. </table>
  206. <p>
  207. <input type="submit" name="Action" id="Action" value="Confirm Delete">
  208. </form>
  209. <script language="JavaScript" type="text/javascript">
  210. <!--
  211. // Write your table-specific startup script here
  212. // document.write("page loaded");
  213. //-->
  214. </script>
  215. <?php include "osj-footer.php" ?>
  216. <?php
  217. // If control is passed here, simply terminate the page without redirect
  218. Page_Terminate();
  219. // -----------------------------------------------------------------
  220. // Subroutine Page_Terminate
  221. // - called when exit page
  222. // - clean up connection and objects
  223. // - if url specified, redirect to url, otherwise end response
  224. function Page_Terminate($url = "") {
  225. global $conn;
  226. // Page unload event, used in current page
  227. Page_Unload();
  228. // Global page unloaded event (in userfn*.php)
  229. Page_Unloaded();
  230. // Close Connection
  231. $conn->Close();
  232. // Go to url if specified
  233. if ($url <> "") {
  234. ob_end_clean();
  235. header("Location: $url");
  236. }
  237. exit();
  238. }
  239. ?>
  240. <?php
  241. // ------------------------------------------------
  242. // Function DeleteRows
  243. // - Delete Records based on current filter
  244. function DeleteRows() {
  245. global $conn, $Security, $osj2Duser_detail;
  246. $DeleteRows = TRUE;
  247. $sWrkFilter = $osj2Duser_detail->CurrentFilter;
  248. if ($Security->CurrentUserID() <> "" && !$Security->IsAdmin()) { // Non system admin
  249. $sWrkFilter = $osj2Duser_detail->AddUserIDFilter($sWrkFilter, $Security->CurrentUserID()); // Add User ID filter
  250. }
  251. // Set up filter (Sql Where Clause) and get Return Sql
  252. // Sql constructor in osj2Duser_detail class, osj2Duser_detailinfo.php
  253. $osj2Duser_detail->CurrentFilter = $sWrkFilter;
  254. $sSql = $osj2Duser_detail->SQL();
  255. $conn->raiseErrorFn = 'ew_ErrorFn';
  256. $rs = $conn->Execute($sSql);
  257. $conn->raiseErrorFn = '';
  258. if ($rs === FALSE) {
  259. return FALSE;
  260. } elseif ($rs->EOF) {
  261. $_SESSION[EW_SESSION_MESSAGE] = "No records found"; // No record found
  262. $rs->Close();
  263. return FALSE;
  264. }
  265. $conn->BeginTrans();
  266. WriteAuditTrailDummy("*** batch delete begin ***"); // Batch delete begin
  267. // Clone old rows
  268. $rsold = ($rs) ? $rs->GetRows() : array();
  269. if ($rs) $rs->Close();
  270. // Call row deleting event
  271. if ($DeleteRows) {
  272. foreach ($rsold as $row) {
  273. $DeleteRows = $osj2Duser_detail->Row_Deleting($row);
  274. if (!$DeleteRows) break;
  275. }
  276. }
  277. if ($DeleteRows) {
  278. $sKey = "";
  279. foreach ($rsold as $row) {
  280. $sThisKey = "";
  281. if ($sThisKey <> "") $sThisKey .= EW_COMPOSITE_KEY_SEPARATOR;
  282. $sThisKey .= $row['user_detail_id'];
  283. $conn->raiseErrorFn = 'ew_ErrorFn';
  284. $DeleteRows = $conn->Execute($osj2Duser_detail->DeleteSQL($row)); // Delete
  285. $conn->raiseErrorFn = '';
  286. if ($DeleteRows === FALSE)
  287. break;
  288. if ($sKey <> "") $sKey .= ", ";
  289. $sKey .= $sThisKey;
  290. }
  291. } else {
  292. // Set up error message
  293. if ($osj2Duser_detail->CancelMessage <> "") {
  294. $_SESSION[EW_SESSION_MESSAGE] = $osj2Duser_detail->CancelMessage;
  295. $osj2Duser_detail->CancelMessage = "";
  296. } else {
  297. $_SESSION[EW_SESSION_MESSAGE] = "Delete cancelled";
  298. }
  299. }
  300. if ($DeleteRows) {
  301. $conn->CommitTrans(); // Commit the changes
  302. if ($DeleteRows) {
  303. foreach ($rsold as $row) {
  304. WriteAuditTrailOnDelete($row);
  305. }
  306. }
  307. WriteAuditTrailDummy("*** batch delete success ***"); // Batch delete success
  308. } else {
  309. $conn->RollbackTrans(); // Rollback changes
  310. WriteAuditTrailDummy("*** batch delete rollback ***"); // Batch delete rollback
  311. }
  312. // Call recordset deleted event
  313. if ($DeleteRows) {
  314. foreach ($rsold as $row) {
  315. $osj2Duser_detail->Row_Deleted($row);
  316. }
  317. }
  318. return $DeleteRows;
  319. }
  320. ?>
  321. <?php
  322. // Load recordset
  323. function LoadRecordset($offset = -1, $rowcnt = -1) {
  324. global $conn, $osj2Duser_detail;
  325. // Call Recordset Selecting event
  326. $osj2Duser_detail->Recordset_Selecting($osj2Duser_detail->CurrentFilter);
  327. // Load list page sql
  328. $sSql = $osj2Duser_detail->SelectSQL();
  329. if ($offset > -1 && $rowcnt > -1) $sSql .= " LIMIT $offset, $rowcnt";
  330. // Load recordset
  331. $conn->raiseErrorFn = 'ew_ErrorFn';
  332. $rs = $conn->Execute($sSql);
  333. $conn->raiseErrorFn = '';
  334. // Call Recordset Selected event
  335. $osj2Duser_detail->Recordset_Selected($rs);
  336. return $rs;
  337. }
  338. ?>
  339. <?php
  340. // Load row based on key values
  341. function LoadRow() {
  342. global $conn, $Security, $osj2Duser_detail;
  343. $sFilter = $osj2Duser_detail->SqlKeyFilter();
  344. if (!is_numeric($osj2Duser_detail->user_detail_id->CurrentValue)) {
  345. return FALSE; // Invalid key, exit
  346. }
  347. $sFilter = str_replace("@user_detail_id@", ew_AdjustSql($osj2Duser_detail->user_detail_id->CurrentValue), $sFilter); // Replace key value
  348. if ($Security->CurrentUserID() <> "" && !$Security->IsAdmin()) { // Non system admin
  349. $sFilter = $osj2Duser_detail->AddUserIDFilter($sFilter, $Security->CurrentUserID()); // Add User ID filter
  350. }
  351. // Call Row Selecting event
  352. $osj2Duser_detail->Row_Selecting($sFilter);
  353. // Load sql based on filter
  354. $osj2Duser_detail->CurrentFilter = $sFilter;
  355. $sSql = $osj2Duser_detail->SQL();
  356. if ($rs = $conn->Execute($sSql)) {
  357. if ($rs->EOF) {
  358. $LoadRow = FALSE;
  359. } else {
  360. $LoadRow = TRUE;
  361. $rs->MoveFirst();
  362. LoadRowValues($rs); // Load row values
  363. // Call Row Selected event
  364. $osj2Duser_detail->Row_Selected($rs);
  365. }
  366. $rs->Close();
  367. } else {
  368. $LoadRow = FALSE;
  369. }
  370. return $LoadRow;
  371. }
  372. // Load row values from recordset
  373. function LoadRowValues(&$rs) {
  374. global $osj2Duser_detail;
  375. $osj2Duser_detail->user_detail_id->setDbValue($rs->fields('user_detail_id'));
  376. $osj2Duser_detail->user_id->setDbValue($rs->fields('user_id'));
  377. $osj2Duser_detail->user_detail_creation_date->setDbValue($rs->fields('user_detail_creation_date'));
  378. $osj2Duser_detail->user_detail_edit_date->setDbValue($rs->fields('user_detail_edit_date'));
  379. $osj2Duser_detail->user_first_name->setDbValue($rs->fields('user_first_name'));
  380. $osj2Duser_detail->user_last_name->setDbValue($rs->fields('user_last_name'));
  381. $osj2Duser_detail->user_description->setDbValue($rs->fields('user_description'));
  382. $osj2Duser_detail->user_company->setDbValue($rs->fields('user_company'));
  383. }
  384. ?>
  385. <?php
  386. // Render row values based on field settings
  387. function RenderRow() {
  388. global $conn, $Security, $osj2Duser_detail;
  389. // Call Row Rendering event
  390. $osj2Duser_detail->Row_Rendering();
  391. // Common render codes for all row types
  392. // user_detail_id
  393. $osj2Duser_detail->user_detail_id->CellCssStyle = "";
  394. $osj2Duser_detail->user_detail_id->CellCssClass = "";
  395. // user_id
  396. $osj2Duser_detail->user_id->CellCssStyle = "";
  397. $osj2Duser_detail->user_id->CellCssClass = "";
  398. // user_detail_edit_date
  399. $osj2Duser_detail->user_detail_edit_date->CellCssStyle = "";
  400. $osj2Duser_detail->user_detail_edit_date->CellCssClass = "";
  401. // user_first_name
  402. $osj2Duser_detail->user_first_name->CellCssStyle = "";
  403. $osj2Duser_detail->user_first_name->CellCssClass = "";
  404. // user_last_name
  405. $osj2Duser_detail->user_last_name->CellCssStyle = "";
  406. $osj2Duser_detail->user_last_name->CellCssClass = "";
  407. // user_description
  408. $osj2Duser_detail->user_description->CellCssStyle = "";
  409. $osj2Duser_detail->user_description->CellCssClass = "";
  410. // user_company
  411. $osj2Duser_detail->user_company->CellCssStyle = "";
  412. $osj2Duser_detail->user_company->CellCssClass = "";
  413. if ($osj2Duser_detail->RowType == EW_ROWTYPE_VIEW) { // View row
  414. // user_detail_id
  415. $osj2Duser_detail->user_detail_id->CssStyle = "";
  416. $osj2Duser_detail->user_detail_id->CssClass = "";
  417. $osj2Duser_detail->user_detail_id->ViewCustomAttributes = "";
  418. // user_id
  419. $osj2Duser_detail->user_id->ViewValue = $osj2Duser_detail->user_id->CurrentValue;
  420. $osj2Duser_detail->user_id->CssStyle = "";
  421. $osj2Duser_detail->user_id->CssClass = "";
  422. $osj2Duser_detail->user_id->ViewCustomAttributes = "";
  423. // user_detail_edit_date
  424. $osj2Duser_detail->user_detail_edit_date->ViewValue = ew_FormatDateTime($osj2Duser_detail->user_detail_edit_date->ViewValue, 6);
  425. $osj2Duser_detail->user_detail_edit_date->CssStyle = "";
  426. $osj2Duser_detail->user_detail_edit_date->CssClass = "";
  427. $osj2Duser_detail->user_detail_edit_date->ViewCustomAttributes = "";
  428. // user_first_name
  429. $osj2Duser_detail->user_first_name->ViewValue = $osj2Duser_detail->user_first_name->CurrentValue;
  430. $osj2Duser_detail->user_first_name->CssStyle = "";
  431. $osj2Duser_detail->user_first_name->CssClass = "";
  432. $osj2Duser_detail->user_first_name->ViewCustomAttributes = "";
  433. // user_last_name
  434. $osj2Duser_detail->user_last_name->ViewValue = $osj2Duser_detail->user_last_name->CurrentValue;
  435. $osj2Duser_detail->user_last_name->CssStyle = "";
  436. $osj2Duser_detail->user_last_name->CssClass = "";
  437. $osj2Duser_detail->user_last_name->ViewCustomAttributes = "";
  438. // user_description
  439. $osj2Duser_detail->user_description->ViewValue = $osj2Duser_detail->user_description->CurrentValue;
  440. if (!is_null($osj2Duser_detail->user_description->ViewValue)) $osj2Duser_detail->user_description->ViewValue = str_replace("\n", "<br>", $osj2Duser_detail->user_description->ViewValue);
  441. $osj2Duser_detail->user_description->CssStyle = "";
  442. $osj2Duser_detail->user_description->CssClass = "";
  443. $osj2Duser_detail->user_description->ViewCustomAttributes = "";
  444. // user_company
  445. $osj2Duser_detail->user_company->ViewValue = $osj2Duser_detail->user_company->CurrentValue;
  446. $osj2Duser_detail->user_company->CssStyle = "";
  447. $osj2Duser_detail->user_company->CssClass = "";
  448. $osj2Duser_detail->user_company->ViewCustomAttributes = "";
  449. // user_detail_id
  450. $osj2Duser_detail->user_detail_id->HrefValue = "";
  451. // user_id
  452. $osj2Duser_detail->user_id->HrefValue = "";
  453. // user_detail_edit_date
  454. $osj2Duser_detail->user_detail_edit_date->HrefValue = "";
  455. // user_first_name
  456. $osj2Duser_detail->user_first_name->HrefValue = "";
  457. // user_last_name
  458. $osj2Duser_detail->user_last_name->HrefValue = "";
  459. // user_description
  460. $osj2Duser_detail->user_description->HrefValue = "";
  461. // user_company
  462. $osj2Duser_detail->user_company->HrefValue = "";
  463. } elseif ($osj2Duser_detail->RowType == EW_ROWTYPE_ADD) { // Add row
  464. } elseif ($osj2Duser_detail->RowType == EW_ROWTYPE_EDIT) { // Edit row
  465. } elseif ($osj2Duser_detail->RowType == EW_ROWTYPE_SEARCH) { // Search row
  466. }
  467. // Call Row Rendered event
  468. $osj2Duser_detail->Row_Rendered();
  469. }
  470. ?>
  471. <?php
  472. // Write Audit Trail start/end for grid update
  473. function WriteAuditTrailDummy($typ) {
  474. $table = 'osj-user_detail';
  475. // Write Audit Trail
  476. $filePfx = "log";
  477. $curDate = date("Y/m/d");
  478. $curTime = date("H:i:s");
  479. $id = ew_ScriptName();
  480. $user = CurrentUserID();
  481. $action = $typ;
  482. ew_WriteAuditTrail($filePfx, $curDate, $curTime, $id, $user, $action, $table, "", "", "", "");
  483. }
  484. ?>
  485. <?php
  486. // Write Audit Trail (delete page)
  487. function WriteAuditTrailOnDelete(&$rs) {
  488. global $osj2Duser_detail;
  489. $table = 'osj-user_detail';
  490. // Get key value
  491. $key = "";
  492. if ($key <> "") $key .= EW_COMPOSITE_KEY_SEPARATOR;
  493. $key .= $rs['user_detail_id'];
  494. // Write Audit Trail
  495. $filePfx = "log";
  496. $curDate = date("Y/m/d");
  497. $curTime = date("H:i:s");
  498. $id = ew_ScriptName();
  499. $user = CurrentUserID();
  500. $action = "D";
  501. $newvalue = "";
  502. foreach (array_keys($rs) as $fldname) {
  503. if ($osj2Duser_detail->fields[$fldname]->FldDataType <> EW_DATATYPE_BLOB) { // Ignore Blob Field
  504. $oldvalue = ($osj2Duser_detail->fields[$fldname]->FldDataType == EW_DATATYPE_MEMO) ? "<MEMO>" : $rs[$fldname]; // Memo Field
  505. ew_WriteAuditTrail($filePfx, $curDate, $curTime, $id, $user, $action, $table, $fldname, $key, $oldvalue, $newvalue);
  506. }
  507. }
  508. }
  509. ?>
  510. <?php
  511. // Page Load event
  512. function Page_Load() {
  513. //echo "Page Load";
  514. }
  515. // Page Unload event
  516. function Page_Unload() {
  517. //echo "Page Unload";
  518. }
  519. ?>