Project

General

Profile

« Previous | Next » 

Revision 9d47d187

Added by Andreas Kohlbecker over 12 years ago

fixed caching problem; improved openlayers map

View differences:

modules/cdm_dataportal/cdm_dataportal.module
736 736
  
737 737
  $form['cdm_dataportal']['geoservice']['cdm_dataportal_geoservice_bounding_box'] = array(
738 738
    '#type' => 'textfield',
739
    '#title' => t('Geoservice Bounding Box'),
739
    '#title' => t('Fixed Geoservice Bounding Box'),
740 740
    '#default_value' => variable_get('cdm_dataportal_geoservice_bounding_box', '-180,-90,180,90'),
741
    '#description' => t('Define the surrounding area using latitude and longitude. Leave as is for the whole world.')
741
    '#description' => t('Define urrounding of area to be displayed in maps. Use "-180,-90,180,90" for the whole world. Leave <strong>empty</strong> to let the map <strong>automatically zoom</strong> to the distribution area.')
742 742
  );
743 743
  
744 744
   //cdm_dataportal_geoservice_labels_on
......
1078 1078
  return false;
1079 1079
}
1080 1080

  
1081
/**
1082
 * Truncates a $string to the specified $length. 
1083
 * If the supplied string is equal to or shorter than the $legth the original is returend.
1084
 * if an $appendix is defined the resulting string will have the specified $length including the $appendix.
1085
 *
1086
 * @param String $string	the string to truncate
1087
 * @param Number $length	the maximun length
1088
 * @param String $appendix	an optional appendix.
1089
 *
1090
 * @return the string
1091
 */
1092
function str_trunk(&$string, $length, $appendix=''){
1093
  if(strlen($string) >= $length ){
1094
    return  substr($string, 0, $length - strlen($appendix)).$appendix;
1095
  } else {
1096
    return $string;
1097
  }
1098
}
1099

  
1100
/**
1101
 * @param string $str
1102
 * @param string $sub
1103
 * @return boolean
1104
 */
1105
function str_beginsWith( $str, $sub ) {
1106
  return ( substr( $str, 0, strlen( $sub ) ) === $sub );
1107
}
1108

  
1109
/**
1110
 *
1111
 * @param string $str
1112
 * @param string $sub
1113
 * @return boolean
1114
 */
1115
function str_endsWith( $str, $sub ) {
1116
  return ( substr( $str, strlen( $str ) - strlen( $sub ) ) === $sub );
1117
}
1118

  
1119
/**
1120
 * Replaces all occurences in $array of the key defined in $replace_map with the according values in the 
1121
 * $replace_map.
1122
 * 
1123
 * @param $array
1124
 * @param $replace_map 
1125
 * @return unknown_type
1126
 */
1127
function array_replace_key($array, $replace_map){
1128
  foreach($replace_map as $key=>$newkey){
1129
    if(isset($array[$key])){
1130
      $array[$newkey] = $array[$key];
1131
      unset($array[$key]);
1132
    }
1133
  }
1134
  return $array;
1135
}
1136

  
1137
/**
1138
 * Replaces all occurrences of space characters with 
1139
 * an underscore and transforms the given
1140
 * string to lowercase.
1141
 *
1142
 * @param String $string
1143
 * @return the transformed string
1144
 */
1145
function generalizeString($string){
1146
  return str_replace(' ', '_', strtolower($string));
1147
}
1148

  
1149 1081
/**@Deprecated
1150 1082
 * 
1151 1083
 */

Also available in: Unified diff