PageRenderTime 67ms CodeModel.GetById 39ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/photolab/upload_search_patient.php

https://github.com/timschofield/2.8
PHP | 278 lines | 188 code | 40 blank | 50 comment | 15 complexity | 1337e8f13549d43572aa2d90d03b77c1 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 Deployment 2.1 - 2004-10-02
  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. # Default value for the maximum nr of rows per block displayed, define this to the value you wish
  14. # In normal cases this value is derived from the db table "care_config_global" using the "pagin_insurance_list_max_block_rows" element.
  15. define('MAX_BLOCK_ROWS',30);
  16. define('MODULE','photolab');
  17. define('LANG_FILE_MODULAR','photolab.php');
  18. $local_user='ck_photolab_user';
  19. require_once($root_path.'include/helpers/inc_front_chain_lang.php');
  20. $searchkey=trim($searchkey);
  21. $searchkey=strtr($searchkey,"*?","%_");
  22. $toggle=0;
  23. $append=URL_APPEND."&target=$target&noresize=1&user_origin=$user_origin";
  24. /* Set color values for the search mask */
  25. $searchmask_bgcolor='#f3f3f3';
  26. $searchprompt=$LDKeywordPrompt;
  27. $entry_block_bgcolor='#fff3f3';
  28. $entry_border_bgcolor='#6666ee';
  29. $entry_body_bgcolor='#ffffff';
  30. $breakfile=$root_path."main/plugin.php$append";
  31. $thisfile=basename(__FILE__);
  32. # Data to append to url
  33. $append='&status='.$status.'&target='.$target.'&user_origin='.$user_origin;
  34. # Initialize page's control variables
  35. if($mode=='paginate'){
  36. $searchkey=$_SESSION['sess_searchkey'];
  37. //$searchkey='USE_SESSION_SEARCHKEY';
  38. //$mode='search';
  39. }else{
  40. # Reset paginator variables
  41. $pgx=0;
  42. $totalcount=0;
  43. $odir='ASC';
  44. $oitem='name_last';
  45. }
  46. # Paginator object
  47. require_once($root_path.'include/core/class_paginator.php');
  48. $pagen=new Paginator($pgx,$thisfile,$_SESSION['sess_searchkey'],$root_path);
  49. require_once($root_path.'include/core/class_globalconfig.php');
  50. $glob_obj=new GlobalConfig($GLOBAL_CONFIG);
  51. # Get the max nr of rows from global config
  52. $glob_obj->getConfig('pagin_patient_search_max_block_rows');
  53. if(empty($GLOBAL_CONFIG['pagin_patient_search_max_block_rows'])) $pagen->setMaxCount(MAX_BLOCK_ROWS); # Last resort, use the default defined at the start of this page
  54. else $pagen->setMaxCount($GLOBAL_CONFIG['pagin_patient_search_max_block_rows']);
  55. if(($mode=='search'||$mode=='paginate')&&!empty($searchkey)){
  56. # Convert other wildcards
  57. $searchkey=strtr($searchkey,'*?','%_');
  58. # Save the search keyword for eventual pagination routines
  59. if($mode=='search') $_SESSION['sess_searchkey']=$searchkey;
  60. include_once($root_path.'include/helpers/inc_date_format_functions.php');
  61. include_once($root_path.'include/core/class_encounter.php');
  62. $enc_obj=new Encounter;
  63. $encounter=& $enc_obj->searchLimitEncounterBasicInfo($searchkey,$pagen->MaxCount(),$pgx,$oitem,$odir);
  64. //echo $enc_obj->getLastQuery();
  65. # Get the resulting record count
  66. $linecount=$enc_obj->LastRecordCount();
  67. if($linecount==1&&$mode=='search'){
  68. $zeile=$encounter->FetchRow();
  69. header('location:photolab-dir-select.php'.URL_REDIRECT_APPEND.'&patnum='.$zeile['encounter_nr'].'&lastname='.strtr($zeile['name_last'],' ','+').'&firstname='.strtr($zeile['name_first'],' ','+').'&bday='.$zeile['date_birth'].'&maxpic='.$aux1);
  70. exit;
  71. }
  72. //$linecount=$address_obj->LastRecordCount();
  73. $pagen->setTotalBlockCount($linecount);
  74. # Count total available data
  75. if(isset($totalcount)&&$totalcount){
  76. $pagen->setTotalDataCount($totalcount);
  77. }else{
  78. @$enc_obj->searchEncounterBasicInfo($searchkey);
  79. $totalcount=$enc_obj->LastRecordCount();
  80. $pagen->setTotalDataCount($totalcount);
  81. }
  82. $pagen->setSortItem($oitem);
  83. $pagen->setSortDirection($odir);
  84. }
  85. # Start Smarty templating here
  86. /**
  87. * LOAD Smarty
  88. */
  89. # Note: it is advisable to load this after the inc_front_chain_lang.php so
  90. # that the smarty script can use the user configured template theme
  91. require_once(CARE_BASE.'/include/helpers/smarty_care.class.php');
  92. $smarty = new smarty_care('system_admin');
  93. # Title in toolbar
  94. $smarty->assign('sToolbarTitle',$LDFotoLab);
  95. $smarty->assign('LDBack', $LDBack);
  96. $smarty->assign('LDHelp', $LDHelp);
  97. $smarty->assign('LDClose', $LDClose);
  98. # Hide return button
  99. $smarty->assign('pbBack',FALSE);
  100. # href for help button
  101. $smarty->assign('pbHelp',CARE_GUI . "modules/" . MODULE . "/help/" . $lang . "/photolab_how2search.html");
  102. # href for close button
  103. $smarty->assign('breakfile',$breakfile);
  104. # target for close button
  105. $smarty->assign('sCloseTarget','target="_parent"');
  106. # Window bar title
  107. $smarty->assign('sWindowTitle',$LDFotoLab);
  108. # Body Onload js
  109. $smarty->assign('sOnLoadJs','onLoad="document.searchform.searchkey.select()"');
  110. # Buffer page output
  111. ob_start();
  112. ?>
  113. <ul>
  114. <table border=0 cellpadding=10 bgcolor="<?php echo $entry_border_bgcolor ?>">
  115. <tr>
  116. <td>
  117. <?php
  118. $searchmask_bgcolor="#f3f3f3";
  119. include($root_path.'include/helpers/inc_patient_searchmask.php');
  120. ?>
  121. </td>
  122. </tr>
  123. </table>
  124. <p>
  125. <a href="<?php echo $breakfile; ?>" class="button icon remove danger" target='_parent'>Cancel</a>
  126. <p>
  127. </ul>
  128. <?php
  129. if($mode=='search'||$mode=='paginate'){
  130. if ($linecount) echo str_replace("~nr~",$totalcount,$LDSearchFound).' '.$LDShowing.' '.$pagen->BlockStartNr().' '.$LDTo.' '.$pagen->BlockEndNr().'.';
  131. else echo str_replace('~nr~','0',$LDSearchFound);
  132. if ($linecount) {
  133. # Load the common icons
  134. $img_options=createComIcon($root_path,'l-arrowgrnlrg.gif','0','',TRUE);
  135. $img_male=createComIcon($root_path,'spm.gif','0','',TRUE);
  136. $img_female=createComIcon($root_path,'spf.gif','0','',TRUE);
  137. //$bgimg='tableHeaderbg3.gif';
  138. //$tbg= 'background="'.$root_path.'gui/img/common/'.$theme_com_icon.'/'.$bgimg.'"';
  139. echo '
  140. <table border=0 cellpadding=2 cellspacing=1> <tr class="wardlisttitlerow">';
  141. ?>
  142. <td><b>
  143. <?php echo $pagen->makeSortLink($LDPatientNr,'encounter_nr',$oitem,$odir,$append); ?></b></td>
  144. <td><b>
  145. <?php echo $pagen->makeSortLink($LDSex,'sex',$oitem,$odir,$append); ?></b></td>
  146. <td><b>
  147. <?php echo $pagen->makeSortLink($LDLastName,'name_last',$oitem,$odir,$append); ?></b></td>
  148. <td><b>
  149. <?php echo $pagen->makeSortLink($LDFirstName,'name_first',$oitem,$odir,$append); ?></b></td>
  150. <td><b>
  151. <?php echo $pagen->makeSortLink($LDBday,'date_birth',$oitem,$odir,$append); ?></b></td>
  152. <!-- <td align='center'><b>
  153. <?php echo $pagen->makeSortLink($LDZipCode,'addr_zip',$oitem,$odir,$append); ?></b></td>
  154. -->
  155. <td background="<?php echo createBgSkin($root_path,'tableHeaderbg.gif'); ?>" align=center><font color="#ffffff"><b><?php echo $LDSelect; ?></td>
  156. <?php
  157. echo"</tr>";
  158. while($zeile=$encounter->FetchRow())
  159. {
  160. $ahref='<a href="photolab-dir-select.php'.URL_APPEND.'&patnum='.$zeile['encounter_nr'].'&lastname='.strtr($zeile['name_last'],' ','+').'&firstname='.strtr($zeile['name_first'],' ','+').'&bday='.$zeile['date_birth'].'&maxpic='.$aux1.'">';
  161. echo '
  162. <tr class=';
  163. if($toggle) { echo "wardlistrow2>"; $toggle=0;} else {echo "wardlistrow1>"; $toggle=1;};
  164. echo '<td>&nbsp;'.$ahref.$zeile['encounter_nr'];
  165. echo '</a></td>
  166. ';
  167. echo '<td>';
  168. switch($zeile['sex']){
  169. case 'f': echo '<img '.$img_female.'>'; break;
  170. case 'm': echo '<img '.$img_male.'>'; break;
  171. default: echo '&nbsp;'; break;
  172. }
  173. echo '</td>
  174. ';
  175. echo"<td>";
  176. echo "&nbsp;".$ahref.ucfirst($zeile['name_last']);
  177. echo '</a></td>
  178. ';
  179. echo"<td>";
  180. echo "&nbsp;".$ahref.ucfirst($zeile['name_first']);
  181. echo '</a></td>
  182. ';
  183. echo"<td>";
  184. echo "&nbsp;".formatDate2Local($zeile['date_birth'],$date_format);
  185. echo "</td>";
  186. /* echo"<td>";
  187. echo "&nbsp;".$zeile['addr_zip'];
  188. echo "</td>";
  189. */
  190. if($_COOKIE[$local_user.$sid]) echo '
  191. <td>&nbsp;
  192. <a href="photolab-dir-select.php'.URL_APPEND.'&patnum='.$zeile['encounter_nr'].'&lastname='.strtr($zeile['name_last'],' ','+').'&firstname='.strtr($zeile['name_first'],' ','+').'&bday='.$zeile['date_birth'].'&maxpic='.$aux1.'">
  193. <img '.$img_options.' alt="'.$LDSelect.'"></a>&nbsp;
  194. </td>';
  195. echo '
  196. </tr>';
  197. }
  198. echo '
  199. <tr><td colspan=5>'.$pagen->makePrevLink($LDPrevious,$append).'</td>
  200. <td align=right>'.$pagen->makeNextLink($LDNext,$append).'</td>
  201. </tr>
  202. </table>';
  203. if($linecount>$pagen->MaxCount())
  204. {
  205. /* Set the appending nr for the searchform */
  206. $searchform_count=2;
  207. ?>
  208. <ul>
  209. <p>
  210. <table border=0 cellpadding=10 bgcolor="<?php echo $entry_border_bgcolor ?>">
  211. <tr>
  212. <td>
  213. <?php
  214. include($root_path.'include/helpers/inc_patient_searchmask.php');
  215. ?>
  216. </td>
  217. </tr>
  218. </table>
  219. <p>
  220. <a href="<?php echo $breakfile; ?>" target='_parent' class="button icon remove danger">Cancel</a>
  221. </ul>
  222. <?php
  223. }
  224. }
  225. }
  226. ?>
  227. &nbsp;
  228. <p>
  229. <?php
  230. $sTemp = ob_get_contents();
  231. ob_end_clean();
  232. # Assign page output to the mainframe template
  233. $smarty->assign('sMainFrameBlockData',$sTemp);
  234. /**
  235. * show Template
  236. */
  237. $smarty->display(CARE_BASE . 'main/view/mainframe.tpl');
  238. ?>