Odyssey
cucontactafter.prg
1 <?php
2 $monLibrary= dirname(__FILE__) . "/../library";
3 require_once("$monLibrary/cu_top.i");
4 require_once("$monLibrary/ck_hticket.i");
5 
6 
7  if (!CheckPerm($link, $Hu, basename($_SERVER['SCRIPT_NAME']), $_SERVER['REMOTE_ADDR'])) {
8  // ** Permissions failed
9  // ** redirect to new page
10  header("Location: /hcuadm/hcu_noperm.prg");
11  exit;
12  }
13 
14  $dms_ok=array('cu'=>'string');
15  dms_import($dms_ok);
16 
17  $dbh = $link;
18 
19  $chome = $cu;
20 
21  $AfterHoursAry = Array();
22  if ($chome != '') {
23 
24  $sql = "SELECT *
25  FROM cucontact
26  WHERE user_name = '" . prep_save($chome, 12) . "'
27  ORDER by user_name, priority ";
28  $contact_rs = db_query($sql, $dbh);
29 
30 
31  $row_idx = 0;
32  while ($contact_row = db_fetch_array($contact_rs, $row_idx)) {
33  $AfterHoursAry[] = Array("Priority"=>trim($contact_row['priority']),
34  "Name"=>trim($contact_row['name']),
35  "Phone"=>trim($contact_row['phone']),
36  "Comments"=>trim($contact_row['comments']));
37  $row_idx++;
38  }
39  }
40 
41  if ($row_idx > 0) {
42  print <<< print_html
43  <html>
44  <title>After Hours 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">Priority</span>
51  </td>
52  <td class="dtl">
53  <span style="font-weight:bold">Name</span>
54  </td>
55  <td class="dtl" nowrap>
56  <span style="font-weight:bold">Phone</span>
57  </td>
58  <td class="dtl">
59  <span style="font-weight:bold">Comments</span>
60  </td>
61  </tr>
62 print_html;
63 
64  // ** LOOP THROUGH EACH OF THE items in the array
65 
66  foreach ($AfterHoursAry as $key=>$ContactInfo) {
67 
68  $disp_priority = dms_disphtml($ContactInfo['Priority']);
69  $disp_name = dms_disphtml($ContactInfo['Name']);
70  $disp_phone = dms_disphtml($ContactInfo['Phone']);
71  $disp_comments = dms_disphtml($ContactInfo['Comments']);
72  $class_tr = (isset($class_tr) && $class_tr == "odd" ? "even" : "odd");
73  print <<< print_html
74  <tr class='$class_tr'>
75  <td class="dtl $class_tr">$disp_priority</td>
76  <td class="dtl $class_tr">$disp_name</td>
77  <td class="dtl $class_tr">$disp_phone</td>
78  <td class="dtl $class_tr">$disp_comments</td>
79  </tr>
80 print_html;
81 
82 
83  }
84 
85 
86  print "</table></body></html>";
87  } else {
88  // * NO ROWS -- DISPLAY SUCH
89  print "There are no entries for after hours support.";
90  }
91 
92 ?>