fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15299]


From: nelson . guerra
Subject: [Fmsystem-commits] [15299]
Date: Fri, 17 Jun 2016 00:11:57 +0000 (UTC)

Revision: 15299
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15299
Author:   nelson224
Date:     2016-06-17 00:11:57 +0000 (Fri, 17 Jun 2016)
Log Message:
-----------


Added Paths:
-----------
    branches/dev-syncromind-2/property/inc/import/import_update_components.php

Copied: 
branches/dev-syncromind-2/property/inc/import/import_update_components.php 
(from rev 15290, 
branches/dev-syncromind-2/property/inc/import/import_update_generic.php)
===================================================================
--- branches/dev-syncromind-2/property/inc/import/import_update_components.php  
                        (rev 0)
+++ branches/dev-syncromind-2/property/inc/import/import_update_components.php  
2016-06-17 00:11:57 UTC (rev 15299)
@@ -0,0 +1,63 @@
+<?php
+
+       class import_components
+       {
+
+               protected $db;
+
+               public function __construct()
+               {
+                       $this->account = 
(int)$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->db = & $GLOBALS['phpgw']->db;
+                       $this->join = $this->db->join;
+                       $this->bo = CreateObject('property.boadmin_entity', 
true);
+               }
+
+               public function get_entity_categories ($data = array())
+               {
+                       $querymethod = '';
+                       if ($data['parent_id'])
+                       {
+                               $querymethod .= " AND parent_id = 
".$data['parent_id'];
+                       }
+                       
+                       $sql = "SELECT * FROM fm_entity_category WHERE 
entity_id = 3 {$querymethod}";
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       
+                       while ($this->db->next_record())
+                       {
+                               $buildingpart = explode(' ', 
trim($this->db->f('name')))[0];
+                                       
+                               $values[$buildingpart] = array
+                                       (
+                                       'id' => $this->db->f('id'),
+                                       'name' => $this->db->f('name'),
+                                       'buildingpart' => $buildingpart,
+                                       'location_id' => 
$this->db->f('location_id'),
+                                       'parent_id' => 
$this->db->f('parent_id'),
+                                       'entity_id' => $this->db->f('entity_id')
+                               );
+                       }
+                       
+                       return $values;
+               }
+               
+               public function add_entity_categories ($buildingpart_out_table)
+               {
+                       foreach ($buildingpart_out_table as $k => $v)
+                       {
+                               if ($v['parent'])
+                               {
+                                       $childs = 
$this->get_entity_categories(array('parent_id' => $v['parent']['id']));
+                                       if (count($childs))
+                                       {
+                                               $category = 
array_values($childs)[0];
+                                               $attrib_list = 
$this->bo->read_attrib(array('entity_id' => $category['entity_id'], 'cat_id' => 
$category['id'], 'allrows' => true));
+                                       }
+                               }
+                       }
+                       
+                       return $attrib_list;
+               }
+               
+       }
\ No newline at end of file




reply via email to

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