address book based on users table
[openemr.git] / interface / usergroup / addrbook_list.php
blob6237bed40fe6fa449a6f2b909b9b038a75d97fa5
1 <?php
2 // Copyright (C) 2006 Rod Roark <rod@sunsetsystems.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 require_once("../globals.php");
10 require_once("$srcdir/acl.inc");
12 $form_fname = trim($_POST['form_fname']);
13 $form_lname = trim($_POST['form_lname']);
14 $form_specialty = trim($_POST['form_specialty']);
16 $query = "SELECT * FROM users WHERE 1 = 1 ";
17 if ($form_lname) $query .= "AND lname LIKE '$form_lname%' ";
18 if ($form_fname) $query .= "AND fname LIKE '$form_fname%' ";
19 if ($form_specialty) $query .= "AND specialty LIKE '%$form_specialty%' ";
20 $query .= "ORDER BY lname, fname, mname LIMIT 500";
21 $res = sqlStatement($query);
23 <html>
25 <head>
27 <link rel=stylesheet href='<? echo $css_header ?>' type='text/css'>
28 <title><?php xl('Address Book','e'); ?></title>
30 <style>
31 td {
32 font-family: Arial, Helvetica, sans-serif;
33 padding-left: 4px;
34 padding-right: 4px;
36 a, a:visited, a:hover {
37 color:#0000cc;
39 tr.search {
40 font-size:9pt;
41 font-weight:bold;
43 tr.head {
44 font-size:10pt;
45 background-color:#cccccc;
46 font-weight:bold;
48 tr.detail {
49 font-size:10pt;
52 .inputtext {
53 font-family:monospace;
54 font-size:9pt;
55 font-weight:normal;
56 border-style:solid;
57 border-width:1px;
59 border-top-width:0px;
60 border-bottom-width:1px;
61 border-left-width:0px;
62 border-right-width:0px;
64 border-color: #000000;
65 background-color:transparent;
68 .button {
69 font-family:sans-serif;
70 font-size:8pt;
71 font-weight:bold;
73 </style>
75 <script type="text/javascript" src="../../library/dialog.js"></script>
77 <script language="JavaScript">
79 // Callback from popups to refresh this display.
80 function refreshme() {
81 // location.reload();
82 document.forms[0].submit();
85 // Process click to pop up the add/edit window.
86 function doedclick(userid) {
87 dlgopen('addrbook_edit.php?userid=' + userid, '_blank', 700, 450);
90 </script>
92 </head>
94 <body <?echo $top_bg_line;?>>
96 <form method='post' action='addrbook_list.php'>
98 <table border='0' cellpadding='5' cellspacing='0' width='100%'>
99 <tr>
100 <td height="1" colspan="2">
101 </td>
102 </tr>
103 <tr class='search'> <!-- bgcolor='#ddddff' -->
104 <td>
105 <?xl('First Name:','e')?>
106 <input type='text' name='form_fname' size='10' value='<?php echo $form_fname; ?>'
107 class='inputtext' title='<?php xl("All or part of the first name","e") ?>' />&nbsp;
108 <?xl('Last Name:','e')?>
109 <input type='text' name='form_lname' size='10' value='<?php echo $form_lname; ?>'
110 class='inputtext' title='<?php xl("All or part of the last name","e") ?>' />&nbsp;
111 <?xl('Specialty:','e')?>
112 <input type='text' name='form_specialty' size='10' value='<?php echo $form_specialty; ?>'
113 class='inputtext' title='<?php xl("Any part of the desired specialty","e") ?>' />&nbsp;&nbsp;
114 <input type='submit' class='button' name='form_search' value='<?xl("Search","e")?>' />
115 </td>
116 <td align='right'>
117 <input type='button' class='button' value='Add New' onclick='doedclick(0)' />
118 </td>
119 </tr>
120 <tr>
121 <td height="1" colspan="2">
122 </td>
123 </tr>
124 </table>
126 <table width='100%' cellpadding='1' cellspacing='2'>
127 <tr class='head'>
128 <td title='Click to view or edit'><?php xl('Name','e'); ?></td>
129 <td><?php xl('Login','e'); ?></td><!-- empty for external -->
130 <td><?php xl('Specialty','e'); ?></td>
131 <td><?php xl('Phone','e'); ?></td>
132 <td><?php xl('Fax','e'); ?></td>
133 <td><?php xl('Email','e'); ?></td>
134 <td><?php xl('Street','e'); ?></td>
135 <td><?php xl('City','e'); ?></td>
136 <td><?php xl('State','e'); ?></td>
137 <td><?php xl('Postal','e'); ?></td>
138 </tr>
139 <?php
140 $encount = 0;
141 while ($row = sqlFetchArray($res)) {
142 ++$encount;
143 $bgcolor = "#" . (($encount & 1) ? "ddddff" : "ffdddd");
144 $username = $row['username'];
145 if (! $row['active']) $username = '--';
146 echo " <tr class='detail' bgcolor='$bgcolor' style='cursor:pointer' " .
147 "onclick='doedclick(" . $row['id'] . ")'>\n";
148 echo " <td>" . $row['lname'] . ', ' . $row['fname'] . ' ' . $row['mname'] . "</td>\n";
149 echo " <td>" . $username . "</td>\n";
150 echo " <td>" . $row['specialty'] . "</td>\n";
151 echo " <td>" . $row['phonew1'] . "</td>\n";
152 echo " <td>" . $row['fax'] . "</td>\n";
153 echo " <td>" . $row['email'] . "</td>\n";
154 echo " <td>" . $row['street'] . "</td>\n";
155 echo " <td>" . $row['city'] . "</td>\n";
156 echo " <td>" . $row['state'] . "</td>\n";
157 echo " <td>" . $row['zip'] . "</td>\n";
158 echo " </tr>\n";
161 </table>
163 </body>
164 </html>