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

/osj-osj2duser_level_permissionsdelete.php

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