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

/osj-osj2dapplicationsview.php

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