Odyssey
hcu_prod_list.prg
1 <?php
2 $monLibrary= dirname(__FILE__) . "/../library";
3 require_once("$monLibrary/cu_top.i");
4 require_once("$monLibrary/ck_hticket.i");
5 
6  if (!CheckPerm($link, $Hu, basename($_SERVER['SCRIPT_NAME']), $_SERVER['REMOTE_ADDR'])) {
7  // ** Permissions failed
8  // ** redirect to new page
9  header("Location: /hcuadm/hcu_noperm.prg");
10  exit;
11  }
12 
13 $dms_ok=array('mode'=>'string','hcu_code'=>'string','form_err'=>'string');
14 dms_import($dms_ok);
15 
16  if (!isset($mode) || $mode == '')
17  $mode = "MENU";
18 
19  if ($mode == "DELETE") {
20  // Delete Alert
21  $sql = "DELETE
22  FROM cuprodlist
23  WHERE home_cu_code = '" . prep_save($hcu_code) . "' ";
24  $del_rs = db_query($sql, $link);
25 
26  if ($del_rs)
27  $msg = "Home CU Product deleted successfully!";
28  else
29  $msg = "Problem deleting product, please try again.";
30 
31  $mode = "MENU";
32  }
33 
34  switch ($mode) {
35  case "CONF":
36  // Confirm Deletion of the Product Code
37  print <<< print_html
38  <form action="/hcuadm/hcu_prod_list.prg" method="post">
39  <input type="hidden" name="mode" value="DELETE">
40  <input type="hidden" name="hcu_code" value="{$hcu_code}">
41 
42  <table width="50%" cellpadding=3 cellspacing=0 align="center" class='dmsbg'><tr><td>
43  <table width="100%" cellpadding=1 cellspacing=0 align="center" bgcolor=white>
44  <tr>
45  <td CLASS="barb" nowrap>
46  Delete Homecu Product Code
47  </td>
48  </tr>
49  <tr>
50  <td class="">
51  <table border=0 cellpadding=2 cellspacing=0 width="100%">
52  <tr>
53  <td class="hdr" align="center">
54  You are about to delete a home cu product code, <br>
55  this may cause irratic behavior.<br>
56  <br>Are you sure you want to continue?
57  <br>
58  <hr>
59  <input type="submit" name="btnDelete" value="Sure">
60  <input type="button" name="btnCancel" value="I better think twice" onClick="document.location='/hcuadm/hcu_prod_list.prg'">
61  </td>
62  </tr>
63  </table>
64  </td>
65  </table>
66  </td></tr></table>
67  </form>
68 print_html;
69  break;
70  case "DELETE":
71 
72  break;
73  case "MENU":
74 
75  cu_header('Home CU - Products');
76 ?>
77  <form>
78 
79  <?php
80  // Connect to the data and retrieve the current list of Home CU Products
81  $query = "SELECT * FROM cuprodlist ORDER BY home_cu_desc";
82  $prod_result = db_query($query, $link);
83 
84  ?>
85 
86  <!-- Print out the top of the table -->
87 
88  <table border="0" cellpadding="3" cellspacing="0" align="center" class="dmsbg"><tr><td>
89  <table border="0" cellpadding="1" cellspacing="0" align="center" bgcolor=white
90  <?php if (isset($msg) && strlen($msg) > 0): ?>
91  <tr>
92  <td colspan="4" class="dtl" align="center">
93  <font color="red"><?php echo $msg; ?></font>
94  </td>
95  </tr>
96  <?php endif; ?>
97  <tr>
98  <td colspan="4" class="bar" align="center">
99  HOME CU PRODUCTS LIST
100  </td>
101  </tr>
102  <tr>
103  <td class="hdr" align="center">
104  Home CU Product Code
105  </td>
106  <td class="hdr" align="center">
107  Product Description
108  </td>
109  <td class="hdr" align="center">
110  Select
111  </td>
112  </tr>
113  <?php
114  $RGB = "odd";
115  $row = 0;
116  while ($prod_row = db_fetch_object($prod_result, $row)):
117  $row++;
118  ?>
119  <tr class="<?php echo $RGB; ?>">
120  <td nowrap >
121  <?php echo trim($prod_row->home_cu_code) ?>
122  </td>
123  <td nowrap >
124  <?php echo trim($prod_row->home_cu_desc) ?>
125  </td>
126  <td nowrap >
127  <a href="hcu_prod_edit.prg?home_cu_code=<?php echo trim($prod_row->home_cu_code) ?>">Edit</a>
128  &nbsp;|&nbsp;
129  <a href="/hcuadm/hcu_prod_list.prg?mode=CONF&hcu_code=<?php echo trim($prod_row->home_cu_code) ?>">Delete</a>
130  </td>
131  </tr>
132  <?php
133  $RGB = ($RGB == "odd" ? "even" : "odd");
134  endwhile; ?>
135 
136  <tr>
137  <td colspan="3">
138  <a href="home_cu_prod.prg">Add Home CU Product</a>
139  <br>
140  <a href="/monitor/mindex.html" target="_top">Main Credit Union List</a>
141  </td>
142  </tr>
143  </table>
144  </td></tr></table>
145 
146  </form>
147  </body>
148 </html>
149 <?php
150  break;
151  }
152 ?>