exclude local non-practitioners from the address book
[openemr.git] / interface / usergroup / addrbook_list.php
blob8057d201100de2d1335a2a10e959d850d507fbef
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 active = 1 AND ( authorized = 1 OR username = '' ) ";
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='<?php echo $css_header ?>' type='text/css'>
28 <title><?php xl('Address Book','e'); ?></title>
30 <!-- style tag moved into proper CSS file -->
32 <script type="text/javascript" src="../../library/dialog.js"></script>
34 <script language="JavaScript">
36 // Callback from popups to refresh this display.
37 function refreshme() {
38 // location.reload();
39 document.forms[0].submit();
42 // Process click to pop up the add/edit window.
43 function doedclick(userid) {
44 dlgopen('addrbook_edit.php?userid=' + userid, '_blank', 700, 550);
47 </script>
49 </head>
51 <body class="body_top">
53 <div id="addressbook_list">
54 <form method='post' action='addrbook_list.php'>
56 <table>
57 <tr class='search'> <!-- bgcolor='#ddddff' -->
58 <td>
59 <?php xl('First Name:','e')?>
60 <input type='text' name='form_fname' size='10' value='<?php echo $form_fname; ?>'
61 class='inputtext' title='<?php xl("All or part of the first name","e") ?>' />&nbsp;
62 <?php xl('Last Name:','e')?>
63 <input type='text' name='form_lname' size='10' value='<?php echo $form_lname; ?>'
64 class='inputtext' title='<?php xl("All or part of the last name","e") ?>' />&nbsp;
65 <?php xl('Specialty:','e')?>
66 <input type='text' name='form_specialty' size='10' value='<?php echo $form_specialty; ?>'
67 class='inputtext' title='<?php xl("Any part of the desired specialty","e") ?>' />&nbsp;&nbsp;
68 <input type='submit' class='button' name='form_search' value='<?php xl("Search","e")?>' />
69 </td>
70 <td align='right'>
71 <input type='button' class='button' value='Add New' onclick='doedclick(0)' />
72 </td>
73 </tr>
74 </table>
76 <table>
77 <tr class='head'>
78 <td title='Click to view or edit'><?php xl('Name','e'); ?></td>
79 <td><?php xl('Local','e'); ?></td><!-- empty for external -->
80 <td><?php xl('Specialty','e'); ?></td>
81 <td><?php xl('Phone','e'); ?></td>
82 <td><?php xl('Mobile','e'); ?></td>
83 <td><?php xl('Fax','e'); ?></td>
84 <td><?php xl('Email','e'); ?></td>
85 <td><?php xl('Street','e'); ?></td>
86 <td><?php xl('City','e'); ?></td>
87 <td><?php xl('State','e'); ?></td>
88 <td><?php xl('Postal','e'); ?></td>
89 </tr>
91 <?php
92 $encount = 0;
93 while ($row = sqlFetchArray($res)) {
94 ++$encount;
95 //$bgcolor = "#" . (($encount & 1) ? "ddddff" : "ffdddd");
96 $bgclass = (($encount & 1) ? "evenrow" : "oddrow");
97 $username = $row['username'];
98 if (! $row['active']) $username = '--';
99 $trTitle = "Edit ". $row['fname'] . ' ' . $row['mname'] . $row['lname'];
100 echo " <tr class='detail $bgclass' style='cursor:pointer' " .
101 "onclick='doedclick(" . $row['id'] . ")' title='$trTitle'>\n";
102 echo " <td>" . $row['lname'] . ', ' . $row['fname'] . ' ' . $row['mname'] . "</td>\n";
103 echo " <td>" . ($username ? '*' : '') . "</td>\n";
104 echo " <td>" . $row['specialty'] . "</td>\n";
105 echo " <td>" . $row['phonew1'] . "</td>\n";
106 echo " <td>" . $row['phonecell'] . "</td>\n";
107 echo " <td>" . $row['fax'] . "</td>\n";
108 echo " <td>" . $row['email'] . "</td>\n";
109 echo " <td>" . $row['street'] . "</td>\n";
110 echo " <td>" . $row['city'] . "</td>\n";
111 echo " <td>" . $row['state'] . "</td>\n";
112 echo " <td>" . $row['zip'] . "</td>\n";
113 echo " </tr>\n";
116 </table>
118 </body>
119 </html>