Odyssey
monitorView.i
1 <?php
2 /*
3  * Include File: monitorView
4  *
5  * Purpose: This include will have functions used for generating 'view' code.
6  *
7  *
8  */
9 
10 /* This will return the HTML of the menu bar from an array of options. It is called from printMonitorPageMiddle.
11  * The function recursively goes through an associate array. Each key in the array needs to have an array with configuration options.
12  * PARAMETERS:
13  * $options= associate array attached to arrays for configuration options.
14  * CONFIGURATION OPTIONS:
15  * id= id of the list item. You can then reference the id in code just like you would for any other HTML element with an id.
16  * url= The url that the list item will redirect to with a click.
17  * target= This corresponds to the target option in HTML a tags.
18  * text= The text of the list item. This is optional. If it is not present, then it uses the key.
19  * disabled= boolean option that when set will disable the item.
20  * noA= boolean option that when set will output the li only. (If there is no list, then a tag is created underneath li. Otherwise, kendo will falsely add an arrow to the item.)
21  * list= list of sub menu items. If this is set, then this function will be called for the subset. Therefore, all options are available to the submenu item.
22  * OUTPUT:
23  * Unordered list of the menu items. The outermost ul is not included. I.E. "<li>Redirect<ul><li><a href='url1' id='id1' target='target1'>Redirect1</a></li></ul></li>"
24  */
25 function getMenuBar($options)
26 {
27  $menuBar= "";
28  if (is_array($options))
29  {
30  foreach($options as $key => $config)
31  {
32  $id= isset($config["id"]) ? "id='" . $config["id"] . "'" : "";
33  $url= isset($config["url"]) ? "href='" . $config["url"] . "'" : "href='#'";
34  $target= isset($config["target"]) ? "target='" . $config["target"] . "'" : "";
35  $text= isset($config["text"]) ? $config["text"] : $key;
36  $disabled= isset($config["disabled"]) && $config["disabled"] ? "disabled='disabled'" : "";
37 
38  if (isset($config["list"]) && is_array($config["list"]))
39  {
40  $thisMenuBar= getMenuBar($config["list"]);
41  $menuBar.= "<li $id $disabled>$text<ul>$thisMenuBar</ul></li>";
42  }
43  else
44  {
45  $menuBar.= isset($config["noA"]) && $config["noA"] ? "<li $id $disabled>$text</li>" : "<li $disabled><a $id $url $target>$text</a></li>";
46  }
47  }
48  }
49 
50  return $menuBar;
51 }
52 
53 /* This prints out the middle portion of the monitor page. This includes the HTML of the menu bar, the closing of the header tag, and the opening of the body tag.
54  * The menu bar has the "Return to Monitor" link and the user can add additional menu options.
55  * PARAMETERS:
56  * $titleText= This text will show up in the header, $additionalMenuOptions= optional menu options see getMenuBar function above.
57  */
58 function printMonitorPageMiddle($titleText, $additionalMenuOptions= array(), $hideRedirect=false) {
59  global $produrl; // From cu_top
60  global $dev_mode; // From cu_top
61  $menuOptions= $hideRedirect ? array() : array("REDIRECT" => array("text" => "Jump to: ", "list" => array("Monitor" => array("url" => "$produrl/monitor/mindex.html", "target" => "_top"))));
62 
63  if (is_array($additionalMenuOptions))
64  {
65  foreach($additionalMenuOptions as $topLevel => $config)
66  {
67  if (!isset($menuOptions[$topLevel]))
68  $menuOptions[$topLevel]= array();
69  foreach($config as $key => $value)
70  {
71  if ($key == "list")
72  {
73  $list= isset($menuOptions[$topLevel]["list"]) ? $menuOptions[$topLevel]["list"] : array();
74  $menuOptions[$topLevel]["list"]= array_merge($list, $value);
75  }
76  else
77  $menuOptions[$topLevel][$key]= $value;
78  }
79  }
80  }
81 
82  $menuBar = "";
83  if (count($menuOptions) > 0)
84  {
85  $menuBar= "<ul id='topMenuBar'>";
86  $menuBar.= getMenuBar($menuOptions);
87  $menuBar.= "</ul>";
88  }
89 
90  if ($dev_mode) {
91  $environmentMsg= "(Development)";
92  $environmentClass= "dev";
93  } else {
94  $environmentMsg= "(Production)";
95  $environmentClass= "prod";
96  }
97  ?>
98 
99  </head>
100 
101  <body id="fixedBody">
102  <header id="commonMonitorHeader" class="<?php echo $environmentClass; ?>">
103  <div class="header-title"><?php echo $titleText ?></div>
104  <div id="environmentMsg"><?php echo $environmentMsg; ?></div>
105  <?php echo $menuBar; ?>
106  </header>
107  <div id="pageContents">
108 <?php }
109 
110 /* This prints out the top portion of the monitor page. This includes the meta tags, links to stylesheets and javascripts, and kendo initialization of the menu bar.
111  * PARAMETERS:
112  * $title= this text will show up at the top of the browser tab, $homecuKendoVersion= the version to pull in the right stylesheets, $cloudfrontDomainName= the link to where kendo files are located.
113  */
114 function printMonitorPageTop($title, $homecuKendoVersion, $cloudfrontDomainName, $bootstrapVersion = '', $fontawesomeVersion = '', $useBootStrap = false) {
115  global $useGZExt;
116 
117  $homecuKendoVersion = $homecuKendoVersion == "" ? GetHomecuKendoVersion() : $homecuKendoVersion;
118  $bootstrapVersion = $bootstrapVersion == "" ? GetHomecuBootstrapVersion() : $bootstrapVersion;
119  $fontawesomeVersion = $fontawesomeVersion == "" ? GetFontawesomeVersion() : $fontawesomeVersion;
120  $kendoStyle = GetMonitorDefaultKendoStyle();
121  $cloudfrontDomainName = $cloudfrontDomainName == "" ? GetCloudFrontDomainName() : $cloudfrontDomainName;
122 
123  $vendor_by_cu_css = (
124  preg_match('/TrustedVendorByCu.prg/', $_SERVER['SCRIPT_URL']) ||
125  preg_match('/TrustedVendorByCu.prg/', $_SERVER['SCRIPT_URI'])) ?
126  '<link href="/shared/static/css/trusted-report-by-vendor.css" rel="stylesheet">' :
127  null;
128 
129  if (!$useBootStrap) { // don't use bootstrap'
130  ?>
131 
132 
133 <!DOCTYPE html>
134 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
135  <head>
136  <title><?php echo $title; ?></title>
137  <meta http-equiv="X-UA-Compatible" content="IE=8" />
138 
139  <meta name="viewport" content="width=device-width, initial-scale=1" />
140 
141  <link rel="stylesheet" media="all" type="text/css" href="https://<?php echo $cloudfrontDomainName; ?>/homecu/css/reset.css" />
142 
143  <?php //KENDO UI CSS Includes ?>
144  <link href="https://<?php echo $cloudfrontDomainName; ?>/homecu/css/KendoUI/<?php echo $homecuKendoVersion; ?>/kendo.common.min.css" rel="stylesheet">
145  <link href="https://<?php echo $cloudfrontDomainName; ?>/homecu/css/KendoUI/<?php echo $homecuKendoVersion; ?>/kendo.<?php echo $kendoStyle; ?>.min.css" rel="stylesheet">
146  <link rel='stylesheet' media='all' type='text/css' href='https://<?php echo $cloudfrontDomainName; ?>/homecu/css/grid.css'>
147  <?php echo $vendor_by_cu_css; ?>
148  <link href="/shared/static/css/kendo.homecucustom.css" type="text/css" rel="stylesheet">
149  <script type="text/javascript" src="https://<?php echo $cloudfrontDomainName; ?>/jquery/js/jquery-1.10.2.min.js.gz"></script>
150  <!-- /* FONT AWESOME */ -->
151  <link href='https://d1kryjpwpzirc7.cloudfront.net/homecu/css/font-awesome/<?php echo $fontawesomeVersion; ?>/css/font-awesome.css' rel='stylesheet'/>
152  <?php //KENDO UI JS scripts ?>
153  <script src="https://<?php echo $cloudfrontDomainName; ?>/homecu/js/KendoUI/<?php echo $homecuKendoVersion; ?>/kendo.web.min.js"></script>
154  <script type="text/javascript" src="https://<?php echo $cloudfrontDomainName; ?>/homecu/js/hcuFormError.4091.min.js"></script>
155  <!--[if IE]>
156  <script type="text/javascript" src="https://<?php echo $cloudfrontDomainName; ?>/homecu/js/modernizr.min.js"></script>
157  <![endif]--><!-- ANY INTERNET EXPLORER -->
158  <script type='text/javascript' src='/shared/static/js/kendo.homecu.custom.js'></script>
159 
160  <link href="/monitor/css/monitor-core.css" type="text/css" rel="stylesheet">
161 
162  <script type="text/javascript">
163  $(document).ready(function () {
164  var topMenuBar= $("#topMenuBar").kendoMenu({
165 
166  }).data("kendoMenu");
167  });
168  </script>
169 <?php
170 
171  } else {
172 
173  /**
174  * STYLE SHEET INCLUDES
175  *
176  * RESET FORM STYLING TO CREATE CONSISTENT DISPLAY
177  */
178 print <<< HTML_DEPS
179 
180 <!DOCTYPE html>
181 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
182  <head>
183  <title>{$title}</title>
184  <meta http-equiv="X-UA-Coampatible" content="IE=8" />
185 
186  <meta name="viewport" content="width=device-width, initial-scale=1" />
187 
188  <link rel='stylesheet' media='all' type='text/css' href='https://{$cloudfrontDomainName}/homecu/css/reset.4085.min.css' />
189 
190  <!-- BASE BOOTSTRAP -->
191  <link href='https://cucommon.s3.amazonaws.com/homecu/css/bootstrap/{$bootstrapVersion}/css/bootstrap.css' rel='stylesheet'/>
192 
193  <!-- KENDO BOOTSTRAP COMMON STYLES - - REPLACES kendo.common.css -->
194  <link href='https://cucommon.s3.amazonaws.com/homecu/css/KendoUI/{$homecuKendoVersion}/kendo.common-bootstrap.min.css' rel='stylesheet'/>
195 
196  <!-- KENDO BOOTSTRAP THEME */ -->
197  <link href='https://{$cloudfrontDomainName}/homecu/css/KendoUI/{$homecuKendoVersion}/kendo.$kendoStyle.min.css' rel='stylesheet'/>
198 
199  <!-- /* CUSTOM KENDO BOOTSTRAP STYLING */ -->
200  <link rel='stylesheet' media='all' type='text/css' href='/shared/static/css/homecu-custom-kendo-boot.css' />
201 
202  <!-- /* SAMPLE BOOTSTRAP BASE LAYOUT */ -->
203  <!-- <link rel='stylesheet' media='all' type='text/css' href='/_static/css/site.css' /> -->
204 
205  <!-- /* HOMECU BASE LAYOUT */ -->
206  <link rel='stylesheet' media='all' type='text/css' href='/shared/static/css/hcuLayout.css' />
207  <link rel='stylesheet' media='all' type='text/css' href='/monitor/css/layout.css' />
208 
209  <!-- /* FONT AWESOME */ -->
210  <link href='https://{$cloudfrontDomainName}/homecu/css/font-awesome/{$fontawesomeVersion}/css/font-awesome.css' rel='stylesheet'/>
211 
212  <!-- /* CREDIT UNION BRANDING CUSTOM STYLES */ -->
213  <link rel='stylesheet' media='all' type='text/css' href='/monitor/css/brand.css' />
214 
215  <!-- /**
216  * JAVASCRIPT INCLUDES
217  */
218  /* JQUERY BASE */ -->
219  <script type='text/javascript' src='https://{$cloudfrontDomainName}/jquery/js/jquery-1.10.2.min.js{$useGZExt}'></script>
220 
221  <!-- /* KENDO FULL WIDGET INCLUDE - - CREATE CUSTOM FOR PRODUCTION */ -->
222  <script src='https://{$cloudfrontDomainName}/homecu/js/KendoUI/{$homecuKendoVersion}/kendo.web.min.js'></script>
223  <!-- /* BOOTSTRAP JAVASCRIPT */ -->
224  <script src='https://cucommon.s3.amazonaws.com/homecu/js/bootstrap/{$bootstrapVersion}/js/bootstrap.js'></script>
225 
226  <!-- /* JQUERY COOKIE */ -->
227  <script type='text/javascript' src='https://{$cloudfrontDomainName}/homecu/js/jquery.cookie.js'></script>
228 
229  <!-- /* HOMECU CUSTOM ERRORS FOR FORMS */ -->
230  <script type='text/javascript' src='/shared/static/js/hcuFormError.js'></script>
231 
232  <!-- /* HOMECU CUSTOM NOTICES FOR FORMS - - PROVIDES CHAINING*/ -->
233  <script type='text/javascript' src='/banking/static/js/hcuFormNotice.js'></script>
234 
235  <!-- /* HOMECU CUSTOM KENDO SETTINGS */ -->
236  <script type='text/javascript' src='/shared/static/js/kendo.homecu.custom.js'></script>
237 
238  <link href="/monitor/css/monitor-core.css" type="text/css" rel="stylesheet">
239 
240 HTML_DEPS;
241 
242  /*
243  * SECTION FOR DECENDING DEPENDENCIES TO SHOW BASED ON NEED
244  */
245 
246 ?>
247 
248 <script type="text/javascript">
249  $(document).ready(function () {
250  var topMenuBar= $("#topMenuBar").kendoMenu({
251 
252  }).data("kendoMenu");
253  });
254 </script>
255 <?php
256 }
257 }
258 
259 /* This prints out the bottom portion of the monitor page. There is nothing there now but that could change.
260  */
261 function printMonitorPageBottom()
262 { ?>
263  </div>
264  </body>
265 </html>
266 
267 <?php }