2 error_reporting(E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
);
3 require('./roots.php');
4 require($root_path.'include/inc_environment_global.php');
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
11 * See the file "copy_notice.txt" for the licence notice
13 $lang_tables[] = 'access.php';
14 define('LANG_FILE','edp.php');
15 $local_user='ck_edv_user';
16 require_once($root_path.'include/inc_front_chain_lang.php');
19 * The following require loads the access areas that can be assigned for
22 require($root_path.'include/inc_accessplan_areas_functions.php');
24 $breakfile='edv-system-admi-welcome.php'.URL_APPEND
;
25 $returnfile=$HTTP_SESSION_VARS['sess_file_return'].URL_APPEND
;
26 $HTTP_SESSION_VARS['sess_file_return']=basename(__FILE__
);
28 //gjergji : load the department list
29 require_once($root_path.'include/care_api_classes/class_department.php');
30 $dept_obj=new Department
;
31 $deptarray=$dept_obj->getAllActiveSort('name_formal');
36 if(!isset($mode)) $mode='';
37 if(!isset($errorname)) $errorname='';
38 if(!isset($erroruser)) $erroruser='';
39 if(!isset($username)) $username='';
40 if(!isset($userid)) $userid='';
41 if(!isset($errorpass)) $errorpass='';
42 if(!isset($pass)) $pass='';
43 if(!isset($errorbereich)) $errorbereich='';
44 if(!isset($dept_nr)) $dept_nr='0';
47 if($mode!='edit' && $mode!='update' && $mode!='data_saved'){
48 /* Trim white spaces off */
49 $username=trim($username);
50 $userid=trim($userid);
53 if($username=='') { $errorname=1; $error=1; }
54 if($userid=='') { $erroruser=1; $error=1; }
55 if($pass=='') { $errorpass=1; $error=1; }
59 if(($mode=='save' && !$error ) ||
($mode=='update' && !$erroruser))
63 /* Prepare the permission codes */
68 while(list($x,$v)=each($HTTP_POST_VARS))
70 if(!ereg('_a_',$x)) continue;
72 if($HTTP_POST_VARS[$x] != '') $p_areas.=$v.' ';
74 /* If permission area is available, save it */
81 $sql="INSERT INTO care_users
98 '".addslashes($username)."',
99 '".addslashes($userid)."',
102 '".((int)$personell_nr)."',
105 '".serialize($dept_nr)."',
108 '".$HTTP_SESSION_VARS['sess_user_name']."',
113 $dept_nr=serialize($dept_nr);
114 $sql="UPDATE care_users SET permission='$p_areas', dept_nr='$dept_nr' ,modify_id='".$HTTP_COOKIE_VARS[$local_user.$sid]."' WHERE login_id='$userid'";
119 $ok=$db->Execute($sql);
120 if($ok&&$db->CommitTrans())
123 header('Location:edv_user_access_edit.php'.URL_REDIRECT_APPEND
.'&userid='.strtr($userid,' ','+').'&mode=data_saved');
128 $db->RollbackTrans();
129 if($mode!='save') $edit=1;
130 $mode='error_double';
131 //echo "$sql $LDDbNoSave";
136 if($mode!='save') $edit=1;
137 $mode='error_noareas';
138 } // end if ($p_areas!="")
139 }// end of if($mode=="save"
141 if($mode=='edit' ||
$mode=='data_saved' ||
$edit) {
143 $sql="SELECT name, login_id, permission, dept_nr FROM care_users WHERE login_id='$userid'";
145 if($ergebnis=$db->Execute($sql)) {
147 if($ergebnis->RecordCount()) {
149 $user=$ergebnis->FetchRow();
157 # Start Smarty templating here
161 # Note: it is advisable to load this after the inc_front_chain_lang.php so
162 # that the smarty script can use the user configured template theme
164 require_once($root_path.'gui/smarty_template/smarty_care.class.php');
165 $smarty = new smarty_care('system_admin');
168 $smarty->assign('sToolbarTitle',$LDManageAccess);
170 # href for return button
171 $smarty->assign('pbBack',$returnfile);
173 # href for help button
174 $smarty->assign('pbHelp',"javascript:gethelp('edp.php','access','$mode')");
176 # href for close button
177 $smarty->assign('breakfile',$breakfile);
180 $smarty->assign('sWindowTitle',$LDManageAccess);
186 echo '<script src="../../js/SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
187 <link href="../../js/SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />';
193 //if ($mode=='data_saved' || $error || $mode=='error_noareas' || $mode=='data_nosave' )
195 if (($mode!='' ||
$error ) && $mode!='edit' ){
200 <td
><img
<?php
echo createMascot($root_path,'mascot1_r.gif','0','bottom') ?
> align
="absmiddle"></td
>
201 <td
class="warnprompt">
203 if ($error) echo $LDInputError;
204 elseif ($mode=='data_saved') echo $LDUserInfoSaved;
205 elseif($mode=='error_save') echo $LDUserInfoNoSave;
206 elseif($mode=='error_noareas') echo $LDNoAreas;
207 elseif($mode=='error_double') echo $LDUserDouble;
215 <FONT
class="prompt">
219 if(($mode=="")and($remark!='fromlist'))
222 if ($gtime<'9.00') echo $LDGoodMorning;
223 if (($gtime>'9.00')and($gtime<'18.00')) echo $LDGoodDay;
224 if ($gtime>'18.00') echo $LDGoodEvening;
225 echo ' '.$HTTP_COOKIE_VARS[$local_user.$sid];
230 <FORM action
="edv_user_access_list.php" name
="all">
232 <input type
="hidden" name
="sid" value
="<?php echo $sid; ?>">
233 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>">
234 <INPUT type
="submit" name
=message value
="<?php echo $LDListActual ?>"></font
>
240 <form method
="post" action
="edv_user_access_edit.php" name
="user">
242 <input type
="image" <?php
echo createLDImgSrc($root_path,'savedisc.gif','0','absmiddle') ?
>>
245 if($mode=='data_saved' ||
$edit)
247 echo '<input type="button" value="'.$LDEnterNewUser.'" onClick="javascript:window.location.href=\'edv_user_access_edit.php'.URL_REDIRECT_APPEND
.'&remark=fromlist\'">';
250 <input type
="button" value
="<?php echo $LDFindEmployee; ?>" onClick
="javascript:window.location.href='edv_user_search_employee.php<?php echo URL_REDIRECT_APPEND; ?>&remark=fromlist'">
252 <table border
=0 bgcolor
="#000000" cellpadding
=0 cellspacing
=0>
256 <table border
="0" cellpadding
="5" cellspacing
="1">
258 <tr bgcolor
="#dddddd">
260 <?php
echo $LDNewAccess ?
>:
264 <tr bgcolor
="#dddddd">
266 <input type
=hidden name
=route value
=validroute
>
269 <?php
if ($errorname) {echo "<font color=red > <b>$LDName</b>";}
270 else { echo $LDName;} ?
>
276 echo '<input type="hidden" name="username" value="'.$user['name'].'">'.'<b>'.$user['name'].'</b>';
278 elseif(isset($is_employee)&&$is_employee)
281 <input name
="username" type
="hidden"
283 if ($username!="") echo ' value="'.$username.'"><br><b>'.$username.'</b>';
289 <input name
="username" type
="text" <?php
if ($username!="") echo ' value="'.$username.'"'; ?
>>
297 <?php
if ($erroruser) {echo "<font color=red > <b>$LDUserId</b>";}
298 else { echo $LDUserId;} ?
>
302 if($edit) echo '<input type="hidden" name="userid" value="'.$user['login_id'].'">'.'<b>'.$user['login_id'].'</b>';
306 <input type
=text name
="userid"
307 <?php
if ($userid!="") echo 'value="'.$userid.'"'; ?
>>
315 <?php
if ($errorpass) {echo "<font color=red > <b>$LDPassword</b>";}
316 else { echo $LDPassword;} ?
>
320 if($edit) echo '<input type="hidden" name="pass" value="*">****';
324 <input type
="password" name
="pass" <?php
if ($pass!="") echo "value=".$pass ; ?
>>
334 <tr bgcolor
="#dddddd">
336 <?php
if ($errorbereich) {echo "<font color=red > <b>$LDAllowedArea</b> </font>";}
337 else { echo $LDAllowedArea;} ?
>
342 <tr bgcolor
="#dddddd">
344 <div id
="TabbedPanels1" class="TabbedPanels">
345 <ul
class="TabbedPanelsTabGroup">
346 <li
class="TabbedPanelsTab" tabindex
="0"><?php
echo $LDAllowedArea ?
></li
>
347 <li
class="TabbedPanelsTab" tabindex
="0"><?php
echo $LDOwnerDept ?
></li
>
349 <div
class="TabbedPanelsContentGroup">
350 <div
class="TabbedPanelsContent">
351 <table border
=0 cellspacing
=0 width
=100%
>
353 <!-- The
list of the permissible areas are displayed here
-->
357 /* Loop through the elements of the access area tags */
358 while (list($x,$v)=each($area_opt))
360 echo '<tr bgcolor="white">';
363 if (eregi('title',$x)) // If title print it out
366 <td valign=top bgcolor="#81eff5" colspan=5><FONT SIZE=2 FACE="Arial">'.$v.'</td>';
370 // get the colum index
371 $cindex=substr($x,3,1);
373 // extract the actual index name
375 //$x_name=substr($x,strpos($x,'x')+1);
381 <td valign=top colspan=5><img '.createComIcon($root_path,'redpfeil.gif','0','absmiddle').'><input type="checkbox" name="'.$x.'" value="'.$x.'" ';
382 if($edit && strstr($user['permission'],$x)) echo 'checked ><FONT SIZE=2 FACE="Arial" color="#ff0000"> ';
387 <td><img src="p.gif" width=15></td><td valign=top colspan=4><img src="tl2-blue.gif" border=0 width=20 height=21 align="absmiddle"><input type="checkbox" name="'.$x.'" value="'.$x.'" ';
388 if($edit && strstr($user['permission'],$x)) echo 'checked ><FONT SIZE=2 FACE="Arial" color="#ff0000">';
393 <td><img src="p.gif" width=15><td><img src="p.gif" width=15><td valign=top colspan=3><img src="tl2-blue.gif" border=0 width=20 height=21 align="absmiddle"><input type="checkbox" name="'.$x.'" value="'.$x.'" ';
394 if($edit && strstr($user['permission'],$x)) echo 'checked ><FONT SIZE=2 FACE="Arial" color="#ff0000">';
399 <td><img src="p.gif" width=15><td><img src="p.gif" width=15><td><img src="p.gif" width=15><td valign=top colspan=2><img src="tl2-blue.gif" border=0 width=20 height=21 align="absmiddle"><input type="checkbox" name="'.$x.'" value="'.$x.'" ';
400 if($edit && strstr($user['permission'],$x)) echo 'checked ><FONT SIZE=2 FACE="Arial" color="#ff0000">';
405 <td><img src="p.gif" width=15><td><img src="p.gif" width=15><td><img src="p.gif" width=15><td><img src="p.gif" width=15><td valign=top colspan=1><img src="tl2-blue.gif" border=0 width=20 height=21 align="absmiddle"><input type="checkbox" name="'.$x.'" value="'.$x.'" ';
406 if($edit && strstr($user['permission'],$x)) echo 'checked ><FONT SIZE=2 FACE="Arial" color="#ff0000">';
421 <!-- begin dept
list -->
422 <div
class="TabbedPanelsContent">
423 <table border
=0 cellpadding
=3>
424 <tr
class="wardlisttitlerow">
425 <!-- <td bgcolor
="#e9e9e9"></td
>
426 --> <td
class=pblock align
=center
><?php
echo $LDDept ?
></td
>
429 while(list($x,$dept)=each($deptarray)){
430 $actualDept = unserialize($user['dept_nr']);
433 <td
class=pblock bgColor
="#eeeeee">
434 <input type
="checkbox" name
="dept_nr[]" id
="<?php echo $dept['nr'] ?>" value
="<?php echo $dept['nr']?>" <?php
if( in_array($dept['nr'],$actualDept)) echo 'checked' ?
>>
436 if(isset($
$dept['LD_var'])&&!empty($
$dept['LD_var'])) echo $
$dept['LD_var'];
437 else echo $dept['name_formal'];
449 <script type
="text/javascript">
451 echo 'var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");'
454 <!-- end dept
list -->
458 <tr bgcolor
="#dddddd">
461 <input type
="hidden" name
="personell_nr" value
="<?php echo $personell_nr; ?>">
462 <input type
="hidden" name
="itemname" value
="<?php echo $itemname ?>">
463 <input type
="hidden" name
="sid" value
="<?php echo $sid; ?>">
464 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>">
465 <input type
="hidden" name
="mode" value
="<?php if($edit || $mode=='data_saved' || $mode=='edit') echo 'update'; else echo 'save'; ?>">
466 <input type
="image" <?php
echo createLDImgSrc($root_path,'savedisc.gif','0','absmiddle') ?
>>
467 <!-- <input type
="reset" value
="<?php echo $LDReset ?>"> -->
479 <a href
="<?php echo $breakfile ?>" ><img
<?php
echo createLDImgSrc($root_path,'cancel.gif','0') ?
> alt
="<?php echo $LDCancel ?>" align
="middle"></a
>
485 $sTemp = ob_get_contents();
488 # Assign page output to the mainframe template
490 $smarty->assign('sMainFrameBlockData',$sTemp);
494 $smarty->display('common/mainframe.tpl');