added addPDFKeyValue()

This commit is contained in:
Roland Gruber 2015-03-11 20:50:37 +00:00
parent 5392204173
commit 187b51978e
4 changed files with 9 additions and 10 deletions

View File

@ -850,7 +850,7 @@ abstract class baseModule {
* @param mixed $value value as String or array * @param mixed $value value as String or array
* @param String $delimiter delimiter if value is array (default: ", ") * @param String $delimiter delimiter if value is array (default: ", ")
*/ */
public function addPDFKeyValue(&$result, $name, $label, $value, $delimiter = ', ') { protected function addPDFKeyValue(&$result, $name, $label, $value, $delimiter = ', ') {
if (is_array($value)) { if (is_array($value)) {
natcasesort($value); natcasesort($value);
$value = implode($delimiter, $value); $value = implode($delimiter, $value);

View File

@ -770,7 +770,7 @@ class kolabUser extends baseModule {
if (!empty($this->attributes['mailQuota'][0])) { if (!empty($this->attributes['mailQuota'][0])) {
$mailQuota = ($this->attributes['mailQuota'][0] / 1024) . 'MB'; $mailQuota = ($this->attributes['mailQuota'][0] / 1024) . 'MB';
} }
$return[get_class($this) . '_mailQuota'] = array('<block><key>' . _('Mailbox quota') . '</key><value>' . $mailQuota . '</value></block>'); $this->addPDFKeyValue($return, 'mailQuota', _('Mailbox quota'), $mailQuota);
return $return; return $return;
} }

View File

@ -539,7 +539,7 @@ class nisMailAliasUser extends baseModule {
} }
} }
$foundAliases = array_unique($foundAliases); $foundAliases = array_unique($foundAliases);
$return[get_class($this) . '_alias'] = array('<block><key>' . _('Alias names') . '</key><value>' . implode(', ', $foundAliases) . '</value></block>'); $this->addPDFKeyValue($return, 'alias', _('Alias names'), implode(', ', $foundAliases));
return $return; return $return;
} }

View File

@ -1866,10 +1866,9 @@ class posixAccount extends baseModule implements passwordService {
$additionalGroups = $this->groups; $additionalGroups = $this->groups;
natcasesort($additionalGroups); natcasesort($additionalGroups);
} }
$return = array( $return = array();
'posixAccount_primaryGroup' => array('<block><key>' . _('Primary group') . '</key><value>' . $this->getGroupName($this->attributes['gidNumber'][0]) . '</value></block>'), $this->addPDFKeyValue($return, 'primaryGroup', _('Primary group'), $this->getGroupName($this->attributes['gidNumber'][0]));
'posixAccount_additionalGroups' => array('<block><key>' . _('Additional groups') . '</key><value>' . implode(", ", $additionalGroups) . '</value></block>'), $this->addPDFKeyValue($return, 'additionalGroups', _('Additional groups'), implode(", ", $additionalGroups));
);
$this->addSimplePDFField($return, 'uid', $uidLabel); $this->addSimplePDFField($return, 'uid', $uidLabel);
$this->addSimplePDFField($return, 'cn', _('Common name')); $this->addSimplePDFField($return, 'cn', _('Common name'));
$this->addSimplePDFField($return, 'uidNumber', _('UID number')); $this->addSimplePDFField($return, 'uidNumber', _('UID number'));
@ -1886,13 +1885,13 @@ class posixAccount extends baseModule implements passwordService {
} }
} }
natcasesort($gons); natcasesort($gons);
$return['posixAccount_gon'] = array('<block><key>' . _('Groups of names') . '</key><value>' . implode(", ", $gons) . '</value></block>'); $this->addPDFKeyValue($return, 'gon', _('Groups of names'), implode(", ", $gons));
} }
if (isset($this->clearTextPassword)) { if (isset($this->clearTextPassword)) {
$return['posixAccount_userPassword'] = array('<block><key>' . _('Password') . '</key><value>' . $this->clearTextPassword . '</value></block>'); $this->addPDFKeyValue($return, 'userPassword', _('Password'), $this->clearTextPassword);
} }
else if (isset($this->attributes['INFO.userPasswordClearText'])) { else if (isset($this->attributes['INFO.userPasswordClearText'])) {
$return['posixAccount_userPassword'] = array('<block><key>' . _('Password') . '</key><value>' . $this->attributes['INFO.userPasswordClearText'] . '</value></block>'); $this->addPDFKeyValue($return, 'userPassword', _('Password'), $this->attributes['INFO.userPasswordClearText']);
} }
return $return; return $return;
} }