new type API
This commit is contained in:
parent
3a3c88ba4b
commit
267cdcb31b
|
@ -803,11 +803,12 @@ abstract class baseModule {
|
|||
* <br>
|
||||
* 'myAttribute' => '<block><key>AttrName</key><tr><td align=\"L\">123</td></tr></block><block><tr><td align=\"L\">456</td></tr></block><block><tr><td align=\"L\">789</td></tr></block>'
|
||||
*
|
||||
* @param string $typeId type id (user, group, host)
|
||||
* @return array PDF entries
|
||||
*
|
||||
* @see baseModule::get_metaData()
|
||||
*/
|
||||
public function get_pdfFields() {
|
||||
public function get_pdfFields($typeId) {
|
||||
return ((isset($this->meta['PDF_fields'])) ? $this->meta['PDF_fields'] : array());
|
||||
}
|
||||
|
||||
|
@ -815,9 +816,10 @@ abstract class baseModule {
|
|||
* Returns the PDF entries for this module.
|
||||
*
|
||||
* @param array $pdfKeys list of PDF keys that are included in document
|
||||
* @param string $typeId type id (user, group, host)
|
||||
* @return PDFEntry[] list of key => PDFEntry
|
||||
*/
|
||||
public function get_pdfEntries($pdfKeys) {
|
||||
public function get_pdfEntries($pdfKeys, $typeId) {
|
||||
return array();
|
||||
}
|
||||
|
||||
|
|
|
@ -413,7 +413,7 @@ function getAvailablePDFFields($typeId) {
|
|||
$return = array();
|
||||
for ($i = 0; $i < sizeof($mods); $i++) {
|
||||
$module = moduleCache::getModule($mods[$i], \LAM\TYPES\getScopeFromTypeId($typeId));
|
||||
$fields = $module->get_pdfFields();
|
||||
$fields = $module->get_pdfFields($typeId);
|
||||
$return[$mods[$i]] = array();
|
||||
if (is_array($fields)) {
|
||||
foreach ($fields as $fieldID => $fieldLabel) {
|
||||
|
@ -2010,12 +2010,13 @@ class accountContainer {
|
|||
* Returns a list of possible PDF entries for this account.
|
||||
*
|
||||
* @param array $pdfKeys list of PDF keys that are included in document
|
||||
* @param string $typeId type id (user, group, host)
|
||||
* @return PDFEntry[] list of key => PDFEntry
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
while(($current = current($this->module)) != null) {
|
||||
$return = array_merge($return,$current->get_pdfEntries($pdfKeys));
|
||||
$return = array_merge($return,$current->get_pdfEntries($pdfKeys, $typeId));
|
||||
next($this->module);
|
||||
}
|
||||
$dn = $this->dn_orig;
|
||||
|
|
|
@ -223,7 +223,7 @@ class account extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'description', _('Description'));
|
||||
$this->addSimplePDFField($return, 'uid', _('User name'));
|
||||
|
|
|
@ -978,7 +978,7 @@ class asteriskAccount extends baseModule implements passwordService {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'AstAccountCallerID', _('Caller ID'));
|
||||
$this->addSimplePDFField($return, 'AstAccountContext', _('Account context'));
|
||||
|
|
|
@ -800,7 +800,7 @@ class asteriskExtension extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$a = $this->attributes;
|
||||
$o = $this->orig;
|
||||
$return = array();
|
||||
|
|
|
@ -365,7 +365,7 @@ class asteriskVoicemail extends baseModule implements passwordService {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'AstVoicemailMailbox', _('Mailbox'));
|
||||
$this->addSimplePDFField($return, 'AstContext', _('Account context'));
|
||||
|
|
|
@ -224,7 +224,7 @@ class authorizedServiceObject extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
if (in_array('authorizedServiceObject', $this->attributes['objectClass'])) {
|
||||
$this->addSimplePDFField($return, 'authorizedService', _('Authorized Services'));
|
||||
|
|
|
@ -398,7 +398,7 @@ class ddns extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
public function get_pdfEntries($pdfKeys) {
|
||||
public function get_pdfEntries($pdfKeys, $typeId) {
|
||||
// attributes are taken from DHCP server object
|
||||
$this->attributes = &$this->getAccountContainer()->getAccountModule('dhcp_settings')->attributes;
|
||||
$this->orig = &$this->getAccountContainer()->getAccountModule('dhcp_settings')->orig;
|
||||
|
|
|
@ -660,7 +660,7 @@ By default, the nodes are configured as H-Nodes which fits for small networks. I
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$nodeType = $this->getDHCPOption('netbios-node-type');
|
||||
$nodeTypeValue = '';
|
||||
if (isset($this->all_netbios_node_types[$nodeType])) {
|
||||
|
|
|
@ -551,7 +551,7 @@ class eduPerson extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'primaryAffiliation', _('Primary affiliation'), 'eduPersonPrimaryAffiliation');
|
||||
$this->addSimplePDFField($return, 'scopedAffiliation', _('Scoped affiliations'), 'eduPersonScopedAffiliation');
|
||||
|
|
|
@ -734,7 +734,7 @@ class fixed_ip extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
if (is_array($this->fixed_ip) && (sizeof($this->fixed_ip) > 0)) {
|
||||
$pdfTable = new PDFTable();
|
||||
|
|
|
@ -688,7 +688,7 @@ class freeRadius extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'radiusFramedIPAddress', _('IP address'));
|
||||
$this->addSimplePDFField($return, 'radiusFramedIPNetmask', _('Net mask'));
|
||||
|
|
|
@ -198,7 +198,7 @@ class hostObject extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'hosts', _('Host list'), 'host');
|
||||
return $return;
|
||||
|
|
|
@ -158,7 +158,7 @@ class ieee802device extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'macAddress', _('MAC addresses'));
|
||||
return $return;
|
||||
|
|
|
@ -347,7 +347,7 @@ class inetLocalMailRecipient extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'routingAdr', _('Routing address'), 'mailRoutingAddress');
|
||||
$this->addSimplePDFField($return, 'localAdr', _('Local address list'), 'mailLocalAddress');
|
||||
|
|
|
@ -1975,7 +1975,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'description', _('Description'));
|
||||
$this->addSimplePDFField($return, 'title', _('Job title'));
|
||||
|
|
|
@ -393,7 +393,7 @@ class kolabGroup extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'mail', _('Email address'));
|
||||
$this->addSimplePDFField($return, 'kolabAllowSMTPRecipient', _('Allowed recipients'));
|
||||
|
|
|
@ -513,7 +513,7 @@ class kolabSharedFolder extends baseModule { // TODO folder type
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'cn', _('Name'));
|
||||
$this->addSimplePDFField($return, 'mail', _('Email address'));
|
||||
|
|
|
@ -702,7 +702,7 @@ class kolabUser extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'mailHost', _('Mailbox home server'));
|
||||
// invitation policies
|
||||
|
|
|
@ -285,7 +285,7 @@ class ldapPublicKey extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
if (sizeof($this->attributes['sshPublicKey']) > 0) {
|
||||
$pdfTable = new PDFTable(_('SSH public keys'));
|
||||
|
|
|
@ -468,7 +468,7 @@ class nisMailAlias extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'alias', _('Alias name'), 'cn');
|
||||
$this->addSimplePDFField($return, 'recipients', _('Recipient list'), 'rfc822MailMember');
|
||||
|
|
|
@ -525,7 +525,7 @@ class nisMailAliasUser extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$aliases = $this->getMailAliasList();
|
||||
$foundAliases = array();
|
||||
|
|
|
@ -253,7 +253,7 @@ class nisNetGroupHost extends nisNetGroupUser {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$pdfTable = new PDFTable();
|
||||
$pdfRow = new PDFTableRow();
|
||||
|
|
|
@ -471,7 +471,7 @@ class nisNetGroupUser extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$pdfTable = new PDFTable();
|
||||
$pdfRow = new PDFTableRow();
|
||||
|
|
|
@ -575,7 +575,7 @@ class nisnetgroup extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'cn', _('Group name'));
|
||||
$this->addSimplePDFField($return, 'description', _('Description'));
|
||||
|
|
|
@ -1818,7 +1818,7 @@ class posixAccount extends baseModule implements passwordService {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$uidLabel = _('User name');
|
||||
if ($this->get_scope() == 'host') {
|
||||
$uidLabel = _('Host name');
|
||||
|
|
|
@ -616,7 +616,7 @@ class posixGroup extends baseModule implements passwordService {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'memberUid', _('Group members'));
|
||||
$this->addSimplePDFField($return, 'cn', _('Group name'));
|
||||
|
|
|
@ -401,7 +401,7 @@ class puppetClient extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
if (!in_array('puppetClient', $this->attributes['objectClass'])) {
|
||||
return $return;
|
||||
|
|
|
@ -256,7 +256,7 @@ class pykotaBillingCode extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->loadCodeCache();
|
||||
$this->addSimplePDFField($return, 'pykotaBillingCode', _('Billing code'));
|
||||
|
|
|
@ -462,7 +462,7 @@ class pykotaGroup extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'cn', _('Common name'));
|
||||
$this->addSimplePDFField($return, 'pykotaGroupName', _('PyKota group name'));
|
||||
|
|
|
@ -579,7 +579,7 @@ class pykotaPrinter extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->loadPrinterNameCache();
|
||||
$this->addSimplePDFField($return, 'cn', _('Printer name'));
|
||||
|
|
|
@ -887,7 +887,7 @@ class pykotaUser extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'cn', _('Common name'));
|
||||
$this->addSimplePDFField($return, 'uid', _('User name'));
|
||||
|
|
|
@ -609,7 +609,7 @@ class quota extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$this->initQuotas();
|
||||
if (!isset($this->quota) || !is_array($this->quota)) return array();
|
||||
if (sizeof($this->quota) > 0) {
|
||||
|
|
|
@ -767,7 +767,7 @@ class range extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
if (is_array($this->ranges) && (sizeof($this->ranges) > 0)) {
|
||||
$pdfTable = new PDFTable(_('Ranges'));
|
||||
|
|
|
@ -593,7 +593,7 @@ class sambaDomain extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'domainName', _('Domain name'), 'sambaDomainName');
|
||||
$this->addSimplePDFField($return, 'domainSID', _('Domain SID'), 'sambaSID');
|
||||
|
|
|
@ -535,7 +535,7 @@ class sambaGroupMapping extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'gidNumber', _('GID number'));
|
||||
$this->addSimplePDFField($return, 'sambaSID', _('Windows group'));
|
||||
|
|
|
@ -1905,7 +1905,7 @@ class sambaSamAccount extends baseModule implements passwordService {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'displayName', _('Display name'));
|
||||
$this->addSimplePDFField($return, 'sambaHomePath', _('Home path'));
|
||||
|
|
|
@ -550,7 +550,7 @@ class shadowAccount extends baseModule implements passwordService {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
function get_pdfEntries($pdfKeys) {
|
||||
function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$timeZone = getTimeZone();
|
||||
$shadowLastChange = '';
|
||||
if (!empty($this->attributes['shadowLastChange'][0])) {
|
||||
|
|
|
@ -376,7 +376,7 @@ class systemQuotas extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
public function get_pdfEntries($pdfKeys) {
|
||||
public function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
if (isset($this->attributes['quota'][0])) {
|
||||
$pdfTable = new PDFTable();
|
||||
|
|
|
@ -910,7 +910,7 @@ class windowsGroup extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
public function get_pdfEntries($pdfKeys) {
|
||||
public function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'cn', _('Group name'));
|
||||
$this->addSimplePDFField($return, 'description', _('Description'));
|
||||
|
|
|
@ -284,7 +284,7 @@ class windowsHost extends baseModule {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
public function get_pdfEntries($pdfKeys) {
|
||||
public function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'cn', _('Host name'));
|
||||
$this->addSimplePDFField($return, 'description', _('Description'));
|
||||
|
|
|
@ -2415,7 +2415,7 @@ class windowsUser extends baseModule implements passwordService {
|
|||
* {@inheritDoc}
|
||||
* @see baseModule::get_pdfEntries()
|
||||
*/
|
||||
public function get_pdfEntries($pdfKeys) {
|
||||
public function get_pdfEntries($pdfKeys, $typeId) {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'userPrincipalName', _('User name'));
|
||||
$this->addSimplePDFField($return, 'cn', _('Common name'));
|
||||
|
|
|
@ -104,7 +104,7 @@ function createModulePDF($accounts, $pdf_structure="default", $returnAsString =
|
|||
$pdf->AddPage();
|
||||
|
||||
// Get PDF entries for the current account
|
||||
$entries = $account->get_pdfEntries($pdfKeys);
|
||||
$entries = $account->get_pdfEntries($pdfKeys, $account_type->getId());
|
||||
|
||||
// Now create the PDF file acording to the structure with the submitted values
|
||||
foreach($structure as $entry) {
|
||||
|
|
Loading…
Reference in New Issue