phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] phpgwapi/inc class.categories.inc.php


From: Dave Hall
Subject: [Phpgroupware-cvs] phpgwapi/inc class.categories.inc.php
Date: Tue, 18 Apr 2006 10:59:09 +0000

CVSROOT:        /cvsroot/phpgwapi
Module name:    phpgwapi
Branch:         
Changes by:     Dave Hall <address@hidden>      06/04/18 10:59:08

Modified files:
        inc            : class.categories.inc.php 

Log message:
        make cats admin work properly and add the ability to call new style 
hooks when adding, editing and deleting cats, via admin or other metods, 
example in tts soon

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/phpgwapi/inc/class.categories.inc.php.diff?tr1=1.124&tr2=1.125&r1=text&r2=text

Patches:
Index: phpgwapi/inc/class.categories.inc.php
diff -u phpgwapi/inc/class.categories.inc.php:1.124 
phpgwapi/inc/class.categories.inc.php:1.125
--- phpgwapi/inc/class.categories.inc.php:1.124 Tue Apr 11 18:40:36 2006
+++ phpgwapi/inc/class.categories.inc.php       Tue Apr 18 10:59:08 2006
@@ -7,7 +7,7 @@
        * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage utilities
-       * @version $Id: class.categories.inc.php,v 1.124 2006/04/11 18:40:36 
skwashd Exp $
+       * @version $Id: class.categories.inc.php,v 1.125 2006/04/18 10:59:08 
skwashd Exp $
        */
 
        /**
@@ -43,8 +43,8 @@
 
                        $this->account_id       = $account_id;
                        $this->app_name         = 
$GLOBALS['phpgw']->db->db_addslashes($app_name);
-                       $this->db                       = $GLOBALS['phpgw']->db;
-                       $this->db2                      = $this->db;
+                       $this->db                       =& 
$GLOBALS['phpgw']->db;
+                       $this->db2                      = clone( $this->db);
                        $this->grants           = 
$GLOBALS['phpgw']->acl->get_grants($app_name);
                }
 
@@ -475,11 +475,11 @@
                                        $s .= 
$GLOBALS['phpgw']->strip_html($cat['name']);
                                        if ($cat['app_name'] == 'phpgw')
                                        {
-                                               $s .= '&nbsp;&lt;' . 
lang('Global') . '&gt;';
+                                               $s .= '&nbsp;[' . 
lang('Global') . ']';
                                        }
                                        if ($cat['owner'] == '-1')
                                        {
-                                               $s .= '&nbsp;&lt;' . 
lang('Global') . '&nbsp;' . lang($this->app_name) . '&gt;';
+                                               $s .= '&nbsp;[' . 
lang('Global') . '&nbsp;' . lang($this->app_name) . ']';
                                        }
                                        $s .= '</option>' . "\n";
                                }
@@ -580,17 +580,17 @@
                                $name = '';
                                for ($i=0;$i<$cat['level'];$i++)
                                {
-                                       $name .= '&nbsp;.&nbsp;';
+                                       $name .= ' . ';
                                }
                                $name .= 
$GLOBALS['phpgw']->strip_html($cat['name']);
 
                                if ($cat['app_name'] == 'phpgw')
                                {
-                                       $name .= ' <' . lang('Global') . '>';
+                                       $name .= ' [' . lang('Global') . ']';
                                }
                                if ($cat['owner'] == '-1')
                                {
-                                       $name .= ' <' . lang('Global') . ' ' . 
lang($this->app_name) . '>';
+                                       $name .= ' [' . lang('Global') . ' ' . 
lang($this->app_name) . ']';
                                }
 
                                $cat_list[] = array
@@ -659,6 +659,16 @@
                        {
                                $this->db->query('UPDATE phpgw_categories SET 
cat_main=' . $max . ' WHERE cat_id=' . $max,__LINE__,__FILE__);
                        }
+                       
+                       $args = array
+                       (
+                               'cat_id'        => $max,
+                               'cat_name'      => $values['name'],
+                               'cat_owner'     => $this->account_id,
+                               'location'      => 'cat_edit'
+                       );
+                       $GLOBALS['phpgw']->hooks->single($args, 
$this->app_name);
+
                        return $max;
                }
 
@@ -669,18 +679,6 @@
                * @param boolean $drop_subs Delete subcategroies
                * @param boolean $modify_subs Modify subcategories
                */
-               /*function delete($cat_id,$subs = False)
-               {
-                       $cat_id = intval($cat_id);
-                       if ($subs)
-                       {
-                               $subdelete = ' OR cat_parent=' . $cat_id . ' OR 
cat_main=' . $cat_id; 
-                       }
-
-                       $this->db->query('DELETE FROM phpgw_categories WHERE 
cat_id=' . $cat_id . $subdelete . " AND cat_appname='"
-                                                       . $this->app_name . 
"'",__LINE__,__FILE__);
-               } */
-
                function delete($cat_id, $drop_subs = False, $modify_subs = 
False)
                {
                        $cat_id = intval($cat_id);
@@ -723,6 +721,12 @@
 
                        $this->db->query('DELETE FROM phpgw_categories WHERE 
cat_id=' . $cat_id . $subdelete . " AND cat_appname='"
                                                        . $this->app_name . 
"'",__LINE__,__FILE__);
+                       $args = array
+                       (
+                               'cat_id'        => $cat_id,
+                               'location'      => 'cat_delete'
+                       );
+                       $GLOBALS['phpgw']->hooks->single($args, 
$this->app_name);
                }
 
                /**
@@ -764,6 +768,16 @@
                                        . " WHERE cat_appname='" . 
$this->app_name . "' AND cat_id=" . $values['id'];
 
                        $this->db->query($sql,__LINE__,__FILE__);
+                       
+                       $args = array
+                       (
+                               'cat_id'        => $values['id'],
+                               'cat_name'      => $values['name'],
+                               'cat_owner'     => $this->account_id,
+                               'location'      => 'cat_edit'
+                       );
+                       $GLOBALS['phpgw']->hooks->single($args, 
$this->app_name);
+                       
                        return $values['id'];
                }
 




reply via email to

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