mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
move categories class to api
This commit is contained in:
parent
52a7f2198a
commit
4da844a70f
@ -622,7 +622,7 @@ class Accounts
|
||||
$GLOBALS['egw']->acl->delete_account($id);
|
||||
|
||||
// delete all categories belonging to that user or group
|
||||
categories::delete_account($id);
|
||||
Categories::delete_account($id);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
1154
api/src/Categories.php
Normal file
1154
api/src/Categories.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -16,10 +16,6 @@
|
||||
|
||||
namespace EGroupware\Api;
|
||||
|
||||
// explicitly reference classes still in phpgwapi
|
||||
use categories;
|
||||
use etemplate; // cats2color
|
||||
|
||||
use calendar_bo; // to_do: do NOT require it, just use if there
|
||||
|
||||
/**
|
||||
@ -143,7 +139,7 @@ class Contacts extends Contacts\Storage
|
||||
/**
|
||||
* Categories object
|
||||
*
|
||||
* @var categories
|
||||
* @var Categories
|
||||
*/
|
||||
var $categories;
|
||||
|
||||
@ -315,7 +311,7 @@ class Contacts extends Contacts\Storage
|
||||
$this->org_fields[] = 'adr_two_countrycode';
|
||||
}
|
||||
}
|
||||
$this->categories = new categories($this->user,'addressbook');
|
||||
$this->categories = new Categories($this->user,'addressbook');
|
||||
|
||||
$this->delete_history = $GLOBALS['egw_info']['server']['history'];
|
||||
}
|
||||
@ -1525,7 +1521,7 @@ class Contacts extends Contacts\Storage
|
||||
$result[$contact['id']] = call_user_func_array('imap_rfc822_write_address', $args);
|
||||
}
|
||||
// show category color
|
||||
if ($contact['cat_id'] && ($color = etemplate::cats2color($contact['cat_id'])))
|
||||
if ($contact['cat_id'] && ($color = Categories::cats2color($contact['cat_id'])))
|
||||
{
|
||||
$result[$contact['id']] = array(
|
||||
'label' => $result[$contact['id']],
|
||||
@ -1691,7 +1687,7 @@ class Contacts extends Contacts\Storage
|
||||
$drop_subs = ($data['drop_subs'] && !$data['modify_subs']);
|
||||
if($drop_subs)
|
||||
{
|
||||
$cats = new categories('', 'addressbook');
|
||||
$cats = new Categories('', 'addressbook');
|
||||
$cat_ids = $cats->return_all_children($data['cat_id']);
|
||||
}
|
||||
else
|
||||
@ -2090,7 +2086,7 @@ class Contacts extends Contacts\Storage
|
||||
{
|
||||
if (!is_object($this->categories))
|
||||
{
|
||||
$this->categories = new categories($this->user,'addressbook');
|
||||
$this->categories = new Categories($this->user,'addressbook');
|
||||
}
|
||||
|
||||
if (!is_array($cat_id_list))
|
||||
|
@ -932,7 +932,7 @@ class Ldap
|
||||
{
|
||||
if (!is_object($GLOBALS['egw']->categories))
|
||||
{
|
||||
$GLOBALS['egw']->categories = CreateObject('phpgwapi.categories');
|
||||
$GLOBALS['egw']->categories = new Api\Categories();
|
||||
}
|
||||
$cats = $GLOBALS['egw']->categories->return_all_children((int)$value);
|
||||
if (count($cats) > 1) $filters .= '(|';
|
||||
@ -1210,7 +1210,7 @@ class Ldap
|
||||
foreach(is_array($data['cat_id']) ? $data['cat_id'] : explode(',',$data['cat_id']) as $cat)
|
||||
{
|
||||
$ldapContact['category'][] = Api\Translation::convert(
|
||||
ExecMethod('phpgwapi.categories.id2name',$cat),$this->charset,'utf-8');
|
||||
Api\Categories::id2name($cat),$this->charset,'utf-8');
|
||||
}
|
||||
}
|
||||
foreach(array(
|
||||
@ -1256,7 +1256,7 @@ class Ldap
|
||||
{
|
||||
if (!is_int($iii)) continue;
|
||||
|
||||
$contact['cat_id'][] = ExecMethod('phpgwapi.categories.name2id',$cat);
|
||||
$contact['cat_id'][] = $GLOBALS['egw']->categories->name2id($cat);
|
||||
}
|
||||
if ($contact['cat_id']) $contact['cat_id'] = implode(',',$contact['cat_id']);
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ class Sql extends Api\Storage
|
||||
{
|
||||
if (!is_object($GLOBALS['egw']->categories))
|
||||
{
|
||||
$GLOBALS['egw']->categories = CreateObject('phpgwapi.categories');
|
||||
$GLOBALS['egw']->categories = new Api\Categories;
|
||||
}
|
||||
foreach($GLOBALS['egw']->categories->return_all_children((int)$cat_id) as $cat)
|
||||
{
|
||||
|
@ -16,7 +16,6 @@ namespace EGroupware\Api;
|
||||
// explicitly import old not yet ported classes
|
||||
use egw;
|
||||
use egw_framework;
|
||||
use categories; // css
|
||||
|
||||
/**
|
||||
* New eTemplate serverside contains:
|
||||
@ -232,7 +231,7 @@ class Etemplate extends Etemplate\Widget\Template
|
||||
egw_framework::validate_file('.','app',$app,false);
|
||||
}
|
||||
// Category styles
|
||||
categories::css($app);
|
||||
Categories::css($app);
|
||||
|
||||
// set action attribute for autocomplete form tag
|
||||
// as firefox complains on about:balnk action, thus we have to literaly submit the form to a blank html
|
||||
|
@ -19,7 +19,6 @@ use EGroupware\Api;
|
||||
// explicitly import old not yet ported classes
|
||||
use egw;
|
||||
use egw_framework; // includeCSS
|
||||
use categories;
|
||||
|
||||
/**
|
||||
* eTemplate serverside implementation of the nextmatch widget
|
||||
@ -920,7 +919,7 @@ class Nextmatch extends Etemplate\Widget
|
||||
public static function category_action($app, $group=0, $caption='Change category',
|
||||
$prefix='cat_', $globals=true, $parent_id=0, $max_cats_flat=self::DEFAULT_MAX_MENU_LENGTH)
|
||||
{
|
||||
$cat = new categories(null,$app);
|
||||
$cat = new Api\Categories(null,$app);
|
||||
$cats = $cat->return_sorted_array($start=0, false, '', 'ASC', 'cat_name', $globals, $parent_id, true);
|
||||
|
||||
// if more then max_length cats, switch automatically to hierarchical display
|
||||
|
@ -17,7 +17,6 @@ use EGroupware\Api\Etemplate;
|
||||
use EGroupware\Api;
|
||||
|
||||
// explicitly import old not yet ported classes
|
||||
use categories;
|
||||
use calendar_timezones;
|
||||
|
||||
/**
|
||||
@ -563,7 +562,7 @@ class Select extends Etemplate\Widget
|
||||
}
|
||||
else // we need to instanciate a new cat object for the correct application
|
||||
{
|
||||
$categories = new categories($type5,$type3);
|
||||
$categories = new Api\Categories($type5,$type3);
|
||||
}
|
||||
// Allow text for global
|
||||
$type = ($type && strlen($type) > 1 ? $type : !$type);
|
||||
@ -572,9 +571,9 @@ class Select extends Etemplate\Widget
|
||||
{
|
||||
$s = str_repeat(' ',$cat['level']) . stripslashes($cat['name']);
|
||||
|
||||
if (categories::is_global($cat))
|
||||
if (Api\Categories::is_global($cat))
|
||||
{
|
||||
$s .= categories::$global_marker;
|
||||
$s .= Api\Categories::$global_marker;
|
||||
}
|
||||
$options[$cat['id']] = array(
|
||||
'label' => $s,
|
||||
|
@ -18,7 +18,6 @@ use EGroupware\Api;
|
||||
|
||||
// explicitly import old not yet ported classes
|
||||
use common; // egw_exit
|
||||
use categories;
|
||||
use egw_framework;
|
||||
|
||||
egw_framework::includeCSS('/phpgwapi/js/dhtmlxtree/codebase/dhtmlXTree.css');
|
||||
@ -436,7 +435,7 @@ class Tree extends Etemplate\Widget
|
||||
}
|
||||
else // we need to instanciate a new cat object for the correct application
|
||||
{
|
||||
$categories = new categories('',$type3);
|
||||
$categories = new Api\Categories('',$type3);
|
||||
}
|
||||
$cat2path=array();
|
||||
foreach((array)$categories->return_sorted_array(0,False,'','','',!$type,0,true) as $cat)
|
||||
|
@ -712,33 +712,7 @@ class etemplate extends boetemplate
|
||||
*/
|
||||
static function cats2color($cats)
|
||||
{
|
||||
static $cat2color;
|
||||
|
||||
// ACL check
|
||||
$cats = $GLOBALS['egw']->categories->check_list(EGW_ACL_READ,$cats);
|
||||
|
||||
if (!$cats) return null;
|
||||
|
||||
if (isset($cat2color[$cats]))
|
||||
{
|
||||
return $cat2color[$cats];
|
||||
}
|
||||
|
||||
foreach(explode(',',$cats) as $cat)
|
||||
{
|
||||
if (isset($cat2color[$cat]))
|
||||
{
|
||||
return $cat2color[$cat];
|
||||
}
|
||||
$data = categories::id2name($cat,'data');
|
||||
|
||||
if (is_array($data) && ($color = $data['color']))
|
||||
{
|
||||
//echo "<p>cats2color('$cats')=$color</p>\n";
|
||||
return $cat2color[$cats] = $cat2color[$cat] = $color;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return Api\Categories::cats2color($cats);
|
||||
}
|
||||
|
||||
/**
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user