fix: faxsms psr7 vendor fix (#7794)
[openemr.git] / interface / main / calendar / find_group_popup.php
blob4ef82eecb2a4523479e546655f98a46942a11763
1 <?php
3 /**
4 * interface/main/calendar/find_group_popup.php
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Rod Roark <rod@sunsetsystems.com>
9 * @author Shachar Zilbershlag <shaharzi@matrix.co.il>
10 * @author Amiel Elboim <amielel@matrix.co.il>
11 * @author Brady Miller <brady.g.miller@gmail.com>
12 * @copyright Copyright (c) 2005-2007 Rod Roark <rod@sunsetsystems.com>
13 * @copyright Copyright (c) 2016 Shachar Zilbershlag <shaharzi@matrix.co.il>
14 * @copyright Copyright (c) 2016 Amiel Elboim <amielel@matrix.co.il>
15 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
16 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
19 require_once('../../globals.php');
20 require_once("$srcdir/group.inc.php");
21 require_once("../../therapy_groups/therapy_groups_controllers/therapy_groups_controller.php");
23 use OpenEMR\Common\Csrf\CsrfUtils;
24 use OpenEMR\Core\Header;
26 if (!empty($_POST)) {
27 if (!CsrfUtils::verifyCsrfToken($_POST["csrf_token_form"])) {
28 CsrfUtils::csrfNotVerified();
32 $info_msg = "";
33 $group_types = TherapyGroupsController::prepareGroupTypesList();
34 // If we are searching, search.
36 if ($_POST['searchby'] && $_POST['searchparm']) {
37 $searchby = $_POST['searchby'];
38 $searchparm = trim($_POST['searchparm']);
40 if ($searchby == "Name") {
41 $result = getGroupData("$searchparm", "*", 'group_name');
42 } elseif ($searchby == "ID") {
43 $result = getGroupData("$searchparm", "*", 'group_id');
47 <html>
48 <head>
49 <title><?php echo xlt('Group Finder'); ?></title>
50 <?php Header::setupHeader('opener'); ?>
52 <style>
53 form {
54 padding: 0px;
55 margin: 0px;
58 #searchCriteria {
59 text-align: center;
60 width: 100%;
61 font-size: 0.8em;
62 background-color: #ddddff;
63 font-weight: bold;
64 padding: 3px;
67 #searchResultsHeader {
68 width: 100%;
69 background-color: lightgrey;
72 #searchResultsHeader table {
73 width: 96%; /* not 100% because the 'searchResults' table has a scrollbar */
74 border-collapse: collapse;
77 #searchResultsHeader th {
78 font-size: 0.7em;
81 #searchResults {
82 width: 96%;
83 height: 80%;
84 overflow: auto;
87 #results_table{
88 text-align: center;
91 /* search results column widths */
92 .srName {
93 width: 30%;
96 .srGID {
97 width: 21%;
100 .srType {
101 width: 17%;
104 .srStartDate {
105 width: 17%;
108 #searchResults table {
109 width: 100%;
110 border-collapse: collapse;
111 background-color: white;
114 #searchResults tr {
115 cursor: hand;
116 cursor: pointer;
119 #searchResults td {
120 font-size: 0.7em;
121 border-bottom: 1px solid #eee;
124 .oneResult {
127 .billing {
128 color: red;
129 font-weight: bold;
132 /* for search results or 'searching' notification */
133 #searchstatus {
134 font-size: 0.8em;
135 font-weight: bold;
136 padding: 1px 1px 10px 1px;
137 font-style: italic;
138 color: black;
139 text-align: center;
142 .noResults {
143 background-color: #ccc;
146 .tooManyResults {
147 background-color: #fc0;
150 .howManyResults {
151 background-color: #9f6;
154 #searchspinner {
155 display: inline;
156 visibility: hidden;
159 /* highlight for the mouse-over */
160 .highlight {
161 background-color: #336699;
162 color: white;
164 </style>
166 <script
168 function selgid(gid, name, end_date) {
169 if (opener.closed || !opener.setgroup)
170 alert(<?php echo xlj('The destination form was closed; I cannot act on your selection.'); ?>);
171 else
172 opener.setgroup(gid, name, end_date);
173 dlgclose();
174 return false;
177 </script>
179 </head>
181 <body class="body_top">
183 <div id="searchCriteria">
184 <form method='post' name='theform' id="theform" action='find_group_popup.php'>
185 <input type="hidden" name="csrf_token_form" value="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
186 <?php echo xlt('Search by') . ':'; ?>
187 <select name='searchby'>
188 <option value="Name"><?php echo xlt('Name'); ?></option>
189 <option value="ID"<?php echo ($searchby == 'ID') ? ' selected' : ''; ?>><?php echo xlt('ID'); ?></option>
190 </select>
191 <?php echo xlt('for') . ':'; ?>
192 <input type='text' id='searchparm' name='searchparm' size='12' value='<?php echo attr($_POST['searchparm']); ?>'> &nbsp;
193 <input type='submit' id="submitbtn" value='<?php echo xla('Search'); ?>'>
194 <div id="searchspinner"><img src="<?php echo $GLOBALS['webroot'] ?>/interface/pic/ajax-loader.gif"></div>
195 </form>
196 </div>
199 <?php if (!isset($_POST['searchparm'])) : ?>
200 <div id="searchstatus"><?php echo xlt('Enter your search criteria above'); ?></div>
201 <?php elseif (count($result) == 0) : ?>
202 <div id="searchstatus" class="noResults"><?php echo xlt('No records found. Please expand your search criteria.'); ?>
203 <br />
204 </div>
205 <?php elseif (count($result) >= 100) : ?>
206 <div id="searchstatus" class="tooManyResults"><?php echo xlt('More than 100 records found. Please narrow your search criteria.'); ?></div>
207 <?php elseif (count($result) < 100) : ?>
208 <div id="searchstatus" class="howManyResults"><?php echo text(count($result)); ?> <?php echo xlt('records found.'); ?></div>
209 <?php endif; ?>
211 <?php if (isset($result)) : ?>
212 <div id="searchResultsHeader">
213 <table>
214 <tr>
215 <th class="srName"><?php echo xlt('Name'); ?></th>
216 <th class="srGID"><?php echo xlt('ID'); ?></th> <!-- (CHEMED) Search by phone number -->
217 <th class="srType"><?php echo xlt('Type'); ?></th>
218 <th class="srStartDate"><?php echo xlt('Start Date'); ?></th>
219 </tr>
220 </table>
221 </div>
223 <div id="searchResults">
224 <table id="results_table">
225 <?php
226 foreach ($result as $iter) {
227 $itergid = $iter['group_id'];
228 $itername = $iter['group_name'];
229 $itertype = $group_types[$iter['group_type']];
230 $iter_start_date = $iter['group_start_date'];
231 $iter_end_date = $iter['group_end_date'];
233 $trClass = "oneresult";
235 echo " <tr class='" . attr($trClass) . "' id='" .
236 attr($itergid . "~" . $itername . "~" . $itertype . "~" . $iter_start_date . "~" . $iter_end_date) . "'>";
237 echo " <td class='srName'>" . text($itername) . "</td>\n";
238 echo " <td class='srGID'>" . text($itergid) . "</td>\n";
239 echo " <td class='srType'>" . text($itertype) . "</td>\n";
240 echo " <td class='srStartDate'>" . text($iter_start_date) . "</td>\n";
241 echo " </tr>";
244 </table>
245 </div>
246 <?php endif; ?>
248 <script>
250 // jQuery stuff to make the page a little easier to use
252 $(function () {
253 $("#searchparm").trigger("focus");
254 $(".oneresult").on("mouseover", function() { $(this).toggleClass("highlight"); });
255 $(".oneresult").on("mouseout", function() { $(this).toggleClass("highlight"); });
256 $(".oneresult").on("click", function() { SelectGroup(this); });
258 $("#theform").on("submit" , function() { SubmitForm(this); });
262 // show the 'searching...' status and submit the form
263 var SubmitForm = function(eObj) {
264 $("#submitbtn").css("disabled", "true");
265 $("#searchspinner").css("visibility", "visible");
266 return true;
270 // parts[] ==> 0=GID, 1=Group Name 4=Group End Date
271 var SelectGroup = function (eObj) {
272 objID = eObj.id;
273 var parts = objID.split("~");
274 return selgid(parts[0], parts[1], parts[4]);
277 </script>
279 </center>
280 </body>
281 </html>