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

/osj-osj2dresumesview.php

http://osjobber.googlecode.com/
PHP | 777 lines | 620 code | 75 blank | 82 comment | 135 complexity | f785a1a78e6f1067a85b096c923bbf16 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-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->CanView()) {
  37. $Security->SaveLastUrl();
  38. Page_Terminate("osj-osj2dresumeslist.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 (@$_GET["resume_id"] <> "") {
  60. if ($sExportFile <> "") $sExportFile .= "_";
  61. $sExportFile .= ew_StripSlashes($_GET["resume_id"]);
  62. }
  63. if ($osj2Dresumes->Export == "html") {
  64. // Printer friendly, no action required
  65. }
  66. if ($osj2Dresumes->Export == "xml") {
  67. header('Content-Type: text/xml');
  68. header('Content-Disposition: attachment; filename=' . $sExportFile .'.xml');
  69. }
  70. if ($osj2Dresumes->Export == "csv") {
  71. header('Content-Type: application/csv');
  72. header('Content-Disposition: attachment; filename=' . $sExportFile .'.csv');
  73. }
  74. ?>
  75. <?php
  76. // Paging variables
  77. $nStartRec = 0; // Start record index
  78. $nStopRec = 0; // Stop record index
  79. $nTotalRecs = 0; // Total number of records
  80. $nDisplayRecs = 1;
  81. $nRecRange = 10;
  82. // Load current record
  83. $bLoadCurrentRecord = FALSE;
  84. if (@$_GET["resume_id"] <> "") {
  85. $osj2Dresumes->resume_id->setQueryStringValue($_GET["resume_id"]);
  86. } else {
  87. $bLoadCurrentRecord = TRUE;
  88. }
  89. // Get action
  90. if (@$_POST["a_view"] <> "") {
  91. $osj2Dresumes->CurrentAction = $_POST["a_view"];
  92. } else {
  93. $osj2Dresumes->CurrentAction = "I"; // Display form
  94. }
  95. switch ($osj2Dresumes->CurrentAction) {
  96. case "I": // Get a record to display
  97. $nStartRec = 1; // Initialize start position
  98. $rs = LoadRecordset(); // Load records
  99. $nTotalRecs = $rs->RecordCount(); // Get record count
  100. if ($nTotalRecs <= 0) { // No record found
  101. $_SESSION[EW_SESSION_MESSAGE] = "No records found"; // Set no record message
  102. Page_Terminate("osj-osj2dresumeslist.php"); // Return to list page
  103. } elseif ($bLoadCurrentRecord) { // Load current record position
  104. SetUpStartRec(); // Set up start record position
  105. // Point to current record
  106. if (intval($nStartRec) <= intval($nTotalRecs)) {
  107. $rs->Move($nStartRec-1);
  108. }
  109. } else { // Match key values
  110. $bMatchRecord = FALSE;
  111. while (!$rs->EOF) {
  112. if (strval($osj2Dresumes->resume_id->CurrentValue) == strval($rs->fields('resume_id'))) {
  113. $bMatchRecord = TRUE;
  114. break;
  115. } else {
  116. $nStartRec++;
  117. $rs->MoveNext();
  118. }
  119. }
  120. if (!$bMatchRecord) {
  121. $_SESSION[EW_SESSION_MESSAGE] = "No records found"; // Set no record message
  122. Page_Terminate("osj-osj2dresumeslist.php"); // Return to list
  123. } else {
  124. $osj2Dresumes->setStartRecordNumber($nStartRec); // Save record position
  125. }
  126. }
  127. LoadRowValues($rs); // Load row values
  128. }
  129. // Export data only
  130. if ($osj2Dresumes->Export == "xml" || $osj2Dresumes->Export == "csv") {
  131. ExportData();
  132. Page_Terminate(); // Terminate response
  133. }
  134. // Set return url
  135. $osj2Dresumes->setReturnUrl("osj-osj2dresumesview.php");
  136. // Render row
  137. $osj2Dresumes->RowType = EW_ROWTYPE_VIEW;
  138. RenderRow();
  139. ?>
  140. <?php include "osj-header.php" ?>
  141. <script type="text/javascript">
  142. <!--
  143. var EW_PAGE_ID = "view"; // Page id
  144. var EW_SHOW_HIGHLIGHT = "Show highlight";
  145. var EW_HIDE_HIGHLIGHT = "Hide highlight";
  146. //-->
  147. </script>
  148. <script language="JavaScript" type="text/javascript">
  149. <!--
  150. // Write your client script here, no need to add script tags.
  151. // To include another .js script, use:
  152. // ew_ClientScriptInclude("my_javascript.js");
  153. //-->
  154. </script>
  155. <p><span class="phpmaker">View TABLE: Resumes
  156. <?php if ($osj2Dresumes->Export == "") { ?>
  157. &nbsp;&nbsp;<a href="osj-osj2dresumesview.php?export=html&resume_id=<?php echo urlencode($osj2Dresumes->resume_id->CurrentValue) ?>">Printer Friendly</a>
  158. &nbsp;&nbsp;<a href="osj-osj2dresumesview.php?export=xml&resume_id=<?php echo urlencode($osj2Dresumes->resume_id->CurrentValue) ?>">Export to XML</a>
  159. &nbsp;&nbsp;<a href="osj-osj2dresumesview.php?export=csv&resume_id=<?php echo urlencode($osj2Dresumes->resume_id->CurrentValue) ?>">Export to CSV</a>
  160. <?php } ?>
  161. <br><br>
  162. <?php if ($osj2Dresumes->Export == "") { ?>
  163. <a href="osj-osj2dresumeslist.php">Back to List</a>&nbsp;
  164. <?php if ($Security->CanAdd()) { ?>
  165. <?php if (ShowOptionLink()) { ?>
  166. <a href="osj-osj2dresumesadd.php">Add</a>&nbsp;
  167. <?php } ?>
  168. <?php } ?>
  169. <?php if ($Security->CanEdit()) { ?>
  170. <?php if (ShowOptionLink()) { ?>
  171. <a href="<?php echo $osj2Dresumes->EditUrl() ?>">Edit</a>&nbsp;
  172. <?php } ?>
  173. <?php } ?>
  174. <?php if ($Security->CanDelete()) { ?>
  175. <?php if (ShowOptionLink()) { ?>
  176. <a href="<?php echo $osj2Dresumes->DeleteUrl() ?>">Delete</a>&nbsp;
  177. <?php } ?>
  178. <?php } ?>
  179. <?php } ?>
  180. </span>
  181. </p>
  182. <?php
  183. if (@$_SESSION[EW_SESSION_MESSAGE] <> "") {
  184. ?>
  185. <p><span class="ewmsg"><?php echo $_SESSION[EW_SESSION_MESSAGE] ?></span></p>
  186. <?php
  187. $_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message
  188. }
  189. ?>
  190. <p>
  191. <?php if ($osj2Dresumes->Export == "") { ?>
  192. <form action="osj-osj2dresumesview.php" name="ewpagerform" id="ewpagerform">
  193. <table border="0" cellspacing="0" cellpadding="0">
  194. <tr>
  195. <td nowrap>
  196. <span class="phpmaker">
  197. <?php if (!isset($Pager)) $Pager = new cNumericPager($nStartRec, $nDisplayRecs, $nTotalRecs, $nRecRange) ?>
  198. <?php if ($Pager->RecordCount > 0) { ?>
  199. <?php if ($Pager->FirstButton->Enabled) { ?>
  200. <a href="osj-osj2dresumesview.php?start=<?php echo $Pager->FirstButton->Start ?>"><b>First</b></a>&nbsp;
  201. <?php } ?>
  202. <?php if ($Pager->PrevButton->Enabled) { ?>
  203. <a href="osj-osj2dresumesview.php?start=<?php echo $Pager->PrevButton->Start ?>"><b>Previous</b></a>&nbsp;
  204. <?php } ?>
  205. <?php foreach ($Pager->Items as $PagerItem) { ?>
  206. <?php if ($PagerItem->Enabled) { ?><a href="osj-osj2dresumesview.php?start=<?php echo $PagerItem->Start ?>"><?php } ?><b><?php echo $PagerItem->Text ?></b><?php if ($PagerItem->Enabled) { ?></a><?php } ?>&nbsp;
  207. <?php } ?>
  208. <?php if ($Pager->NextButton->Enabled) { ?>
  209. <a href="osj-osj2dresumesview.php?start=<?php echo $Pager->NextButton->Start ?>"><b>Next</b></a>&nbsp;
  210. <?php } ?>
  211. <?php if ($Pager->LastButton->Enabled) { ?>
  212. <a href="osj-osj2dresumesview.php?start=<?php echo $Pager->LastButton->Start ?>"><b>Last</b></a>&nbsp;
  213. <?php } ?>
  214. <?php if ($Pager->ButtonCount > 0) { ?><br><?php } ?>
  215. Records <?php echo $Pager->FromIndex ?> to <?php echo $Pager->ToIndex ?> of <?php echo $Pager->RecordCount ?>
  216. <?php } else { ?>
  217. <?php if ($Security->CanList()) { ?>
  218. <?php if ($sSrchWhere == "0=101") { ?>
  219. Please enter search criteria
  220. <?php } else { ?>
  221. No records found
  222. <?php } ?>
  223. <?php } else { ?>
  224. You do not have the right permission to view the page
  225. <?php } ?>
  226. <?php } ?>
  227. </span>
  228. </td>
  229. </tr>
  230. </table>
  231. </form>
  232. <?php } ?>
  233. <form>
  234. <table class="ewTable">
  235. <tr class="ewTableRow">
  236. <td class="ewTableHeader">Resume ID</td>
  237. <td<?php echo $osj2Dresumes->resume_id->CellAttributes() ?>>
  238. </td>
  239. </tr>
  240. <tr class="ewTableAltRow">
  241. <td class="ewTableHeader">User ID</td>
  242. <td<?php echo $osj2Dresumes->user_id->CellAttributes() ?>>
  243. <div<?php echo $osj2Dresumes->user_id->ViewAttributes() ?>><?php echo $osj2Dresumes->user_id->ViewValue ?></div>
  244. </td>
  245. </tr>
  246. <tr class="ewTableRow">
  247. <td class="ewTableHeader">Resume Status Level</td>
  248. <td<?php echo $osj2Dresumes->resume_permissions_id->CellAttributes() ?>>
  249. <div<?php echo $osj2Dresumes->resume_permissions_id->ViewAttributes() ?>><?php echo $osj2Dresumes->resume_permissions_id->ViewValue ?></div>
  250. </td>
  251. </tr>
  252. <tr class="ewTableAltRow">
  253. <td class="ewTableHeader">Resume Created Date</td>
  254. <td<?php echo $osj2Dresumes->resume_creation_date->CellAttributes() ?>>
  255. <div<?php echo $osj2Dresumes->resume_creation_date->ViewAttributes() ?>><?php echo $osj2Dresumes->resume_creation_date->ViewValue ?></div>
  256. </td>
  257. </tr>
  258. <tr class="ewTableRow">
  259. <td class="ewTableHeader">Resume Edit Date</td>
  260. <td<?php echo $osj2Dresumes->resume_edit_date->CellAttributes() ?>>
  261. <div<?php echo $osj2Dresumes->resume_edit_date->ViewAttributes() ?>><?php echo $osj2Dresumes->resume_edit_date->ViewValue ?></div>
  262. </td>
  263. </tr>
  264. <tr class="ewTableAltRow">
  265. <td class="ewTableHeader">Resume Text</td>
  266. <td<?php echo $osj2Dresumes->resume_text->CellAttributes() ?>>
  267. <div<?php echo $osj2Dresumes->resume_text->ViewAttributes() ?>><?php echo $osj2Dresumes->resume_text->ViewValue ?></div>
  268. </td>
  269. </tr>
  270. <tr class="ewTableRow">
  271. <td class="ewTableHeader">Resume Attachment</td>
  272. <td<?php echo $osj2Dresumes->resume_file->CellAttributes() ?>>
  273. <?php if ($osj2Dresumes->resume_file->HrefValue <> "") { ?>
  274. <?php if (!is_null($osj2Dresumes->resume_file->Upload->DbValue)) { ?>
  275. <a href="<?php echo $osj2Dresumes->resume_file->HrefValue ?>" target="_blank"><?php echo $osj2Dresumes->resume_file->ViewValue ?></a>
  276. <?php } ?>
  277. <?php } else { ?>
  278. <?php if (!is_null($osj2Dresumes->resume_file->Upload->DbValue)) { ?>
  279. <?php echo $osj2Dresumes->resume_file->ViewValue ?>
  280. <?php } ?>
  281. <?php } ?>
  282. </td>
  283. </tr>
  284. <tr class="ewTableAltRow">
  285. <td class="ewTableHeader">Resume Categories</td>
  286. <td<?php echo $osj2Dresumes->resume_categories->CellAttributes() ?>>
  287. </td>
  288. </tr>
  289. <tr class="ewTableRow">
  290. <td class="ewTableHeader">Resume Title</td>
  291. <td<?php echo $osj2Dresumes->resume_title->CellAttributes() ?>>
  292. <div<?php echo $osj2Dresumes->resume_title->ViewAttributes() ?>><?php echo $osj2Dresumes->resume_title->ViewValue ?></div>
  293. </td>
  294. </tr>
  295. </table>
  296. </form>
  297. <?php if ($osj2Dresumes->Export == "") { ?>
  298. <form action="osj-osj2dresumesview.php" name="ewpagerform" id="ewpagerform">
  299. <table border="0" cellspacing="0" cellpadding="0">
  300. <tr>
  301. <td nowrap>
  302. <span class="phpmaker">
  303. <?php if (!isset($Pager)) $Pager = new cNumericPager($nStartRec, $nDisplayRecs, $nTotalRecs, $nRecRange) ?>
  304. <?php if ($Pager->RecordCount > 0) { ?>
  305. <?php if ($Pager->FirstButton->Enabled) { ?>
  306. <a href="osj-osj2dresumesview.php?start=<?php echo $Pager->FirstButton->Start ?>"><b>First</b></a>&nbsp;
  307. <?php } ?>
  308. <?php if ($Pager->PrevButton->Enabled) { ?>
  309. <a href="osj-osj2dresumesview.php?start=<?php echo $Pager->PrevButton->Start ?>"><b>Previous</b></a>&nbsp;
  310. <?php } ?>
  311. <?php foreach ($Pager->Items as $PagerItem) { ?>
  312. <?php if ($PagerItem->Enabled) { ?><a href="osj-osj2dresumesview.php?start=<?php echo $PagerItem->Start ?>"><?php } ?><b><?php echo $PagerItem->Text ?></b><?php if ($PagerItem->Enabled) { ?></a><?php } ?>&nbsp;
  313. <?php } ?>
  314. <?php if ($Pager->NextButton->Enabled) { ?>
  315. <a href="osj-osj2dresumesview.php?start=<?php echo $Pager->NextButton->Start ?>"><b>Next</b></a>&nbsp;
  316. <?php } ?>
  317. <?php if ($Pager->LastButton->Enabled) { ?>
  318. <a href="osj-osj2dresumesview.php?start=<?php echo $Pager->LastButton->Start ?>"><b>Last</b></a>&nbsp;
  319. <?php } ?>
  320. <?php if ($Pager->ButtonCount > 0) { ?><br><?php } ?>
  321. Records <?php echo $Pager->FromIndex ?> to <?php echo $Pager->ToIndex ?> of <?php echo $Pager->RecordCount ?>
  322. <?php } else { ?>
  323. <?php if ($Security->CanList()) { ?>
  324. <?php if ($sSrchWhere == "0=101") { ?>
  325. Please enter search criteria
  326. <?php } else { ?>
  327. No records found
  328. <?php } ?>
  329. <?php } else { ?>
  330. You do not have the right permission to view the page
  331. <?php } ?>
  332. <?php } ?>
  333. </span>
  334. </td>
  335. </tr>
  336. </table>
  337. </form>
  338. <?php } ?>
  339. <p>
  340. <script language="JavaScript" type="text/javascript">
  341. <!--
  342. // Write your table-specific startup script here
  343. // document.write("page loaded");
  344. //-->
  345. </script>
  346. <?php include "osj-footer.php" ?>
  347. <?php
  348. // If control is passed here, simply terminate the page without redirect
  349. Page_Terminate();
  350. // -----------------------------------------------------------------
  351. // Subroutine Page_Terminate
  352. // - called when exit page
  353. // - clean up connection and objects
  354. // - if url specified, redirect to url, otherwise end response
  355. function Page_Terminate($url = "") {
  356. global $conn;
  357. // Page unload event, used in current page
  358. Page_Unload();
  359. // Global page unloaded event (in userfn*.php)
  360. Page_Unloaded();
  361. // Close Connection
  362. $conn->Close();
  363. // Go to url if specified
  364. if ($url <> "") {
  365. ob_end_clean();
  366. header("Location: $url");
  367. }
  368. exit();
  369. }
  370. ?>
  371. <?php
  372. // Load recordset
  373. function LoadRecordset($offset = -1, $rowcnt = -1) {
  374. global $conn, $osj2Dresumes;
  375. // Call Recordset Selecting event
  376. $osj2Dresumes->Recordset_Selecting($osj2Dresumes->CurrentFilter);
  377. // Load list page sql
  378. $sSql = $osj2Dresumes->SelectSQL();
  379. if ($offset > -1 && $rowcnt > -1) $sSql .= " LIMIT $offset, $rowcnt";
  380. // Load recordset
  381. $conn->raiseErrorFn = 'ew_ErrorFn';
  382. $rs = $conn->Execute($sSql);
  383. $conn->raiseErrorFn = '';
  384. // Call Recordset Selected event
  385. $osj2Dresumes->Recordset_Selected($rs);
  386. return $rs;
  387. }
  388. ?>
  389. <?php
  390. // Load row based on key values
  391. function LoadRow() {
  392. global $conn, $Security, $osj2Dresumes;
  393. $sFilter = $osj2Dresumes->SqlKeyFilter();
  394. if (!is_numeric($osj2Dresumes->resume_id->CurrentValue)) {
  395. return FALSE; // Invalid key, exit
  396. }
  397. $sFilter = str_replace("@resume_id@", ew_AdjustSql($osj2Dresumes->resume_id->CurrentValue), $sFilter); // Replace key value
  398. if ($Security->CurrentUserID() <> "" && !$Security->IsAdmin()) { // Non system admin
  399. $sFilter = $osj2Dresumes->AddUserIDFilter($sFilter, $Security->CurrentUserID()); // Add User ID filter
  400. }
  401. // Call Row Selecting event
  402. $osj2Dresumes->Row_Selecting($sFilter);
  403. // Load sql based on filter
  404. $osj2Dresumes->CurrentFilter = $sFilter;
  405. $sSql = $osj2Dresumes->SQL();
  406. if ($rs = $conn->Execute($sSql)) {
  407. if ($rs->EOF) {
  408. $LoadRow = FALSE;
  409. } else {
  410. $LoadRow = TRUE;
  411. $rs->MoveFirst();
  412. LoadRowValues($rs); // Load row values
  413. // Call Row Selected event
  414. $osj2Dresumes->Row_Selected($rs);
  415. }
  416. $rs->Close();
  417. } else {
  418. $LoadRow = FALSE;
  419. }
  420. return $LoadRow;
  421. }
  422. // Load row values from recordset
  423. function LoadRowValues(&$rs) {
  424. global $osj2Dresumes;
  425. $osj2Dresumes->resume_id->setDbValue($rs->fields('resume_id'));
  426. $osj2Dresumes->user_id->setDbValue($rs->fields('user_id'));
  427. $osj2Dresumes->resume_permissions_id->setDbValue($rs->fields('resume_permissions_id'));
  428. $osj2Dresumes->resume_creation_date->setDbValue($rs->fields('resume_creation_date'));
  429. $osj2Dresumes->resume_edit_date->setDbValue($rs->fields('resume_edit_date'));
  430. $osj2Dresumes->resume_text->setDbValue($rs->fields('resume_text'));
  431. $osj2Dresumes->resume_file->Upload->DbValue = $rs->fields('resume_file');
  432. $osj2Dresumes->resume_categories->setDbValue($rs->fields('resume_categories'));
  433. $osj2Dresumes->resume_title->setDbValue($rs->fields('resume_title'));
  434. }
  435. ?>
  436. <?php
  437. // Render row values based on field settings
  438. function RenderRow() {
  439. global $conn, $Security, $osj2Dresumes;
  440. // Call Row Rendering event
  441. $osj2Dresumes->Row_Rendering();
  442. // Common render codes for all row types
  443. // resume_id
  444. $osj2Dresumes->resume_id->CellCssStyle = "";
  445. $osj2Dresumes->resume_id->CellCssClass = "";
  446. // user_id
  447. $osj2Dresumes->user_id->CellCssStyle = "";
  448. $osj2Dresumes->user_id->CellCssClass = "";
  449. // resume_permissions_id
  450. $osj2Dresumes->resume_permissions_id->CellCssStyle = "";
  451. $osj2Dresumes->resume_permissions_id->CellCssClass = "";
  452. // resume_creation_date
  453. $osj2Dresumes->resume_creation_date->CellCssStyle = "";
  454. $osj2Dresumes->resume_creation_date->CellCssClass = "";
  455. // resume_edit_date
  456. $osj2Dresumes->resume_edit_date->CellCssStyle = "";
  457. $osj2Dresumes->resume_edit_date->CellCssClass = "";
  458. // resume_text
  459. $osj2Dresumes->resume_text->CellCssStyle = "";
  460. $osj2Dresumes->resume_text->CellCssClass = "";
  461. // resume_file
  462. $osj2Dresumes->resume_file->CellCssStyle = "";
  463. $osj2Dresumes->resume_file->CellCssClass = "";
  464. // resume_categories
  465. $osj2Dresumes->resume_categories->CellCssStyle = "";
  466. $osj2Dresumes->resume_categories->CellCssClass = "";
  467. // resume_title
  468. $osj2Dresumes->resume_title->CellCssStyle = "";
  469. $osj2Dresumes->resume_title->CellCssClass = "";
  470. if ($osj2Dresumes->RowType == EW_ROWTYPE_VIEW) { // View row
  471. // resume_id
  472. $osj2Dresumes->resume_id->CssStyle = "";
  473. $osj2Dresumes->resume_id->CssClass = "";
  474. $osj2Dresumes->resume_id->ViewCustomAttributes = "";
  475. // user_id
  476. $osj2Dresumes->user_id->ViewValue = $osj2Dresumes->user_id->CurrentValue;
  477. $osj2Dresumes->user_id->CssStyle = "";
  478. $osj2Dresumes->user_id->CssClass = "";
  479. $osj2Dresumes->user_id->ViewCustomAttributes = "";
  480. // resume_permissions_id
  481. if (!is_null($osj2Dresumes->resume_permissions_id->CurrentValue)) {
  482. switch ($osj2Dresumes->resume_permissions_id->CurrentValue) {
  483. case "0":
  484. $osj2Dresumes->resume_permissions_id->ViewValue = "Inactive";
  485. break;
  486. case "1":
  487. $osj2Dresumes->resume_permissions_id->ViewValue = "Active";
  488. break;
  489. default:
  490. $osj2Dresumes->resume_permissions_id->ViewValue = $osj2Dresumes->resume_permissions_id->CurrentValue;
  491. }
  492. } else {
  493. $osj2Dresumes->resume_permissions_id->ViewValue = NULL;
  494. }
  495. $osj2Dresumes->resume_permissions_id->CssStyle = "";
  496. $osj2Dresumes->resume_permissions_id->CssClass = "";
  497. $osj2Dresumes->resume_permissions_id->ViewCustomAttributes = "";
  498. // resume_creation_date
  499. $osj2Dresumes->resume_creation_date->ViewValue = $osj2Dresumes->resume_creation_date->CurrentValue;
  500. $osj2Dresumes->resume_creation_date->ViewValue = ew_FormatDateTime($osj2Dresumes->resume_creation_date->ViewValue, 10);
  501. $osj2Dresumes->resume_creation_date->CssStyle = "";
  502. $osj2Dresumes->resume_creation_date->CssClass = "";
  503. $osj2Dresumes->resume_creation_date->ViewCustomAttributes = "";
  504. // resume_edit_date
  505. $osj2Dresumes->resume_edit_date->ViewValue = $osj2Dresumes->resume_edit_date->CurrentValue;
  506. $osj2Dresumes->resume_edit_date->ViewValue = ew_FormatDateTime($osj2Dresumes->resume_edit_date->ViewValue, 10);
  507. $osj2Dresumes->resume_edit_date->CssStyle = "";
  508. $osj2Dresumes->resume_edit_date->CssClass = "";
  509. $osj2Dresumes->resume_edit_date->ViewCustomAttributes = "";
  510. // resume_text
  511. $osj2Dresumes->resume_text->ViewValue = $osj2Dresumes->resume_text->CurrentValue;
  512. if (!is_null($osj2Dresumes->resume_text->ViewValue)) $osj2Dresumes->resume_text->ViewValue = str_replace("\n", "<br>", $osj2Dresumes->resume_text->ViewValue);
  513. $osj2Dresumes->resume_text->CssStyle = "";
  514. $osj2Dresumes->resume_text->CssClass = "";
  515. $osj2Dresumes->resume_text->ViewCustomAttributes = "";
  516. // resume_file
  517. if (!is_null($osj2Dresumes->resume_file->Upload->DbValue)) {
  518. $osj2Dresumes->resume_file->ViewValue = "Resume Attachment";
  519. } else {
  520. $osj2Dresumes->resume_file->ViewValue = "";
  521. }
  522. $osj2Dresumes->resume_file->CssStyle = "";
  523. $osj2Dresumes->resume_file->CssClass = "";
  524. $osj2Dresumes->resume_file->ViewCustomAttributes = "";
  525. // resume_categories
  526. $osj2Dresumes->resume_categories->CssStyle = "";
  527. $osj2Dresumes->resume_categories->CssClass = "";
  528. $osj2Dresumes->resume_categories->ViewCustomAttributes = "";
  529. // resume_title
  530. $osj2Dresumes->resume_title->ViewValue = $osj2Dresumes->resume_title->CurrentValue;
  531. $osj2Dresumes->resume_title->CssStyle = "";
  532. $osj2Dresumes->resume_title->CssClass = "";
  533. $osj2Dresumes->resume_title->ViewCustomAttributes = "";
  534. // resume_id
  535. $osj2Dresumes->resume_id->HrefValue = "";
  536. // user_id
  537. $osj2Dresumes->user_id->HrefValue = "";
  538. // resume_permissions_id
  539. $osj2Dresumes->resume_permissions_id->HrefValue = "";
  540. // resume_creation_date
  541. $osj2Dresumes->resume_creation_date->HrefValue = "";
  542. // resume_edit_date
  543. $osj2Dresumes->resume_edit_date->HrefValue = "";
  544. // resume_text
  545. $osj2Dresumes->resume_text->HrefValue = "";
  546. // resume_file
  547. if (!is_null($osj2Dresumes->resume_file->Upload->DbValue)) {
  548. $osj2Dresumes->resume_file->HrefValue = "osj-osj2dresumes_resume_file_bv.php?resume_id=" . $osj2Dresumes->resume_id->CurrentValue;
  549. if ($osj2Dresumes->Export <> "") $osj2Dresumes->resume_file->HrefValue = ew_ConvertFullUrl($osj2Dresumes->resume_file->HrefValue);
  550. } else {
  551. $osj2Dresumes->resume_file->HrefValue = "";
  552. }
  553. // resume_categories
  554. $osj2Dresumes->resume_categories->HrefValue = "";
  555. // resume_title
  556. $osj2Dresumes->resume_title->HrefValue = "";
  557. } elseif ($osj2Dresumes->RowType == EW_ROWTYPE_ADD) { // Add row
  558. } elseif ($osj2Dresumes->RowType == EW_ROWTYPE_EDIT) { // Edit row
  559. } elseif ($osj2Dresumes->RowType == EW_ROWTYPE_SEARCH) { // Search row
  560. }
  561. // Call Row Rendered event
  562. $osj2Dresumes->Row_Rendered();
  563. }
  564. ?>
  565. <?php
  566. // Export data in Xml or Csv format
  567. function ExportData() {
  568. global $nTotalRecs, $nStartRec, $nStopRec, $nTotalRecs, $nDisplayRecs, $osj2Dresumes;
  569. $sCsvStr = "";
  570. $rs = LoadRecordset();
  571. $nTotalRecs = $rs->RecordCount();
  572. $nStartRec = 1;
  573. SetUpStartRec(); // Set Up Start Record Position
  574. // Set the last record to display
  575. if ($nDisplayRecs < 0) {
  576. $nStopRec = $nTotalRecs;
  577. } else {
  578. $nStopRec = $nStartRec + $nDisplayRecs - 1;
  579. }
  580. if ($osj2Dresumes->Export == "xml") {
  581. $XmlDoc = new cXMLDocument();
  582. }
  583. if ($osj2Dresumes->Export == "csv") {
  584. $sCsvStr .= "resume_id" . ",";
  585. $sCsvStr .= "user_id" . ",";
  586. $sCsvStr .= "resume_permissions_id" . ",";
  587. $sCsvStr .= "resume_creation_date" . ",";
  588. $sCsvStr .= "resume_edit_date" . ",";
  589. $sCsvStr .= "resume_text" . ",";
  590. $sCsvStr .= "resume_categories" . ",";
  591. $sCsvStr .= "resume_title" . ",";
  592. $sCsvStr = substr($sCsvStr, 0, strlen($sCsvStr)-1); // Remove last comma
  593. $sCsvStr .= "\n";
  594. }
  595. // Move to first record directly for performance reason
  596. $nRecCount = $nStartRec - 1;
  597. if (!$rs->EOF) {
  598. $rs->MoveFirst();
  599. $rs->Move($nStartRec - 1);
  600. }
  601. while (!$rs->EOF && $nRecCount < $nStopRec) {
  602. $nRecCount++;
  603. if (intval($nRecCount) >= intval($nStartRec)) {
  604. LoadRowValues($rs);
  605. if ($osj2Dresumes->Export == "xml") {
  606. $XmlDoc->BeginRow();
  607. $XmlDoc->AddField('resume_id', $osj2Dresumes->resume_id->CurrentValue);
  608. $XmlDoc->AddField('user_id', $osj2Dresumes->user_id->CurrentValue);
  609. $XmlDoc->AddField('resume_permissions_id', $osj2Dresumes->resume_permissions_id->CurrentValue);
  610. $XmlDoc->AddField('resume_creation_date', $osj2Dresumes->resume_creation_date->CurrentValue);
  611. $XmlDoc->AddField('resume_edit_date', $osj2Dresumes->resume_edit_date->CurrentValue);
  612. $XmlDoc->AddField('resume_text', $osj2Dresumes->resume_text->CurrentValue);
  613. $XmlDoc->AddField('resume_categories', $osj2Dresumes->resume_categories->CurrentValue);
  614. $XmlDoc->AddField('resume_title', $osj2Dresumes->resume_title->CurrentValue);
  615. $XmlDoc->EndRow();
  616. }
  617. if ($osj2Dresumes->Export == "csv") {
  618. $sCsvStr .= '"' . str_replace('"', '""', strval($osj2Dresumes->resume_id->CurrentValue)) . '",';
  619. $sCsvStr .= '"' . str_replace('"', '""', strval($osj2Dresumes->user_id->CurrentValue)) . '",';
  620. $sCsvStr .= '"' . str_replace('"', '""', strval($osj2Dresumes->resume_permissions_id->CurrentValue)) . '",';
  621. $sCsvStr .= '"' . str_replace('"', '""', strval($osj2Dresumes->resume_creation_date->CurrentValue)) . '",';
  622. $sCsvStr .= '"' . str_replace('"', '""', strval($osj2Dresumes->resume_edit_date->CurrentValue)) . '",';
  623. $sCsvStr .= '"' . str_replace('"', '""', strval($osj2Dresumes->resume_text->CurrentValue)) . '",';
  624. $sCsvStr .= '"' . str_replace('"', '""', strval($osj2Dresumes->resume_categories->CurrentValue)) . '",';
  625. $sCsvStr .= '"' . str_replace('"', '""', strval($osj2Dresumes->resume_title->CurrentValue)) . '",';
  626. $sCsvStr = substr($sCsvStr, 0, strlen($sCsvStr)-1); // Remove last comma
  627. $sCsvStr .= "\n";
  628. }
  629. }
  630. $rs->MoveNext();
  631. }
  632. // Close recordset
  633. $rs->Close();
  634. if ($osj2Dresumes->Export == "xml") {
  635. header("Content-Type: text/xml");
  636. echo $XmlDoc->XML();
  637. }
  638. if ($osj2Dresumes->Export == "csv") {
  639. echo $sCsvStr;
  640. }
  641. }
  642. ?>
  643. <?php
  644. // Show link optionally based on User ID
  645. function ShowOptionLink() {
  646. global $Security, $osj2Dresumes;
  647. if ($Security->IsLoggedIn()) {
  648. if (!$Security->IsAdmin()) {
  649. return $Security->IsValidUserID($osj2Dresumes->user_id->CurrentValue);
  650. }
  651. }
  652. return TRUE;
  653. }
  654. ?>
  655. <?php
  656. // Set up Starting Record parameters based on Pager Navigation
  657. function SetUpStartRec() {
  658. global $nDisplayRecs, $nStartRec, $nTotalRecs, $nPageNo, $osj2Dresumes;
  659. if ($nDisplayRecs == 0) return;
  660. // Check for a START parameter
  661. if (@$_GET[EW_TABLE_START_REC] <> "") {
  662. $nStartRec = $_GET[EW_TABLE_START_REC];
  663. $osj2Dresumes->setStartRecordNumber($nStartRec);
  664. } elseif (@$_GET[EW_TABLE_PAGE_NO] <> "") {
  665. $nPageNo = $_GET[EW_TABLE_PAGE_NO];
  666. if (is_numeric($nPageNo)) {
  667. $nStartRec = ($nPageNo-1)*$nDisplayRecs+1;
  668. if ($nStartRec <= 0) {
  669. $nStartRec = 1;
  670. } elseif ($nStartRec >= intval(($nTotalRecs-1)/$nDisplayRecs)*$nDisplayRecs+1) {
  671. $nStartRec = intval(($nTotalRecs-1)/$nDisplayRecs)*$nDisplayRecs+1;
  672. }
  673. $osj2Dresumes->setStartRecordNumber($nStartRec);
  674. } else {
  675. $nStartRec = $osj2Dresumes->getStartRecordNumber();
  676. }
  677. } else {
  678. $nStartRec = $osj2Dresumes->getStartRecordNumber();
  679. }
  680. // Check if correct start record counter
  681. if (!is_numeric($nStartRec) || $nStartRec == "") { // Avoid invalid start record counter
  682. $nStartRec = 1; // Reset start record counter
  683. $osj2Dresumes->setStartRecordNumber($nStartRec);
  684. } elseif (intval($nStartRec) > intval($nTotalRecs)) { // Avoid starting record > total records
  685. $nStartRec = intval(($nTotalRecs-1)/$nDisplayRecs)*$nDisplayRecs+1; // Point to last page first record
  686. $osj2Dresumes->setStartRecordNumber($nStartRec);
  687. } elseif (($nStartRec-1) % $nDisplayRecs <> 0) {
  688. $nStartRec = intval(($nStartRec-1)/$nDisplayRecs)*$nDisplayRecs+1; // Point to page boundary
  689. $osj2Dresumes->setStartRecordNumber($nStartRec);
  690. }
  691. }
  692. ?>
  693. <?php
  694. // Page Load event
  695. function Page_Load() {
  696. //echo "Page Load";
  697. }
  698. // Page Unload event
  699. function Page_Unload() {
  700. //echo "Page Unload";
  701. }
  702. ?>