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

/osj-osj2duser_level_permissionsadd.php

http://osjobber.googlecode.com/
PHP | 579 lines | 453 code | 60 blank | 66 comment | 71 complexity | eddb7e25526a68936e1e7996e1e24c37 MD5 | raw file
Possible License(s): LGPL-2.1, AGPL-1.0
  1. <?php
  2. define("EW_PAGE_ID", "add", 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 values from QueryString
  52. $bCopy = TRUE;
  53. if (@$_GET["user_level_id"] != "") {
  54. $osj2Duser_level_permissions->user_level_id->setQueryStringValue($_GET["user_level_id"]);
  55. } else {
  56. $bCopy = FALSE;
  57. }
  58. if (@$_GET["user_level_table_name"] != "") {
  59. $osj2Duser_level_permissions->user_level_table_name->setQueryStringValue($_GET["user_level_table_name"]);
  60. } else {
  61. $bCopy = FALSE;
  62. }
  63. // Create form object
  64. $objForm = new cFormObj();
  65. // Process form if post back
  66. if (@$_POST["a_add"] <> "") {
  67. $osj2Duser_level_permissions->CurrentAction = $_POST["a_add"]; // Get form action
  68. LoadFormValues(); // Load form values
  69. } else { // Not post back
  70. if ($bCopy) {
  71. $osj2Duser_level_permissions->CurrentAction = "C"; // Copy Record
  72. } else {
  73. $osj2Duser_level_permissions->CurrentAction = "I"; // Display Blank Record
  74. LoadDefaultValues(); // Load default values
  75. }
  76. }
  77. // Perform action based on action code
  78. switch ($osj2Duser_level_permissions->CurrentAction) {
  79. case "I": // Blank record, no action required
  80. break;
  81. case "C": // Copy an existing record
  82. if (!LoadRow()) { // Load record based on key
  83. $_SESSION[EW_SESSION_MESSAGE] = "No records found"; // No record found
  84. Page_Terminate($osj2Duser_level_permissions->getReturnUrl()); // Clean up and return
  85. }
  86. break;
  87. case "A": // ' Add new record
  88. $osj2Duser_level_permissions->SendEmail = TRUE; // Send email on add success
  89. if (AddRow()) { // Add successful
  90. $_SESSION[EW_SESSION_MESSAGE] = "Add New Record Successful"; // Set up success message
  91. Page_Terminate($osj2Duser_level_permissions->KeyUrl($osj2Duser_level_permissions->getReturnUrl())); // Clean up and return
  92. } else {
  93. RestoreFormValues(); // Add failed, restore form values
  94. }
  95. }
  96. // Render row based on row type
  97. $osj2Duser_level_permissions->RowType = EW_ROWTYPE_ADD; // Render add type
  98. RenderRow();
  99. ?>
  100. <?php include "osj-header.php" ?>
  101. <script type="text/javascript">
  102. <!--
  103. var EW_PAGE_ID = "add"; // Page id
  104. var EW_SHOW_HIGHLIGHT = "Show highlight";
  105. var EW_HIDE_HIGHLIGHT = "Hide highlight";
  106. //-->
  107. </script>
  108. <script type="text/javascript">
  109. <!--
  110. function ew_ValidateForm(fobj) {
  111. if (fobj.a_confirm && fobj.a_confirm.value == "F")
  112. return true;
  113. var i, elm, aelm, infix;
  114. var rowcnt = (fobj.key_count) ? Number(fobj.key_count.value) : 1;
  115. for (i=0; i<rowcnt; i++) {
  116. infix = (fobj.key_count) ? String(i+1) : "";
  117. elm = fobj.elements["x" + infix + "_user_level_id"];
  118. if (elm && !ew_HasValue(elm)) {
  119. if (!ew_OnError(elm, "Please enter required field - user level id"))
  120. return false;
  121. }
  122. elm = fobj.elements["x" + infix + "_user_level_table_name"];
  123. if (elm && !ew_HasValue(elm)) {
  124. if (!ew_OnError(elm, "Please enter required field - Permission To Do..."))
  125. return false;
  126. }
  127. elm = fobj.elements["x" + infix + "_user_level_permission"];
  128. if (elm && !ew_HasValue(elm)) {
  129. if (!ew_OnError(elm, "Please enter required field - Permission Level"))
  130. return false;
  131. }
  132. }
  133. return true;
  134. }
  135. //-->
  136. </script>
  137. <script type="text/javascript">
  138. <!--
  139. var ew_DHTMLEditors = [];
  140. //-->
  141. </script>
  142. <script type="text/javascript">
  143. <!--
  144. // js for Popup Calendar
  145. //-->
  146. </script>
  147. <script type="text/javascript">
  148. <!--
  149. var ew_MultiPagePage = "Page"; // multi-page Page Text
  150. var ew_MultiPageOf = "of"; // multi-page Of Text
  151. var ew_MultiPagePrev = "Prev"; // multi-page Prev Text
  152. var ew_MultiPageNext = "Next"; // multi-page Next Text
  153. //-->
  154. </script>
  155. <script language="JavaScript" type="text/javascript">
  156. <!--
  157. // Write your client script here, no need to add script tags.
  158. // To include another .js script, use:
  159. // ew_ClientScriptInclude("my_javascript.js");
  160. //-->
  161. </script>
  162. <p><span class="phpmaker">Add to TABLE: User Permissions<br><br><a href="<?php echo $osj2Duser_level_permissions->getReturnUrl() ?>">Go Back</a></span></p>
  163. <?php
  164. if (@$_SESSION[EW_SESSION_MESSAGE] <> "") { // Mesasge in Session, display
  165. ?>
  166. <p><span class="ewmsg"><?php echo $_SESSION[EW_SESSION_MESSAGE] ?></span></p>
  167. <?php
  168. $_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
  169. }
  170. ?>
  171. <form name="fosj2Duser_level_permissionsadd" id="fosj2Duser_level_permissionsadd" action="osj-osj2duser_level_permissionsadd.php" method="post" onSubmit="return ew_ValidateForm(this);">
  172. <p>
  173. <input type="hidden" name="a_add" id="a_add" value="A">
  174. <table class="ewTable">
  175. <tr class="ewTableRow">
  176. <td class="ewTableHeader">user level id<span class='ewmsg'>&nbsp;*</span></td>
  177. <td<?php echo $osj2Duser_level_permissions->user_level_id->CellAttributes() ?>><span id="cb_x_user_level_id">
  178. <select id="x_user_level_id" name="x_user_level_id"<?php echo $osj2Duser_level_permissions->user_level_id->EditAttributes() ?>>
  179. <!--option value="">Please Select</option-->
  180. <?php
  181. if (is_array($osj2Duser_level_permissions->user_level_id->EditValue)) {
  182. $arwrk = $osj2Duser_level_permissions->user_level_id->EditValue;
  183. $rowswrk = count($arwrk);
  184. for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
  185. $selwrk = (strval($osj2Duser_level_permissions->user_level_id->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected" : "";
  186. ?>
  187. <option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
  188. <?php echo $arwrk[$rowcntwrk][1] ?>
  189. </option>
  190. <?php
  191. }
  192. }
  193. ?>
  194. </select>
  195. </span></td>
  196. </tr>
  197. <tr class="ewTableAltRow">
  198. <td class="ewTableHeader">Permission To Do...<span class='ewmsg'>&nbsp;*</span></td>
  199. <td<?php echo $osj2Duser_level_permissions->user_level_table_name->CellAttributes() ?>><span id="cb_x_user_level_table_name">
  200. <select id="x_user_level_table_name" name="x_user_level_table_name"<?php echo $osj2Duser_level_permissions->user_level_table_name->EditAttributes() ?>>
  201. <!--option value="">Please Select</option-->
  202. <?php
  203. if (is_array($osj2Duser_level_permissions->user_level_table_name->EditValue)) {
  204. $arwrk = $osj2Duser_level_permissions->user_level_table_name->EditValue;
  205. $rowswrk = count($arwrk);
  206. for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
  207. $selwrk = (strval($osj2Duser_level_permissions->user_level_table_name->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected" : "";
  208. ?>
  209. <option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
  210. <?php echo $arwrk[$rowcntwrk][1] ?>
  211. </option>
  212. <?php
  213. }
  214. }
  215. ?>
  216. </select>
  217. </span></td>
  218. </tr>
  219. <tr class="ewTableRow">
  220. <td class="ewTableHeader">Permission Level<span class='ewmsg'>&nbsp;*</span></td>
  221. <td<?php echo $osj2Duser_level_permissions->user_level_permission->CellAttributes() ?>><span id="cb_x_user_level_permission">
  222. <select id="x_user_level_permission" name="x_user_level_permission"<?php echo $osj2Duser_level_permissions->user_level_permission->EditAttributes() ?>>
  223. <!--option value="">Please Select</option-->
  224. <?php
  225. if (is_array($osj2Duser_level_permissions->user_level_permission->EditValue)) {
  226. $arwrk = $osj2Duser_level_permissions->user_level_permission->EditValue;
  227. $rowswrk = count($arwrk);
  228. for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
  229. $selwrk = (strval($osj2Duser_level_permissions->user_level_permission->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected" : "";
  230. ?>
  231. <option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
  232. <?php echo $arwrk[$rowcntwrk][1] ?>
  233. </option>
  234. <?php
  235. }
  236. }
  237. ?>
  238. </select>
  239. </span></td>
  240. </tr>
  241. </table>
  242. <p>
  243. <input type="submit" name="btnAction" id="btnAction" value=" Add ">
  244. </form>
  245. <script language="JavaScript" type="text/javascript">
  246. <!--
  247. // Write your table-specific startup script here
  248. // document.write("page loaded");
  249. //-->
  250. </script>
  251. <?php include "osj-footer.php" ?>
  252. <?php
  253. // If control is passed here, simply terminate the page without redirect
  254. Page_Terminate();
  255. // -----------------------------------------------------------------
  256. // Subroutine Page_Terminate
  257. // - called when exit page
  258. // - clean up connection and objects
  259. // - if url specified, redirect to url, otherwise end response
  260. function Page_Terminate($url = "") {
  261. global $conn;
  262. // Page unload event, used in current page
  263. Page_Unload();
  264. // Global page unloaded event (in userfn*.php)
  265. Page_Unloaded();
  266. // Close Connection
  267. $conn->Close();
  268. // Go to url if specified
  269. if ($url <> "") {
  270. ob_end_clean();
  271. header("Location: $url");
  272. }
  273. exit();
  274. }
  275. ?>
  276. <?php
  277. // Load default values
  278. function LoadDefaultValues() {
  279. global $osj2Duser_level_permissions;
  280. $osj2Duser_level_permissions->user_level_id->CurrentValue = 0;
  281. $osj2Duser_level_permissions->user_level_permission->CurrentValue = 0;
  282. }
  283. ?>
  284. <?php
  285. // Load form values
  286. function LoadFormValues() {
  287. // Load from form
  288. global $objForm, $osj2Duser_level_permissions;
  289. $osj2Duser_level_permissions->user_level_id->setFormValue($objForm->GetValue("x_user_level_id"));
  290. $osj2Duser_level_permissions->user_level_table_name->setFormValue($objForm->GetValue("x_user_level_table_name"));
  291. $osj2Duser_level_permissions->user_level_permission->setFormValue($objForm->GetValue("x_user_level_permission"));
  292. }
  293. // Restore form values
  294. function RestoreFormValues() {
  295. global $osj2Duser_level_permissions;
  296. $osj2Duser_level_permissions->user_level_id->CurrentValue = $osj2Duser_level_permissions->user_level_id->FormValue;
  297. $osj2Duser_level_permissions->user_level_table_name->CurrentValue = $osj2Duser_level_permissions->user_level_table_name->FormValue;
  298. $osj2Duser_level_permissions->user_level_permission->CurrentValue = $osj2Duser_level_permissions->user_level_permission->FormValue;
  299. }
  300. ?>
  301. <?php
  302. // Load row based on key values
  303. function LoadRow() {
  304. global $conn, $Security, $osj2Duser_level_permissions;
  305. $sFilter = $osj2Duser_level_permissions->SqlKeyFilter();
  306. if (!is_numeric($osj2Duser_level_permissions->user_level_id->CurrentValue)) {
  307. return FALSE; // Invalid key, exit
  308. }
  309. $sFilter = str_replace("@user_level_id@", ew_AdjustSql($osj2Duser_level_permissions->user_level_id->CurrentValue), $sFilter); // Replace key value
  310. $sFilter = str_replace("@user_level_table_name@", ew_AdjustSql($osj2Duser_level_permissions->user_level_table_name->CurrentValue), $sFilter); // Replace key value
  311. // Call Row Selecting event
  312. $osj2Duser_level_permissions->Row_Selecting($sFilter);
  313. // Load sql based on filter
  314. $osj2Duser_level_permissions->CurrentFilter = $sFilter;
  315. $sSql = $osj2Duser_level_permissions->SQL();
  316. if ($rs = $conn->Execute($sSql)) {
  317. if ($rs->EOF) {
  318. $LoadRow = FALSE;
  319. } else {
  320. $LoadRow = TRUE;
  321. $rs->MoveFirst();
  322. LoadRowValues($rs); // Load row values
  323. // Call Row Selected event
  324. $osj2Duser_level_permissions->Row_Selected($rs);
  325. }
  326. $rs->Close();
  327. } else {
  328. $LoadRow = FALSE;
  329. }
  330. return $LoadRow;
  331. }
  332. // Load row values from recordset
  333. function LoadRowValues(&$rs) {
  334. global $osj2Duser_level_permissions;
  335. $osj2Duser_level_permissions->user_level_id->setDbValue($rs->fields('user_level_id'));
  336. $osj2Duser_level_permissions->user_level_table_name->setDbValue($rs->fields('user_level_table_name'));
  337. $osj2Duser_level_permissions->user_level_permission->setDbValue($rs->fields('user_level_permission'));
  338. }
  339. ?>
  340. <?php
  341. // Render row values based on field settings
  342. function RenderRow() {
  343. global $conn, $Security, $osj2Duser_level_permissions;
  344. // Call Row Rendering event
  345. $osj2Duser_level_permissions->Row_Rendering();
  346. // Common render codes for all row types
  347. // user_level_id
  348. $osj2Duser_level_permissions->user_level_id->CellCssStyle = "";
  349. $osj2Duser_level_permissions->user_level_id->CellCssClass = "";
  350. // user_level_table_name
  351. $osj2Duser_level_permissions->user_level_table_name->CellCssStyle = "";
  352. $osj2Duser_level_permissions->user_level_table_name->CellCssClass = "";
  353. // user_level_permission
  354. $osj2Duser_level_permissions->user_level_permission->CellCssStyle = "";
  355. $osj2Duser_level_permissions->user_level_permission->CellCssClass = "";
  356. if ($osj2Duser_level_permissions->RowType == EW_ROWTYPE_VIEW) { // View row
  357. } elseif ($osj2Duser_level_permissions->RowType == EW_ROWTYPE_ADD) { // Add row
  358. // user_level_id
  359. $osj2Duser_level_permissions->user_level_id->EditCustomAttributes = "";
  360. $sSqlWrk = "SELECT `user_level_id`, `user_level_name` FROM `osj-user_level`";
  361. $sSqlWrk .= " ORDER BY `user_level_name` Asc";
  362. $rswrk = $conn->Execute($sSqlWrk);
  363. $arwrk = ($rswrk) ? $rswrk->GetRows() : array();
  364. if ($rswrk) $rswrk->Close();
  365. array_unshift($arwrk, array("", "Please Select"));
  366. $osj2Duser_level_permissions->user_level_id->EditValue = $arwrk;
  367. // user_level_table_name
  368. $osj2Duser_level_permissions->user_level_table_name->EditCustomAttributes = "";
  369. $arwrk = array();
  370. $arwrk[] = array("osj-applications", "Applications");
  371. $arwrk[] = array("osj-applications", "Applications");
  372. $arwrk[] = array("osj-posts", "Postings");
  373. $arwrk[] = array("osj-resumes", "Resumes");
  374. $arwrk[] = array("osj-users", "Users");
  375. $arwrk[] = array("osj-user_detail", "User Detail Page");
  376. $arwrk[] = array("osj-user_level", "User Levels");
  377. $arwrk[] = array("osj-user_level_permissions", "User Permission Levels");
  378. array_unshift($arwrk, array("", "Please Select"));
  379. $osj2Duser_level_permissions->user_level_table_name->EditValue = $arwrk;
  380. // user_level_permission
  381. $osj2Duser_level_permissions->user_level_permission->EditCustomAttributes = "";
  382. $arwrk = array();
  383. $arwrk[] = array("0", "No Permission");
  384. $arwrk[] = array("1", "Add Only");
  385. $arwrk[] = array("2", "Delete Only");
  386. $arwrk[] = array("4", "Edit Only");
  387. $arwrk[] = array("8", "View Only");
  388. $arwrk[] = array("5", "Add/Edit");
  389. $arwrk[] = array("3", "Add/Delete");
  390. $arwrk[] = array("7", "Add/Edit/Delete");
  391. $arwrk[] = array("6", "Edit/Delete");
  392. $arwrk[] = array("9", "View/Add");
  393. $arwrk[] = array("11", "View/Add/Delete");
  394. $arwrk[] = array("12", "View/Edit");
  395. $arwrk[] = array("10", "View/Delete");
  396. $arwrk[] = array("14", "View/Edit/Delete");
  397. $arwrk[] = array("13", "View/Add/Edit");
  398. $arwrk[] = array("15", "View/Add/Edit/Delete");
  399. array_unshift($arwrk, array("", "Please Select"));
  400. $osj2Duser_level_permissions->user_level_permission->EditValue = $arwrk;
  401. } elseif ($osj2Duser_level_permissions->RowType == EW_ROWTYPE_EDIT) { // Edit row
  402. } elseif ($osj2Duser_level_permissions->RowType == EW_ROWTYPE_SEARCH) { // Search row
  403. }
  404. // Call Row Rendered event
  405. $osj2Duser_level_permissions->Row_Rendered();
  406. }
  407. ?>
  408. <?php
  409. // Add record
  410. function AddRow() {
  411. global $conn, $Security, $osj2Duser_level_permissions;
  412. // Check for duplicate key
  413. $bCheckKey = TRUE;
  414. $sFilter = $osj2Duser_level_permissions->SqlKeyFilter();
  415. if (trim(strval($osj2Duser_level_permissions->user_level_id->CurrentValue)) == "") {
  416. $bCheckKey = FALSE;
  417. } else {
  418. $sFilter = str_replace("@user_level_id@", ew_AdjustSql($osj2Duser_level_permissions->user_level_id->CurrentValue), $sFilter); // Replace key value
  419. }
  420. if (!is_numeric($osj2Duser_level_permissions->user_level_id->CurrentValue)) {
  421. $bCheckKey = FALSE;
  422. }
  423. if (trim(strval($osj2Duser_level_permissions->user_level_table_name->CurrentValue)) == "") {
  424. $bCheckKey = FALSE;
  425. } else {
  426. $sFilter = str_replace("@user_level_table_name@", ew_AdjustSql($osj2Duser_level_permissions->user_level_table_name->CurrentValue), $sFilter); // Replace key value
  427. }
  428. if ($bCheckKey) {
  429. $rsChk = $osj2Duser_level_permissions->LoadRs($sFilter);
  430. if ($rsChk && !$rsChk->EOF) {
  431. $_SESSION[EW_SESSION_MESSAGE] = "Duplicate value for primary key";
  432. $rsChk->Close();
  433. return FALSE;
  434. }
  435. }
  436. $rsnew = array();
  437. // Field user_level_id
  438. $osj2Duser_level_permissions->user_level_id->SetDbValueDef($osj2Duser_level_permissions->user_level_id->CurrentValue, 0);
  439. $rsnew['user_level_id'] =& $osj2Duser_level_permissions->user_level_id->DbValue;
  440. // Field user_level_table_name
  441. $osj2Duser_level_permissions->user_level_table_name->SetDbValueDef($osj2Duser_level_permissions->user_level_table_name->CurrentValue, "");
  442. $rsnew['user_level_table_name'] =& $osj2Duser_level_permissions->user_level_table_name->DbValue;
  443. // Field user_level_permission
  444. $osj2Duser_level_permissions->user_level_permission->SetDbValueDef($osj2Duser_level_permissions->user_level_permission->CurrentValue, 0);
  445. $rsnew['user_level_permission'] =& $osj2Duser_level_permissions->user_level_permission->DbValue;
  446. // Call Row Inserting event
  447. $bInsertRow = $osj2Duser_level_permissions->Row_Inserting($rsnew);
  448. if ($bInsertRow) {
  449. $conn->raiseErrorFn = 'ew_ErrorFn';
  450. $AddRow = $conn->Execute($osj2Duser_level_permissions->InsertSQL($rsnew));
  451. $conn->raiseErrorFn = '';
  452. } else {
  453. if ($osj2Duser_level_permissions->CancelMessage <> "") {
  454. $_SESSION[EW_SESSION_MESSAGE] = $osj2Duser_level_permissions->CancelMessage;
  455. $osj2Duser_level_permissions->CancelMessage = "";
  456. } else {
  457. $_SESSION[EW_SESSION_MESSAGE] = "Insert cancelled";
  458. }
  459. $AddRow = FALSE;
  460. }
  461. if ($AddRow) {
  462. // Call Row Inserted event
  463. $osj2Duser_level_permissions->Row_Inserted($rsnew);
  464. WriteAuditTrailOnAdd($rsnew);
  465. }
  466. return $AddRow;
  467. }
  468. ?>
  469. <?php
  470. // Write Audit Trail start/end for grid update
  471. function WriteAuditTrailDummy($typ) {
  472. $table = 'osj-user_level_permissions';
  473. // Write Audit Trail
  474. $filePfx = "log";
  475. $curDate = date("Y/m/d");
  476. $curTime = date("H:i:s");
  477. $id = ew_ScriptName();
  478. $user = CurrentUserID();
  479. $action = $typ;
  480. ew_WriteAuditTrail($filePfx, $curDate, $curTime, $id, $user, $action, $table, "", "", "", "");
  481. }
  482. ?>
  483. <?php
  484. // Write Audit Trail (add page)
  485. function WriteAuditTrailOnAdd(&$rs) {
  486. global $osj2Duser_level_permissions;
  487. $table = 'osj-user_level_permissions';
  488. // Get key value
  489. $key = "";
  490. if ($key <> "") $key .= EW_COMPOSITE_KEY_SEPARATOR;
  491. $key .= $rs['user_level_id'];
  492. if ($key <> "") $key .= EW_COMPOSITE_KEY_SEPARATOR;
  493. $key .= $rs['user_level_table_name'];
  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 = "A";
  501. $oldvalue = "";
  502. foreach (array_keys($rs) as $fldname) {
  503. if ($osj2Duser_level_permissions->fields[$fldname]->FldDataType <> EW_DATATYPE_BLOB) { // Ignore Blob Field
  504. $newvalue = ($osj2Duser_level_permissions->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. ?>