示例#1
0
 public function getAllChildren(Geo $geo)
 {
     if (!$geo->isLoaded()) {
         return array();
     }
     return $this->findByWhereMany("parentId = '{$geo->getPKValue()}'");
 }
示例#2
0
 public function getNameForLocation(Geo $geo, $lang)
 {
     if (!$geo->isLoaded()) {
         return false;
     }
     $this->sql_order = 'isshort DESC, ispreferred DESC';
     if ($this->findByWhere("geonameId = '{$geo->getPKValue()}' AND isoLanguage = '{$this->dao->escape($lang)}'")) {
         return $this->alternatename;
     } else {
         return false;
     }
 }
示例#3
0
 /**
  * returns array of usage counts for all usage types
  *
  * @param object $geo
  * @access public
  * @return array
  */
 public function getUsageForGeoByType(Geo $geo)
 {
     $result = array();
     if (!$geo->isLoaded()) {
         return $result;
     }
     $use = $this->findByWhereMany("geoId = '{$geo->getPKValue()}'");
     foreach ($this->geo_types as $type) {
         foreach ($use as $count) {
             if ($count->typeId = $type->getPKValue()) {
                 $result[$type->name] = $count->count;
             }
         }
     }
     return $result;
 }
示例#4
0
 /**
  * finds a local group for a geo location
  *
  * @param object $geo
  * @access public
  * @return object|false
  */
 public function getGroupForGeo(Geo $geo, $local = false)
 {
     if (!$geo->isLoaded()) {
         return false;
     }
     return $this->findByWhere("IdGeoname = '{$geo->getPKValue()}'" . ($local ? " AND IsLocal = TRUE" : ''));
 }