"adding fields for (max. 10) single category names"

This commit is contained in:
Ralf Becker 2010-03-10 18:05:44 +00:00
parent 54b4454d51
commit ca3f3b463f

View File

@ -4,7 +4,7 @@
*
* @link www.egroupware.org
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) 2006-8 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) 2006-10 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @package addressbook
* @subpackage export
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
@ -31,6 +31,11 @@ class addressbook_csv
'select-cat' => array('cat_id'),
);
/**
* Number of individual category fields
*/
const CAT_MAX = 10;
/**
* Constructor
*
@ -43,7 +48,7 @@ class addressbook_csv
$this->obj = $obj;
$this->separator = $separator;
$this->charset_out = $charset;
$this->charset = $GLOBALS['egw']->translation->charset();
$this->charset = translation::charset();
}
/**
@ -59,6 +64,14 @@ class addressbook_csv
{
$fields = $this->csv_fields();
}
// add fields for single categories
if (isset($fields['cat_id']))
{
for($n = 1; $n <= self::CAT_MAX; ++$n)
{
$fields['cat_'.$n] = lang('Category').' '.$n;
}
}
if (!$file)
{
$browser = new browser();
@ -120,7 +133,7 @@ class addressbook_csv
if ($this->charset_out && $this->charset != $this->charset_out)
{
$out = $GLOBALS['egw']->translation->convert($out,$this->charset,$this->charset_out);
$out = translation::convert($out,$this->charset,$this->charset_out);
}
return $out;
}
@ -151,9 +164,9 @@ class addressbook_csv
if ($data['tel_prefer']) $data['tel_prefer'] = $fields[$data['tel_prefer']];
$cats = array();
foreach(explode(',',$data['cat_id']) as $cat_id)
foreach(explode(',',$data['cat_id']) as $n => $cat_id)
{
if ($cat_id) $cats[] = $GLOBALS['egw']->categories->id2name($cat_id);
if ($cat_id) $cats[] = $data['cat_'.($n+1)] = $GLOBALS['egw']->categories->id2name($cat_id);
}
$data['cat_id'] = implode('; ',$cats);