[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: phpgwapi/inc class.categories.inc.php,1.85,1.86
From: |
Bettina Gille <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: phpgwapi/inc class.categories.inc.php,1.85,1.86 |
Date: |
Mon, 02 Sep 2002 22:21:38 -0400 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv2639
Modified Files:
class.categories.inc.php
Log Message:
updated function delete, id2name, return_sorted_array to move subcats down if
delete their parent
Index: class.categories.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.categories.inc.php,v
retrieving revision 1.85
retrieving revision 1.86
diff -C2 -r1.85 -r1.86
*** class.categories.inc.php 2 Sep 2002 22:03:00 -0000 1.85
--- class.categories.inc.php 3 Sep 2002 02:21:36 -0000 1.86
***************
*** 204,208 ****
! function return_sorted_array($start,$limit = True,$query =
'',$sort = '',$order = '',$globals = False)
{
if ($globals)
--- 204,208 ----
! function return_sorted_array($start,$limit = True,$query =
'',$sort = '',$order = '',$globals = False, $parent_id = '')
{
if ($globals)
***************
*** 247,250 ****
--- 247,259 ----
}
+ if ($parent_id)
+ {
+ $parent_select = " AND cat_parent='$parent_id'";
+ }
+ else
+ {
+ $parent_select = " AND cat_parent='0'";
+ }
+
if ($query)
{
***************
*** 255,267 ****
. $querymethod;
! $mainselect = ' AND cat_level=0';
if ($limit)
{
! $this->db->limit_query($sql . $mainselect .
$ordermethod,$start,__LINE__,__FILE__);
}
else
{
! $this->db->query($sql . $mainselect .
$ordermethod,__LINE__,__FILE__);
}
--- 264,276 ----
. $querymethod;
! //$mainselect = ' AND cat_level=0';
if ($limit)
{
! $this->db->limit_query($sql . $parent_select .
$ordermethod,$start,__LINE__,__FILE__);
}
else
{
! $this->db->query($sql . $parent_select .
$ordermethod,__LINE__,__FILE__);
}
***************
*** 285,297 ****
for ($i=0;$i < $num_cats;$i++)
{
! $subselect = " AND cat_parent='" .
$cats[$i]['id'] . "' AND cat_level='" . ($cats[$i]['level']+1) . "'";
if ($limit)
{
! $this->db->limit_query($sql .
$subselect . $ordermethod,$start,__LINE__,__FILE__);
}
else
{
! $this->db->query($sql . $subselect .
$ordermethod,__LINE__,__FILE__);
}
--- 294,306 ----
for ($i=0;$i < $num_cats;$i++)
{
! $sub_select = " AND cat_parent='" .
$cats[$i]['id'] . "' AND cat_level='" . ($cats[$i]['level']+1) . "'";
if ($limit)
{
! $this->db->limit_query($sql .
$sub_select . $ordermethod,$start,__LINE__,__FILE__);
}
else
{
! $this->db->query($sql . $sub_select .
$ordermethod,__LINE__,__FILE__);
}
***************
*** 511,522 ****
@param $cat_id int - category id
*/
! function delete($cat_id,$subs = False)
{
! 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__);
}
--- 520,563 ----
@param $cat_id int - category id
*/
! function delete($cat_id, $drop_subs = False, $modify_subs =
False)
{
! if ($drop_subs)
{
! $subdelete = ' OR cat_parent=' . $cat_id . ' OR
cat_main=' . $cat_id;
! }
!
! if ($modify_subs)
! {
! $cats =
$this->return_sorted_array('',False,'','','',False, $cat_id);
!
! $new_parent = $this->id2name($cat_id,'parent');
!
! for ($i=0;$i<count($cats);$i++)
! {
! if ($cats[$i]['level'] == 1)
! {
! $this->db->query('UPDATE
phpgw_categories set cat_level=0, cat_parent=0, cat_main=' . $cats[$i]['id']
!
. ' WHERE cat_id=' . $cats[$i]['id'],__LINE__,__FILE__);
! $new_main = $cats[$i]['id'];
! }
! else
! {
! if ($new_main)
! {
! $update_main =
',cat_main=' . $new_main;
! }
!
! if ($cats[$i]['parent'] ==
$cat_id)
! {
! $update_parent =
',cat_parent=' . $new_parent;
! }
!
! $this->db->query('UPDATE
phpgw_categories set cat_level=' . ($cats[$i]['level']-1) . $update_main .
$update_parent
!
. ' WHERE cat_id=' . $cats[$i]['id'],__LINE__,__FILE__);
! }
! }
}
! $this->db->query("DELETE FROM phpgw_categories WHERE
cat_id='" . $cat_id . $subdelete . "'AND cat_appname='"
. $this->app_name .
"'",__LINE__,__FILE__);
}
***************
*** 557,562 ****
{
$this->db->query("SELECT cat_id FROM phpgw_categories
WHERE cat_name='" . $this->db->db_addslashes($cat_name) . "' "
! ."AND cat_appname='" . $this->app_name . "' "
! ."AND cat_owner=" .
$this->account_id,__LINE__,__FILE__);
if(!$this->db->num_rows())
--- 598,602 ----
{
$this->db->query("SELECT cat_id FROM phpgw_categories
WHERE cat_name='" . $this->db->db_addslashes($cat_name) . "' "
! ."AND cat_appname='" .
$this->app_name . "' AND cat_owner=" . $this->account_id,__LINE__,__FILE__);
if(!$this->db->num_rows())
***************
*** 582,586 ****
case 'main': $value = 'cat_main'; break;
case 'level': $value = 'cat_level'; break;
! case 'data': $value = 'cat_data'; break;
}
--- 622,627 ----
case 'main': $value = 'cat_main'; break;
case 'level': $value = 'cat_level'; break;
! case 'data': $value = 'cat_data'; break;
! case 'parent': $value = 'cat_parent'; break;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: phpgwapi/inc class.categories.inc.php,1.85,1.86,
Bettina Gille <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: sitemgr/sitemgr-site/templates/NukeNews centerblock.tpl,NONE,1.1 main.tpl,NONE,1.1 sideblock.tpl,NONE,1.1
- Next by Date:
[Phpgroupware-cvs] CVS: admin/templates/default delete_cat.tpl,1.4,1.5
- Previous by thread:
[Phpgroupware-cvs] CVS: sitemgr/sitemgr-site/templates/NukeNews centerblock.tpl,NONE,1.1 main.tpl,NONE,1.1 sideblock.tpl,NONE,1.1
- Next by thread:
[Phpgroupware-cvs] CVS: admin/templates/default delete_cat.tpl,1.4,1.5
- Index(es):