mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-29 17:28:36 +01:00
Fix filter for personal categories under a global category
This commit is contained in:
parent
a9cd9ed96d
commit
d15e738692
@ -285,7 +285,7 @@ class admin_categories
|
|||||||
* @param array &$readonlys eg. to disable buttons based on acl, not use here, maybe in a derived class
|
* @param array &$readonlys eg. to disable buttons based on acl, not use here, maybe in a derived class
|
||||||
* @return int total number of rows
|
* @return int total number of rows
|
||||||
*/
|
*/
|
||||||
static function get_rows($query,&$rows,&$readonlys)
|
public function get_rows($query,&$rows,&$readonlys)
|
||||||
{
|
{
|
||||||
self::init_static();
|
self::init_static();
|
||||||
|
|
||||||
@ -310,15 +310,21 @@ class admin_categories
|
|||||||
$filter['owner'] = 0;
|
$filter['owner'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//$cats = new categories($query['col_filter']['owner'] ? $query['col_filter']['owner'] : $query['filter'],$query['appname']);
|
|
||||||
$cats = new categories($filter['owner'],$query['appname']);
|
$cats = new categories($filter['owner'],$query['appname']);
|
||||||
|
|
||||||
$parent =array(0);
|
$globalcat=1;
|
||||||
// Use all parents, in case user has their cat as a child of a global or something
|
$parent = 0;
|
||||||
//if($filter['owner']) $parent += $cats->return_array('all',0,false,'','ASC','',true,null,-1, 'id');
|
$rows = $cats->return_sorted_array($query['start'],false,$query['search'],$query['sort'],$query['order'],$globalcat,$parent,true);
|
||||||
$rows = $cats->return_sorted_array($query['start'],$query['num_rows'],$query['search'],$query['sort'],$query['order'],$globalcat,$parent,true, $filter);
|
$count = $cats->total_records;
|
||||||
foreach($rows as &$row)
|
foreach($rows as $key => &$row)
|
||||||
{
|
{
|
||||||
|
if($filter['owner'] && $filter['owner'] != $row['owner'])
|
||||||
|
{
|
||||||
|
unset($rows[$key]);
|
||||||
|
$count--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$row['level_spacer'] = str_repeat(' ',$row['level']);
|
$row['level_spacer'] = str_repeat(' ',$row['level']);
|
||||||
|
|
||||||
if ($row['data']['icon']) $row['icon_url'] = self::icon_url($row['data']['icon']);
|
if ($row['data']['icon']) $row['icon_url'] = self::icon_url($row['data']['icon']);
|
||||||
@ -334,13 +340,14 @@ class admin_categories
|
|||||||
$readonlys["add[$row[id]]"] = !self::$acl_add_sub;
|
$readonlys["add[$row[id]]"] = !self::$acl_add_sub;
|
||||||
$readonlys["delete[$row[id]]"] = !self::$acl_delete;
|
$readonlys["delete[$row[id]]"] = !self::$acl_delete;
|
||||||
}
|
}
|
||||||
|
$rows = $count <= $query['num_rows'] ? array_values($rows) : array_slice($rows, $query['start'], $query['num_rows']);
|
||||||
// make appname available for actions
|
// make appname available for actions
|
||||||
$rows['appname'] = $query['appname'];
|
$rows['appname'] = $query['appname'];
|
||||||
|
|
||||||
$GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Global categories').
|
$GLOBALS['egw_info']['flags']['app_header'] = lang($this->appname).' - '.lang('categories').
|
||||||
($query['appname'] != categories::GLOBAL_APPNAME ? ': '.lang($query['appname']) : '');
|
($query['appname'] != categories::GLOBAL_APPNAME ? ': '.lang($query['appname']) : '');
|
||||||
|
|
||||||
return $cats->total_records;
|
return $count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
class preferences_categories_ui extends admin_categories {
|
class preferences_categories_ui extends admin_categories {
|
||||||
|
|
||||||
protected $appname = 'preferences';
|
protected $appname = 'preferences';
|
||||||
protected $get_rows = 'preferences_categories_ui::get_rows';
|
protected $get_rows = 'preferencespreferences_categories_ui.get_rows';
|
||||||
protected $list_link = 'preferences.preferences_categories_ui.index';
|
protected $list_link = 'preferences.preferences_categories_ui.index';
|
||||||
protected $edit_link = 'preferences.preferences_categories_ui.edit';
|
protected $edit_link = 'preferences.preferences_categories_ui.edit';
|
||||||
protected $add_link = 'preferences.preferences_categories_ui.edit';
|
protected $add_link = 'preferences.preferences_categories_ui.edit';
|
||||||
@ -25,7 +25,7 @@ class preferences_categories_ui extends admin_categories {
|
|||||||
function __construct() {
|
function __construct() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function get_rows(&$query, &$rows, &$readonlys) {
|
public function get_rows(&$query, &$rows, &$readonlys) {
|
||||||
$count = parent::get_rows($query, $rows, $readonlys);
|
$count = parent::get_rows($query, $rows, $readonlys);
|
||||||
$rows['edit_link'] = 'preferences.preferences_categories_ui.edit';
|
$rows['edit_link'] = 'preferences.preferences_categories_ui.edit';
|
||||||
return $count;
|
return $count;
|
||||||
|
Loading…
Reference in New Issue
Block a user