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

/osj-osj2duser_detailadd.php

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