implemented PDF

This commit is contained in:
Roland Gruber 2011-11-27 15:14:09 +00:00
parent 9a3905f58e
commit cff9db5cb1
1 changed files with 47 additions and 35 deletions

View File

@ -4,8 +4,8 @@
$Id$ $Id$
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam) This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
Copyright (C) 2009 - 2010 Pavel Pozdnyak Copyright (C) 2009 - 2011 Pavel Pozdnyak
2009 - 2010 Roland Gruber 2009 - 2011 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -126,13 +126,14 @@ class asteriskExtensionNewUI extends baseModule {
$return['profile_mappings'] = array( $return['profile_mappings'] = array(
'AsteriskExtension_AstContext' => 'AstContext', 'AsteriskExtension_AstContext' => 'AstContext',
); );
/* // available PDF fields
$configContainer = new htmlTable(); $return['PDF_fields'] = array(
$configMigrateSuffix = new htmlTableExtendedInputField(_('Suffix to migrate'), 'AsteriskExtension_MigrateSuffix', '', 'MigrateSuffix'); 'AstContext' => _('Account context'),
$configMigrateSuffix->setRequired(false); 'AstExtension' => _('Extension name'),
$configContainer->addElement($configMigrateSuffix, true); 'member' => _('Extension owners'),
$return['config_options']['all'] = $configContainer; 'cn' => _('Common name'),
*/ 'rules' => _('Rules'),
);
return $return; return $return;
} }
@ -677,32 +678,43 @@ class asteriskExtensionNewUI extends baseModule {
if (isset($this->extensionRows[0]['astextension'][0])) { if (isset($this->extensionRows[0]['astextension'][0])) {
$extName = $this->extensionRows[0]['astextension'][0]; $extName = $this->extensionRows[0]['astextension'][0];
} }
$entries = $this->load_extension_parts($extName); // global values
for ($rowCounter = 0; $rowCounter < count($this->extensionRows); $rowCounter++) { if (isset($this->attributes['AstContext'])) {
$row = $this->extensionRows[$rowCounter]; $return[get_class($this) . '_AstContext'] = array('<block><key>' . _('Account context') . '</key><value>' . $this->attributes['AstContext'][0] . '</value></block>');
if (isset($row['astcontext'])) { }
$return[get_class($this) . '_AstContext'. $rowCounter] = array('<block><key>' . _('Account context') . '</key><value>' . $row['astcontext'][0] . '</value></block>'); if (isset($this->attributes['AstExtension'])) {
} $return[get_class($this) . '_AstExtension'] = array('<block><key>' . _('Extension name') . '</key><value>' . $this->attributes['AstExtension'][0] . '</value></block>');
if (isset($row['astapplicationdata'])) { }
$return[get_class($this) . '_AstApplicationData' . $rowCounter] = array('<block><key>' . _('Application data') . '</key><value>' . $row['astapplicationdata'][0] . '</value></block>'); if (isset($this->attributes['member'])) {
} $return[get_class($this) . '_member'] = array('<block><key>' . _('Extension owners') . '</key><value>' . implode('; ', $this->attributes['member']) . '</value></block>');
if (isset($row['astapplication'])) { }
$return[get_class($this) . '_AstApplication' . $rowCounter] = array('<block><key>' . _('Application') . '</key><value>' . $row['astapplication'][0] . '</value></block>'); if (isset($this->attributes['cn'])) {
} $return[get_class($this) . '_cn'] = array('<block><key>' . _('Common name') . '</key><value>' . $this->attributes['cn'][0] . '</value></block>');
if (isset($row['astpriority'])) { }
$return[get_class($this) . '_AstPriority' . $rowCounter] = array('<block><key>' . _('Priority') . '</key><value>' . $row['astpriority'][0] . '</value></block>'); // rules
} $entries = $this->load_extension_parts($extName);
if (isset($row['astetension'])) { $rulePDF = array();
$return[get_class($this) . '_AstExtension' . $rowCounter] = array('<block><key>' . _('Extension name') . '</key><value>' . $row['astetension'][0] . '</value></block>'); $rulePDF[] = '<block><tr><td width="80%"> </td></tr></block>';
} $rulePDF[] = '<block><tr><td width="80%"> </td></tr></block>';
if (isset($row['member'])) { $rulePDF[] = '<block><tr><td width="80%"> </td></tr></block>';
$return[get_class($this) . '_member' . $rowCounter] = array('<block><key>' . _('Extension owners') . '</key><value>' . implode('; ', $row['member']) . '</value></block>'); $rulePDF[] = '<block><tr>' .
} '<td width="20%"><b>' . _('Name') . '</b></td>' .
if (isset($row['cn'])) { '<td width="30%"><b>' . _('Application') . '</b></td>' .
$return[get_class($this) . '_cn' . $rowCounter] = array('<block><key>' . _('Common name') . '</key><value>' . $row['cn'][0] . '</value></block>'); '<td width="30%"><b>' . _('Application data') . '</b></td>' .
} '<td width="20%"><b>' . _('Priority') . '</b></td>' .
} '</tr></block>';
for ($i = 0; $i < sizeof($entries); $i++) {
$appdata = '';
if (isset($entries[$i]['astapplicationdata'][0])) {
$appdata = $entries[$i]['astapplicationdata'][0];
}
$rulePDF[] = '<block><tr>' .
'<td width="20%" align=\"L\">' . $entries[$i]['cn'][0] . '</td>' .
'<td width="30%" align=\"L\">' . $entries[$i]['astapplication'][0] . '</td>' .
'<td width="30%" align=\"L\">' . $appdata . '</td>' .
'<td width="20%" align=\"L\">' . $entries[$i]['astpriority'][0] . '</td></tr></block>';
}
$return[get_class($this) . '_rules'] = $rulePDF;
return $return; return $return;
} }