fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [8517] property.solocation.get_children


From: Sigurd Nes
Subject: [Fmsystem-commits] [8517] property.solocation.get_children
Date: Sat, 07 Jan 2012 14:40:38 +0000

Revision: 8517
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8517
Author:   sigurdne
Date:     2012-01-07 14:40:38 +0000 (Sat, 07 Jan 2012)
Log Message:
-----------
property.solocation.get_children

Modified Paths:
--------------
    trunk/property/inc/class.solocation.inc.php

Modified: trunk/property/inc/class.solocation.inc.php
===================================================================
--- trunk/property/inc/class.solocation.inc.php 2012-01-07 14:40:28 UTC (rev 
8516)
+++ trunk/property/inc/class.solocation.inc.php 2012-01-07 14:40:38 UTC (rev 
8517)
@@ -1769,4 +1769,29 @@
                        $this->db->next_record();
                        return $this->db->f('id');
                }
+
+               function get_children($location_code)
+               {
+                       $level = count(explode('-', $location_code));
+                       $child_level = $level + 1;
+                       $location_types = 
$this->soadmin_location->select_location_type();
+
+                       $values = array();
+                       
+                       if( $level >= count($location_types))
+                       {
+                               return $values;
+                       }
+                       
+                       $this->db->query("SELECT loc{$child_level} AS id, 
loc{$child_level}_name AS name FROM fm_location{$child_level} WHERE 
location_code {$this->like} '{$location_code}%'",__LINE__,__FILE__);
+                       while ($this->db->next_record())
+                       {
+                               $values[] = array
+                               (
+                                       'id'    =>  $this->db->f('id'),
+                                       'name'  =>  $this->db->f('name')
+                               );
+                       }
+                       return $values;
+               }
        }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]