diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc
index d1c4bef2..9b71dd2c 100644
--- a/lam/lib/modules.inc
+++ b/lam/lib/modules.inc
@@ -1003,14 +1003,9 @@ class accountContainer {
// Dummy implementation
function getAvailablePDFFields() {
$return = array();
- foreach($this->module as $key => $value) {
- $fields = array();
- if(is_array($value->attributes)) {
- foreach($value->attributes as $field_key => $field_value) {
- $fields[] = $field_key;
- }
- }
- $return[$key] = $fields;
+ foreach($this->module as $moduleName => $module) {
+ echo "
moduleName: $moduleName\n
";
+ $return[$moduleName] = $module->get_pdfFields($this->type);
}
return $return;
}
diff --git a/lam/lib/modules/account.inc b/lam/lib/modules/account.inc
index cd633687..7db5c775 100644
--- a/lam/lib/modules/account.inc
+++ b/lam/lib/modules/account.inc
@@ -209,9 +209,11 @@ class account {
return array();
}
+ function get_pdfFields($account_type="user") {
+ return array( 'description');
+ }
+
function get_pdfEntries($account_type = "user") {
- echo "account:\n";
- print_r($this->attributes);
return array('account_description' => array('' . _('Description') . '' . $this->attributes['description'][0] . ''));
}
diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc
index 4c54f80d..2f781c37 100644
--- a/lam/lib/modules/inetOrgPerson.inc
+++ b/lam/lib/modules/inetOrgPerson.inc
@@ -314,9 +314,23 @@ class inetOrgPerson {
return array();
}
+ function get_pdfFields($account_type = "user") {
+ return array( 'description',
+ 'host',
+ 'title',
+ 'givenName',
+ 'sn',
+ 'employeeType',
+ 'street',
+ 'postalCode',
+ 'postalAddress',
+ 'telephoneNumber',
+ 'mobileTelephoneNumber',
+ 'facimilieTelefonNumber',
+ 'mail');
+ }
+
function get_pdfEntries($account_type = "user") {
- echo "inetOrgPerson:\n";
- print_r($this->attributes);
return array( 'inetOrgPerson_description' => array('' . _('Description') . '' . $this->attributes['description'][0] . ''),
'inetOrgPerson_host' => array('' . _('Unix workstations') . '' . $this->attributes['host'][0] . ''),
'inetOrgPerson_title' => array('' . _('Title') . '' . $this->attributes['title'][0] . ''),
diff --git a/lam/lib/modules/main.inc b/lam/lib/modules/main.inc
index 40b3ccbc..203c8664 100644
--- a/lam/lib/modules/main.inc
+++ b/lam/lib/modules/main.inc
@@ -302,6 +302,10 @@ class main {
return $return;
}
+ function get_pdfFields($account_type="user") {
+ return array( 'dn');
+ }
+
function get_pdfEntries($account_type = "user") {
return array( 'main_dn' => array('' . _('DN') . '' . $_SESSION[$this->base]->dn . ''));
}
diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc
index 5562d7e4..500799e3 100644
--- a/lam/lib/modules/posixAccount.inc
+++ b/lam/lib/modules/posixAccount.inc
@@ -710,9 +710,19 @@ class posixAccount {
return array();
}
+ function get_pdfFields($account_type="user") {
+ return array( 'uid',
+ 'uidNumber',
+ 'gidNumber',
+ 'gecos',
+ 'primaryGroup',
+ 'additionalGroups',
+ 'homeDirectory',
+ 'userPassword',
+ 'loginShell');
+ }
+
function get_pdfEntries($account_type = "user") {
- echo "posixAccount:\n";
- print_r($this->attributes);
return array( 'posixAccount_uid' => array('' . _('Username') . '' . $this->attributes['uid'][0] . ''),
'posixAccount_uidNumber' => array('' . _('UID number') . '' . $this->attributes['uidNumber'][0] . ''),
'posixAccount_gidNumber' => array('' . _('GID number') . '' . $this->attributes['gidNumber'][0] . ''),
diff --git a/lam/lib/modules/posixGroup.inc b/lam/lib/modules/posixGroup.inc
index f663e30e..21d28f96 100644
--- a/lam/lib/modules/posixGroup.inc
+++ b/lam/lib/modules/posixGroup.inc
@@ -597,11 +597,15 @@ class posixGroup {
return array();
}
+ function get_pdfFields($account_type="user") {
+ return array( 'cn',
+ 'gidNumber',
+ 'memberUid',
+ 'description');
+ }
+
function get_pdfEntries($account_type = "group") {
- echo "posixGroup:\n";
- print_r($this->attributes);
- return array( '_posixGroup_cn' => array($this->attributes['cn'][0]),
- 'posixGroup_cn' => array('' . _('Groupname') . '' . $this->attributes['cn'][0] . ''),
+ return array( 'posixGroup_cn' => array('' . _('Groupname') . '' . $this->attributes['cn'][0] . ''),
'posixGroup_gidNumber' => array('' . _('GID number') . '' . $this->attributes['gidNumber'][0] . ''),
'posixGroup_memberUid' => array('' . _('Group members') . '' . $this->attributes['memberUid'][0] . ''),
'posixGroup_description' => array('' . _('Description') . '' . $this->attributes['description'][0] . ''));
diff --git a/lam/lib/modules/quota.inc b/lam/lib/modules/quota.inc
index fa620cdf..d5bd0311 100644
--- a/lam/lib/modules/quota.inc
+++ b/lam/lib/modules/quota.inc
@@ -305,7 +305,11 @@ class quota {
return array();
}
- function get_pdfEntries($account_type = "User") {
+ function get_pdfFields($account_type="user") {
+ return array( 'quotas');
+ }
+
+ function get_pdfEntries($account_type = "user") {
return array( 'quota_quotas' => array('' . _('User quota') . '' . _('Mountpoint') . ' | ' . _('Soft block') . ' | ' . _('Soft inode') . ' | ' . _('Hard block') . ' | ' . _('Hard inode') . ' | '));
}
diff --git a/lam/lib/modules/sambaAccount.inc b/lam/lib/modules/sambaAccount.inc
index ae05fe3f..997d14b4 100644
--- a/lam/lib/modules/sambaAccount.inc
+++ b/lam/lib/modules/sambaAccount.inc
@@ -690,9 +690,19 @@ class sambaAccount {
return array();
}
+ function get_pdfFields($account_type="user") {
+ return array( 'displayName',
+ 'uid',
+ 'smbHome',
+ 'homeDrive',
+ 'scriptPath',
+ 'profilePath',
+ 'userWorkstations',
+ 'domain',
+ 'description');
+ }
+
function get_pdfEntries($account_type = "user") {
- echo "sambaAccount:\n";
- print_r($this->attributes);
return array( 'sambaAccount_displayName' => array('' . _('Display name') . 'attributes['displayName'][0] . ''),
'sambaAccount_uid' => array('' . _('Username') . '' . $this->attributes['uid'][0] . ''),
'sambaAccount_smbHome' => array('' . _('Home path') . '' . $this->attributes['smbHome'][0] . ''),
diff --git a/lam/lib/modules/sambaGroupMapping.inc b/lam/lib/modules/sambaGroupMapping.inc
index 8270906d..e6e22c75 100644
--- a/lam/lib/modules/sambaGroupMapping.inc
+++ b/lam/lib/modules/sambaGroupMapping.inc
@@ -329,9 +329,15 @@ class sambaGroupMapping {
return array();
}
+ function get_pdfFields($account_type="user") {
+ return array( 'gidNumber',
+ 'sambaSID',
+ 'displayName',
+ 'sambaGroupType',
+ 'description');
+ }
+
function get_pdfEntries($account_type = "User") {
- echo "sambaGroupMapping:\n";
- print_r($this->attributes);
return array( 'sambaGroupMapping_gidNumber' => array('' . _('GID number') . '' . $this->attributes['gidNumber'][0] . ''),
'sambaGroupMapping_sambaSID' => array('' . _('Windows group') . '' . $this->attributes['sambaSID'][0] . ''),
'sambaGroupMapping_displayName' => array('' . _('Display name') . '' . $this->attributes['displayName'][0] . ''),
diff --git a/lam/lib/modules/sambaSamAccount.inc b/lam/lib/modules/sambaSamAccount.inc
index b8aa7c95..2894a485 100644
--- a/lam/lib/modules/sambaSamAccount.inc
+++ b/lam/lib/modules/sambaSamAccount.inc
@@ -715,9 +715,20 @@ class sambaSamAccount {
return array();
}
+ function get_pdfFields($account_type="user") {
+ return array( 'displayName',
+ 'uid',
+ 'sambaHomePath',
+ 'sambaHomeDrive',
+ 'sambaLogonScript',
+ 'sambaProfilePath',
+ 'sambaUserWorkstations',
+ 'sambaDomainName',
+ 'description',
+ 'sambaPrimaryGroupSID');
+ }
+
function get_pdfEntries($account_type = "user") {
- echo "sambaSamAccount:\n";
- print_r($this->attributes);
return array( 'sambaSamAccount_displayName' => array('' . _('Display name') . 'attributes['displayName'][0] . ''),
'sambaSamAccount_uid' => array('' . _('Username') . '' . $this->attributes['uid'][0] . ''),
'sambaSamAccount_sambaHomePath' => array('' . _('Home path') . '' . $this->attributes['sambaHomeDrive'][0] . ''),
diff --git a/lam/lib/modules/shadowAccount.inc b/lam/lib/modules/shadowAccount.inc
index a9070c51..cb767864 100644
--- a/lam/lib/modules/shadowAccount.inc
+++ b/lam/lib/modules/shadowAccount.inc
@@ -302,9 +302,16 @@ class shadowAccount {
return array();
}
+ function get_pdfFields($account_type="user") {
+ return array( 'shadowLastChange',
+ 'shadowWarning',
+ 'shadowInactive',
+ 'shadowExpire',
+ 'shadowFlag',
+ 'description');
+ }
+
function get_pdfEntries($account_type = "user") {
- echo "shadowAccount:\n";
- print_r($this->attributes);
return array( 'shadowAccount_shadowLastChange' => array('' . _('Last shadow password change') . '' . $this->attributes['shadowLastChange'][0] . ''),
'shadowAccount_shadowWarning' => array('' . _('Password warn') . '' . $this->attributes['shadowWarn'][0] . ''),
'shadowAccount_shadowInactive' => array('' . _('Account inactive') . '' . $this->attributes['shadowInactive'][0] . ''),
diff --git a/lam/lib/pdf.inc b/lam/lib/pdf.inc
index de430831..3a7be2ea 100644
--- a/lam/lib/pdf.inc
+++ b/lam/lib/pdf.inc
@@ -26,27 +26,36 @@ $Id$
define('FPDF_FONTPATH','font/');
define('LAMPDF_LINEWIDTH',190);
include_once("fpdf.php");
-//include_once('include.inc');
include_once('xml_parser.inc');
$key = false;
$line_width = LAMPDF_LINEWIDTH;
-function createModulePDF($accounts,$account_type="") {
+function getAvailablePDFStructures($scope='user') {
+ $return = array();
+ $dirHandle = opendir($_SESSION['lampath'] . '/config/pdf/' . $scope . '/');
+ while($file = readdir($dirHandle)) {
+ if(!is_dir($file) && $file != '.' && $file != '..') {
+ array_push($return,$file);
+ }
+ }
+ sort($return);
+ return $return;
+}
+
+function createModulePDF($accounts,$pdf_structure="default.xml") {
global $key;
- // Store PDF structure in Session when called the first time
- if(!isset($_SESSION['pdf_structure'])) {
- $_SESSION['pdf_structure'] = getStructure();
- }
-
// Get account type from account container if none was specified or
// if it is different to the submitted or previous stored
if($account_type == "" || $account_type != $accounts[0]->get_type()) {
$account_type = $accounts[0]->get_type();
}
+ // Get PDF structure from xml file
+ $structure = getStructure($account_type,$pdf_structure);
+
// The decimal separator must be a dot in order to write pdf-files
setlocale(LC_NUMERIC, "C");
@@ -55,8 +64,6 @@ function createModulePDF($accounts,$account_type="") {
// Loop over each account and add a new page in the PDF file for it
foreach($accounts as $account) {
- // Get PDF structure from session
- $structure = $_SESSION['pdf_structure'][$account_type];
// Start a new page for each account
$pdf->AddPage();
@@ -70,7 +77,7 @@ function createModulePDF($accounts,$account_type="") {
if($entry['tag'] == "SECTION" && $entry['type'] == "open") {
$name = $entry['attributes']['NAME'];
if(preg_match("/^\_[a-zA-Z\_]+/",$name)) {
- $section_headline = $entries[$name][0];
+ $section_headline = getSectionHeadline($entries[substr($name,1)][0]);
}
else {
$section_headline = '- ' . _($name);
@@ -143,7 +150,6 @@ function createModulePDF($accounts,$account_type="") {
if(is_array($value_entry)) {
// Loop over all rows of this entry (most of the time this will be just one)
foreach($value_entry as $line) {
- echo "line: " . $line . "
\n";
// Substitue XML syntax with valid FPDF methods
$methods = processLine($line);
// Call every method
@@ -168,35 +174,36 @@ function createModulePDF($accounts,$account_type="") {
// Save PDF
$pdf->Output($filename);
// Output meta refresh to pdf-file
- //metaRefresh($filename);
+ metaRefresh($filename);
// Return relative path of pdf-file
return $filename;
}
-function getStructure($account_type = array("user","group","host")) {
+function getStructure($scope,$pdf_structure) {
$parser = new xmlParser();
- $xml = $parser->parse($_SESSION['lampath'] . '/config/pdf-structure.xml');
+ $xml = $parser->parse($_SESSION['lampath'] . '/config/pdf/' . $scope . '/' . $pdf_structure);
- // Don't know why this is needed but without the array pointer seems to
- // be at the last element and therefor the while loop fails.
- reset($account_type);
$border = array();
$structure = array();
- while(($current = current($account_type)) != null) {
- $pdf_entries = $xml[1]['PDF'];
- $border[$current] = array();
- while(($index = current($pdf_entries)) != null) {
- if($xml[0][$index]['attributes']['TYPE'] == $current) {
- $border[$current]['start'] = $index;
- next($pdf_entries);
- $border[$current]['end'] = current($pdf_entries);
- }
- next($pdf_entries);
- }
- $structure[$current] = array_slice($xml[0],$border[$current]['start'] + 1,$border[$current]['end'] - ($border[$current]['start'] + 1));
- next($account_type);
+ $pdf_entries = $xml[1]['PDF'];
+ while(($index = current($pdf_entries)) != null) {
+ $border['start'] = $index;
+ next($pdf_entries);
+ $border['end'] = current($pdf_entries);
+ next($pdf_entries);
+ }
+ return array_slice($xml[0],$border['start'] + 1,$border['end'] - ($border['start'] + 1));
+}
+
+function getSectionHeadline($line) {
+ $headline_pattern = '/.*(.*)<\/value><\/block>/';
+ if(preg_match($headline_pattern,$line,$matches)) {
+ $valueStyle = processFormatTags($matches[1],'');
+ return $valueStyle[1];
+ }
+ else {
+ return '';
}
- return $structure;
}
function processLine($line,$first_td = true) {
@@ -321,458 +328,6 @@ function processAttributes($attrs,$return = array()) {
}
}
-function createUserPDF($accounts) {
-// The decimal separator must be a dot in order to write pdf-files
- setlocale(LC_NUMERIC, "C");
-// Start PDF file
- $pdfFile = new lamPDF();
- $pdfFile->Open();
-// Write some information into the PDF file
- $pdfFile->setFont("arial","",12);
- $pdfFile->setTitle("LDAP Account Manager");
- $pdfFile->setSubject(_("User information page"));
- $pdfFile->setAuthor("LDAP Account Manager Devel-Team -Michael Duergner-");
- $pdfFile->setCreator("LDAP Account Manager (pdf.inc)");
-// Loop for every sumbitted account and print its values on a extra page
- foreach ($accounts as $account) {
- $pdfFile->addPage();
- // Load string with additional information from session
- $info_string = $_SESSION['config']->pdftext;
- // Print individuall text.
- // Get all allowed vairables from account-object
- $values = get_object_vars($account);
- $values = array_keys($values);
- // Replace $varstring in string with variable
- foreach ($values as $value) {
- // replace string
- if (is_string($account->$value)) $info_string = str_replace('$'.$value, $account->$value, $info_string);
- // replace object
- else if (is_object($account->$value)) {
- $values2 = get_object_vars($account->$value);
- $values2 = array_keys($values2);
- foreach ($values2 as $value2) {
- $info_string = str_replace('$'.$value.'->'.$value2, $account->$value->$value2, $info_string);
- }
- }
- // replace array
- else if (is_array($account->$value)) {
- foreach ($account->$value as $sub_array2) $sub_array .= $sub_array2.", ";
- $sub_array = substr($sub_array, 0, -2);
- $info_string = str_replace('$'.$value, $sub_array, $info_string);
- }
- }
- // Split string in array
- $info_array = explode("\n", $info_string);
- $pdfFile->setFont("times","",10);
- foreach ($info_array as $info)
- $pdfFile->Cell(50,5,$info,0,1,"L",0);
- $pdfFile->Ln(6);
-// Print Personal settings
- $pdfFile->setFont("arial","B",12);
- $pdfFile->Write(5,"- " . _("Personal User Infos") . ":");
- $pdfFile->Ln(6);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Title") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->personal_title,0,1,"L",0);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Surname") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->general_surname,0,1,"L",0);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Given name") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->general_givenname,0,1,"L",0);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Street") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->personal_street,0,1,"L",0);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Postal code") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->personal_postalCode,0,1,"L",0);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Postal address") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->personal_postalAddress,0,1,"L",0);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("E-Mail") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->personal_mail,0,1,"L",0);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Phone") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->personal_telephoneNumber,0,1,"L",0);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Cellular phone") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->personal_mobileTelephoneNumber,0,1,"L",0);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Facsimile") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->personal_facsimileTelephoneNumber,0,1,"L",0);
- $pdfFile->setFont("times","",10);
-// Print Unix settings
- $pdfFile->Ln(9);
- $pdfFile->setFont("arial","B",12);
- $pdfFile->Write(5,"- " . _("Unix User Settings") . ":");
- $pdfFile->Ln(6);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Username") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->general_username,0,1,"L",0);
- if($account->unix_password_no == "1") {
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Unix password") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,_("Unix password disabled!"),0,1,"L",0);
- }
- elseif($account->unix_password == "") {
- }
- else {
- $account->unix_password = $_SESSION['ldap']->decrypt(base64_decode($account->unix_password));
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Unix password") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->unix_password,0,1,"L",0);
- }
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Group(s)") . ":",0,0,"R",0);
- $text = $account->general_group;
- $groups = $account->general_groupadd;
- for($j=0;$jsetFont("times","",10);
- $pdfFile->Cell(50,5,$text,0,1,"L",0);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Home Directory") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->general_homedir,0,1,"L",0);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Login Shell") . ":",0,0,"R",0);
- $text = "";
- $shells = $account->general_shell;
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->general_shell,0,1,"L",0);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Password expire") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,date('j. F Y' ,$account->unix_pwdexpire),0,1,"L",0);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Login at host(s)") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->unix_host,0,1,"L",0);
-// Print Samba settings
- $pdfFile->Ln(9);
- $pdfFile->setFont("arial","B",12);
- $pdfFile->Write(5,"- " . _("Windows User Settings") . ":");
- $pdfFile->Ln(6);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Username") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->general_username,0,1,"L",0);
- if($account->smb_flags['N']) {
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Windows password") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,_("Window password disabled!"),0,1,"L",0);
- }
- elseif($account->smb_useunixpwd == "1") {
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Windows password") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,_("Windows password set to unix password."),0,1,"L",0);
- }
- elseif($account->smb_password == "") {
- }
- else {
- $account->smb_password = $_SESSION['ldap']->decrypt(base64_decode($account->smb_password));
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Windows password") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->smb_password,0,1,"L",0);
- }
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Home drive") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->smb_homedrive,0,1,"L",0);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Script path") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->smb_scriptPath,0,1,"L",0);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Profile path") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->smb_profilePath,0,1,"L",0);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Login at workstation(s)") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->smb_smbuserworkstations,0,1,"L",0);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Windows home directory") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $pdfFile->Cell(50,5,$account->smb_smbhome,0,1,"L",0);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("Windows Domain") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- if($_SESSION['config']->get_samba3() == "yes") $pdfFile->Cell(50,5,$account->smb_domain->name,0,1,"L",0);
- else $pdfFile->Cell(50,5,$account->smb_domain,0,1,"L",0);
-// Print Quota settings
- $pdfFile->Ln(9);
- $pdfFile->setFont("arial","B",12);
- $pdfFile->Write(5,"- " . _("Quota Settings") . ":");
- $pdfFile->Ln(6);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Cell(50,5,_("User quota(s)") . ":",0,0,"R",0);
- $pdfFile->setFont("times","",10);
- $quotas = $account->quota;
- if(count($quotas)>0) {
- $pdfFile->Cell(30,5,_("Mountpoint"),0,0,"L",0);
- $pdfFile->Cell(30,5,_("Soft block"),0,0,"L",0);
- $pdfFile->Cell(30,5,_("Soft inode"),0,0,"L",0);
- $pdfFile->Cell(30,5,_("Hard block"),0,0,"L",0);
- $pdfFile->Cell(30,5,_("Hard inode"),0,1,"L",0);
- for($j=0;$jCell(50,5,"",0,0,"R",0);
- $pdfFile->Cell(30,5,$quotas[$j][0],0,0,"L",0);
- $pdfFile->Cell(30,5,$quotas[$j][2],0,0,"L",0);
- $pdfFile->Cell(30,5,$quotas[$j][6],0,0,"L",0);
- $pdfFile->Cell(30,5,$quotas[$j][3],0,0,"L",0);
- $pdfFile->Cell(30,5,$quotas[$j][7],0,1,"L",0);
- }
- }
- else {
- $pdfFile->Cell(50,5,_("No user quotas defined or no quota support by filesystem."),0,1,"L",0);
- }
- $pdfFile->Ln(9);
- }
- // Close PDF
- $pdfFile->Close();
- // Get relative url path
- $fullpath = realpath('.');
- $subdirs = explode('/', str_replace($_SESSION['lampath'], '', $fullpath));
- for ($i=0; $irand . time() .'.pdf';
- // Save PDF
- $pdfFile->Output($filename);
- // Output meta refresh to pdf-file
- metaRefresh($filename);
- // Return relative path of pdf-file
- return $filename;
-}
-
-// creates a PDF with host accounts
-// $accounts: array of account
-function createHostPDF($accounts) {
- // The decimal separator must be a dot in order to write pdf-files
- setlocale(LC_NUMERIC, "C");
- // Start PDF file
- $pdfFile = new lamHostPDF();
- $pdfFile->Open();
- // Write some information into the PDF file
- $pdfFile->setFont("arial","",12);
- $pdfFile->setTitle("LDAP Account Manager");
- $pdfFile->setSubject(_("Samba-Host information page"));
- $pdfFile->setAuthor("LDAP Account Manager Devel-Team -Roland Gruber-");
- $pdfFile->setCreator("LDAP Account Manager (pdf.inc)");
- // print host accounts
- $pdfFile->addPage();
- $k = 0; // used to count the already printed accounts per page
- for($i = 0; $i < count($accounts); $i++) {
- $k++;
- $account = $accounts[$i];
- $ypos = $pdfFile->GetY();
- $pdfFile->setFont("times","B",16);
- $pdfFile->Write(5,$account->general_username);
- $pdfFile->Ln(8);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Write(5,_("Description") . ": ");
- $pdfFile->setFont("times","",10);
- $pdfFile->Write(5,$account->general_gecos);
- $pdfFile->Ln(5);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Write(5,_("UID") . ": ");
- $pdfFile->setFont("times","",10);
- $pdfFile->Write(5,$account->general_uidNumber);
- $pdfFile->Ln(5);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Write(5,_("Primary group") . ": ");
- $pdfFile->setFont("times","",10);
- $pdfFile->Write(5,$account->general_group);
- $pdfFile->Ln(5);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Write(5,_("Domain") . ": ");
- $pdfFile->setFont("times","",10);
- unset($domain);
- if (is_string($account->smb_domain)) {
- $domain = $account->smb_domain;
- }
- else {
- $domain = $account->smb_domain->name;
- }
- $pdfFile->Write(5,$domain);
- $pdfFile->Ln(5);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Write(5,_("DN") . ": ");
- $pdfFile->setFont("times","",9);
- $pdfFile->Write(5,$account->general_dn);
- // print second column
- if ($accounts[$i+1]) {
- $k++;
- $i++;
- $account = $accounts[$i];
- $pdfFile->SetY($ypos);
- $pdfFile->SetX(115);
- $pdfFile->setFont("times","B",16);
- $pdfFile->Write(5,$account->general_username);
- $pdfFile->Ln(7);
- $pdfFile->SetX(115);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Write(5,_("Description") . ": ");
- $pdfFile->setFont("times","",10);
- $pdfFile->Write(5,$account->general_gecos);
- $pdfFile->Ln(5);
- $pdfFile->SetX(115);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Write(5,_("UID") . ": ");
- $pdfFile->setFont("times","",10);
- $pdfFile->Write(5,$account->general_uidNumber);
- $pdfFile->Ln(5);
- $pdfFile->SetX(115);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Write(5,_("Primary group") . ": ");
- $pdfFile->setFont("times","",10);
- $pdfFile->Write(5,$account->general_group);
- $pdfFile->Ln(5);
- $pdfFile->SetX(115);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Write(5,_("Domain") . ": ");
- $pdfFile->setFont("times","",10);
- unset($domain);
- if (is_string($account->smb_domain)) {
- $domain = $account->smb_domain;
- }
- else {
- $domain = $account->smb_domain->name;
- }
- $pdfFile->Write(5,$domain);
- $pdfFile->Ln(5);
- $pdfFile->SetX(115);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Write(5,_("DN") . ": ");
- $pdfFile->setFont("times","",9);
- $pdfFile->Write(5,$account->general_dn);
- }
- // space between two rows
- if ($i < count($accounts) - 1) {
- $pdfFile->Ln(12);
- }
- // new page after twelve accounts
- if ($k == 12) {
- $k = 0;
- $pdfFile->addPage();
- }
- }
-
- // Close PDF
- $pdfFile->Close();
- // Get relative url path
- $fullpath = realpath('.');
- $subdirs = explode('/', str_replace($_SESSION['lampath'], '', $fullpath));
- for ($i=0; $irand . time() .'.pdf';
- // Save PDF
- $pdfFile->Output($filename);
- // Output meta refresh to pdf-file
- metaRefresh($filename);
- // Return relative path of pdf-file
- return $filename;
-}
-
-// creates a PDF with groups
-// $accounts: array of account
-function createGroupPDF($accounts) {
- // The decimal separator must be a dot in order to write pdf-files
- setlocale(LC_NUMERIC, "C");
- // Start PDF file
- $pdfFile = new lamGroupPDF();
- $pdfFile->Open();
- // Write some information into the PDF file
- $pdfFile->setFont("arial","",12);
- $pdfFile->setTitle("LDAP Account Manager");
- $pdfFile->setSubject(_("Group information page"));
- $pdfFile->setAuthor("LDAP Account Manager Devel-Team -Roland Gruber-");
- $pdfFile->setCreator("LDAP Account Manager (pdf.inc)");
- // print group accounts
- $pdfFile->addPage();
- for($i = 0; $i < count($accounts); $i++) {
- $account = $accounts[$i];
- $ypos = $pdfFile->GetY();
- if ($ypos > 260) $pdfFile->addPage();
- $pdfFile->setFont("times","B",16);
- $pdfFile->Write(5,$account->general_username);
- $pdfFile->Ln(8);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Write(5,_("Description") . ": ");
- $pdfFile->setFont("times","",10);
- $pdfFile->Write(5,$account->general_gecos);
- $pdfFile->Ln(5);
- if ($account->smb_displayname) {
- $pdfFile->setFont("times","B",10);
- $pdfFile->Write(5,_("Display name") . ": ");
- $pdfFile->setFont("times","",10);
- $pdfFile->Write(5,$account->smb_displayname);
- $pdfFile->Ln(5);
- }
- $pdfFile->setFont("times","B",10);
- $pdfFile->Write(5,_("GID") . ": ");
- $pdfFile->setFont("times","",10);
- $pdfFile->Write(5,$account->general_uidNumber);
- $pdfFile->Ln(5);
- if ($account->domain) {
- $pdfFile->setFont("times","B",10);
- $pdfFile->Write(5,_("Domain") . ": ");
- $pdfFile->setFont("times","",10);
- $pdfFile->Write(5,$account->domain->name);
- $pdfFile->Ln(5);
- }
- $pdfFile->setFont("times","B",10);
- $pdfFile->Write(5,_("DN") . ": ");
- $pdfFile->setFont("times","",9);
- $pdfFile->Write(5,$account->general_dn);
- if (is_array($account->unix_memberUid)) {
- $pdfFile->Ln(5);
- $pdfFile->setFont("times","B",10);
- $pdfFile->Write(5,_("Members") . ": ");
- $pdfFile->setFont("times","",10);
- $pdfFile->Write(5,implode(", ", $account->unix_memberUid));
- }
-
- // space between two rows
- if ($i < count($accounts) - 1) {
- $pdfFile->Ln(12);
- }
- }
-
- // Close PDF
- $pdfFile->Close();
- // Get relative url path
- $fullpath = realpath('.');
- $subdirs = explode('/', str_replace($_SESSION['lampath'], '', $fullpath));
- for ($i=0; $irand . time() .'.pdf';
- // Save PDF
- $pdfFile->Output($filename);
- // Output meta refresh to pdf-file
- metaRefresh($filename);
- // Return relative path of pdf-file
- return $filename;
-}
-
// lamPDF class || For defining own a Header and Footer
class lamPDF extends FPDF {
diff --git a/lam/templates/lists/listgroups.php b/lam/templates/lists/listgroups.php
index 7c807115..daca4e4e 100644
--- a/lam/templates/lists/listgroups.php
+++ b/lam/templates/lists/listgroups.php
@@ -77,6 +77,7 @@ if ($_POST['new_group'] || $_POST['del_group'] || $_POST['pdf_group'] || $_POST[
}
// PDF for selected groups
elseif ($_POST['pdf_group']){
+ $pdf_structure = $_POST['pdf_structure'];
// search for checkboxes
$groups = array_keys($_POST, "on");
$list = array();
@@ -87,7 +88,7 @@ if ($_POST['new_group'] || $_POST['del_group'] || $_POST['pdf_group'] || $_POST[
$list[$i] = $_SESSION["accountPDF-$i"];
}
if (sizeof($list) > 0) {
- createModulePDF($list, "group");
+ createModulePDF($list,$pdf_structure);
exit;
}
}
@@ -100,7 +101,7 @@ if ($_POST['new_group'] || $_POST['del_group'] || $_POST['pdf_group'] || $_POST[
$list[$i] = $_SESSION["accountPDF-$i"];
}
if (sizeof($list) > 0) {
- createModulePDF($list, "group");
+ createModulePDF($list,$_POST['pdf_structure']);
exit;
}
}
@@ -331,6 +332,12 @@ if (sizeof($grp_info) > 0) {
echo ("\n");
echo ("
\n");
echo "