- modules/fotolab updated imagej to current version & some cod fixes to make it work
[care2x.git] / Care2007 / modules / appointment_scheduler / appt_show.php
blobd4497b032ce2943e0b0bdca958e9e295b00f1407
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
13 $lang_tables=array('date_time.php','departments.php','actions.php','prompt.php');
14 define('LANG_FILE','aufnahme.php');
15 //define('NO_2LEVEL_CHK',1);
16 //define('NO_CHAIN',1);
17 $local_user='aufnahme_user';
18 require($root_path.'include/inc_front_chain_lang.php');
19 require_once($root_path.'include/inc_date_format_functions.php');
21 if(!isset($currDay)||!$currDay) $currDay=date('d');
22 if(!isset($currMonth)||!$currMonth) $currMonth=date('m');
23 if(!isset($currYear)||!$currYear) $currYear=date('Y');
24 if(isset($HTTP_SESSION_VARS['sess_parent_mod'])) $HTTP_SESSION_VARS['sess_parent_mod']='';
26 $thisfile=basename(__FILE__);
27 $editorfile=$root_path.'modules/registration_admission/show_appointment.php';
28 require_once($root_path.'include/care_api_classes/class_appointment.php');
29 $appt_obj=new Appointment();
31 if(!isset($mode)){
32 $mode='show';
33 }elseif($mode=='appt_cancel'&&!empty($nr)){
34 if($appt_obj->cancelAppointment($nr,$reason,$HTTP_SESSION_VARS['sess_user_name'])){
35 header("location:$thisfile".URL_REDIRECT_APPEND."&currYear=$currYear&currMonth=$currMonth&currDay=$currDay");
36 exit;
37 }else{
38 echo "$appt_obj->sql<br>$LDDbNoUpdate";
42 if($mode=='show'){
43 # Clean doc
44 if(isset($aux)) $aux=trim($aux);
45 # Get the appointments basing on some conditions
46 if((isset($dept_nr)&&$dept_nr)){
47 # Get by department
48 $result=&$appt_obj->getAllByDeptObj($currYear,$currMonth,$currDay,$dept_nr);
49 }elseif(isset($aux)&&!empty($aux)){
50 # Get by doctor
51 $result=&$appt_obj->getAllByDocObj($currYear,$currMonth,$currDay,$aux);
52 }else{
53 # Get all appointments
54 $result=&$appt_obj->getAllByDateObj($currYear,$currMonth,$currDay);
58 $HTTP_SESSION_VARS['sess_parent_mod']='';
59 $HTTP_SESSION_VARS['sess_appt_dept_nr']='';
60 $HTTP_SESSION_VARS['sess_appt_doc']='';
62 # Create encounter object
63 require_once($root_path.'include/care_api_classes/class_encounter.php');
64 $enc_obj=new Encounter;
66 # load all encounter classes
67 if($ec_obj=&$enc_obj->AllEncounterClassesObject()){
68 # Prepare to an array, technique is used in listing routines
69 while($ec_row=$ec_obj->FetchRow()) $enc_class[$ec_row['class_nr']]=$ec_row;
72 # Load departments
73 require_once($root_path.'include/care_api_classes/class_department.php');
74 $dept_obj=new Department;
75 $deptarray=$dept_obj->getAllMedical('name_formal');
77 # Set the break (return) file
78 switch($HTTP_SESSION_VARS['sess_user_origin']){
79 case 'amb': $breakfile=$root_path.'modules/ambulatory/ambulatory.php'.URL_APPEND; break;
80 default: $breakfile=$root_path.'main/startframe.php'.URL_APPEND;
82 # Create department object
83 require_once($root_path.'include/care_api_classes/class_department.php');
84 $dept_obj=new Department;
85 # Load all medical departments
86 $med_arr=&$dept_obj->getAllMedical();
88 # Prepare the html select options
89 $options='';
90 while(list($x,$v)=each($med_arr)){
91 if($x==42) continue;
92 $buffer=$v['LD_var'];
93 if(isset($$buffer)&&!empty($$buffer)) $buf2=$$buffer;
94 else $buf2=$v['name_formal'];
95 $options.='
96 <option value="'.$v['nr'].'"';
97 if ($dept_nr==$v['nr']){
98 $options.=' selected';
99 $curr_dept=$buf2;
101 $options.='>'.$buf2.'</option>';
104 # Load the common icons
105 $img_male=createComIcon($root_path,'spm.gif','0','',TRUE);
106 $img_female=createComIcon($root_path,'spf.gif','0','',TRUE);
108 # Start Smarty templating here
110 * LOAD Smarty
113 # Note: it is advisable to load this after the inc_front_chain_lang.php so
114 # that the smarty script can use the user configured template theme
116 require_once($root_path.'gui/smarty_template/smarty_care.class.php');
117 $smarty = new smarty_care('common');
119 # Toolbar title
121 $smarty->assign('sToolbarTitle',$LDAppointments);
123 # href for the button
124 $smarty->assign('pbHelp',"javascript:gethelp('appointment_show.php')");
126 $smarty->assign('breakfile',$breakfile);
128 # Window bar title
129 $smarty->assign('title',$LDAppointments);
131 # Collect extra javascript code
133 ob_start();
137 <script language="javascript">
138 <!--
140 var urlholder;
142 function popinfo(l,d){
143 urlholder="nursing-or-dienstplan-popinfo.php<?php echo URL_REDIRECT_APPEND ?>&nr="+l+"&dept_nr="+d+"&user=<?php echo $aufnahme_user.'"' ?>;
145 infowin=window.open(urlholder,"dienstinfo","width=400,height=300,menubar=no,resizable=yes,scrollbars=yes");
149 </script>
151 <?php
153 $sTemp = ob_get_contents();
154 ob_end_clean();
156 $smarty->append('JavaScript',$sTemp);
158 # Buffer calendar output
160 ob_start();
161 /*generate the calendar */
162 include($root_path.'classes/calendar_jl/class.calendar.php');
163 /** CREATE CALENDAR OBJECT **/
164 $Calendar = new Calendar;
165 /** WRITE CALENDAR **/
166 $Calendar -> mkCalendar ($currYear, $currMonth, $currDay,$dept_nr,$aux);
168 $sTemp = ob_get_contents();
169 ob_end_clean();
171 $smarty->assign('sMiniCalendar',$sTemp);
173 $smarty->assign('LDListApptByDept',$LDListApptByDept);
174 $smarty->assign('sByDeptSelect','<select name="dept_nr">
175 <option value="">'.$LD_AllMedicalDept.'</option>'.$options.'
176 </select>');
177 $smarty->assign('sByDeptHiddenInputs','<input type="submit" value="'.$LDShow.'">
178 <input type="hidden" name="currYear" value="'.$currYear.'">
179 <input type="hidden" name="currMonth" value="'.$currMonth.'">
180 <input type="hidden" name="currDay" value="'.$currDay.'">
181 <input type="hidden" name="sid" value="'.$sid.'">
182 <input type="hidden" name="lang" value="'.$lang.'">');
184 $smarty->assign('LDListApptByDoc',$LDListApptByDoc);
185 $smarty->assign('sByDocSelect','<input type="text" name="aux" size=35 maxlength=40 value="'.$aux.'">');
186 $smarty->assign('sByDocHiddenInputs','<input type="submit" value="'.$LDShow.'">
187 <input type="hidden" name="name_last" value="">
188 <input type="hidden" name="name_first" value="">
189 <input type="hidden" name="date_birth" value="">
190 <input type="hidden" name="personnel_nr" value="">
191 <input type="hidden" name="currYear" value="'.$currYear.'">
192 <input type="hidden" name="currMonth" value="'.$currMonth.'">
193 <input type="hidden" name="currDay" value="'.$currDay.'">
194 <input type="hidden" name="sid" value="'.$sid.'">
195 <input type="hidden" name="lang" value="'.$lang.'">');
197 /* show the appointments */
198 if($appt_obj->count){
199 # Buffer output
200 ob_start();
201 include('./gui_bridge/default/gui_show_appointment.php');
202 $sTemp = ob_get_contents();
203 ob_end_clean();
204 $smarty->assign('sApptList',$sTemp);
205 }else{
206 $smarty->assign('bShowPrompt',TRUE);
207 $smarty->assign('sMascotImg','<img '.createMascot($root_path,'mascot1_r.gif','0','absmiddle').'>');
208 $smarty->assign('sPrompt',((date('Y-m-d'))==$currYear.'-'.$currMonth.'-'.$currDay) ? $LDNoPendingApptToday : $LDNoPendingApptThisDay);
211 $smarty->assign('sButton','<img '.createComIcon($root_path,'bul_arrowgrnlrg.gif','0','absmiddle',TRUE).'>');
212 $smarty->assign('sNewApptLink','<a href="'.$root_path.'modules/registration_admission/patient_register_pass.php'.URL_APPEND.'&pid='.$HTTP_SESSION_VARS['sess_pid'].'&target=search">'.$LDScheduleNewAppointment.'</a>');
214 $smarty->assign('pbClose','<a href="'.$breakfile.'"><img '.createLDImgSrc($root_path,'close2.gif','0').' alt="'.$LDCloseAlt.'">');
216 $smarty->assign('sMainBlockIncludeFile','appointment/appt_list.tpl');
219 * show Template
222 $smarty->display('common/mainframe.tpl');