Updated documentation.
[openemr.git] / interface / usergroup / addrbook_list.php
blob02bc486ad84c68f5fa731dd2d8ed6a9d910fa71b
1 <?php
2 // Copyright (C) 2006-2008 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 $popup = empty($_GET['popup']) ? 0 : 1;
14 $form_fname = trim($_POST['form_fname']);
15 $form_lname = trim($_POST['form_lname']);
16 $form_specialty = trim($_POST['form_specialty']);
18 $query = "SELECT * FROM users WHERE active = 1 AND ( authorized = 1 OR username = '' ) ";
19 if ($form_lname) $query .= "AND lname LIKE '$form_lname%' ";
20 if ($form_fname) $query .= "AND fname LIKE '$form_fname%' ";
21 if ($form_specialty) $query .= "AND specialty LIKE '%$form_specialty%' ";
22 $query .= "ORDER BY lname, fname, mname LIMIT 500";
23 $res = sqlStatement($query);
25 <html>
27 <head>
29 <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
30 <title><?php xl('Address Book','e'); ?></title>
32 <!-- style tag moved into proper CSS file -->
34 <?php if ($popup) { ?>
35 <script type="text/javascript" src="../../library/topdialog.js"></script>
36 <?php } ?>
37 <script type="text/javascript" src="../../library/dialog.js"></script>
39 <script language="JavaScript">
41 <?php if ($popup) require($GLOBALS['srcdir'] . "/restoreSession.php"); ?>
43 // Callback from popups to refresh this display.
44 function refreshme() {
45 // location.reload();
46 document.forms[0].submit();
49 // Process click to pop up the add/edit window.
50 function doedclick(userid) {
51 dlgopen('addrbook_edit.php?userid=' + userid, '_blank', 700, 550);
54 </script>
56 </head>
58 <body class="body_top">
60 <div id="addressbook_list">
61 <form method='post' action='addrbook_list.php'>
63 <table>
64 <tr class='search'> <!-- bgcolor='#ddddff' -->
65 <td>
66 <?php xl('First Name:','e')?>
67 <input type='text' name='form_fname' size='10' value='<?php echo $form_fname; ?>'
68 class='inputtext' title='<?php xl("All or part of the first name","e") ?>' />&nbsp;
69 <?php xl('Last Name:','e')?>
70 <input type='text' name='form_lname' size='10' value='<?php echo $form_lname; ?>'
71 class='inputtext' title='<?php xl("All or part of the last name","e") ?>' />&nbsp;
72 <?php xl('Specialty:','e')?>
73 <input type='text' name='form_specialty' size='10' value='<?php echo $form_specialty; ?>'
74 class='inputtext' title='<?php xl("Any part of the desired specialty","e") ?>' />&nbsp;&nbsp;
75 <input type='submit' class='button' name='form_search' value='<?php xl("Search","e")?>' />
76 </td>
77 <td align='right'>
78 <input type='button' class='button' value='Add New' onclick='doedclick(0)' />
79 </td>
80 </tr>
81 </table>
83 <table>
84 <tr class='head'>
85 <td title='Click to view or edit'><?php xl('Name','e'); ?></td>
86 <td><?php xl('Local','e'); ?></td><!-- empty for external -->
87 <td><?php xl('Specialty','e'); ?></td>
88 <td><?php xl('Phone','e'); ?></td>
89 <td><?php xl('Mobile','e'); ?></td>
90 <td><?php xl('Fax','e'); ?></td>
91 <td><?php xl('Email','e'); ?></td>
92 <td><?php xl('Street','e'); ?></td>
93 <td><?php xl('City','e'); ?></td>
94 <td><?php xl('State','e'); ?></td>
95 <td><?php xl('Postal','e'); ?></td>
96 </tr>
98 <?php
99 $encount = 0;
100 while ($row = sqlFetchArray($res)) {
101 ++$encount;
102 //$bgcolor = "#" . (($encount & 1) ? "ddddff" : "ffdddd");
103 $bgclass = (($encount & 1) ? "evenrow" : "oddrow");
104 $username = $row['username'];
105 if (! $row['active']) $username = '--';
106 $trTitle = "Edit ". $row['fname'] . ' ' . $row['mname'] . $row['lname'];
107 echo " <tr class='detail $bgclass' style='cursor:pointer' " .
108 "onclick='doedclick(" . $row['id'] . ")' title='$trTitle'>\n";
109 echo " <td>" . $row['lname'] . ', ' . $row['fname'] . ' ' . $row['mname'] . "</td>\n";
110 echo " <td>" . ($username ? '*' : '') . "</td>\n";
111 echo " <td>" . $row['specialty'] . "</td>\n";
112 echo " <td>" . $row['phonew1'] . "</td>\n";
113 echo " <td>" . $row['phonecell'] . "</td>\n";
114 echo " <td>" . $row['fax'] . "</td>\n";
115 echo " <td>" . $row['email'] . "</td>\n";
116 echo " <td>" . $row['street'] . "</td>\n";
117 echo " <td>" . $row['city'] . "</td>\n";
118 echo " <td>" . $row['state'] . "</td>\n";
119 echo " <td>" . $row['zip'] . "</td>\n";
120 echo " </tr>\n";
123 </table>
125 </body>
126 </html>