mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 17:14:36 +01:00
Add functions to edit custom fields
This commit is contained in:
parent
eb8f0e5f76
commit
6c91a354e0
@ -33,6 +33,52 @@
|
||||
}
|
||||
}
|
||||
|
||||
function read_custom_fields($start='',$limit='',$query='',$sort='ASC')
|
||||
{
|
||||
global $phpgw,$phpgw_info;
|
||||
$phpgw->preferences->read_repository($phpgw_info['user']['account_id']);
|
||||
|
||||
$i=0;$j=0;
|
||||
while (list($col,$descr) = each($phpgw_info["user"]["preferences"]["addressbook"]))
|
||||
{
|
||||
if ( substr($col,0,6) == 'extra_' )
|
||||
{
|
||||
$fields[$j]['name'] = ereg_replace('extra_','',$col);
|
||||
$fields[$j]['name'] = ereg_replace(' ','_',$fields[$j]['name']);
|
||||
$fields[$j]['id'] = $i;
|
||||
|
||||
if ($query && ($fields[$j]['name'] != $query))
|
||||
{
|
||||
unset($fields[$j]['name']);
|
||||
unset($fields[$j]['id']);
|
||||
}
|
||||
else
|
||||
{
|
||||
//echo "<br>".$j.": '".$fields[$j]['name']."'";
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
|
||||
function save_custom_field($old='',$new='')
|
||||
{
|
||||
global $phpgw,$phpgw_info;
|
||||
|
||||
$phpgw->preferences->read_repository($phpgw_info['user']['account_id']);
|
||||
if ($old)
|
||||
{
|
||||
$phpgw->preferences->delete("addressbook","extra_".$old);
|
||||
}
|
||||
if($new)
|
||||
{
|
||||
$phpgw->preferences->add("addressbook","extra_".$new);
|
||||
}
|
||||
$phpgw->preferences->save_repository(1);
|
||||
}
|
||||
|
||||
// Return a select form element with the categories option dialog in it
|
||||
function cat_option($cat_id='',$notall=False,$java=True) {
|
||||
global $phpgw_info;
|
||||
|
Loading…
Reference in New Issue
Block a user