- modules/fotolab updated imagej to current version & some cod fixes to make it work
[care2x.git] / Care2007 / modules / address / citytown_new.php
blob5b6501fd95207ce9dbc48cdca36f9c0a43da145b
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 define('LANG_FILE','place.php');
14 $local_user='aufnahme_user';
15 require_once($root_path.'include/inc_front_chain_lang.php');
16 # Load the insurance object
17 require_once($root_path.'include/care_api_classes/class_address.php');
18 $address_obj=new Address;
20 //$db->debug=1;
22 switch($retpath)
24 case 'list': $breakfile='citytown_list.php'.URL_APPEND; break;
25 case 'search': $breakfile='citytown_search.php'.URL_APPEND; break;
26 default: $breakfile='address_manage.php'.URL_APPEND;
29 if(!isset($mode)){
30 $mode='';
31 $edit=true;
32 }else{
33 switch($mode)
35 case 'save':
38 # Validate important data
40 $HTTP_POST_VARS['name']=trim($HTTP_POST_VARS['name']);
41 if(!empty($HTTP_POST_VARS['name'])){
43 # Check if address exists
45 if($address_obj->CityTownExists($HTTP_POST_VARS['name'],$HTTP_POST_VARS['iso_country_id'])){
47 # Do notification
49 $mode='citytown_exists';
50 }else{
51 if($address_obj->saveCityTownInfoFromArray($HTTP_POST_VARS)){
53 # Get the last insert ID
55 $insid=$db->Insert_ID();
57 # Resolve the ID to the primary key
59 $nr=$address_obj->LastInsertPK('nr',$insid);
61 header("location:citytown_info.php?sid=$sid&lang=$lang&nr=$nr&mode=show&save_ok=1&retpath=$retpath");
62 exit;
63 }else{echo "$sql<br>$LDDbNoSave";}
65 }else{
66 $mode='bad_data';
68 break;
70 } // end of switch($mode)
73 # Start Smarty templating here
74 /**
75 * LOAD Smarty
77 # Note: it is advisable to load this after the inc_front_chain_lang.php so
78 # that the smarty script can use the user configured template theme
80 require_once($root_path.'gui/smarty_template/smarty_care.class.php');
81 $smarty = new smarty_care('system_admin');
83 # Title in toolbar
84 $smarty->assign('sToolbarTitle',"$LDAddress :: $LDNewCityTown");
86 # href for help button
87 $smarty->assign('pbHelp',"javascript:gethelp('address_new.php')");
89 # href for close button
90 $smarty->assign('breakfile',$breakfile);
92 # Window bar title
93 $smarty->assign('sWindowTitle',"$LDAddress :: $LDNewCityTown");
95 # Coller Javascript code
97 ob_start();
100 <script language="javascript">
101 <!--
102 function check(d)
104 if((d.name.value=="")){
105 alert("<?php echo "$LDAlertNoCityTownName \\n $LDPlsEnterInfo"; ?>");
106 d.name.focus();
107 return false;
108 }else if(d.iso_country_id.value==""){
109 alert("<?php echo $LDEnterISOCountryCode.'\n'.$LDEnterQMark; ?>");
110 d.iso_country_id.focus();
111 return false;
112 }else if(isNaN(d.unece_locode_type.value)){
113 alert("<?php echo $LDWrongUneceLocCode.'\n'.$LDEnterZero; ?>");
114 d.unece_locode_type.focus();
115 return false;
116 }else{
117 return true;
120 // -->
121 </script>
123 <?php
125 $sTemp = ob_get_contents();
126 ob_end_clean();
128 $smarty->append('JavaScript',$sTemp);
130 # Buffer page output
132 ob_start();
136 <ul>
137 <?php
138 if(!empty($mode)){
140 <table border=0>
141 <tr>
142 <td><img <?php echo createMascot($root_path,'mascot1_r.gif','0','bottom') ?>></td>
143 <td valign="bottom"><br><font class="warnprompt"><b>
144 <?php
145 switch($mode)
147 case 'bad_data':
149 echo $LDAlertNoCityTownName;
150 break;
152 case 'citytown_exists':
154 echo "$LDCityTownExists<br>$LDDataNoSave";
158 </b></font><p>
159 </td>
160 </tr>
161 </table>
162 <?php
165 &nbsp;<br>
167 <form action="<?php echo $thisfile; ?>" method="post" name="citytown" onSubmit="return check(this)">
168 <font face="Verdana, Arial" size=-1><?php echo $LDEnterAllFields ?>
169 <table border=0>
170 <tr>
171 <td align=right class="adm_item"><font color=#ff0000><b>*</b></font> <?php echo $LDCityTownName ?>: </td>
172 <td class="adm_input"><input type="text" name="name" size=50 maxlength=60 value="<?php echo $name ?>"><br>
173 </td>
174 </tr>
175 <tr>
176 <td align=right class="adm_item"><?php echo $LDISOCountryCode ?>: </td>
177 <td class="adm_input"><input type="text" name="iso_country_id" size=50 maxlength=3 value="<?php echo $iso_country_id ?>"><br></td>
178 </tr>
179 <tr>
180 <td align=right class="adm_item"><?php echo $LDUNECELocalCode ?>: </td>
181 <td class="adm_input"><input type="text" name="unece_locode" size=50 maxlength=60 value="<?php echo $unece_locode ?>"><br></td>
182 </tr>
183 <tr>
184 <td align=right class="adm_item"><?php echo $LDUNECEModifier ?>: </td>
185 <td class="adm_input"><input type="text" name="unece_modifier" size=50 maxlength=60 value="<?php echo $unece_modifier ?>"><br></td>
186 </tr>
187 <tr>
188 <td align=right class="adm_item"><?php echo $LDUNECELocalCodeType ?>: </td>
189 <td class="adm_input"><input type="text" name="unece_locode_type" size=50 maxlength=60 value="<?php echo $unece_locode_type ?>"><br></td>
190 </tr>
191 <tr>
192 <td align=right class="adm_item"><?php echo $LDUNECECoordinates ?>: </td>
193 <td class="adm_input"><input type="text" name="unece_coordinates" size=50 maxlength=60 value="<?php echo $unece_coordinates ?>"><br></td>
194 </tr>
195 <tr>
196 <td align=right class="adm_item"><?php echo $LDWebsiteURL ?>: </td>
197 <td class="adm_input"><input type="text" name="info_url" size=50 maxlength=60 value="<?php echo $info_url ?>"><br></td>
198 </tr>
199 <tr>
200 <td class=pblock><input type="image" <?php echo createLDImgSrc($root_path,'savedisc.gif','0'); ?>></td>
201 <td align=right><a href="<?php echo $breakfile ?>"><img <?php echo createLDImgSrc($root_path,'cancel.gif','0') ?> border="0"></a></td>
202 </tr>
203 </table>
204 <input type="hidden" name="sid" value="<?php echo $sid ?>">
205 <input type="hidden" name="mode" value="save">
206 <input type="hidden" name="lang" value="<?php echo $lang ?>">
207 <input type="hidden" name="retpath" value="<?php echo $retpath ?>">
208 </form>
210 </ul>
212 <?php
214 $sTemp = ob_get_contents();
215 ob_end_clean();
217 # Assign page output to the mainframe template
219 $smarty->assign('sMainFrameBlockData',$sTemp);
221 * show Template
223 $smarty->display('common/mainframe.tpl');