fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8273] API : get locations - filtered by categories


From: Sigurd Nes
Subject: [Fmsystem-commits] [8273] API : get locations - filtered by categories
Date: Mon, 12 Dec 2011 15:12:12 +0000

Revision: 8273
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8273
Author:   sigurdne
Date:     2011-12-12 15:12:11 +0000 (Mon, 12 Dec 2011)
Log Message:
-----------
API : get locations - filtered by categories

Modified Paths:
--------------
    trunk/phpgwapi/inc/class.locations.inc.php

Modified: trunk/phpgwapi/inc/class.locations.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.locations.inc.php  2011-12-11 21:02:26 UTC (rev 
8272)
+++ trunk/phpgwapi/inc/class.locations.inc.php  2011-12-12 15:12:11 UTC (rev 
8273)
@@ -402,11 +402,12 @@
                * @param bool   $grant          Used for finding locations 
where users can grant rights to others
                * @param string $appname        Name of application in question
                * @param bool   $allow_c_attrib Used for finding locations 
where custom attributes can be applied
+               * @param bool   $have_categories for finding locations which 
have categories
                *
                * @return array Array locations
                */
 
-               public function get_locations($grant = false, $appname = '', 
$allow_c_attrib = false, $c_function = false)
+               public function get_locations($grant = false, $appname = '', 
$allow_c_attrib = false, $c_function = false, $have_categories = false)
                {
                        if ( !$appname )
                        {
@@ -417,6 +418,12 @@
                        
                        $filter = " WHERE app_name='{$appname}' AND 
phpgw_locations.name != 'run'";
                        
+                       $join_categories = '';
+                       if($have_categories)
+                       {
+                               $join_categories = "{$this->_join} 
phpgw_categories ON phpgw_locations.location_id = phpgw_categories.location_id";
+                       }
+                       
                        if($allow_c_attrib)
                        {
                                $filter .= ' AND allow_c_attrib = 1';
@@ -432,8 +439,9 @@
                                $filter .= ' AND c_function = 1';
                        }
 
-                       $sql = "SELECT location_id, phpgw_locations.name, 
phpgw_locations.descr FROM phpgw_locations"
-                               . " $this->_join phpgw_applications ON 
phpgw_locations.app_id = phpgw_applications.app_id"
+                       $sql = "SELECT phpgw_locations.location_id, 
phpgw_locations.name, phpgw_locations.descr FROM phpgw_locations"
+                               . " {$this->_join} phpgw_applications ON 
phpgw_locations.app_id = phpgw_applications.app_id"
+                               . " {$join_categories}"
                                . " $filter ORDER BY phpgw_locations.name";
 
                        $this->_db->query($sql, __LINE__, __FILE__);




reply via email to

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