PageRenderTime 51ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/system_admin/admin_user_search_employee.php

https://github.com/timschofield/2.8
PHP | 243 lines | 151 code | 43 blank | 49 comment | 16 complexity | 962c39740d6bf3b5eadc0f7b784eee0f MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, GPL-2.0
  1. <?php
  2. //error_reporting(E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR);
  3. require('./roots.php');
  4. require('../../include/helpers/inc_environment_global.php');
  5. /**
  6. * CARE2X Integrated Hospital Information System version deployment 1.1 (mysql) 2004-01-11
  7. * GNU General Public License
  8. * Copyright 2002,2003,2004,2005 Elpidio Latorilla
  9. * , elpidio@care2x.org
  10. *
  11. * See the file "copy_notice.txt" for the licence notice
  12. */
  13. define('MODULE','system_admin');
  14. define('LANG_FILE_MODULAR','system_admin.php');
  15. $local_user='ck_admin_user';
  16. require_once($root_path.'include/helpers/inc_front_chain_lang.php');
  17. require_once($root_path.'include/helpers/inc_date_format_functions.php');
  18. $toggle=0;
  19. $breakfile= 'admin_user_access_edit.php'.URL_APPEND.'&target='.$target;
  20. /* Set color values for the search mask */
  21. $searchmask_bgcolor='#f3f3f3';
  22. $searchprompt=$LDEntryPrompt;
  23. $entry_block_bgcolor='#fff3f3';
  24. $entry_border_bgcolor='#6666ee';
  25. $entry_body_bgcolor='#ffffff';
  26. if(!isset($searchkey)) $searchkey='';
  27. if(!isset($mode)) $mode='';
  28. //$db->debug=1;
  29. if(($mode=='search')and($searchkey)){
  30. /* Load global config */
  31. $suchwort=trim($searchkey);
  32. if(is_numeric($suchwort)){
  33. $suchbuffer=(int) $suchwort;
  34. $numeric=1;
  35. }else{
  36. $suchbuffer=$suchwort;
  37. }
  38. /* $sql="SELECT ps.nr, ps.is_discharged, p.name_last, p.name_first, p.date_birth,u.login_id
  39. FROM care_person as p, care_staff as ps
  40. LEFT JOIN care_users AS u ON u.staff_nr=ps.nr ";
  41. if($numeric) $sql.="WHERE ps.nr $sql_LIKE '%".$suchbuffer."'";
  42. else $sql.= "WHERE (p.name_last $sql_LIKE '".addslashes($suchwort)."%'
  43. OR p.name_first LIKE '".addslashes($suchwort)."%') ";
  44. $sql.=" AND ps.is_discharged IN ('',0) AND ps.pid=p.pid ORDER BY p.name_last ";*/
  45. //gjergji
  46. //changed to search only the users table
  47. $sql = "SELECT u.* FROM care_users AS u WHERE u.name LIKE '".addslashes($suchwort)."%' OR u.name LIKE '%".addslashes($suchwort)."' ORDER BY u.name ";
  48. if($ergebnis=$db->Execute($sql)){
  49. if ($linecount=$ergebnis->RecordCount()){
  50. if(($linecount==1)&&$numeric){
  51. $zeile=$ergebnis->FetchRow();
  52. if(!empty($zeile['login_id'])){
  53. $append='&mode=edit&userid='.$zeile['login_id'];
  54. }else{
  55. $append='&is_employee=1&staff_nr='.$zeile['nr'].'&username='.strtr(($zeile['name_first'].' '.$zeile['name_last']),' ','+').'&userid='.strtr($zeile['name_last'],' ','_');
  56. }
  57. header("location:admin_user_access_edit.php".URL_REDIRECT_APPEND.$append);
  58. exit;
  59. }
  60. }
  61. }else{echo "<p>".$sql."<p>$LDDbNoRead";};
  62. }else{
  63. $mode='';
  64. }
  65. # Start Smarty templating here
  66. /**
  67. * LOAD Smarty
  68. */
  69. # Note: it is advisable to load this after the inc_front_chain_lang.php so
  70. # that the smarty script can use the user configured template theme
  71. require_once(CARE_BASE.'/include/helpers/smarty_care.class.php');
  72. $smarty = new smarty_care('system_admin');
  73. # Title in toolbar
  74. $smarty->assign('sToolbarTitle',"$LDstaffData :: $LDSearch");
  75. $smarty->assign('LDBack', $LDBack);
  76. $smarty->assign('LDHelp', $LDHelp);
  77. $smarty->assign('LDClose', $LDClose);
  78. # hide return button
  79. $smarty->assign('pbBack',FALSE);
  80. # href for help button
  81. $smarty->assign('pbHelp',CARE_GUI . "modules/" . MODULE . "/help/" . $lang . "/employee_search.html");
  82. # href for close button
  83. $smarty->assign('breakfile',$breakfile);
  84. # Window bar title
  85. $smarty->assign('sWindowTitle',"$LDstaffData :: $LDSearch");
  86. # Body onLoad Javascript
  87. $smarty->assign('sOnLoadJs','onLoad="document.searchform.searchkey.select()"');
  88. # Buffer page output
  89. ob_start();
  90. ?>
  91. <ul>
  92. <table border=0 cellpadding=10 bgcolor="<?php echo $entry_border_bgcolor ?>">
  93. <tr>
  94. <td>
  95. <?php
  96. include($root_path.'include/helpers/inc_patient_searchmask.php');
  97. ?>
  98. </td>
  99. </tr>
  100. </table>
  101. <p>
  102. <a href="<?php echo $breakfile; ?>" class="button icon remove danger">Cancel</a>
  103. <p>
  104. <?php
  105. if($mode=='search'){
  106. if(!$linecount) $linecount=0;
  107. echo '<hr width=80% align=left><p>'.str_replace("~nr~",$linecount,$LDSearchFound).'<p>';
  108. if ($linecount) {
  109. /* Load the common icons & images */
  110. $img_options=createLDImgSrc($root_path,'ok_small.gif','0');
  111. $img_status=createComIcon($root_path,'redflag.gif');
  112. $bg_skin=createBgSkin($root_path,'tableHeaderbg.gif');
  113. ?>
  114. <table border=0 cellpadding=2 cellspacing=1>
  115. <tr class="wardlisttitlerow">
  116. <td><b><?php echo $LDStatus; ?></b></td>
  117. <td><b><?php echo $LDstaffNr; ?></b></td>
  118. <td><b><?php echo $LDLastName; ?></td>
  119. <!--//gjergji
  120. //changed to search only the users table-->
  121. <!--<td><b><?php echo $LDFirstName; ?></td>-->
  122. <!--<td><b><?php echo $LDBday; ?></td>-->
  123. <td><b><?php echo $LDOptions; ?></td>
  124. </tr>
  125. <?php
  126. while($zeile=$ergebnis->FetchRow()){
  127. echo "<tr class=";
  128. if($toggle) { echo '"wardlistrow2">';} else {echo '"wardlistrow1">';};
  129. $toggle=!$toggle;
  130. echo'<td align="center">&nbsp;';
  131. if(!empty($zeile['login_id'])){
  132. echo '<img '.$img_status.'>';
  133. $mode='edit';
  134. $alt=$LDEdit;
  135. $append='&mode='.$mode.'&userid='.$zeile['login_id'];
  136. }else{
  137. $mode='';
  138. $alt=$LDCreate;
  139. $append='&is_employee=1&staff_nr='.$zeile['nr'].'&username='.strtr(($zeile['name'].' '.$zeile['name_last']),' ','+').'&userid='.strtr($zeile['name_last'],' ','_');
  140. }
  141. echo "</td>";
  142. echo"<td>";
  143. echo '&nbsp;'.($zeile['nr']+$GLOBAL_CONFIG['staff_nr']);
  144. echo "</td>";
  145. echo"<td>";
  146. echo "&nbsp;".ucfirst($zeile['name']);
  147. echo "</td>";
  148. //gjergji
  149. //changed to search only the users table
  150. /* echo"<td>";
  151. echo "&nbsp;".ucfirst($zeile['name_first']);
  152. echo "</td>";*/
  153. /* echo"<td>";
  154. echo "&nbsp;".@formatDate2Local($zeile['date_birth'],$date_format);
  155. echo "</td>";*/
  156. echo '
  157. <td>&nbsp;
  158. <a href="admin_user_access_edit.php'.URL_APPEND.$append.'">
  159. <img '.$img_options.' alt="'.$alt.'"></a>&nbsp;';
  160. if(!file_exists($root_path.'cache/barcodes/en_'.$full_en.'.png'))
  161. {
  162. echo "<img src='".$root_path."classes/barcode/image.php?code=".($zeile['nr']+$GLOBAL_CONFIG['staff_nr_adder'])."&style=68&type=I25&width=180&height=50&xres=2&font=5&label=2&form_file=en' border=0 width=0 height=0>";
  163. }
  164. echo '</td></tr>';
  165. }
  166. echo "
  167. </table>";
  168. if($linecount>15)
  169. {
  170. /* Set the appending nr for the searchform */
  171. $searchform_count=2;
  172. ?>
  173. <p>
  174. <table border=0 cellpadding=10 bgcolor="<?php echo $entry_border_bgcolor ?>">
  175. <tr>
  176. <td>
  177. <?php
  178. include($root_path.'include/helpers/inc_patient_searchmask.php');
  179. ?>
  180. </td>
  181. </tr>
  182. </table>
  183. <?php
  184. }
  185. }
  186. }
  187. ?>
  188. <p>
  189. </ul>
  190. <p>
  191. <?php
  192. $sTemp = ob_get_contents();
  193. ob_end_clean();
  194. # Assign page output to the mainframe template
  195. $smarty->assign('sMainFrameBlockData',$sTemp);
  196. /**
  197. * show Template
  198. */
  199. $smarty->display(CARE_BASE . 'main/view/mainframe.tpl');
  200. ?>