mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 15:18:58 +01:00
added function for cat_select_box using xsl tpl
This commit is contained in:
parent
7093aef55a
commit
e9251d17e1
@ -57,7 +57,6 @@
|
||||
$this->app_name = $app_name;
|
||||
$this->db = $GLOBALS['phpgw']->db;
|
||||
$this->grants = $GLOBALS['phpgw']->acl->get_grants($app_name);
|
||||
$this->cats = $this->return_array($type,$start,$limit,$query,$sort,$order,$globals,$parent_id);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -204,7 +203,6 @@
|
||||
return $cats;
|
||||
}
|
||||
|
||||
|
||||
function return_sorted_array($start,$limit = True,$query = '',$sort = '',$order = '',$globals = False, $parent_id = '')
|
||||
{
|
||||
if ($globals)
|
||||
@ -265,8 +263,6 @@
|
||||
$sql = "SELECT * from phpgw_categories WHERE (cat_appname='" . $this->app_name . "' AND" . $grant_cats . $global_cats . ")"
|
||||
. $querymethod;
|
||||
|
||||
//$mainselect = ' AND cat_level=0';
|
||||
|
||||
if ($limit)
|
||||
{
|
||||
$this->db->limit_query($sql . $parent_select . $ordermethod,$start,__LINE__,__FILE__);
|
||||
@ -344,7 +340,6 @@
|
||||
}
|
||||
}
|
||||
$this->total_records = count($cats);
|
||||
|
||||
return $cats;
|
||||
}
|
||||
|
||||
@ -482,6 +477,76 @@
|
||||
}
|
||||
}
|
||||
|
||||
function formatted_xslt_list($data)
|
||||
{
|
||||
if(is_array($data))
|
||||
{
|
||||
$format = (isset($data['format'])?$data['format']:'select');
|
||||
$type = (isset($data['type'])?$data['type']:'all');
|
||||
$selected = (isset($data['selected'])?$data['selected']:'');
|
||||
$globals = (isset($data['globals'])?$data['globals']:False);
|
||||
$site_link = (isset($data['site_link'])?$data['site_link']:'site');
|
||||
}
|
||||
|
||||
if (!is_array($selected))
|
||||
{
|
||||
$selected = explode(',',$selected);
|
||||
}
|
||||
|
||||
if ($type != 'all')
|
||||
{
|
||||
$cats = $this->return_array($type,$start,False,$query,$sort,$order,$globals);
|
||||
}
|
||||
else
|
||||
{
|
||||
$cats = $this->return_sorted_array($start,False,$query,$sort,$order,$globals);
|
||||
}
|
||||
|
||||
if ($format == 'select')
|
||||
{
|
||||
while (is_array($cats) && list(,$cat) = each($cats))
|
||||
{
|
||||
$sel_cat = '';
|
||||
if (in_array($cat['id'],$selected))
|
||||
{
|
||||
$sel_cat = 'selected';
|
||||
}
|
||||
|
||||
$name = '';
|
||||
for ($i=0;$i<$cat['level'];$i++)
|
||||
{
|
||||
$name .= '-';
|
||||
}
|
||||
$name .= $GLOBALS['phpgw']->strip_html($cat['name']);
|
||||
|
||||
if ($cat['app_name'] == 'phpgw')
|
||||
{
|
||||
$name .= ' <' . lang('Global') . '>';
|
||||
}
|
||||
if ($cat['owner'] == '-1')
|
||||
{
|
||||
$name .= ' <' . lang('Global') . ' ' . lang($this->app_name) . '>';
|
||||
}
|
||||
|
||||
$cat_list[] = array
|
||||
(
|
||||
'id' => $cat['id'],
|
||||
'name' => $name,
|
||||
'selected_cat' => $sel_cat
|
||||
);
|
||||
}
|
||||
|
||||
for ($i=0;$i<count($cat_list);$i++)
|
||||
{
|
||||
if ($cat_list[$i]['selected_cat'] != 'selected')
|
||||
{
|
||||
unset($cat_list[$i]['selected_cat']);
|
||||
}
|
||||
}
|
||||
return $cat_list;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@function add
|
||||
@abstract add categories
|
||||
@ -521,7 +586,16 @@
|
||||
@abstract delete category
|
||||
@param $cat_id int - category id
|
||||
*/
|
||||
function delete($cat_id, $drop_subs = False, $modify_subs = False)
|
||||
function delete($data)
|
||||
{
|
||||
if(is_array($data))
|
||||
{
|
||||
$cat_id = $data['cat_id'];
|
||||
$drop_subs = (isset($data['drop_subs'])?$data['drop_subs']:False);
|
||||
$modify_subs = (isset($data['modify_subs'])?$data['modify_subs']:False);
|
||||
}
|
||||
|
||||
if ($cat_id > 0)
|
||||
{
|
||||
if ($drop_subs)
|
||||
{
|
||||
@ -563,6 +637,7 @@
|
||||
$this->db->query("DELETE FROM phpgw_categories WHERE cat_id='" . $cat_id . $subdelete . "'AND cat_appname='"
|
||||
. $this->app_name . "'",__LINE__,__FILE__);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@function edit
|
||||
|
Loading…
Reference in New Issue
Block a user