| | |
| | | * |
| | | */ |
| | | |
| | | |
| | | class tform_base { |
| | | |
| | | /** |
| | |
| | | function loadFormDef($file,$module = '') { |
| | | global $app,$conf; |
| | | |
| | | include($file); |
| | | include $file; |
| | | $this->formDef = $form; |
| | | |
| | | $this->module = $module; |
| | | $wb = array(); |
| | | |
| | | include_once(ISPC_ROOT_PATH.'/lib/lang/'.$_SESSION['s']['language'].'.lng'); |
| | | include_once ISPC_ROOT_PATH.'/lib/lang/'.$_SESSION['s']['language'].'.lng'; |
| | | |
| | | if(is_array($wb)) $wb_global = $wb; |
| | | |
| | | if($module == '') { |
| | | $lng_file = "lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng"; |
| | | if(!file_exists($lng_file)) $lng_file = "lib/lang/en_".$this->formDef["name"].".lng"; |
| | | include($lng_file); |
| | | include $lng_file; |
| | | } else { |
| | | $lng_file = "../$module/lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng"; |
| | | if(!file_exists($lng_file)) $lng_file = "../$module/lib/lang/en_".$this->formDef["name"].".lng"; |
| | | include($lng_file); |
| | | include $lng_file; |
| | | } |
| | | |
| | | if(is_array($wb_global)) { |
| | |
| | | return $new_record; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Converts the data in the array to human readable format |
| | | * Datatype conversion e.g. to show the data in lists |
| | |
| | | * @param record = Dataset as array |
| | | * @return key => value array for the value field of a form |
| | | */ |
| | | |
| | | protected function _getDatasourceData($field, $record, $api = false) { |
| | | global $app; |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get the key => value array of a form filled from a datasource definitiom |
| | | * |
| | |
| | | * @param record = Dataset as array |
| | | * @return key => value array for the value field of a form |
| | | */ |
| | | |
| | | function getDatasourceData($field, $record) { |
| | | return $this->_getDatasourceData($field, $record, false); |
| | | } |
| | |
| | | return $new_record; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Rewrite the record data to be stored in the database |
| | | * and check values with regular expressions. |
| | |
| | | return $this->_encode($record, $tab, $dbencode, false); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * process the filters for a given field. |
| | | * |
| | |
| | | * @param filter_event = 'SAVE'or 'SHOW' |
| | | * @return record |
| | | */ |
| | | |
| | | function filterField($field_name, $field_value, $filters, $filter_event) { |
| | | |
| | | global $app; |
| | |
| | | return $returnval; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * process the validators for a given field. |
| | | * |
| | |
| | | * @param validatoors = Array of validators |
| | | * @return record |
| | | */ |
| | | |
| | | function validateField($field_name, $field_value, $validators) { |
| | | |
| | | global $app; |
| | |
| | | if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){ |
| | | $groups=explode(".",$field_value); |
| | | foreach($groups as $group){ |
| | | if($group<0 OR $group>255) |
| | | if($group<0 or $group>255) |
| | | $vip=0; |
| | | } |
| | | }else{$vip=0;} |
| | |
| | | return $sql; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Create SQL statement |
| | | * |
| | |
| | | |
| | | return $this->_getSQL($record, $tab, $action, $primary_id, $sql_ext_where, false); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Debugging arrays. |
| | |
| | | return $sql; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | ?> |