Odyssey
alertrecreport.prg
1 <?php
2  $monLibrary= dirname(__FILE__) . "/../library";
3  $sharedLibrary= dirname(__FILE__) . "/../../shared/library";
4  require_once("$monLibrary/cu_top.i");
5  require_once("$monLibrary/ck_hticket.i");
6  require_once("$monLibrary/cu_pass.i");
7  require_once("$sharedLibrary/cu_flagconst.i");
8 
9  if (!CheckPerm($link, $Hu, basename($_SERVER['SCRIPT_NAME']), $_SERVER['REMOTE_ADDR'])) {
10  // ** Permissions failed
11  // ** redirect to new page
12  header("Location: /hcuadm/hcu_noperm.prg");
13  exit;
14  }
15 
16  $results_dir = "/home/homecu/html";
17  $view_dir = "/homecu/html";
18  $alerts_prefix = "alerts";
19  $recur_prefix = "recurltx";
20 
21  $month = Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
22 
23  cu_header("Alerts and Recurring");
24 
25  // ** this is the results of the file directory
26  $alerts_list = Array();
27  $recur_list = Array();
28 
29  // ** Get a collection of names from the directory
30  if (is_dir($results_dir)) {
31  if ($dir_hndl = opendir($results_dir)) {
32  while (($file = readdir($dir_hndl)) !== false) {
33 
34  if (filetype("$results_dir/$file") != "file")
35  continue;
36 
37  // ** Check to see if it is an Alerts file
38  if (substr($file, 0, strlen($alerts_prefix)) == $alerts_prefix) {
39  if (!in_array($file, array("alerts.runslotlist.conf", "alerts.blacklist.conf"))) {
40  $alerts_list[] = $file;
41  }
42  } elseif (substr($file, 0, strlen($recur_prefix)) == $recur_prefix) {
43  // ** Check to see if it is an Recur file
44  $recur_list[] = $file;
45  }
46  }
47  closedir($dir_hndl);
48  }
49  // ** Order the array
50  rsort($alerts_list);
51  rsort($recur_list);
52  }
53 
54 
55  // ** This is the main page that will be used to select the report to view
56  print <<< print_html
57  <table cellpadding="3" cellspacing="0" border="0" width="500" class='dmsbg'>
58  <tr><td colspan='2' class='dtl'>
59  <a href="${produrl}/hcuadm/cuilist.prg" target="parent">Credit Union List</a></td></tr>
60 <tr><td width='50%'>
61  <table cellpadding="1" cellspacing="0" border="0" width="100%" bgcolor="white">
62  <tr>
63  <td colspan="2" class="bar" align="center">
64  Daily Alerts Reports
65  </td>
66  </tr>
67  <tr>
68  <td width='5%' align="right" class="hdr" valign='top'>
69  &nbsp;
70  </td>
71  <td width='*' nowrap class='dtll' valign='top'>
72 print_html;
73 
74  $cnt = 0;
75  foreach ($alerts_list as $value) {
76  $cnt++;
77  $year = substr($value,strlen($alerts_prefix), 4);
78  $mon = intval(substr($value, strlen($alerts_prefix) + 4, 2));
79  $day = intval(substr($value, strlen($alerts_prefix) + 6, 2));
80  $hour = intval(substr($value, strlen($alerts_prefix) + 8, 2));
81  $min = intval(substr($value, strlen($alerts_prefix) + 10, 2));
82 
83  $minute = intval(substr($value, strlen($alerts_prefix) + 10, 2));
84  # CALCULATE THE RUNSLOT value --
85  # if we decide to run on the half-hour, use $minute on the end to distinguish
86  # may have to use fancy math to round to 0 or 30, but anyway the minute is there
87  $runslot = strtoupper(date('D',mktime($hour,$minute,0,$mon,$day,$year)) . " " . sprintf("%02d:%02d", $hour, $min));
88 
89  $disp_value = date("F jS, Y", mktime(0, 0, 0, $mon, $day, $year));
90 
91  print "<br><a href='/hcuadm/tfiles.prg$view_dir/$value' title='$runslot'>Alerts $disp_value $runslot</a>";
92  }
93  print <<< print_html
94  </td>
95  </tr>
96  </table>
97  </td>
98  <td width='*' valign='top'>
99  <table cellpadding="1" cellspacing="0" border="0" width="100%" bgcolor="white">
100  <tr>
101  <td colspan="2" class="bar" align="center" nowrap>
102  Daily Recurring Reports
103  </td>
104  </tr>
105  <tr>
106  <td width='5%' align="right" class="hdr" valign='top'>
107  &nbsp;
108  </td>
109  <td width='*' nowrap class='dtl' valign='top'>
110 print_html;
111  $cnt = 0;
112  foreach ($recur_list as $value) {
113  $cnt++;
114  $year = substr($value,strlen($recur_prefix), 4);
115  $mon = intval(substr($value, strlen($recur_prefix) + 4, 2));
116  $day = intval(substr($value, strlen($recur_prefix) + 6, 2));
117  $disp_value = date("F jS, Y", mktime(0, 0, 0, $mon, $day, $year));
118  print "<br><a href='/hcuadm/tfiles.prg$view_dir/$value' >Recur Tx $disp_value</a>";
119  }
120  print <<< print_html
121  </td>
122  </tr>
123  </table>
124  </td></tr></table>
125  </body></html>
126 print_html;
127 ?>
128 
129