Odyssey
cuAdmUsers.prg
1 <?php
2 /* This is a helper routine that is called by an iFrame to supply contact info from the cuadminusers table.
3  * History:
4  * 05/02/13 mbl - created.
5  */
6  $monLibrary= dirname(__FILE__) . "/../library";
7  require_once("$monLibrary/cu_top.i");
8  require_once("$monLibrary/ck_hticket.i");
9 
10  if (!CheckPerm($link, $Hu, basename($_SERVER['SCRIPT_NAME']), $_SERVER['REMOTE_ADDR'])) {
11  // ** Permissions failed
12  // ** redirect to new page
13  header("Location: /hcuadm/hcu_noperm.prg");
14  exit;
15  }
16 
17  $dms_ok=array('cu'=>'string');
18  dms_import($dms_ok);
19 
20  $dbh = $link;
21 
22  $cu = strtoupper($cu);
23  $contactsArray = Array();
24  if ($cu != '') {
25 
26  $sql = "SELECT user_name, realname, email
27  FROM cuadminusers
28  WHERE cu = '" . prep_save($cu, 12) . "'
29  ORDER by user_name ";
30  $contact_rs = db_query($sql, $dbh);
31 
32  $row_idx = 0;
33  while ($contact_row = db_fetch_array($contact_rs, $row_idx)) {
34  $contactsArray[] = Array( "username"=>trim($contact_row['user_name']),
35  "realname"=>trim($contact_row['realname']),
36  "email"=>trim($contact_row['email']));
37  $row_idx++;
38  }
39  }
40 
41  if ($row_idx > 0) {
42  print <<< print_html
43  <html>
44  <title>Credit Union Admin Contacts</title>
45  <body>
46  <LINK REL=stylesheet HREF="/monitor/css/monitor.css" TYPE="text/css">
47  <table width="100%" border=0 cellspacing=0 cellpadding=2>
48  <tr>
49  <td class="dtl">
50  <span style="font-weight:bold">Login Name</span>
51  </td>
52  <td class="dtl">
53  <span style="font-weight:bold">Full Name</span>
54  </td>
55  <td class="dtl" nowrap>
56  <span style="font-weight:bold">E-Mail</span>
57  </td>
58  </tr>
59 print_html;
60 
61  // ** LOOP THROUGH EACH OF THE items in the array
62  foreach ($contactsArray as $key=>$ContactInfo) {
63 
64  $disp_login = dms_disphtml($ContactInfo['username']);
65  $disp_name = dms_disphtml($ContactInfo['realname']);
66  $disp_email = dms_disphtml($ContactInfo['email']);
67  $class_tr = (isset($class_tr) && $class_tr == "odd" ? "even" : "odd");
68  print <<< print_html
69  <tr class='$class_tr'>
70  <td class="dtl $class_tr">$disp_login</td>
71  <td class="dtl $class_tr">$disp_name</td>
72  <td class="dtl $class_tr">$disp_email</td>
73  </tr>
74 print_html;
75 
76 
77  }
78 
79  print "</table></body></html>";
80  } else {
81  // * NO ROWS -- DISPLAY SUCH
82  print "There are no credit union maintained contacts.";
83  }
84 
85 ?>