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

/osj-osj2dresumeslist.php

http://osjobber.googlecode.com/
PHP | 1201 lines | 953 code | 120 blank | 128 comment | 303 complexity | f2c5228e6c83e4591f31e72a65b6b175 MD5 | raw file
Possible License(s): LGPL-2.1, AGPL-1.0
  1. <?php
  2. define("EW_PAGE_ID", "list", TRUE); // Page ID
  3. define("EW_TABLE_NAME", 'osj-resumes', 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-osj2dresumesinfo.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-resumes');
  32. if (!$Security->IsLoggedIn()) {
  33. $Security->SaveLastUrl();
  34. Page_Terminate("osj-login.php");
  35. }
  36. if (!$Security->CanList()) {
  37. $Security->SaveLastUrl();
  38. Page_Terminate("osj-login.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. $osj2Dresumes->Export = @$_GET["export"]; // Get export parameter
  55. $sExport = $osj2Dresumes->Export; // Get export parameter, used in header
  56. $sExportFile = $osj2Dresumes->TableVar; // Get export file, used in header
  57. ?>
  58. <?php
  59. if ($osj2Dresumes->Export == "html") {
  60. // Printer friendly, no action required
  61. }
  62. if ($osj2Dresumes->Export == "xml") {
  63. header('Content-Type: text/xml');
  64. header('Content-Disposition: attachment; filename=' . $sExportFile .'.xml');
  65. }
  66. if ($osj2Dresumes->Export == "csv") {
  67. header('Content-Type: application/csv');
  68. header('Content-Disposition: attachment; filename=' . $sExportFile .'.csv');
  69. }
  70. ?>
  71. <?php
  72. // Paging variables
  73. $nStartRec = 0; // Start record index
  74. $nStopRec = 0; // Stop record index
  75. $nTotalRecs = 0; // Total number of records
  76. $nDisplayRecs = 10;
  77. $nRecRange = 10;
  78. $nRecCount = 0; // Record count
  79. // Search filters
  80. $sSrchAdvanced = ""; // Advanced search filter
  81. $sSrchBasic = ""; // Basic search filter
  82. $sSrchWhere = ""; // Search where clause
  83. $sFilter = "";
  84. // Master/Detail
  85. $sDbMasterFilter = ""; // Master filter
  86. $sDbDetailFilter = ""; // Detail filter
  87. $sSqlMaster = ""; // Sql for master record
  88. // Set up records per page dynamically
  89. SetUpDisplayRecs();
  90. // Handle reset command
  91. ResetCmd();
  92. // Get search criteria for advanced search
  93. $sSrchAdvanced = AdvancedSearchWhere();
  94. // Get basic search criteria
  95. $sSrchBasic = BasicSearchWhere();
  96. // Build search criteria
  97. if ($sSrchAdvanced <> "") {
  98. if ($sSrchWhere <> "") $sSrchWhere .= " AND ";
  99. $sSrchWhere .= "(" . $sSrchAdvanced . ")";
  100. }
  101. if ($sSrchBasic <> "") {
  102. if ($sSrchWhere <> "") $sSrchWhere .= " AND ";
  103. $sSrchWhere .= "(" . $sSrchBasic . ")";
  104. }
  105. // Save search criteria
  106. if ($sSrchWhere <> "") {
  107. if ($sSrchBasic == "") ResetBasicSearchParms();
  108. if ($sSrchAdvanced == "") ResetAdvancedSearchParms();
  109. $osj2Dresumes->setSearchWhere($sSrchWhere); // Save to Session
  110. $nStartRec = 1; // Reset start record counter
  111. $osj2Dresumes->setStartRecordNumber($nStartRec);
  112. } else {
  113. RestoreSearchParms();
  114. }
  115. // Build filter
  116. $sFilter = "";
  117. if (!$Security->CanList()) {
  118. $sFilter = "(0=1)"; // Filter all records
  119. }
  120. if ($Security->CurrentUserID() <> "" && !$Security->IsAdmin()) { // Non system admin
  121. $sFilter = $osj2Dresumes->AddUserIDFilter($sFilter, $Security->CurrentUserID()); // Add User ID filter
  122. }
  123. if ($sDbDetailFilter <> "") {
  124. if ($sFilter <> "") $sFilter .= " AND ";
  125. $sFilter .= "(" . $sDbDetailFilter . ")";
  126. }
  127. if ($sSrchWhere <> "") {
  128. if ($sFilter <> "") $sFilter .= " AND ";
  129. $sFilter .= "(" . $sSrchWhere . ")";
  130. }
  131. // Set up filter in Session
  132. $osj2Dresumes->setSessionWhere($sFilter);
  133. $osj2Dresumes->CurrentFilter = "";
  134. // Set Up Sorting Order
  135. SetUpSortOrder();
  136. // Export data only
  137. if ($osj2Dresumes->Export == "xml" || $osj2Dresumes->Export == "csv") {
  138. ExportData();
  139. Page_Terminate(); // Terminate response
  140. }
  141. // Set Return Url
  142. $osj2Dresumes->setReturnUrl("osj-osj2dresumeslist.php");
  143. ?>
  144. <?php include "osj-header.php" ?>
  145. <?php if ($osj2Dresumes->Export == "") { ?>
  146. <script type="text/javascript">
  147. <!--
  148. var EW_PAGE_ID = "list"; // Page id
  149. var EW_SHOW_HIGHLIGHT = "Show highlight";
  150. var EW_HIDE_HIGHLIGHT = "Hide highlight";
  151. //-->
  152. </script>
  153. <script type="text/javascript">
  154. <!--
  155. var firstrowoffset = 1; // First data row start at
  156. var lastrowoffset = 0; // Last data row end at
  157. var EW_LIST_TABLE_NAME = 'ewlistmain'; // Table name for list page
  158. var rowclass = 'ewTableRow'; // Row class
  159. var rowaltclass = 'ewTableAltRow'; // Row alternate class
  160. var rowmoverclass = 'ewTableHighlightRow'; // Row mouse over class
  161. var rowselectedclass = 'ewTableSelectRow'; // Row selected class
  162. var roweditclass = 'ewTableEditRow'; // Row edit class
  163. //-->
  164. </script>
  165. <script type="text/javascript">
  166. <!--
  167. var ew_DHTMLEditors = [];
  168. //-->
  169. </script>
  170. <script type="text/javascript">
  171. <!--
  172. // js for Popup Calendar
  173. //-->
  174. </script>
  175. <script type="text/javascript">
  176. <!--
  177. function ew_SelectKey(elem) {
  178. var f = elem.form;
  179. if (!f.elements["key_m[]"]) return;
  180. if (f.elements["key_m[]"][0]) {
  181. for (var i=0; i<f.elements["key_m[]"].length; i++)
  182. f.elements["key_m[]"][i].checked = elem.checked;
  183. } else {
  184. f.elements["key_m[]"].checked = elem.checked;
  185. }
  186. ew_ClickAll(elem);
  187. }
  188. function ew_Selected(f) {
  189. if (!f.elements["key_m[]"]) return false;
  190. if (f.elements["key_m[]"][0]) {
  191. for (var i=0; i<f.elements["key_m[]"].length; i++)
  192. if (f.elements["key_m[]"][i].checked) return true;
  193. } else {
  194. return f.elements["key_m[]"].checked;
  195. }
  196. return false;
  197. }
  198. //-->
  199. </script>
  200. <script language="JavaScript" type="text/javascript">
  201. <!--
  202. // Write your client script here, no need to add script tags.
  203. // To include another .js script, use:
  204. // ew_ClientScriptInclude("my_javascript.js");
  205. //-->
  206. </script>
  207. <?php } ?>
  208. <?php if ($osj2Dresumes->Export == "") { ?>
  209. <?php } ?>
  210. <?php
  211. // Load recordset
  212. $bExportAll = (defined("EW_EXPORT_ALL") && $osj2Dresumes->Export <> "");
  213. $bSelectLimit = ($osj2Dresumes->Export == "" && $osj2Dresumes->SelectLimit);
  214. if (!$bSelectLimit) $rs = LoadRecordset();
  215. $nTotalRecs = ($bSelectLimit) ? $osj2Dresumes->SelectRecordCount() : $rs->RecordCount();
  216. $nStartRec = 1;
  217. if ($nDisplayRecs <= 0) $nDisplayRecs = $nTotalRecs; // Display all records
  218. if (!$bExportAll) SetUpStartRec(); // Set up start record position
  219. if ($bSelectLimit) $rs = LoadRecordset($nStartRec-1, $nDisplayRecs);
  220. ?>
  221. <p><span class="phpmaker" style="white-space: nowrap;">TABLE: Resumes
  222. <?php if ($osj2Dresumes->Export == "") { ?>
  223. &nbsp;&nbsp;<a href="osj-osj2dresumeslist.php?export=html">Printer Friendly</a>
  224. &nbsp;&nbsp;<a href="osj-osj2dresumeslist.php?export=xml">Export to XML</a>
  225. &nbsp;&nbsp;<a href="osj-osj2dresumeslist.php?export=csv">Export to CSV</a>
  226. <?php } ?>
  227. </span></p>
  228. <?php if ($osj2Dresumes->Export == "") { ?>
  229. <?php if ($Security->CanSearch()) { ?>
  230. <form name="fosj2Dresumeslistsrch" id="fosj2Dresumeslistsrch" action="osj-osj2dresumeslist.php" >
  231. <table class="ewBasicSearch">
  232. <tr>
  233. <td><span class="phpmaker">
  234. <input type="text" name="<?php echo EW_TABLE_BASIC_SEARCH ?>" id="<?php echo EW_TABLE_BASIC_SEARCH ?>" size="20" value="<?php echo ew_HtmlEncode($osj2Dresumes->getBasicSearchKeyword()) ?>">
  235. <input type="Submit" name="Submit" id="Submit" value="Search (*)">&nbsp;
  236. <a href="osj-osj2dresumeslist.php?cmd=reset">Show all</a>&nbsp;
  237. <a href="osj-osj2dresumessrch.php">Advanced Search</a>&nbsp;
  238. <?php if ($sSrchWhere <> "" && $nTotalRecs > 0) { ?>
  239. <a href="javascript:void(0);" onclick="ew_ToggleHighlight(this);">Hide highlight</a>
  240. <?php } ?>
  241. </span></td>
  242. </tr>
  243. <tr>
  244. <td><span class="phpmaker"><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value="" <?php if ($osj2Dresumes->getBasicSearchType() == "") { ?>checked<?php } ?>>Exact phrase&nbsp;&nbsp;<input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value="AND" <?php if ($osj2Dresumes->getBasicSearchType() == "AND") { ?>checked<?php } ?>>All words&nbsp;&nbsp;<input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value="OR" <?php if ($osj2Dresumes->getBasicSearchType() == "OR") { ?>checked<?php } ?>>Any word</span></td>
  245. </tr>
  246. </table>
  247. </form>
  248. <?php } ?>
  249. <?php } ?>
  250. <?php
  251. if (@$_SESSION[EW_SESSION_MESSAGE] <> "") {
  252. ?>
  253. <p><span class="ewmsg"><?php echo $_SESSION[EW_SESSION_MESSAGE] ?></span></p>
  254. <?php
  255. $_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message
  256. }
  257. ?>
  258. <?php if ($osj2Dresumes->Export == "") { ?>
  259. <form action="osj-osj2dresumeslist.php" name="ewpagerform" id="ewpagerform">
  260. <table border="0" cellspacing="0" cellpadding="0">
  261. <tr>
  262. <td nowrap>
  263. <span class="phpmaker">
  264. <?php if (!isset($Pager)) $Pager = new cNumericPager($nStartRec, $nDisplayRecs, $nTotalRecs, $nRecRange) ?>
  265. <?php if ($Pager->RecordCount > 0) { ?>
  266. <?php if ($Pager->FirstButton->Enabled) { ?>
  267. <a href="osj-osj2dresumeslist.php?start=<?php echo $Pager->FirstButton->Start ?>"><b>First</b></a>&nbsp;
  268. <?php } ?>
  269. <?php if ($Pager->PrevButton->Enabled) { ?>
  270. <a href="osj-osj2dresumeslist.php?start=<?php echo $Pager->PrevButton->Start ?>"><b>Previous</b></a>&nbsp;
  271. <?php } ?>
  272. <?php foreach ($Pager->Items as $PagerItem) { ?>
  273. <?php if ($PagerItem->Enabled) { ?><a href="osj-osj2dresumeslist.php?start=<?php echo $PagerItem->Start ?>"><?php } ?><b><?php echo $PagerItem->Text ?></b><?php if ($PagerItem->Enabled) { ?></a><?php } ?>&nbsp;
  274. <?php } ?>
  275. <?php if ($Pager->NextButton->Enabled) { ?>
  276. <a href="osj-osj2dresumeslist.php?start=<?php echo $Pager->NextButton->Start ?>"><b>Next</b></a>&nbsp;
  277. <?php } ?>
  278. <?php if ($Pager->LastButton->Enabled) { ?>
  279. <a href="osj-osj2dresumeslist.php?start=<?php echo $Pager->LastButton->Start ?>"><b>Last</b></a>&nbsp;
  280. <?php } ?>
  281. <?php if ($Pager->ButtonCount > 0) { ?><br><?php } ?>
  282. Records <?php echo $Pager->FromIndex ?> to <?php echo $Pager->ToIndex ?> of <?php echo $Pager->RecordCount ?>
  283. <?php } else { ?>
  284. <?php if ($Security->CanList()) { ?>
  285. <?php if ($sSrchWhere == "0=101") { ?>
  286. Please enter search criteria
  287. <?php } else { ?>
  288. No records found
  289. <?php } ?>
  290. <?php } else { ?>
  291. You do not have the right permission to view the page
  292. <?php } ?>
  293. <?php } ?>
  294. </span>
  295. </td>
  296. <?php if ($nTotalRecs > 0) { ?>
  297. <td nowrap>&nbsp;&nbsp;&nbsp;&nbsp;</td>
  298. <td align="right" valign="top" nowrap><span class="phpmaker">Records Per Page&nbsp;
  299. <select name="<?php echo EW_TABLE_REC_PER_PAGE ?>" id="<?php echo EW_TABLE_REC_PER_PAGE ?>" onChange="this.form.submit();" class="phpmaker">
  300. <option value="10"<?php if ($nDisplayRecs == 10) echo " selected" ?>>10</option>
  301. <option value="20"<?php if ($nDisplayRecs == 20) echo " selected" ?>>20</option>
  302. <option value="50"<?php if ($nDisplayRecs == 50) echo " selected" ?>>50</option>
  303. </select>
  304. </span></td>
  305. <?php } ?>
  306. </tr>
  307. </table>
  308. </form>
  309. <?php } ?>
  310. <form method="post" name="fosj2Dresumeslist" id="fosj2Dresumeslist">
  311. <?php if ($osj2Dresumes->Export == "") { ?>
  312. <table>
  313. <tr><td><span class="phpmaker">
  314. <?php if ($Security->CanAdd()) { ?>
  315. <a href="osj-osj2dresumesadd.php">Add</a>&nbsp;&nbsp;
  316. <?php } ?>
  317. <?php if ($nTotalRecs > 0) { ?>
  318. <?php if ($Security->CanDelete()) { ?>
  319. <a href="" onClick="if (!ew_Selected(document.fosj2Dresumeslist)) alert('No records selected'); else {document.fosj2Dresumeslist.action='osj-osj2dresumesdelete.php';document.fosj2Dresumeslist.encoding='application/x-www-form-urlencoded';document.fosj2Dresumeslist.submit();};return false;">Delete Selected Records</a>&nbsp;&nbsp;
  320. <?php } ?>
  321. <?php } ?>
  322. </span></td></tr>
  323. </table>
  324. <?php } ?>
  325. <?php if ($nTotalRecs > 0) { ?>
  326. <table id="ewlistmain" class="ewTable">
  327. <?php
  328. $OptionCnt = 0;
  329. if ($Security->CanView()) {
  330. $OptionCnt++; // view
  331. }
  332. if ($Security->CanEdit()) {
  333. $OptionCnt++; // edit
  334. }
  335. if ($Security->CanDelete()) {
  336. $OptionCnt++; // multi select
  337. }
  338. ?>
  339. <!-- Table header -->
  340. <tr class="ewTableHeader">
  341. <?php if ($osj2Dresumes->Export == "") { ?>
  342. <?php if ($Security->CanView()) { ?>
  343. <td nowrap>&nbsp;</td>
  344. <?php } ?>
  345. <?php if ($Security->CanEdit()) { ?>
  346. <td nowrap>&nbsp;</td>
  347. <?php } ?>
  348. <?php if ($Security->CanDelete()) { ?>
  349. <td nowrap><input type="checkbox" class="phpmaker" onClick="ew_SelectKey(this);"></td>
  350. <?php } ?>
  351. <?php } ?>
  352. <td valign="top">
  353. <?php if ($osj2Dresumes->Export <> "") { ?>
  354. Resume Status Level
  355. <?php } else { ?>
  356. <a href="osj-osj2dresumeslist.php?order=<?php echo urlencode('resume_permissions_id') ?>&ordertype=<?php echo $osj2Dresumes->resume_permissions_id->ReverseSort() ?>">Resume Status Level<?php if ($osj2Dresumes->resume_permissions_id->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($osj2Dresumes->resume_permissions_id->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></a>
  357. <?php } ?>
  358. </td>
  359. <td valign="top">
  360. <?php if ($osj2Dresumes->Export <> "") { ?>
  361. Resume Edit Date
  362. <?php } else { ?>
  363. <a href="osj-osj2dresumeslist.php?order=<?php echo urlencode('resume_edit_date') ?>&ordertype=<?php echo $osj2Dresumes->resume_edit_date->ReverseSort() ?>">Resume Edit Date<?php if ($osj2Dresumes->resume_edit_date->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($osj2Dresumes->resume_edit_date->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></a>
  364. <?php } ?>
  365. </td>
  366. <td valign="top">
  367. <?php if ($osj2Dresumes->Export <> "") { ?>
  368. Resume Title
  369. <?php } else { ?>
  370. <a href="osj-osj2dresumeslist.php?order=<?php echo urlencode('resume_title') ?>&ordertype=<?php echo $osj2Dresumes->resume_title->ReverseSort() ?>">Resume Title&nbsp;(*)<?php if ($osj2Dresumes->resume_title->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($osj2Dresumes->resume_title->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></a>
  371. <?php } ?>
  372. </td>
  373. </tr>
  374. <?php
  375. if (defined("EW_EXPORT_ALL") && $osj2Dresumes->Export <> "") {
  376. $nStopRec = $nTotalRecs;
  377. } else {
  378. $nStopRec = $nStartRec + $nDisplayRecs - 1; // Set the last record to display
  379. }
  380. $nRecCount = $nStartRec - 1;
  381. if (!$rs->EOF) {
  382. $rs->MoveFirst();
  383. if (!$osj2Dresumes->SelectLimit) $rs->Move($nStartRec - 1); // Move to first record directly
  384. }
  385. $RowCnt = 0;
  386. while (!$rs->EOF && $nRecCount < $nStopRec) {
  387. $nRecCount++;
  388. if (intval($nRecCount) >= intval($nStartRec)) {
  389. $RowCnt++;
  390. // Init row class and style
  391. $osj2Dresumes->CssClass = "ewTableRow";
  392. $osj2Dresumes->CssStyle = "";
  393. // Init row event
  394. $osj2Dresumes->RowClientEvents = "onmouseover='ew_MouseOver(this);' onmouseout='ew_MouseOut(this);' onclick='ew_Click(this);'";
  395. // Display alternate color for rows
  396. if ($RowCnt % 2 == 0) {
  397. $osj2Dresumes->CssClass = "ewTableAltRow";
  398. }
  399. LoadRowValues($rs); // Load row values
  400. $osj2Dresumes->RowType = EW_ROWTYPE_VIEW; // Render view
  401. RenderRow();
  402. ?>
  403. <!-- Table body -->
  404. <tr<?php echo $osj2Dresumes->DisplayAttributes() ?>>
  405. <?php if ($osj2Dresumes->Export == "") { ?>
  406. <?php if ($Security->CanView()) { ?>
  407. <td nowrap><span class="phpmaker"><?php if (ShowOptionLink()) { ?>
  408. <a href="<?php echo $osj2Dresumes->ViewUrl() ?>">View</a>
  409. <?php } ?></span></td>
  410. <?php } ?>
  411. <?php if ($Security->CanEdit()) { ?>
  412. <td nowrap><span class="phpmaker"><?php if (ShowOptionLink()) { ?>
  413. <a href="<?php echo $osj2Dresumes->EditUrl() ?>">Edit</a>
  414. <?php } ?></span></td>
  415. <?php } ?>
  416. <?php if ($Security->CanDelete()) { ?>
  417. <td nowrap><span class="phpmaker"><?php if (ShowOptionLink()) { ?>
  418. <input type="checkbox" name="key_m[]" id="key_m[]" value="<?php echo ew_HtmlEncode($osj2Dresumes->resume_id->CurrentValue) ?>" class="phpmaker" onclick='ew_ClickMultiCheckbox(this);'>
  419. <?php } ?></span></td>
  420. <?php } ?>
  421. <?php } ?>
  422. <!-- resume_permissions_id -->
  423. <td<?php echo $osj2Dresumes->resume_permissions_id->CellAttributes() ?>>
  424. <div<?php echo $osj2Dresumes->resume_permissions_id->ViewAttributes() ?>><?php echo $osj2Dresumes->resume_permissions_id->ViewValue ?></div>
  425. </td>
  426. <!-- resume_edit_date -->
  427. <td<?php echo $osj2Dresumes->resume_edit_date->CellAttributes() ?>>
  428. <div<?php echo $osj2Dresumes->resume_edit_date->ViewAttributes() ?>><?php echo $osj2Dresumes->resume_edit_date->ViewValue ?></div>
  429. </td>
  430. <!-- resume_title -->
  431. <td<?php echo $osj2Dresumes->resume_title->CellAttributes() ?>>
  432. <div<?php echo $osj2Dresumes->resume_title->ViewAttributes() ?>><?php echo $osj2Dresumes->resume_title->ViewValue ?></div>
  433. </td>
  434. </tr>
  435. <?php
  436. }
  437. $rs->MoveNext();
  438. }
  439. ?>
  440. </table>
  441. <?php if ($osj2Dresumes->Export == "") { ?>
  442. <table>
  443. <tr><td><span class="phpmaker">
  444. <?php if ($Security->CanAdd()) { ?>
  445. <a href="osj-osj2dresumesadd.php">Add</a>&nbsp;&nbsp;
  446. <?php } ?>
  447. <?php if ($nTotalRecs > 0) { ?>
  448. <?php if ($Security->CanDelete()) { ?>
  449. <a href="" onClick="if (!ew_Selected(document.fosj2Dresumeslist)) alert('No records selected'); else {document.fosj2Dresumeslist.action='osj-osj2dresumesdelete.php';document.fosj2Dresumeslist.encoding='application/x-www-form-urlencoded';document.fosj2Dresumeslist.submit();};return false;">Delete Selected Records</a>&nbsp;&nbsp;
  450. <?php } ?>
  451. <?php } ?>
  452. </span></td></tr>
  453. </table>
  454. <?php } ?>
  455. <?php } ?>
  456. </form>
  457. <?php
  458. // Close recordset and connection
  459. if ($rs) $rs->Close();
  460. ?>
  461. <?php if ($osj2Dresumes->Export == "") { ?>
  462. <form action="osj-osj2dresumeslist.php" name="ewpagerform" id="ewpagerform">
  463. <table border="0" cellspacing="0" cellpadding="0">
  464. <tr>
  465. <td nowrap>
  466. <span class="phpmaker">
  467. <?php if (!isset($Pager)) $Pager = new cNumericPager($nStartRec, $nDisplayRecs, $nTotalRecs, $nRecRange) ?>
  468. <?php if ($Pager->RecordCount > 0) { ?>
  469. <?php if ($Pager->FirstButton->Enabled) { ?>
  470. <a href="osj-osj2dresumeslist.php?start=<?php echo $Pager->FirstButton->Start ?>"><b>First</b></a>&nbsp;
  471. <?php } ?>
  472. <?php if ($Pager->PrevButton->Enabled) { ?>
  473. <a href="osj-osj2dresumeslist.php?start=<?php echo $Pager->PrevButton->Start ?>"><b>Previous</b></a>&nbsp;
  474. <?php } ?>
  475. <?php foreach ($Pager->Items as $PagerItem) { ?>
  476. <?php if ($PagerItem->Enabled) { ?><a href="osj-osj2dresumeslist.php?start=<?php echo $PagerItem->Start ?>"><?php } ?><b><?php echo $PagerItem->Text ?></b><?php if ($PagerItem->Enabled) { ?></a><?php } ?>&nbsp;
  477. <?php } ?>
  478. <?php if ($Pager->NextButton->Enabled) { ?>
  479. <a href="osj-osj2dresumeslist.php?start=<?php echo $Pager->NextButton->Start ?>"><b>Next</b></a>&nbsp;
  480. <?php } ?>
  481. <?php if ($Pager->LastButton->Enabled) { ?>
  482. <a href="osj-osj2dresumeslist.php?start=<?php echo $Pager->LastButton->Start ?>"><b>Last</b></a>&nbsp;
  483. <?php } ?>
  484. <?php if ($Pager->ButtonCount > 0) { ?><br><?php } ?>
  485. Records <?php echo $Pager->FromIndex ?> to <?php echo $Pager->ToIndex ?> of <?php echo $Pager->RecordCount ?>
  486. <?php } else { ?>
  487. <?php if ($Security->CanList()) { ?>
  488. <?php if ($sSrchWhere == "0=101") { ?>
  489. Please enter search criteria
  490. <?php } else { ?>
  491. No records found
  492. <?php } ?>
  493. <?php } else { ?>
  494. You do not have the right permission to view the page
  495. <?php } ?>
  496. <?php } ?>
  497. </span>
  498. </td>
  499. <?php if ($nTotalRecs > 0) { ?>
  500. <td nowrap>&nbsp;&nbsp;&nbsp;&nbsp;</td>
  501. <td align="right" valign="top" nowrap><span class="phpmaker">Records Per Page&nbsp;
  502. <select name="<?php echo EW_TABLE_REC_PER_PAGE ?>" id="<?php echo EW_TABLE_REC_PER_PAGE ?>" onChange="this.form.submit();" class="phpmaker">
  503. <option value="10"<?php if ($nDisplayRecs == 10) echo " selected" ?>>10</option>
  504. <option value="20"<?php if ($nDisplayRecs == 20) echo " selected" ?>>20</option>
  505. <option value="50"<?php if ($nDisplayRecs == 50) echo " selected" ?>>50</option>
  506. </select>
  507. </span></td>
  508. <?php } ?>
  509. </tr>
  510. </table>
  511. </form>
  512. <?php } ?>
  513. <?php if ($osj2Dresumes->Export == "") { ?>
  514. <?php } ?>
  515. <?php if ($osj2Dresumes->Export == "") { ?>
  516. <script language="JavaScript" type="text/javascript">
  517. <!--
  518. // Write your table-specific startup script here
  519. // document.write("page loaded");
  520. //-->
  521. </script>
  522. <?php } ?>
  523. <?php include "osj-footer.php" ?>
  524. <?php
  525. // If control is passed here, simply terminate the page without redirect
  526. Page_Terminate();
  527. // -----------------------------------------------------------------
  528. // Subroutine Page_Terminate
  529. // - called when exit page
  530. // - clean up connection and objects
  531. // - if url specified, redirect to url, otherwise end response
  532. function Page_Terminate($url = "") {
  533. global $conn;
  534. // Page unload event, used in current page
  535. Page_Unload();
  536. // Global page unloaded event (in userfn*.php)
  537. Page_Unloaded();
  538. // Close Connection
  539. $conn->Close();
  540. // Go to url if specified
  541. if ($url <> "") {
  542. ob_end_clean();
  543. header("Location: $url");
  544. }
  545. exit();
  546. }
  547. ?>
  548. <?php
  549. // Set up number of records displayed per page
  550. function SetUpDisplayRecs() {
  551. global $nDisplayRecs, $nStartRec, $osj2Dresumes;
  552. $sWrk = @$_GET[EW_TABLE_REC_PER_PAGE];
  553. if ($sWrk <> "") {
  554. if (is_numeric($sWrk)) {
  555. $nDisplayRecs = intval($sWrk);
  556. } else {
  557. if (strtolower($sWrk) == "all") { // Display all records
  558. $nDisplayRecs = -1;
  559. } else {
  560. $nDisplayRecs = 10; // Non-numeric, load default
  561. }
  562. }
  563. $osj2Dresumes->setRecordsPerPage($nDisplayRecs); // Save to Session
  564. // Reset start position
  565. $nStartRec = 1;
  566. $osj2Dresumes->setStartRecordNumber($nStartRec);
  567. } else {
  568. if ($osj2Dresumes->getRecordsPerPage() <> "") {
  569. $nDisplayRecs = $osj2Dresumes->getRecordsPerPage(); // Restore from Session
  570. } else {
  571. $nDisplayRecs = 10; // Load default
  572. }
  573. }
  574. }
  575. // Return Advanced Search Where based on QueryString parameters
  576. function AdvancedSearchWhere() {
  577. global $Security, $osj2Dresumes;
  578. $sWhere = "";
  579. if (!$Security->CanSearch()) return "";
  580. // Field resume_creation_date
  581. BuildSearchSql($sWhere, $osj2Dresumes->resume_creation_date, ew_UnFormatDateTime(@$_GET["x_resume_creation_date"],10), @$_GET["z_resume_creation_date"], @$_GET["v_resume_creation_date"], ew_UnFormatDateTime(@$_GET["y_resume_creation_date"],10), @$_GET["w_resume_creation_date"]);
  582. // Field resume_edit_date
  583. BuildSearchSql($sWhere, $osj2Dresumes->resume_edit_date, ew_UnFormatDateTime(@$_GET["x_resume_edit_date"],10), @$_GET["z_resume_edit_date"], @$_GET["v_resume_edit_date"], ew_UnFormatDateTime(@$_GET["y_resume_edit_date"],10), @$_GET["w_resume_edit_date"]);
  584. // Field resume_text
  585. BuildSearchSql($sWhere, $osj2Dresumes->resume_text, @$_GET["x_resume_text"], @$_GET["z_resume_text"], @$_GET["v_resume_text"], @$_GET["y_resume_text"], @$_GET["w_resume_text"]);
  586. // Field resume_title
  587. BuildSearchSql($sWhere, $osj2Dresumes->resume_title, @$_GET["x_resume_title"], @$_GET["z_resume_title"], @$_GET["v_resume_title"], @$_GET["y_resume_title"], @$_GET["w_resume_title"]);
  588. //AdvancedSearchWhere = sWhere
  589. // Set up search parm
  590. if ($sWhere <> "") {
  591. // Field resume_creation_date
  592. SetSearchParm($osj2Dresumes->resume_creation_date, ew_UnFormatDateTime(@$_GET["x_resume_creation_date"],10), @$_GET["z_resume_creation_date"], @$_GET["v_resume_creation_date"], ew_UnFormatDateTime(@$_GET["y_resume_creation_date"],10), @$_GET["w_resume_creation_date"]);
  593. // Field resume_edit_date
  594. SetSearchParm($osj2Dresumes->resume_edit_date, ew_UnFormatDateTime(@$_GET["x_resume_edit_date"],10), @$_GET["z_resume_edit_date"], @$_GET["v_resume_edit_date"], ew_UnFormatDateTime(@$_GET["y_resume_edit_date"],10), @$_GET["w_resume_edit_date"]);
  595. // Field resume_text
  596. SetSearchParm($osj2Dresumes->resume_text, @$_GET["x_resume_text"], @$_GET["z_resume_text"], @$_GET["v_resume_text"], @$_GET["y_resume_text"], @$_GET["w_resume_text"]);
  597. // Field resume_title
  598. SetSearchParm($osj2Dresumes->resume_title, @$_GET["x_resume_title"], @$_GET["z_resume_title"], @$_GET["v_resume_title"], @$_GET["y_resume_title"], @$_GET["w_resume_title"]);
  599. }
  600. return $sWhere;
  601. }
  602. // Build search sql
  603. function BuildSearchSql(&$Where, &$Fld, $FldVal, $FldOpr, $FldCond, $FldVal2, $FldOpr2) {
  604. $sWrk = "";
  605. $FldParm = substr($Fld->FldVar, 2);
  606. $FldVal = ew_StripSlashes($FldVal);
  607. if (is_array($FldVal)) $FldVal = implode(",", $FldVal);
  608. $FldVal2 = ew_StripSlashes($FldVal2);
  609. if (is_array($FldVal2)) $FldVal2 = implode(",", $FldVal2);
  610. $FldOpr = strtoupper(trim($FldOpr));
  611. if ($FldOpr == "") $FldOpr = "=";
  612. $FldOpr2 = strtoupper(trim($FldOpr2));
  613. if ($FldOpr2 == "") $FldOpr2 = "=";
  614. if ($Fld->FldDataType == EW_DATATYPE_BOOLEAN) {
  615. if ($FldVal <> "") $FldVal = ($FldVal == "1") ? $Fld->TrueValue : $Fld->FalseValue;
  616. if ($FldVal2 <> "") $FldVal2 = ($FldVal2 == "1") ? $Fld->TrueValue : $Fld->FalseValue;
  617. } elseif ($Fld->FldDataType == EW_DATATYPE_DATE) {
  618. if ($FldVal <> "") $FldVal = ew_UnFormatDateTime($FldVal, $Fld->FldDateTimeFormat);
  619. if ($FldVal2 <> "") $FldVal2 = ew_UnFormatDateTime($FldVal2, $Fld->FldDateTimeFormat);
  620. }
  621. if ($FldOpr == "BETWEEN") {
  622. $IsValidValue = (($Fld->FldDataType <> EW_DATATYPE_NUMBER) ||
  623. ($Fld->FldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal) && is_numeric($FldVal2)));
  624. if ($FldVal <> "" && $FldVal2 <> "" && $IsValidValue) {
  625. $sWrk = $Fld->FldExpression . " BETWEEN " . ew_QuotedValue($FldVal, $Fld->FldDataType) .
  626. " AND " . ew_QuotedValue($FldVal2, $Fld->FldDataType);
  627. }
  628. } elseif ($FldOpr == "IS NULL" || $FldOpr == "IS NOT NULL") {
  629. $sWrk = $Fld->FldExpression . " " . $FldOpr;
  630. } else {
  631. $IsValidValue = (($Fld->FldDataType <> EW_DATATYPE_NUMBER) ||
  632. ($Fld->FldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal)));
  633. if ($FldVal <> "" && $IsValidValue && ew_IsValidOpr($FldOpr, $Fld->FldDataType)) {
  634. $sWrk = $Fld->FldExpression . SearchString($FldOpr, $FldVal, $Fld->FldDataType);
  635. }
  636. $IsValidValue = (($Fld->FldDataType <> EW_DATATYPE_NUMBER) ||
  637. ($Fld->FldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal2)));
  638. if ($FldVal2 <> "" && $IsValidValue && ew_IsValidOpr($FldOpr2, $Fld->FldDataType)) {
  639. if ($sWrk <> "") {
  640. $sWrk .= " " . (($FldCond=="OR")?"OR":"AND") . " ";
  641. }
  642. $sWrk .= $Fld->FldExpression . SearchString($FldOpr2, $FldVal2, $Fld->FldDataType);
  643. }
  644. }
  645. if ($sWrk <> "") {
  646. if ($Where <> "") $Where .= " AND ";
  647. $Where .= "(" . $sWrk . ")";
  648. }
  649. }
  650. // Return search string
  651. function SearchString($FldOpr, $FldVal, $FldType) {
  652. if ($FldOpr == "LIKE" || $FldOpr == "NOT LIKE") {
  653. return " " . $FldOpr . " " . ew_QuotedValue("%" . $FldVal . "%", $FldType);
  654. } elseif ($FldOpr == "STARTS WITH") {
  655. return " LIKE " . ew_QuotedValue($FldVal . "%", $FldType);
  656. } else {
  657. return " " . $FldOpr . " " . ew_QuotedValue($FldVal, $FldType);
  658. }
  659. }
  660. // Set search parm
  661. function SetSearchParm($Fld, $FldVal, $FldOpr, $FldCond, $FldVal2, $FldOpr2) {
  662. global $osj2Dresumes;
  663. $FldParm = substr($Fld->FldVar, 2);
  664. $FldVal = ew_StripSlashes($FldVal);
  665. if (is_array($FldVal)) $FldVal = implode(",", $FldVal);
  666. $FldVal2 = ew_StripSlashes($FldVal2);
  667. if (is_array($FldVal2)) $FldVal2 = implode(",", $FldVal2);
  668. $osj2Dresumes->setAdvancedSearch("x_" . $FldParm, $FldVal);
  669. $osj2Dresumes->setAdvancedSearch("z_" . $FldParm, $FldOpr);
  670. $osj2Dresumes->setAdvancedSearch("v_" . $FldParm, $FldCond);
  671. $osj2Dresumes->setAdvancedSearch("y_" . $FldParm, $FldVal2);
  672. $osj2Dresumes->setAdvancedSearch("w_" . $FldParm, $FldOpr2);
  673. }
  674. // Return Basic Search sql
  675. function BasicSearchSQL($Keyword) {
  676. $sKeyword = ew_AdjustSql($Keyword);
  677. $sql = "";
  678. $sql .= "`resume_text` LIKE '%" . $sKeyword . "%' OR ";
  679. $sql .= "`resume_title` LIKE '%" . $sKeyword . "%' OR ";
  680. if (substr($sql, -4) == " OR ") $sql = substr($sql, 0, strlen($sql)-4);
  681. return $sql;
  682. }
  683. // Return Basic Search Where based on search keyword and type
  684. function BasicSearchWhere() {
  685. global $Security, $osj2Dresumes;
  686. $sSearchStr = "";
  687. if (!$Security->CanSearch()) return "";
  688. $sSearchKeyword = ew_StripSlashes(@$_GET[EW_TABLE_BASIC_SEARCH]);
  689. $sSearchType = @$_GET[EW_TABLE_BASIC_SEARCH_TYPE];
  690. if ($sSearchKeyword <> "") {
  691. $sSearch = trim($sSearchKeyword);
  692. if ($sSearchType <> "") {
  693. while (strpos($sSearch, " ") !== FALSE)
  694. $sSearch = str_replace(" ", " ", $sSearch);
  695. $arKeyword = explode(" ", trim($sSearch));
  696. foreach ($arKeyword as $sKeyword) {
  697. if ($sSearchStr <> "") $sSearchStr .= " " . $sSearchType . " ";
  698. $sSearchStr .= "(" . BasicSearchSQL($sKeyword) . ")";
  699. }
  700. } else {
  701. $sSearchStr = BasicSearchSQL($sSearch);
  702. }
  703. }
  704. if ($sSearchKeyword <> "") {
  705. $osj2Dresumes->setBasicSearchKeyword($sSearchKeyword);
  706. $osj2Dresumes->setBasicSearchType($sSearchType);
  707. }
  708. return $sSearchStr;
  709. }
  710. // Clear all search parameters
  711. function ResetSearchParms() {
  712. // Clear search where
  713. global $osj2Dresumes;
  714. $sSrchWhere = "";
  715. $osj2Dresumes->setSearchWhere($sSrchWhere);
  716. // Clear basic search parameters
  717. ResetBasicSearchParms();
  718. // Clear advanced search parameters
  719. ResetAdvancedSearchParms();
  720. }
  721. // Clear all basic search parameters
  722. function ResetBasicSearchParms() {
  723. // Clear basic search parameters
  724. global $osj2Dresumes;
  725. $osj2Dresumes->setBasicSearchKeyword("");
  726. $osj2Dresumes->setBasicSearchType("");
  727. }
  728. // Clear all advanced search parameters
  729. function ResetAdvancedSearchParms() {
  730. // Clear advanced search parameters
  731. global $osj2Dresumes;
  732. $osj2Dresumes->setAdvancedSearch("x_resume_creation_date", "");
  733. $osj2Dresumes->setAdvancedSearch("z_resume_creation_date", "");
  734. $osj2Dresumes->setAdvancedSearch("x_resume_edit_date", "");
  735. $osj2Dresumes->setAdvancedSearch("z_resume_edit_date", "");
  736. $osj2Dresumes->setAdvancedSearch("x_resume_text", "");
  737. $osj2Dresumes->setAdvancedSearch("x_resume_title", "");
  738. }
  739. // Restore all search parameters
  740. function RestoreSearchParms() {
  741. global $sSrchWhere, $osj2Dresumes;
  742. $sSrchWhere = $osj2Dresumes->getSearchWhere();
  743. // Restore advanced search settings
  744. RestoreAdvancedSearchParms();
  745. }
  746. // Restore all advanced search parameters
  747. function RestoreAdvancedSearchParms() {
  748. // Restore advanced search parms
  749. global $osj2Dresumes;
  750. $osj2Dresumes->resume_creation_date->AdvancedSearch->SearchValue = $osj2Dresumes->getAdvancedSearch("x_resume_creation_date");
  751. $osj2Dresumes->resume_creation_date->AdvancedSearch->SearchOperator = $osj2Dresumes->getAdvancedSearch("z_resume_creation_date");
  752. $osj2Dresumes->resume_edit_date->AdvancedSearch->SearchValue = $osj2Dresumes->getAdvancedSearch("x_resume_edit_date");
  753. $osj2Dresumes->resume_edit_date->AdvancedSearch->SearchOperator = $osj2Dresumes->getAdvancedSearch("z_resume_edit_date");
  754. $osj2Dresumes->resume_text->AdvancedSearch->SearchValue = $osj2Dresumes->getAdvancedSearch("x_resume_text");
  755. $osj2Dresumes->resume_title->AdvancedSearch->SearchValue = $osj2Dresumes->getAdvancedSearch("x_resume_title");
  756. }
  757. // Set up Sort parameters based on Sort Links clicked
  758. function SetUpSortOrder() {
  759. global $osj2Dresumes;
  760. // Check for an Order parameter
  761. if (@$_GET["order"] <> "") {
  762. $osj2Dresumes->CurrentOrder = ew_StripSlashes(@$_GET["order"]);
  763. $osj2Dresumes->CurrentOrderType = @$_GET["ordertype"];
  764. // Field resume_permissions_id
  765. $osj2Dresumes->UpdateSort($osj2Dresumes->resume_permissions_id);
  766. // Field resume_edit_date
  767. $osj2Dresumes->UpdateSort($osj2Dresumes->resume_edit_date);
  768. // Field resume_title
  769. $osj2Dresumes->UpdateSort($osj2Dresumes->resume_title);
  770. $osj2Dresumes->setStartRecordNumber(1); // Reset start position
  771. }
  772. $sOrderBy = $osj2Dresumes->getSessionOrderBy(); // Get order by from Session
  773. if ($sOrderBy == "") {
  774. if ($osj2Dresumes->SqlOrderBy() <> "") {
  775. $sOrderBy = $osj2Dresumes->SqlOrderBy();
  776. $osj2Dresumes->setSessionOrderBy($sOrderBy);
  777. }
  778. }
  779. }
  780. // Reset command based on querystring parameter cmd=
  781. // - RESET: reset search parameters
  782. // - RESETALL: reset search & master/detail parameters
  783. // - RESETSORT: reset sort parameters
  784. function ResetCmd() {
  785. global $sDbMasterFilter, $sDbDetailFilter, $nStartRec, $sOrderBy;
  786. global $osj2Dresumes;
  787. // Get reset cmd
  788. if (@$_GET["cmd"] <> "") {
  789. $sCmd = $_GET["cmd"];
  790. // Reset search criteria
  791. if (strtolower($sCmd) == "reset" || strtolower($sCmd) == "resetall") {
  792. ResetSearchParms();
  793. }
  794. // Reset Sort Criteria
  795. if (strtolower($sCmd) == "resetsort") {
  796. $sOrderBy = "";
  797. $osj2Dresumes->setSessionOrderBy($sOrderBy);
  798. $osj2Dresumes->resume_permissions_id->setSort("");
  799. $osj2Dresumes->resume_edit_date->setSort("");
  800. $osj2Dresumes->resume_title->setSort("");
  801. }
  802. // Reset start position
  803. $nStartRec = 1;
  804. $osj2Dresumes->setStartRecordNumber($nStartRec);
  805. }
  806. }
  807. ?>
  808. <?php
  809. // Set up Starting Record parameters based on Pager Navigation
  810. function SetUpStartRec() {
  811. global $nDisplayRecs, $nStartRec, $nTotalRecs, $nPageNo, $osj2Dresumes;
  812. if ($nDisplayRecs == 0) return;
  813. // Check for a START parameter
  814. if (@$_GET[EW_TABLE_START_REC] <> "") {
  815. $nStartRec = $_GET[EW_TABLE_START_REC];
  816. $osj2Dresumes->setStartRecordNumber($nStartRec);
  817. } elseif (@$_GET[EW_TABLE_PAGE_NO] <> "") {
  818. $nPageNo = $_GET[EW_TABLE_PAGE_NO];
  819. if (is_numeric($nPageNo)) {
  820. $nStartRec = ($nPageNo-1)*$nDisplayRecs+1;
  821. if ($nStartRec <= 0) {
  822. $nStartRec = 1;
  823. } elseif ($nStartRec >= intval(($nTotalRecs-1)/$nDisplayRecs)*$nDisplayRecs+1) {
  824. $nStartRec = intval(($nTotalRecs-1)/$nDisplayRecs)*$nDisplayRecs+1;
  825. }
  826. $osj2Dresumes->setStartRecordNumber($nStartRec);
  827. } else {
  828. $nStartRec = $osj2Dresumes->getStartRecordNumber();
  829. }
  830. } else {
  831. $nStartRec = $osj2Dresumes->getStartRecordNumber();
  832. }
  833. // Check if correct start record counter
  834. if (!is_numeric($nStartRec) || $nStartRec == "") { // Avoid invalid start record counter
  835. $nStartRec = 1; // Reset start record counter
  836. $osj2Dresumes->setStartRecordNumber($nStartRec);
  837. } elseif (intval($nStartRec) > intval($nTotalRecs)) { // Avoid starting record > total records
  838. $nStartRec = intval(($nTotalRecs-1)/$nDisplayRecs)*$nDisplayRecs+1; // Point to last page first record
  839. $osj2Dresumes->setStartRecordNumber($nStartRec);
  840. } elseif (($nStartRec-1) % $nDisplayRecs <> 0) {
  841. $nStartRec = intval(($nStartRec-1)/$nDisplayRecs)*$nDisplayRecs+1; // Point to page boundary
  842. $osj2Dresumes->setStartRecordNumber($nStartRec);
  843. }
  844. }
  845. ?>
  846. <?php
  847. // Load recordset
  848. function LoadRecordset($offset = -1, $rowcnt = -1) {
  849. global $conn, $osj2Dresumes;
  850. // Call Recordset Selecting event
  851. $osj2Dresumes->Recordset_Selecting($osj2Dresumes->CurrentFilter);
  852. // Load list page sql
  853. $sSql = $osj2Dresumes->SelectSQL();
  854. if ($offset > -1 && $rowcnt > -1) $sSql .= " LIMIT $offset, $rowcnt";
  855. // Load recordset
  856. $conn->raiseErrorFn = 'ew_ErrorFn';
  857. $rs = $conn->Execute($sSql);
  858. $conn->raiseErrorFn = '';
  859. // Call Recordset Selected event
  860. $osj2Dresumes->Recordset_Selected($rs);
  861. return $rs;
  862. }
  863. ?>
  864. <?php
  865. // Load row based on key values
  866. function LoadRow() {
  867. global $conn, $Security, $osj2Dresumes;
  868. $sFilter = $osj2Dresumes->SqlKeyFilter();
  869. if (!is_numeric($osj2Dresumes->resume_id->CurrentValue)) {
  870. return FALSE; // Invalid key, exit
  871. }
  872. $sFilter = str_replace("@resume_id@", ew_AdjustSql($osj2Dresumes->resume_id->CurrentValue), $sFilter); // Replace key value
  873. if ($Security->CurrentUserID() <> "" && !$Security->IsAdmin()) { // Non system admin
  874. $sFilter = $osj2Dresumes->AddUserIDFilter($sFilter, $Security->CurrentUserID()); // Add User ID filter
  875. }
  876. // Call Row Selecting event
  877. $osj2Dresumes->Row_Selecting($sFilter);
  878. // Load sql based on filter
  879. $osj2Dresumes->CurrentFilter = $sFilter;
  880. $sSql = $osj2Dresumes->SQL();
  881. if ($rs = $conn->Execute($sSql)) {
  882. if ($rs->EOF) {
  883. $LoadRow = FALSE;
  884. } else {
  885. $LoadRow = TRUE;
  886. $rs->MoveFirst();
  887. LoadRowValues($rs); // Load row values
  888. // Call Row Selected event
  889. $osj2Dresumes->Row_Selected($rs);
  890. }
  891. $rs->Close();
  892. } else {
  893. $LoadRow = FALSE;
  894. }
  895. return $LoadRow;
  896. }
  897. // Load row values from recordset
  898. function LoadRowValues(&$rs) {
  899. global $osj2Dresumes;
  900. $osj2Dresumes->resume_id->setDbValue($rs->fields('resume_id'));
  901. $osj2Dresumes->user_id->setDbValue($rs->fields('user_id'));
  902. $osj2Dresumes->resume_permissions_id->setDbValue($rs->fields('resume_permissions_id'));
  903. $osj2Dresumes->resume_creation_date->setDbValue($rs->fields('resume_creation_date'));
  904. $osj2Dresumes->resume_edit_date->setDbValue($rs->fields('resume_edit_date'));
  905. $osj2Dresumes->resume_text->setDbValue($rs->fields('resume_text'));
  906. $osj2Dresumes->resume_file->Upload->DbValue = $rs->fields('resume_file');
  907. $osj2Dresumes->resume_categories->setDbValue($rs->fields('resume_categories'));
  908. $osj2Dresumes->resume_title->setDbValue($rs->fields('resume_title'));
  909. }
  910. ?>
  911. <?php
  912. // Render row values based on field settings
  913. function RenderRow() {
  914. global $conn, $Security, $osj2Dresumes;
  915. // Call Row Rendering event
  916. $osj2Dresumes->Row_Rendering();
  917. // Common render codes for all row types
  918. // resume_permissions_id
  919. $osj2Dresumes->resume_permissions_id->CellCssStyle = "";
  920. $osj2Dresumes->resume_permissions_id->CellCssClass = "";
  921. // resume_edit_date
  922. $osj2Dresumes->resume_edit_date->CellCssStyle = "";
  923. $osj2Dresumes->resume_edit_date->CellCssClass = "";
  924. // resume_title
  925. $osj2Dresumes->resume_title->CellCssStyle = "";
  926. $osj2Dresumes->resume_title->CellCssClass = "";
  927. if ($osj2Dresumes->RowType == EW_ROWTYPE_VIEW) { // View row
  928. // resume_permissions_id
  929. if (!is_null($osj2Dresumes->resume_permissions_id->CurrentValue)) {
  930. switch ($osj2Dresumes->resume_permissions_id->CurrentValue) {
  931. case "0":
  932. $osj2Dresumes->resume_permissions_id->ViewValue = "Inactive";
  933. break;
  934. case "1":
  935. $osj2Dresumes->resume_permissions_id->ViewValue = "Active";
  936. break;
  937. default:
  938. $osj2Dresumes->resume_permissions_id->ViewValue = $osj2Dresumes->resume_permissions_id->CurrentValue;
  939. }
  940. } else {
  941. $osj2Dresumes->resume_permissions_id->ViewValue = NULL;
  942. }
  943. $osj2Dresumes->resume_permissions_id->CssStyle = "";
  944. $osj2Dresumes->resume_permissions_id->CssClass = "";
  945. $osj2Dresumes->resume_permissions_id->ViewCustomAttributes = "";
  946. // resume_edit_date
  947. $osj2Dresumes->resume_edit_date->ViewValue = $osj2Dresumes->resume_edit_date->CurrentValue;
  948. $osj2Dresumes->resume_edit_date->ViewValue = ew_FormatDateTime($osj2Dresumes->resume_edit_date->ViewValue, 10);
  949. $osj2Dresumes->resume_edit_date->CssStyle = "";
  950. $osj2Dresumes->resume_edit_date->CssClass = "";
  951. $osj2Dresumes->resume_edit_date->ViewCustomAttributes = "";
  952. // resume_title
  953. $osj2Dresumes->resume_title->ViewValue = $osj2Dresumes->resume_title->CurrentValue;
  954. $osj2Dresumes->resume_title->ViewValue = ew_Highlight($osj2Dresumes->resume_title->ViewValue, $osj2Dresumes->getBasicSearchKeyword(), $osj2Dresumes->getBasicSearchType(), $osj2Dresumes->getAdvancedSearch("x_resume_title"));
  955. $osj2Dresumes->resume_title->CssStyle = "";
  956. $osj2Dresumes->resume_title->CssClass = "";
  957. $osj2Dresumes->resume_title->ViewCustomAttributes = "";
  958. // resume_permissions_id
  959. $osj2Dresumes->resume_permissions_id->HrefValue = "";
  960. // resume_edit_date
  961. $osj2Dresumes->resume_edit_date->HrefValue = "";
  962. // resume_title
  963. $osj2Dresumes->resume_title->HrefValue = "";
  964. } elseif ($osj2Dresumes->RowType == EW_ROWTYPE_ADD) { // Add row
  965. } elseif ($osj2Dresumes->RowType == EW_ROWTYPE_EDIT) { // Edit row
  966. } elseif ($osj2Dresumes->RowType == EW_ROWTYPE_SEARCH) { // Search row
  967. }
  968. // Call Row Rendered event
  969. $osj2Dresumes->Row_Rendered();
  970. }
  971. ?>
  972. <?php
  973. // Load advanced search
  974. function LoadAdvancedSearch() {
  975. global $osj2Dresumes;
  976. }
  977. ?>
  978. <?php
  979. // Export data in Xml or Csv format
  980. function ExportData() {
  981. global $nTotalRecs, $nStartRec, $nStopRec, $nTotalRecs, $nDisplayRecs, $osj2Dresumes;
  982. $sCsvStr = "";
  983. $rs = LoadRecordset();
  984. $nTotalRecs = $rs->RecordCount();
  985. $nStartRec = 1;
  986. // Export all
  987. if (defined("EW_EXPORT_ALL")) {
  988. $nStopRec = $nTotalRecs;
  989. } else { // Export 1 page only
  990. SetUpStartRec(); // Set Up Start Record Position
  991. // Set the last record to display
  992. if ($nDisplayRecs < 0) {
  993. $nStopRec = $nTotalRecs;
  994. } else {
  995. $nStopRec = $nStartRec + $nDisplayRecs - 1;
  996. }
  997. }
  998. if ($osj2Dresumes->Export == "xml") {
  999. $XmlDoc = new cXMLDocument();
  1000. }
  1001. if ($osj2Dresumes->Export == "csv") {
  1002. $sCsvStr .= "resume_permissions_id" . ",";
  1003. $sCsvStr .= "resume_edit_date" . ",";
  1004. $sCsvStr .= "resume_title" . ",";
  1005. $sCsvStr = substr($sCsvStr, 0, strlen($sCsvStr)-1); // Remove last comma
  1006. $sCsvStr .= "\n";
  1007. }
  1008. // Move to first record directly for performance reason
  1009. $nRecCount = $nStartRec - 1;
  1010. if (!$rs->EOF) {
  1011. $rs->MoveFirst();
  1012. $rs->Move($nStartRec - 1);
  1013. }
  1014. while (!$rs->EOF && $nRecCount < $nStopRec) {
  1015. $nRecCount++;
  1016. if (intval($nRecCount) >= intval($nStartRec)) {
  1017. LoadRowValues($rs);
  1018. if ($osj2Dresumes->Export == "xml") {
  1019. $XmlDoc->BeginRow();
  1020. $XmlDoc->AddField('resume_permissions_id', $osj2Dresumes->resume_permissions_id->CurrentValue);
  1021. $XmlDoc->AddField('resume_edit_date', $osj2Dresumes->resume_edit_date->CurrentValue);
  1022. $XmlDoc->AddField('resume_title', $osj2Dresumes->resume_title->CurrentValue);
  1023. $XmlDoc->EndRow();
  1024. }
  1025. if ($osj2Dresumes->Export == "csv") {
  1026. $sCsvStr .= '"' . str_replace('"', '""', strval($osj2Dresumes->resume_permissions_id->CurrentValue)) . '",';
  1027. $sCsvStr .= '"' . str_replace('"', '""', strval($osj2Dresumes->resume_edit_date->CurrentValue)) . '",';
  1028. $sCsvStr .= '"' . str_replace('"', '""', strval($osj2Dresumes->resume_title->CurrentValue)) . '",';
  1029. $sCsvStr = substr($sCsvStr, 0, strlen($sCsvStr)-1); // Remove last comma
  1030. $sCsvStr .= "\n";
  1031. }
  1032. }
  1033. $rs->MoveNext();
  1034. }
  1035. // Close recordset
  1036. $rs->Close();
  1037. if ($osj2Dresumes->Export == "xml") {
  1038. header("Content-Type: text/xml");
  1039. echo $XmlDoc->XML();
  1040. }
  1041. if ($osj2Dresumes->Export == "csv") {
  1042. echo $sCsvStr;
  1043. }
  1044. }
  1045. ?>
  1046. <?php
  1047. // Show link optionally based on User ID
  1048. function ShowOptionLink() {
  1049. global $Security, $osj2Dresumes;
  1050. if ($Security->IsLoggedIn()) {
  1051. if (!$Security->IsAdmin()) {
  1052. return $Security->IsValidUserID($osj2Dresumes->user_id->CurrentValue);
  1053. }
  1054. }
  1055. return TRUE;
  1056. }
  1057. ?>
  1058. <?php
  1059. // Write Audit Trail start/end for grid update
  1060. function WriteAuditTrailDummy($typ) {
  1061. $table = 'osj-resumes';
  1062. // Write Audit Trail
  1063. $filePfx = "log";
  1064. $curDate = date("Y/m/d");
  1065. $curTime = date("H:i:s");
  1066. $id = ew_ScriptName();
  1067. $user = CurrentUserID();
  1068. $action = $typ;
  1069. ew_WriteAuditTrail($filePfx, $curDate, $curTime, $id, $user, $action, $table, "", "", "", "");
  1070. }
  1071. ?>
  1072. <?php
  1073. // Page Load event
  1074. function Page_Load() {
  1075. //echo "Page Load";
  1076. }
  1077. // Page Unload event
  1078. function Page_Unload() {
  1079. //echo "Page Unload";
  1080. }
  1081. ?>