fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11227] more on controller


From: Sigurd Nes
Subject: [Fmsystem-commits] [11227] more on controller
Date: Tue, 02 Jul 2013 20:01:09 +0000

Revision: 11227
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11227
Author:   sigurdne
Date:     2013-07-02 20:01:08 +0000 (Tue, 02 Jul 2013)
Log Message:
-----------
more on controller

Modified Paths:
--------------
    trunk/controller/inc/class.socontrol_group.inc.php
    trunk/controller/inc/class.soprocedure.inc.php
    trunk/controller/inc/class.uicontrol.inc.php
    trunk/phpgwapi/inc/class.categories.inc.php

Modified: trunk/controller/inc/class.socontrol_group.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol_group.inc.php  2013-07-02 18:14:16 UTC 
(rev 11226)
+++ trunk/controller/inc/class.socontrol_group.inc.php  2013-07-02 20:01:08 UTC 
(rev 11227)
@@ -361,11 +361,21 @@
                 */
                function get_control_groups_by_control_area($control_area_id)
                {
-                       $control_area_id = (int) $control_area_id;
-                       $controls_array = array();
 
-                       $sql = "SELECT * FROM controller_control_group WHERE 
control_area_id=$control_area_id";
+                       $cat_id = (int) $control_area_id;
+                       $cats   = CreateObject('phpgwapi.categories', -1, 
'controller', '.control');
+                       $cat_path = $cats->get_path($cat_id);
+                       foreach ($cat_path as $_category)
+                       {
+                               $cat_filter[] = $_category['id'];
+                       }
+
+                       $filter_control_area = "control_area_id IN (" .  
implode(',', $cat_filter) .')';
+
+                       $sql = "SELECT * FROM controller_control_group WHERE 
{$filter_control_area}";
+
                        $this->db->query($sql);
+                       $controls_array = array();
 
                        while($this->db->next_record())
                        {

Modified: trunk/controller/inc/class.soprocedure.inc.php
===================================================================
--- trunk/controller/inc/class.soprocedure.inc.php      2013-07-02 18:14:16 UTC 
(rev 11226)
+++ trunk/controller/inc/class.soprocedure.inc.php      2013-07-02 20:01:08 UTC 
(rev 11227)
@@ -269,10 +269,8 @@
                {
                        $cat_id = (int) $control_area_id;
                        $cats   = CreateObject('phpgwapi.categories', -1, 
'controller', '.control');
-                       $cats->supress_info     = true;
-                       $cat_list       = $cats->return_sorted_array(0, false, 
'', '', '', false, $cat_id, false);
-                       $cat_filter = array($cat_id);
-                       foreach ($cat_list as $_category)
+                       $cat_path = $cats->get_path($cat_id);
+                       foreach ($cat_path as $_category)
                        {
                                $cat_filter[] = $_category['id'];
                        }

Modified: trunk/controller/inc/class.uicontrol.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol.inc.php        2013-07-02 18:14:16 UTC 
(rev 11226)
+++ trunk/controller/inc/class.uicontrol.inc.php        2013-07-02 20:01:08 UTC 
(rev 11227)
@@ -287,7 +287,9 @@
                        $control_areas_array = $control_areas['cat_list'];
                
                        if($control != null)
+                       {
                                $procedures_array = 
$this->so_procedure->get_procedures_by_control_area($control->get_control_area_id());
+                       }
                        
                        $role_array = $this->so->get_roles();
                        

Modified: trunk/phpgwapi/inc/class.categories.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.categories.inc.php 2013-07-02 18:14:16 UTC (rev 
11226)
+++ trunk/phpgwapi/inc/class.categories.inc.php 2013-07-02 20:01:08 UTC (rev 
11227)
@@ -1054,4 +1054,39 @@
                        $this->location_id      = 
$GLOBALS['phpgw']->locations->get_id($appname, $location);
                        $this->grants           = 
$GLOBALS['phpgw']->acl->get_grants($appname, $location);
                }
+
+               /**
+                * used for retrive the path for a particular node from a 
hierarchy
+                *
+                * @param integer $entity_id Entity id
+                * @param integer $node is the id of the node we want the path 
of
+                * @return array $path Path
+                */
+
+               public function get_path($cat_id)
+               {
+                       $cat_id = (int) $cat_id;
+                       $sql = "SELECT cat_parent, cat_name FROM 
phpgw_categories WHERE cat_id = {$cat_id}";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+
+                       $parent_id = $this->db->f('cat_parent');
+                       $name = $this->db->f('cat_name', true);
+                       $path = array
+                       (
+                               array
+                               (
+                                       'id' => $cat_id,
+                                       'name' => $name
+                               )
+                       );
+
+                       if ($parent_id)
+                       {
+                               $path = 
array_merge($this->get_path($parent_id), $path);
+                       }
+
+                       return $path;
+               }
        }




reply via email to

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