- modules/fotolab updated imagej to current version & some cod fixes to make it work
[care2x.git] / Care2007 / modules / doctors / doctors-dienst-schnellsicht.php
blobded73ac00225a56530ba098917bfbb078e789492
1 <?php
2 error_reporting(E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR);
3 require('./roots.php');
4 require($root_path.'include/inc_environment_global.php');
5 /**
6 * CARE2X Integrated Hospital Information System Deployment 2.2 - 2006-07-10
7 * GNU General Public License
8 * Copyright 2002,2003,2004,2005,2006 Elpidio Latorilla
9 * elpidio@care2x.org,
11 * See the file "copy_notice.txt" for the licence notice
14 # If cache must be deactivated, set $force_no_cache to true
15 $force_no_cache=1;
17 $lang_tables[]='departments.php';
18 $lang_tables[]='prompt.php';
19 define('LANG_FILE','doctors.php');
20 define('NO_2LEVEL_CHK',1);
21 require_once($root_path.'include/inc_front_chain_lang.php');
23 require_once($root_path.'include/care_api_classes/class_core.php');
24 $core=new Core;
26 //$db->debug=1;
28 switch($retpath)
30 case "docs": $breakfile='doctors.php'.URL_APPEND; break;
31 case "op": $breakfile=$root_path.'main/op-doku.php'.URL_APPEND; break;
32 default: $breakfile='doctors.php'.URL_APPEND;
35 $thisfile=basename(__FILE__);
37 $pday=date(j);
38 $pmonth=date(n);
39 $pyear=date(Y);
40 $abtarr=array();
41 $abtname=array();
42 $datum=date("d.m.Y");
44 if(!$hilitedept)
46 if($dept_nr) $hilitedept=$dept_nr;
50 # Prepare the date. We need to consider the early morning hours or until the DOC_CHANGE_TIME value has passed
53 $plan_yesterday=date('Y-m-d',mktime(0,0,0,date('m'),date('d')-1,date('Y')));
55 if(date('H.i')<DOC_CHANGE_TIME){
56 $plan_date=$plan_yesterday;
57 $plan_day=date('d',mktime(0,0,0,date('m'),date('d')-1,date('Y')));
58 }else{
59 $plan_date=date('Y-m-d');
60 $plan_day=date('d');
63 # If plan date is today, attempt to delete the cached plan of yesterday
65 $core->deleteDBCache('DOCS_'.$plan_yesterday);
67 //echo "$plan_date $plan_day";
69 # Get the cached plan
71 $cached_plan='';
72 if(!$is_cached=$core->getDBCache('DOCS_'.$plan_date,$cached_plan)) $force_no_cache=true;
75 if($force_no_cache || (!$force_no_cache && !$is_cached)){
76 if(!$hilitedept){
77 if($dept_nr) $hilitedept=$dept_nr;
79 # Load the department list with oncall doctors
80 include_once($root_path.'include/care_api_classes/class_department.php');
81 $dept_obj=new Department;
82 $dept_DOC=$dept_obj->getAllActiveWithDOC();
83 include_once($root_path.'include/care_api_classes/class_personell.php');
84 $pers_obj=new Personell;
85 $quicklist=&$pers_obj->getDOCQuicklist($dept_DOC,$pyear,$pmonth);
88 # Start Smarty templating here
89 /**
90 * LOAD Smarty
93 # Note: it is advisable to load this after the inc_front_chain_lang.php so
94 # that the smarty script can use the user configured template theme
96 require_once($root_path.'gui/smarty_template/smarty_care.class.php');
97 $smarty = new smarty_care('common');
99 # Title in toolbar
100 $smarty->assign('sToolbarTitle',$LDDocsOnDuty);
102 # href for help button
103 $smarty->assign('pbHelp',"javascript:gethelp('docs_duty_quickview.php')");
105 # href for close button
106 $smarty->assign('breakfile',$breakfile);
108 # Body onLoad javascript
109 $smarty->assign('sOnLoadJs','onUnload="killchild()"');
111 # Window bar title
112 $smarty->assign('sWindowTitle',$LDDocsOnDuty);
114 # Collect extra javascript
116 ob_start();
120 <script language="javascript">
121 <!--
122 var urlholder;
123 function popinfo(l,d)
125 urlholder="doctors-dienstplan-popinfo.php<?php echo URL_REDIRECT_APPEND ?>&nr="+l+"&dept_nr="+d+"&user=<?php echo $aufnahme_user.'"' ?>;
127 infowin=window.open(urlholder,"dienstinfo","width=400,height=300,menubar=no,resizable=yes,scrollbars=yes");
132 </script>
134 <?php
136 $sTemp=ob_get_contents();
137 ob_end_clean();
138 $smarty->append('JavaScript',$sTemp);
140 # Buffer page output
142 ob_start();
146 <table cellpadding="2" cellspacing=0 border="0" >
147 <tr class="wardlisttitlerow" align=center>
148 <?php
150 for($j=0;$j<sizeof($LDTabElements);$j++)
151 echo '<td>&nbsp; '.$LDTabElements[$j].' &nbsp;&nbsp;</td>';
152 echo '
153 </tr>';
155 if(!$force_no_cache&&$is_cached){
157 /* echo '<tr>
158 <td colspan=6><font face="verdana,arial" size=2> <img '.createComIcon($root_path,'warn.gif','0').'> <font color=red>'.$LDCachedInfo.'</font> <a href="'.$thisfile.URL_APPEND.'&force_no_cache=1&retpath='.$retpath.'">'.$LDClkNoCache.'</a>
159 </td>
160 </tr>';
162 $cached_plan=str_replace('URLAPPEND',URL_APPEND,$cached_plan);
163 $cached_plan=str_replace('IMGALT',$LDShowActualPlan,$cached_plan);
164 $cached_plan=str_replace('SHOWBUTTON',$LDShow,$cached_plan);
165 echo str_replace('URLREDIRECTAPPEND',URL_REDIRECT_APPEND,$cached_plan);
167 }else{
170 $toggler=0;
172 # Start generating the DOC list
174 $temp_out='';
176 while(list($x,$v)=each($dept_DOC)){
178 if(in_array($v['nr'],$quicklist)){
179 if($dutyplan=$pers_obj->getDOCDutyplan($v['nr'],$pyear,$pmonth)){
181 $a=unserialize($dutyplan['duty_1_txt']);
182 $r=unserialize($dutyplan['duty_2_txt']);
183 $ha=unserialize($dutyplan['duty_1_pnr']);
184 $hr=unserialize($dutyplan['duty_2_pnr']);
185 if($ha['ha'.($plan_day-1)]) $DOC_1=$pers_obj->getPersonellInfo($ha['ha'.($plan_day-1)]);
186 if($hr['hr'.($plan_day-1)]) $DOC_2=$pers_obj->getPersonellInfo($hr['hr'.($plan_day-1)]);
189 }else{
190 if(isset($a)) unset($a);
191 if(isset($r)) unset($r);
192 if(isset($ha)) unset($ha);
193 if(isset($hr)) unset($hr);
194 if(isset($DOC_1)) unset($DOC_1);
195 if(isset($DOC_2)) unset($DOC_2);
199 $bold='';
200 $boldx='';
201 if($hilitedept==$v['nr']){
202 $temp_out.='<tr class="hilite">'; $bold="<font color=\"red\" size=2><b>";$boldx="</b></font>";
204 elseif ($toggler==0) {
205 $temp_out.='<tr class="wardlistrow1">'; $toggler=1;
206 }else{
207 $temp_out.='<tr class="wardlistrow2">'; $toggler=0;
210 $temp_out.='<td ><font size="1" >&nbsp;'.$bold;
211 $buff= $v['LD_var'];
212 if(isset($$buff)&&!empty($$buff)) $temp_out.=$$buff;
213 else $temp_out.=$v['name_formal'];
214 $temp_out.=$boldx.'&nbsp;</td><td >&nbsp;
215 <img '.createComIcon($root_path,'mans-gr.gif','0','',TRUE).'>&nbsp;';
217 //if ($aelems[l]!="") echo $aelems[l].', ';
218 //echo $aelems[f].'</b></a></td>';
219 if(in_array($v['nr'],$quicklist)&&$DOC_1['name_last']){$temp_out.='<a href="javascript:popinfo(\''.$ha['ha'.(date('d')-1)].'\',\''.$v['nr'].'\')" title="Click f�r mehr Info."><b>'.$DOC_1['name_last'].', '.$DOC_1['name_first'].'</b></a>'; }
220 $temp_out.='</td>
221 <td>';
222 if ($a['a'.(date('d')-1)]!='')
224 $temp_out.=' <font color=red> '.$DOC_1['funk1'].'</font>';
225 if($DOC_1['inphone1']) $temp_out.=' / '.$DOC_1['inphone1'];
227 $temp_out.='&nbsp;</td><td >
228 <img '.createComIcon($root_path,'mans-red.gif','0','',TRUE).'>&nbsp;';
230 if(in_array($v['nr'],$quicklist)&&$DOC_2['name_last']){$temp_out.='<a href="javascript:popinfo(\''.$hr['hr'.(date('d')-1)].'\',\''.$v['nr'].'\')" title="Click f�r mehr Info."><b>'.$DOC_2['name_last'].', '.$DOC_2['name_first'].'</b></a>';}
231 $temp_out.='</td>
232 <td>';
233 if ($r['r'.(date('d')-1)]!='')
235 $temp_out.=' <font color=red> '.$DOC_2['funk1'].'</font>';
236 if($DOC_2['inphone1']) $temp_out.=' / '.$DOC_2['inphone1'];
239 $temp_out.='&nbsp;
240 </td><td >&nbsp; <a href="doctors-dienstplan.phpURLAPPEND&dept_nr='.$v['nr'].'&retpath=qview">
241 <button onClick="javascript:window.location.href=\'doctors-dienstplan.phpURLREDIRECTAPPEND&dept_nr='.$v['nr'].'&retpath=qview\'"><img '.createComIcon($root_path,'new_address.gif','0','absmiddle',FALSE).' alt="IMGALT" ><font size=1> SHOWBUTTON </font></button></a> </td></tr>';
244 # Save in cache
245 if(!$force_no_cache || ($force_no_cache && !$is_cached)) $dept_obj->saveDBCache('DOCS_'.date('Y-m-d'),addslashes($temp_out));
246 # Display list
247 $temp_out=str_replace('URLAPPEND',URL_APPEND,$temp_out);
248 $temp_out=str_replace('IMGALT',$LDShowActualPlan,$temp_out);
249 $temp_out=str_replace('SHOWBUTTON',$LDShow,$temp_out);
250 echo str_replace('URLREDIRECTAPPEND',URL_REDIRECT_APPEND,$temp_out);
253 </table>
255 <a href="<?php echo $breakfile ?>"><img <?php echo createLDImgSrc($root_path,'close2.gif','0') ?> alt="<?php echo $LDCloseAlt ?>">
256 </a>
258 <?php
260 $sTemp = ob_get_contents();
261 ob_end_clean();
263 # Assign the buffer output to main frame template
265 $smarty->assign('sMainFrameBlockData',$sTemp);
268 * show Template
270 $smarty->display('common/mainframe.tpl');