Odyssey
hcuAccountStatus.prg
1 <?php
2  /*
3  * File: hcuAccountStatus.prg
4  *
5  * Purpose: Return formatted html for displaying account status information.
6  * This is used so the platform displaying doesn't have to worry
7  * about how to gather the information but can just show the
8  * content as some form of a web view / iframe / page.
9  *
10  */
11 
12 
13  // ** SET SCRIPT LEVEL VARIABLES
14  $serviceShowInfo = false;
15  $serviceLoadMenu = false;
16  $serviceShowMenu = false;
17  $serviceAllowReadonly = true;
18 
19  // ** INCLUDE MAIN GLOBAL SCRIPT -- Handles security / global variable values
20  require_once(dirname(__FILE__) . '/../library/hcuService.i');
21 
22  /*
23  * ** CHECK USER FEATURE PERMISSIONS **
24  * NOTE: DOES NOT RETURN ON FAILURE
25  */
26  PermCheckFeatureScreen($dbh, $HB_ENV, $MC, FEATURE_BASIC);
27 
28 
29  // ** INSERT BUSINESS LOGIC FOR THIS FORM
30  $Cu = $HB_ENV["Cu"];
31  $Cn = $HB_ENV["Cn"];
32  $chome = $HB_ENV["chome"];
33  $Flang = $HB_ENV["Flang"];
34 
35  // ** SET VARIABLES FOR WEBSITE FLAGS
36 
37 
38  // ** INCLUDE PRE CONTENT SCRIPT
39  $serviceSuppressBanner = true;
40  require_once(dirname(__FILE__) . '/../includes/hcuPreContent.i');
41 
42  /********* functions ************/
43 
44  /********* end functions ********/
45 
46  try {
47  $Flang = (trim($Flang) == "" ? "en_US" : trim($Flang));
48 
49  if ( $HB_ENV['offline'] != "N" ) {
50  $thisPageErrors = $HB_ENV["offlinemsg"];
51  throw new Exception( HCU_JsonEncode( $thisPageErrors ) );
52  }
53 
54 
55  // figure out the last successful login time
56  $loginPriorString = "";
57  $loginPriorTime = 0;
58  if ( HCU_array_key_value("Fplog", $HB_ENV) ) {
59  if ( $HB_ENV['Fplog'] == 'None' ) {
60  // use the defaults
61  } else {
62  $loginPriorTime = strtotime( $HB_ENV['Fplog'] );
63  $loginPriorString = date("D M d, Y h:ia", $loginPriorTime);
64  }
65  }
66 
67  // figure out the last failed login time
68  $loginFailString = "";
69  $loginFailTime = 0;
70  if ( HCU_array_key_value("Fflog", $HB_ENV) ) {
71  if ( $HB_ENV['Fflog'] == 'None' ) {
72  // use the defaults
73  } else {
74  $loginFailTime = strtotime( $HB_ENV['Fflog'] );
75  $loginFailString = date("D M d, Y h:ia", $loginFailTime);
76  }
77  }
78 
79  if ( $loginPriorString != '' && $loginFailString != '' ) {
80  // if the failed login is > than the last login, then set the notify
81  if ( $loginFailTime >= $loginPriorTime ) {
82  $infoFailNotify = true;
83  }
84  } else if ( $loginFailString != '' ) {
85  $infoFailNotify = true;
86  }
87 
88  // ** Check for data being stale
89  if ($HB_ENV['live']) {
90  $curPacketStatusAry = HCU_array_key_value('packetStatus', $HB_ENV);
91  // ** If status is 200, 201, 202 then report stale data
92  //if ($HB_ENV['packetStatus']['status'] == '200' || $HB_ENV['packetStatus']['status'] == '201' || $HB_ENV['packetStatus']['status'] == '202' || $HB_ENV['packetStatus']['status'] == '999') {
93  // ** 200, 201, 202 are no longer used. Ignore. Treat as bad response
94  if (in_array(HCU_array_key_value('status', $curPacketStatusAry), Array('999'))) {
95  $infoDataNotify = true;
96  // * *Suspend notices here
97  $suspendNotices = true;
98  }
99  }
100 
101  $lastUpdateTime = 0;
102  $lastUpdateString = "None";
103  if ( HCU_array_key_value("lastupdate", $HB_ENV) ) {
104  $lastDataTime = strtotime( $HB_ENV['lastupdate'] );
105  $lastDataString = date("D M d, Y h:ia", $lastDataTime);
106  }
107 
108 
109  $infoIconNotify = ($infoDataNotify || $infoFailNotify);
110 
111  /* Set Last Data Message */
112  if ($infoDataNotify) {
113  if ($HB_ENV['packetStatus']['status'] == '999') {
114 
115  $displayLastDataMsg = <<< DATAMSG
116  {$MC->msg('Unable to load')}:
117  <!--<br/>
118  {$MC->msg('Credit Union responded')}:{$HB_ENV['packetStatus']['reason']} ({$HB_ENV['packetStatus']['status']})-->
119  <Br/>
120  {$MC->msg('Please try again later')}
121 DATAMSG;
122  } else {
123  $displayLastDataMsg = <<< DATAMSG
124  {$MC->msg('Credit Union not responding')}
125 DATAMSG;
126  }
127  } else {
128  $displayLastDataMsg = $HB_ENV['lastupdate'];
129  }
130 
131 ?>
132  <div class="container-fluid" style='font-size:12px;'>
133  <div class="col-xs-12">
134  <!-- FORM DATA -->
135  <div class="form-group ">
136  <div class=" k-block <?php echo ($infoFailNotify ? 'hcu-warning-color' : ''); ?>">
137  <div class="hcu-summary-block">
138  <div class="summary-row">
139  <div class="summary-desc">
140  <label class="control-label"><?php echo $MC->msg('Failed Login'); ?></label>
141  </div>
142  <div class="summary-value">
143  <p class="form-control-static"><?php echo $loginFailString; ?></p>
144  </div>
145  </div>
146  </div>
147  </div>
148  </div>
149  <div class="form-group ">
150  <div class="k-block ">
151  <div class="hcu-summary-block">
152  <div class="summary-row">
153  <div class="summary-desc">
154  <label class="control-label"><?php echo $MC->msg('Last Login'); ?></label>
155  </div>
156  <div class="summary-value">
157  <p class="form-control-static"><?php echo $loginPriorString; ?></p>
158  </div>
159  </div>
160  </div>
161  </div>
162  </div>
163  <?php if ($infoDataNotify || !$HB_ENV['live']): ?>
164  <div class="form-group ">
165  <div class=" k-block <?php echo ($infoDataNotify ? 'hcu-warning-color' : ''); ?>">
166  <div class="hcu-summary-block">
167  <div class="summary-row">
168  <?php if (!$HB_ENV['live']): ?>
169  <div class="summary-desc">
170  <label class="control-label"><?php echo $MC->msg('Account Status as of'); ?></label>
171  </div>
172  <div class="summary-value">
173  <p class="form-control-static"><?php echo $lastDataString; ?></p>
174  </div>
175  <?php elseif ($infoDataNotify): ?>
176  <div class="summary-value hcu-row-block">
177  <p class="form-control-static">
178  <?php echo $displayLastDataMsg; ?>
179  </p>
180  </div>
181  <?php endif; ?>
182  </div>
183  </div>
184  </div>
185  </div>
186  <?php endif; ?>
187  </div>
188  </div>
189 
190  <script>
191  $(document).ready(function() {
192  $("footer").hide();
193  $("#header").hide();
194  $("#main-container").css("min-height", "0px");
195  $("#content-wrapper").css("height", "auto");
196  $("#body-wrapper").css("height", "auto");
197  });
198  </script>
199 
200 <?php
201  /*
202  * ** END CONTENT
203  */
204  } catch (Exception $ex) {
205  //Return error message
206  $thisPageErrors = HCU_JsonDecode($ex->getMessage());
207 
208  // ** Handle Errors on this screen
209  // NOTE: the error(s) will be in a specific variable
210  $serviceErrorCode = '917';
211  $serviceErrorMsgs = $thisPageErrors;
212 
213  require_once(dirname(__FILE__) . '/../includes/hcuErrorPage.i');
214  // drop through to close the page
215  }
216 
217  // ** INCLUDE POST CONTENT SCRIPT
218  require_once(dirname(__FILE__) . '/../includes/hcuPostContent.i');
219 
220 
221  // Functions