Odyssey
uploadHist.prg
1 <?php
2 
3 
4  print <<< print_html
5  <style style='text/css'>
6  .upl_alert {
7  background: #dddddd;
8  color: #990000;
9  }
10  </style>
11  <center>
12  <table border=0 cellpadding=2 cellspacing=0 width="420">
13  <tr><td colspan="3" class="">&nbsp;</td></tr>
14  <tr>
15  <td colspan="3" class="bar" align="center">
16  Upload Status
17  </td>
18  </tr>
19  <tr>
20  <td class='hdr' width="100">
21  Upload ID
22  </td>
23  <td class='hdr' width="220">
24  Date of Upload
25  </td>
26  <td class='hdr' width="100">
27  Admin User
28  </td>
29  </tr>
30 print_html;
31 
32  // Now open a pipe to the file if one exists, if not then print that on the screen
33  // First create the file string
34  $exp_file = "$home_path/tmp/exportid.log";
35 
36  if (file_exists($exp_file)) {
37  // Now we need to open a pipe
38  $pipe = @popen("sort -rn " . escapeshellcmd($exp_file) . " | head -30 ", "r");
39 
40  if ($pipe) {
41  $lst_upl = "-1";
42  while (!feof($pipe)) {
43  $seq_str = "";
44  $rgb = ($rgb == "odd" ? "even" : "odd");
45  $line_buffer = fgets($pipe, 4096);
46  // Now we have the line, but we now need to spit into array pieces
47  list($last_upload, $prior_upload, $settings, $date_upload,$exp_batches,$cuuser) = explode("\t", $line_buffer);
48  if (trim($prior_upload) == '') {$prior_upload = $last_upload;}
49  if ($lst_upl == "-1") {
50  $lst_upl = $last_upload;
51  } else {
52  // Check to see if we have gone out of sequence
53  if ((intval($lst_upl) - 1) != $last_upload && intval($last_upload) != 0 && intval($prior_upload) != 0)
54  $seq_str = "*";
55 
56  $lst_upl = $last_upload;
57  }
58 
59  /* ** DETERMINE the settings for the upload -- break the settings up into 3 pieces
60  * 0 - Balance Files Loaded
61  * 1 - Full Refresh Performed
62  * 2 - Delete ALL Rows
63  */
64  $upl_set = explode(",", $settings);
65  if ($upl_set[1] == "1") {
66  $rgb = "upl_alert";
67  }
68  print "
69  <tr>
70  <td class='$rgb'>
71  $last_upload $seq_str
72  </td>
73  <td class='$rgb' align=right>
74  $date_upload
75  </td>
76  <td class='$rgb' align=left>
77  $cuuser
78  </td>
79  </tr>";
80  }
81  fclose ($pipe);
82  print "
83  <tr>
84  <td colspan=2 class='$rgb'>
85  * denotes possible missing batch, <br><span class='upl_alert'>red</span> denotes full refresh
86  </td>
87  </tr>";
88  } else {
89  // File does NOT exist print this message to the screen
90  print "
91  <tr>
92  <td colspan=\"2\" class=\"ahd\">
93  Currently your credit union does not have any upload history.
94  </td>
95  </tr> ";
96  }
97  } else {
98  // File does NOT exist print this message to the screen
99  print "
100  <tr>
101  <td colspan=\"2\" class=\"ahd\">
102  Currently your credit union does not have any upload history.
103  </td>
104  </tr> ";
105 
106  }
107  print "</table>";
108 ?>
Definition: User.php:7