[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: sitemgr/inc class.Categories_SO.inc.php,1.2,1.3
From: |
Bettina Gille <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: sitemgr/inc class.Categories_SO.inc.php,1.2,1.3 |
Date: |
Mon, 02 Sep 2002 18:02:06 -0400 |
Update of /cvsroot/phpgroupware/sitemgr/inc
In directory subversions:/tmp/cvs-serv835
Modified Files:
class.Categories_SO.inc.php
Log Message:
update cats to use class.categories
Index: class.Categories_SO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Categories_SO.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.Categories_SO.inc.php 30 Aug 2002 09:45:25 -0000 1.2
--- class.Categories_SO.inc.php 2 Sep 2002 22:02:04 -0000 1.3
***************
*** 2,36 ****
class Categories_SO
{
! var $db;
!
function Categories_SO()
{
! $this->db = $GLOBALS['phpgw']->db;
}
function getFullCategoryIDList()
{
! $sql = 'SELECT cat_id FROM phpgw_sitemgr_categories
ORDER BY sort_order';
! $this->db->query($sql, __LINE__, __FILE__);
! while ($this->db->next_record())
{
! $cat_id_list[] = $this->db->f('cat_id');
}
return $cat_id_list;
}
! function addCategory($name, $description)
{
! //Create a section for categoriy and return the newly
added category id.
! $sql = 'INSERT INTO phpgw_sitemgr_categories (name,
description) VALUES ("'
! . $name . '","' . $description . '")';
! $this->db->query($sql, __LINE__, __FILE__);
! return
$this->db->get_last_insert_id('phpgw_sitemgr_categories','cat_id');
}
! function removeCategory($cat_id)
{
! $sql = 'DELETE FROM phpgw_sitemgr_categories WHERE
cat_id="' . $cat_id . '"';
! $this->db->query($sql, __LINE__, __FILE__);
return true;
}
--- 2,55 ----
class Categories_SO
{
! var $cats;
!
function Categories_SO()
{
! $this->cats =
CreateObject('phpgwapi.categories',-1,'sitemgr');
! }
!
! function getFullChildrenIDList($parent = '')
! {
! if (!$parent)
! {
! $parent = 0;
! }
!
! $cats =
$this->cats->return_array('all','',False,'','cat_data','',False, $parent)
!
! while (is_array($cats) && list(,$subs) = each($cats))
! {
! $subs_id_list[] = $subs['cat_id'];
! }
! return $subs_id_list;
}
function getFullCategoryIDList()
{
! $cats =
$this->cats->return_array('all','',False,'','cat_data','',False)
!
! while (is_array($cats) && list(,$cat) = each($cats))
{
! $cat_id_list[] = $cat['cat_id'];
}
return $cat_id_list;
}
! function addCategory($name, $description, $parent = '')
{
! $data = array
! (
! 'name' => $name,
! 'descr' => $description,
! 'access' => 'public',
! 'parent' => $parent
! );
!
! return $this->cats->add($data);
}
! function removeCategory($cat_id, $subs = False)
{
! $this->cats->delete($cat_id,$subs);
return true;
}
***************
*** 38,59 ****
function saveCategory($cat_info)
{
! $sql = 'UPDATE phpgw_sitemgr_categories SET name="' .
! $cat_info->name . '", description="' .
$cat_info->description .
! '", sort_order="'. (int) $cat_info->sort_order .
! '" WHERE cat_id="' . $cat_info->id . '"';
! $this->db->query($sql, __LINE__, __FILE__);
}
function getCategory($cat_id)
{
! $sql = 'SELECT * FROM phpgw_sitemgr_categories WHERE
cat_id="' . $cat_id . '"';
! $this->db->query($sql, __LINE__, __FILE__);
! if ($this->db->next_record())
{
! $cat_info = CreateObject('sitemgr.Category_SO',
True);
! $cat_info->id = $cat_id;
! $cat_info->name = $this->db->f('name');
! $cat_info->sort_order =
$this->db->f('sort_order');
! $cat_info->description =
$this->db->f('description');
return $cat_info;
}
--- 57,82 ----
function saveCategory($cat_info)
{
! $data = array
! (
! 'name' => $cat_info->name,
! 'descr' => $cat_info->description,
! 'data' => (int) $cat_info->sort_order,
! 'id' => $cat_info->id
! );
!
! $this->cats->edit($data);
}
function getCategory($cat_id)
{
! $cat = $this->cats->return_single($cat_id);
!
! if (is_array($cat))
{
! $cat_info =
CreateObject('sitemgr.Category_SO', True);
! $cat_info->id = $cat[0]['id'];
! $cat_info->name =
$cat[0]['name'];
! $cat_info->sort_order = $cat[0]['data'];
! $cat_info->description = $cat[0]['descr'];
return $cat_info;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: sitemgr/inc class.Categories_SO.inc.php,1.2,1.3,
Bettina Gille <address@hidden> <=