PageRenderTime 52ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/osj-osj2duser_levelview.php

http://osjobber.googlecode.com/
PHP | 565 lines | 452 code | 53 blank | 60 comment | 113 complexity | 1216451d1a1f9488b85d594b846902cf MD5 | raw file
Possible License(s): LGPL-2.1, AGPL-1.0
  1. <?php
  2. define("EW_PAGE_ID", "view", TRUE); // Page ID
  3. define("EW_TABLE_NAME", 'osj-user_level', 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_levelinfo.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');
  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->Export = @$_GET["export"]; // Get export parameter
  47. $sExport = $osj2Duser_level->Export; // Get export parameter, used in header
  48. $sExportFile = $osj2Duser_level->TableVar; // Get export file, used in header
  49. ?>
  50. <?php
  51. if (@$_GET["user_level_id"] <> "") {
  52. if ($sExportFile <> "") $sExportFile .= "_";
  53. $sExportFile .= ew_StripSlashes($_GET["user_level_id"]);
  54. }
  55. if ($osj2Duser_level->Export == "html") {
  56. // Printer friendly, no action required
  57. }
  58. if ($osj2Duser_level->Export == "xml") {
  59. header('Content-Type: text/xml');
  60. header('Content-Disposition: attachment; filename=' . $sExportFile .'.xml');
  61. }
  62. if ($osj2Duser_level->Export == "csv") {
  63. header('Content-Type: application/csv');
  64. header('Content-Disposition: attachment; filename=' . $sExportFile .'.csv');
  65. }
  66. ?>
  67. <?php
  68. // Paging variables
  69. $nStartRec = 0; // Start record index
  70. $nStopRec = 0; // Stop record index
  71. $nTotalRecs = 0; // Total number of records
  72. $nDisplayRecs = 1;
  73. $nRecRange = 10;
  74. // Load current record
  75. $bLoadCurrentRecord = FALSE;
  76. if (@$_GET["user_level_id"] <> "") {
  77. $osj2Duser_level->user_level_id->setQueryStringValue($_GET["user_level_id"]);
  78. } else {
  79. $bLoadCurrentRecord = TRUE;
  80. }
  81. // Get action
  82. if (@$_POST["a_view"] <> "") {
  83. $osj2Duser_level->CurrentAction = $_POST["a_view"];
  84. } else {
  85. $osj2Duser_level->CurrentAction = "I"; // Display form
  86. }
  87. switch ($osj2Duser_level->CurrentAction) {
  88. case "I": // Get a record to display
  89. $nStartRec = 1; // Initialize start position
  90. $rs = LoadRecordset(); // Load records
  91. $nTotalRecs = $rs->RecordCount(); // Get record count
  92. if ($nTotalRecs <= 0) { // No record found
  93. $_SESSION[EW_SESSION_MESSAGE] = "No records found"; // Set no record message
  94. Page_Terminate("osj-osj2duser_levellist.php"); // Return to list page
  95. } elseif ($bLoadCurrentRecord) { // Load current record position
  96. SetUpStartRec(); // Set up start record position
  97. // Point to current record
  98. if (intval($nStartRec) <= intval($nTotalRecs)) {
  99. $rs->Move($nStartRec-1);
  100. }
  101. } else { // Match key values
  102. $bMatchRecord = FALSE;
  103. while (!$rs->EOF) {
  104. if (strval($osj2Duser_level->user_level_id->CurrentValue) == strval($rs->fields('user_level_id'))) {
  105. $bMatchRecord = TRUE;
  106. break;
  107. } else {
  108. $nStartRec++;
  109. $rs->MoveNext();
  110. }
  111. }
  112. if (!$bMatchRecord) {
  113. $_SESSION[EW_SESSION_MESSAGE] = "No records found"; // Set no record message
  114. Page_Terminate("osj-osj2duser_levellist.php"); // Return to list
  115. } else {
  116. $osj2Duser_level->setStartRecordNumber($nStartRec); // Save record position
  117. }
  118. }
  119. LoadRowValues($rs); // Load row values
  120. }
  121. // Export data only
  122. if ($osj2Duser_level->Export == "xml" || $osj2Duser_level->Export == "csv") {
  123. ExportData();
  124. Page_Terminate(); // Terminate response
  125. }
  126. // Set return url
  127. $osj2Duser_level->setReturnUrl("osj-osj2duser_levelview.php");
  128. // Render row
  129. $osj2Duser_level->RowType = EW_ROWTYPE_VIEW;
  130. RenderRow();
  131. ?>
  132. <?php include "osj-header.php" ?>
  133. <script type="text/javascript">
  134. <!--
  135. var EW_PAGE_ID = "view"; // Page id
  136. var EW_SHOW_HIGHLIGHT = "Show highlight";
  137. var EW_HIDE_HIGHLIGHT = "Hide highlight";
  138. //-->
  139. </script>
  140. <script language="JavaScript" type="text/javascript">
  141. <!--
  142. // Write your client script here, no need to add script tags.
  143. // To include another .js script, use:
  144. // ew_ClientScriptInclude("my_javascript.js");
  145. //-->
  146. </script>
  147. <p><span class="phpmaker">View TABLE: User Levels
  148. <?php if ($osj2Duser_level->Export == "") { ?>
  149. &nbsp;&nbsp;<a href="osj-osj2duser_levelview.php?export=html&user_level_id=<?php echo urlencode($osj2Duser_level->user_level_id->CurrentValue) ?>">Printer Friendly</a>
  150. &nbsp;&nbsp;<a href="osj-osj2duser_levelview.php?export=xml&user_level_id=<?php echo urlencode($osj2Duser_level->user_level_id->CurrentValue) ?>">Export to XML</a>
  151. &nbsp;&nbsp;<a href="osj-osj2duser_levelview.php?export=csv&user_level_id=<?php echo urlencode($osj2Duser_level->user_level_id->CurrentValue) ?>">Export to CSV</a>
  152. <?php } ?>
  153. <br><br>
  154. <?php if ($osj2Duser_level->Export == "") { ?>
  155. <a href="osj-osj2duser_levellist.php">Back to List</a>&nbsp;
  156. <?php if ($Security->CanAdd()) { ?>
  157. <a href="osj-osj2duser_leveladd.php">Add</a>&nbsp;
  158. <?php } ?>
  159. <?php if ($Security->CanEdit()) { ?>
  160. <a href="<?php echo $osj2Duser_level->EditUrl() ?>">Edit</a>&nbsp;
  161. <?php } ?>
  162. <?php if ($Security->CanDelete()) { ?>
  163. <a href="<?php echo $osj2Duser_level->DeleteUrl() ?>">Delete</a>&nbsp;
  164. <?php } ?>
  165. <?php } ?>
  166. </span>
  167. </p>
  168. <?php
  169. if (@$_SESSION[EW_SESSION_MESSAGE] <> "") {
  170. ?>
  171. <p><span class="ewmsg"><?php echo $_SESSION[EW_SESSION_MESSAGE] ?></span></p>
  172. <?php
  173. $_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message
  174. }
  175. ?>
  176. <p>
  177. <?php if ($osj2Duser_level->Export == "") { ?>
  178. <form action="osj-osj2duser_levelview.php" name="ewpagerform" id="ewpagerform">
  179. <table border="0" cellspacing="0" cellpadding="0">
  180. <tr>
  181. <td nowrap>
  182. <span class="phpmaker">
  183. <?php if (!isset($Pager)) $Pager = new cNumericPager($nStartRec, $nDisplayRecs, $nTotalRecs, $nRecRange) ?>
  184. <?php if ($Pager->RecordCount > 0) { ?>
  185. <?php if ($Pager->FirstButton->Enabled) { ?>
  186. <a href="osj-osj2duser_levelview.php?start=<?php echo $Pager->FirstButton->Start ?>"><b>First</b></a>&nbsp;
  187. <?php } ?>
  188. <?php if ($Pager->PrevButton->Enabled) { ?>
  189. <a href="osj-osj2duser_levelview.php?start=<?php echo $Pager->PrevButton->Start ?>"><b>Previous</b></a>&nbsp;
  190. <?php } ?>
  191. <?php foreach ($Pager->Items as $PagerItem) { ?>
  192. <?php if ($PagerItem->Enabled) { ?><a href="osj-osj2duser_levelview.php?start=<?php echo $PagerItem->Start ?>"><?php } ?><b><?php echo $PagerItem->Text ?></b><?php if ($PagerItem->Enabled) { ?></a><?php } ?>&nbsp;
  193. <?php } ?>
  194. <?php if ($Pager->NextButton->Enabled) { ?>
  195. <a href="osj-osj2duser_levelview.php?start=<?php echo $Pager->NextButton->Start ?>"><b>Next</b></a>&nbsp;
  196. <?php } ?>
  197. <?php if ($Pager->LastButton->Enabled) { ?>
  198. <a href="osj-osj2duser_levelview.php?start=<?php echo $Pager->LastButton->Start ?>"><b>Last</b></a>&nbsp;
  199. <?php } ?>
  200. <?php if ($Pager->ButtonCount > 0) { ?><br><?php } ?>
  201. Records <?php echo $Pager->FromIndex ?> to <?php echo $Pager->ToIndex ?> of <?php echo $Pager->RecordCount ?>
  202. <?php } else { ?>
  203. <?php if ($Security->CanList()) { ?>
  204. <?php if ($sSrchWhere == "0=101") { ?>
  205. Please enter search criteria
  206. <?php } else { ?>
  207. No records found
  208. <?php } ?>
  209. <?php } else { ?>
  210. You do not have the right permission to view the page
  211. <?php } ?>
  212. <?php } ?>
  213. </span>
  214. </td>
  215. </tr>
  216. </table>
  217. </form>
  218. <?php } ?>
  219. <form>
  220. <table class="ewTable">
  221. <tr class="ewTableRow">
  222. <td class="ewTableHeader">user level id</td>
  223. <td<?php echo $osj2Duser_level->user_level_id->CellAttributes() ?>>
  224. <div<?php echo $osj2Duser_level->user_level_id->ViewAttributes() ?>><?php echo $osj2Duser_level->user_level_id->ViewValue ?></div>
  225. </td>
  226. </tr>
  227. <tr class="ewTableAltRow">
  228. <td class="ewTableHeader">user level name</td>
  229. <td<?php echo $osj2Duser_level->user_level_name->CellAttributes() ?>>
  230. <div<?php echo $osj2Duser_level->user_level_name->ViewAttributes() ?>><?php echo $osj2Duser_level->user_level_name->ViewValue ?></div>
  231. </td>
  232. </tr>
  233. </table>
  234. </form>
  235. <?php if ($osj2Duser_level->Export == "") { ?>
  236. <form action="osj-osj2duser_levelview.php" name="ewpagerform" id="ewpagerform">
  237. <table border="0" cellspacing="0" cellpadding="0">
  238. <tr>
  239. <td nowrap>
  240. <span class="phpmaker">
  241. <?php if (!isset($Pager)) $Pager = new cNumericPager($nStartRec, $nDisplayRecs, $nTotalRecs, $nRecRange) ?>
  242. <?php if ($Pager->RecordCount > 0) { ?>
  243. <?php if ($Pager->FirstButton->Enabled) { ?>
  244. <a href="osj-osj2duser_levelview.php?start=<?php echo $Pager->FirstButton->Start ?>"><b>First</b></a>&nbsp;
  245. <?php } ?>
  246. <?php if ($Pager->PrevButton->Enabled) { ?>
  247. <a href="osj-osj2duser_levelview.php?start=<?php echo $Pager->PrevButton->Start ?>"><b>Previous</b></a>&nbsp;
  248. <?php } ?>
  249. <?php foreach ($Pager->Items as $PagerItem) { ?>
  250. <?php if ($PagerItem->Enabled) { ?><a href="osj-osj2duser_levelview.php?start=<?php echo $PagerItem->Start ?>"><?php } ?><b><?php echo $PagerItem->Text ?></b><?php if ($PagerItem->Enabled) { ?></a><?php } ?>&nbsp;
  251. <?php } ?>
  252. <?php if ($Pager->NextButton->Enabled) { ?>
  253. <a href="osj-osj2duser_levelview.php?start=<?php echo $Pager->NextButton->Start ?>"><b>Next</b></a>&nbsp;
  254. <?php } ?>
  255. <?php if ($Pager->LastButton->Enabled) { ?>
  256. <a href="osj-osj2duser_levelview.php?start=<?php echo $Pager->LastButton->Start ?>"><b>Last</b></a>&nbsp;
  257. <?php } ?>
  258. <?php if ($Pager->ButtonCount > 0) { ?><br><?php } ?>
  259. Records <?php echo $Pager->FromIndex ?> to <?php echo $Pager->ToIndex ?> of <?php echo $Pager->RecordCount ?>
  260. <?php } else { ?>
  261. <?php if ($Security->CanList()) { ?>
  262. <?php if ($sSrchWhere == "0=101") { ?>
  263. Please enter search criteria
  264. <?php } else { ?>
  265. No records found
  266. <?php } ?>
  267. <?php } else { ?>
  268. You do not have the right permission to view the page
  269. <?php } ?>
  270. <?php } ?>
  271. </span>
  272. </td>
  273. </tr>
  274. </table>
  275. </form>
  276. <?php } ?>
  277. <p>
  278. <script language="JavaScript" type="text/javascript">
  279. <!--
  280. // Write your table-specific startup script here
  281. // document.write("page loaded");
  282. //-->
  283. </script>
  284. <?php include "osj-footer.php" ?>
  285. <?php
  286. // If control is passed here, simply terminate the page without redirect
  287. Page_Terminate();
  288. // -----------------------------------------------------------------
  289. // Subroutine Page_Terminate
  290. // - called when exit page
  291. // - clean up connection and objects
  292. // - if url specified, redirect to url, otherwise end response
  293. function Page_Terminate($url = "") {
  294. global $conn;
  295. // Page unload event, used in current page
  296. Page_Unload();
  297. // Global page unloaded event (in userfn*.php)
  298. Page_Unloaded();
  299. // Close Connection
  300. $conn->Close();
  301. // Go to url if specified
  302. if ($url <> "") {
  303. ob_end_clean();
  304. header("Location: $url");
  305. }
  306. exit();
  307. }
  308. ?>
  309. <?php
  310. // Load recordset
  311. function LoadRecordset($offset = -1, $rowcnt = -1) {
  312. global $conn, $osj2Duser_level;
  313. // Call Recordset Selecting event
  314. $osj2Duser_level->Recordset_Selecting($osj2Duser_level->CurrentFilter);
  315. // Load list page sql
  316. $sSql = $osj2Duser_level->SelectSQL();
  317. if ($offset > -1 && $rowcnt > -1) $sSql .= " LIMIT $offset, $rowcnt";
  318. // Load recordset
  319. $conn->raiseErrorFn = 'ew_ErrorFn';
  320. $rs = $conn->Execute($sSql);
  321. $conn->raiseErrorFn = '';
  322. // Call Recordset Selected event
  323. $osj2Duser_level->Recordset_Selected($rs);
  324. return $rs;
  325. }
  326. ?>
  327. <?php
  328. // Load row based on key values
  329. function LoadRow() {
  330. global $conn, $Security, $osj2Duser_level;
  331. $sFilter = $osj2Duser_level->SqlKeyFilter();
  332. if (!is_numeric($osj2Duser_level->user_level_id->CurrentValue)) {
  333. return FALSE; // Invalid key, exit
  334. }
  335. $sFilter = str_replace("@user_level_id@", ew_AdjustSql($osj2Duser_level->user_level_id->CurrentValue), $sFilter); // Replace key value
  336. // Call Row Selecting event
  337. $osj2Duser_level->Row_Selecting($sFilter);
  338. // Load sql based on filter
  339. $osj2Duser_level->CurrentFilter = $sFilter;
  340. $sSql = $osj2Duser_level->SQL();
  341. if ($rs = $conn->Execute($sSql)) {
  342. if ($rs->EOF) {
  343. $LoadRow = FALSE;
  344. } else {
  345. $LoadRow = TRUE;
  346. $rs->MoveFirst();
  347. LoadRowValues($rs); // Load row values
  348. // Call Row Selected event
  349. $osj2Duser_level->Row_Selected($rs);
  350. }
  351. $rs->Close();
  352. } else {
  353. $LoadRow = FALSE;
  354. }
  355. return $LoadRow;
  356. }
  357. // Load row values from recordset
  358. function LoadRowValues(&$rs) {
  359. global $osj2Duser_level;
  360. $osj2Duser_level->user_level_id->setDbValue($rs->fields('user_level_id'));
  361. if (is_null($osj2Duser_level->user_level_id->CurrentValue)) {
  362. $osj2Duser_level->user_level_id->CurrentValue = 0;
  363. } else {
  364. $osj2Duser_level->user_level_id->CurrentValue = intval($osj2Duser_level->user_level_id->CurrentValue);
  365. }
  366. $osj2Duser_level->user_level_name->setDbValue($rs->fields('user_level_name'));
  367. }
  368. ?>
  369. <?php
  370. // Render row values based on field settings
  371. function RenderRow() {
  372. global $conn, $Security, $osj2Duser_level;
  373. // Call Row Rendering event
  374. $osj2Duser_level->Row_Rendering();
  375. // Common render codes for all row types
  376. // user_level_id
  377. $osj2Duser_level->user_level_id->CellCssStyle = "";
  378. $osj2Duser_level->user_level_id->CellCssClass = "";
  379. // user_level_name
  380. $osj2Duser_level->user_level_name->CellCssStyle = "";
  381. $osj2Duser_level->user_level_name->CellCssClass = "";
  382. if ($osj2Duser_level->RowType == EW_ROWTYPE_VIEW) { // View row
  383. // user_level_id
  384. $osj2Duser_level->user_level_id->ViewValue = $osj2Duser_level->user_level_id->CurrentValue;
  385. $osj2Duser_level->user_level_id->CssStyle = "";
  386. $osj2Duser_level->user_level_id->CssClass = "";
  387. $osj2Duser_level->user_level_id->ViewCustomAttributes = "";
  388. // user_level_name
  389. $osj2Duser_level->user_level_name->ViewValue = $osj2Duser_level->user_level_name->CurrentValue;
  390. $osj2Duser_level->user_level_name->CssStyle = "";
  391. $osj2Duser_level->user_level_name->CssClass = "";
  392. $osj2Duser_level->user_level_name->ViewCustomAttributes = "";
  393. // user_level_id
  394. $osj2Duser_level->user_level_id->HrefValue = "";
  395. // user_level_name
  396. $osj2Duser_level->user_level_name->HrefValue = "";
  397. } elseif ($osj2Duser_level->RowType == EW_ROWTYPE_ADD) { // Add row
  398. } elseif ($osj2Duser_level->RowType == EW_ROWTYPE_EDIT) { // Edit row
  399. } elseif ($osj2Duser_level->RowType == EW_ROWTYPE_SEARCH) { // Search row
  400. }
  401. // Call Row Rendered event
  402. $osj2Duser_level->Row_Rendered();
  403. }
  404. ?>
  405. <?php
  406. // Export data in Xml or Csv format
  407. function ExportData() {
  408. global $nTotalRecs, $nStartRec, $nStopRec, $nTotalRecs, $nDisplayRecs, $osj2Duser_level;
  409. $sCsvStr = "";
  410. $rs = LoadRecordset();
  411. $nTotalRecs = $rs->RecordCount();
  412. $nStartRec = 1;
  413. SetUpStartRec(); // Set Up Start Record Position
  414. // Set the last record to display
  415. if ($nDisplayRecs < 0) {
  416. $nStopRec = $nTotalRecs;
  417. } else {
  418. $nStopRec = $nStartRec + $nDisplayRecs - 1;
  419. }
  420. if ($osj2Duser_level->Export == "xml") {
  421. $XmlDoc = new cXMLDocument();
  422. }
  423. if ($osj2Duser_level->Export == "csv") {
  424. $sCsvStr .= "user_level_id" . ",";
  425. $sCsvStr .= "user_level_name" . ",";
  426. $sCsvStr = substr($sCsvStr, 0, strlen($sCsvStr)-1); // Remove last comma
  427. $sCsvStr .= "\n";
  428. }
  429. // Move to first record directly for performance reason
  430. $nRecCount = $nStartRec - 1;
  431. if (!$rs->EOF) {
  432. $rs->MoveFirst();
  433. $rs->Move($nStartRec - 1);
  434. }
  435. while (!$rs->EOF && $nRecCount < $nStopRec) {
  436. $nRecCount++;
  437. if (intval($nRecCount) >= intval($nStartRec)) {
  438. LoadRowValues($rs);
  439. if ($osj2Duser_level->Export == "xml") {
  440. $XmlDoc->BeginRow();
  441. $XmlDoc->AddField('user_level_id', $osj2Duser_level->user_level_id->CurrentValue);
  442. $XmlDoc->AddField('user_level_name', $osj2Duser_level->user_level_name->CurrentValue);
  443. $XmlDoc->EndRow();
  444. }
  445. if ($osj2Duser_level->Export == "csv") {
  446. $sCsvStr .= '"' . str_replace('"', '""', strval($osj2Duser_level->user_level_id->CurrentValue)) . '",';
  447. $sCsvStr .= '"' . str_replace('"', '""', strval($osj2Duser_level->user_level_name->CurrentValue)) . '",';
  448. $sCsvStr = substr($sCsvStr, 0, strlen($sCsvStr)-1); // Remove last comma
  449. $sCsvStr .= "\n";
  450. }
  451. }
  452. $rs->MoveNext();
  453. }
  454. // Close recordset
  455. $rs->Close();
  456. if ($osj2Duser_level->Export == "xml") {
  457. header("Content-Type: text/xml");
  458. echo $XmlDoc->XML();
  459. }
  460. if ($osj2Duser_level->Export == "csv") {
  461. echo $sCsvStr;
  462. }
  463. }
  464. ?>
  465. <?php
  466. // Set up Starting Record parameters based on Pager Navigation
  467. function SetUpStartRec() {
  468. global $nDisplayRecs, $nStartRec, $nTotalRecs, $nPageNo, $osj2Duser_level;
  469. if ($nDisplayRecs == 0) return;
  470. // Check for a START parameter
  471. if (@$_GET[EW_TABLE_START_REC] <> "") {
  472. $nStartRec = $_GET[EW_TABLE_START_REC];
  473. $osj2Duser_level->setStartRecordNumber($nStartRec);
  474. } elseif (@$_GET[EW_TABLE_PAGE_NO] <> "") {
  475. $nPageNo = $_GET[EW_TABLE_PAGE_NO];
  476. if (is_numeric($nPageNo)) {
  477. $nStartRec = ($nPageNo-1)*$nDisplayRecs+1;
  478. if ($nStartRec <= 0) {
  479. $nStartRec = 1;
  480. } elseif ($nStartRec >= intval(($nTotalRecs-1)/$nDisplayRecs)*$nDisplayRecs+1) {
  481. $nStartRec = intval(($nTotalRecs-1)/$nDisplayRecs)*$nDisplayRecs+1;
  482. }
  483. $osj2Duser_level->setStartRecordNumber($nStartRec);
  484. } else {
  485. $nStartRec = $osj2Duser_level->getStartRecordNumber();
  486. }
  487. } else {
  488. $nStartRec = $osj2Duser_level->getStartRecordNumber();
  489. }
  490. // Check if correct start record counter
  491. if (!is_numeric($nStartRec) || $nStartRec == "") { // Avoid invalid start record counter
  492. $nStartRec = 1; // Reset start record counter
  493. $osj2Duser_level->setStartRecordNumber($nStartRec);
  494. } elseif (intval($nStartRec) > intval($nTotalRecs)) { // Avoid starting record > total records
  495. $nStartRec = intval(($nTotalRecs-1)/$nDisplayRecs)*$nDisplayRecs+1; // Point to last page first record
  496. $osj2Duser_level->setStartRecordNumber($nStartRec);
  497. } elseif (($nStartRec-1) % $nDisplayRecs <> 0) {
  498. $nStartRec = intval(($nStartRec-1)/$nDisplayRecs)*$nDisplayRecs+1; // Point to page boundary
  499. $osj2Duser_level->setStartRecordNumber($nStartRec);
  500. }
  501. }
  502. ?>
  503. <?php
  504. // Page Load event
  505. function Page_Load() {
  506. //echo "Page Load";
  507. }
  508. // Page Unload event
  509. function Page_Unload() {
  510. //echo "Page Unload";
  511. }
  512. ?>