示例#1
0
 /**
  * @param string $myzip
  * @param int $miles
  * @return array v6_databaselist->the_list
  */
 function ZipsWithinMiles($myzip, $miles)
 {
     // first find out my lat/lon
     $this->my_zip_record->load_by_secondary_key('zip_code', $myzip);
     $ziplist = new v6_database_list($this->zip_radius_table_name);
     $where = sprintf("(SQRT((69.172*(%f-zip_radius_table_name.latitude))*(69.172*(%f-zip_radius_table_name.latitude))+(53.0*(%f-zip_radius_table_name.longitude))*(53.0*(%f-zip_radius_table_name.longitude)))<=%f)", $this->my_zip_record->latitude, $this->my_zip_record->latitude, $this->my_zip_record->longitude, $this->my_zip_record->longitude, $miles);
     $where = str_replace('zip_radius_table_name', $this->zip_radius_table_name, $where);
     $ziplist->load_by_custom_where($where);
     return $ziplist->the_list;
 }
 public function PrivilegeId($privilege_id_descrip)
 {
     if (is_string($privilege_id_descrip) == true) {
         $privilege = new v6_table('privileges');
         $privilege->load_by_secondary_key('descrip', $privilege_id_descrip);
         $result = $privilege->id;
     } else {
         // otherwise it's really an int not a string so return the int without looking it up from a string
         $result = $privilege_id_descrip;
     }
     return $result;
 }