new pdf support nearly completed; dropdown boxes added in lists to choose which profile to use;
This commit is contained in:
parent
5f31cbef1a
commit
f6e01592a7
|
@ -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 "<pre>moduleName: $moduleName\n</pre>";
|
||||
$return[$moduleName] = $module->get_pdfFields($this->type);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
|
|
@ -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('<block><key>' . _('Description') . '</key><value>' . $this->attributes['description'][0] . '</value></block>'));
|
||||
}
|
||||
|
||||
|
|
|
@ -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('<block><key>' . _('Description') . '</key><value>' . $this->attributes['description'][0] . '</value></block>'),
|
||||
'inetOrgPerson_host' => array('<block><key>' . _('Unix workstations') . '</key><value>' . $this->attributes['host'][0] . '</value></block>'),
|
||||
'inetOrgPerson_title' => array('<block><key>' . _('Title') . '</key><value>' . $this->attributes['title'][0] . '</value></block>'),
|
||||
|
|
|
@ -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('<block><key>' . _('DN') . '</key><value>' . $_SESSION[$this->base]->dn . '</value></block>'));
|
||||
}
|
||||
|
|
|
@ -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('<block><key>' . _('Username') . '</key><value>' . $this->attributes['uid'][0] . '</value></block>'),
|
||||
'posixAccount_uidNumber' => array('<block><key>' . _('UID number') . '</key><value>' . $this->attributes['uidNumber'][0] . '</value></block>'),
|
||||
'posixAccount_gidNumber' => array('<block><key>' . _('GID number') . '</key><value>' . $this->attributes['gidNumber'][0] . '</value></block>'),
|
||||
|
|
|
@ -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('<block><key>' . _('Groupname') . '</key><value>' . $this->attributes['cn'][0] . '</value></block>'),
|
||||
return array( 'posixGroup_cn' => array('<block><key>' . _('Groupname') . '</key><value>' . $this->attributes['cn'][0] . '</value></block>'),
|
||||
'posixGroup_gidNumber' => array('<block><key>' . _('GID number') . '</key><value>' . $this->attributes['gidNumber'][0] . '</value></block>'),
|
||||
'posixGroup_memberUid' => array('<block><key>' . _('Group members') . '</key><value>' . $this->attributes['memberUid'][0] . '</value></block>'),
|
||||
'posixGroup_description' => array('<block><key>' . _('Description') . '</key><value>' . $this->attributes['description'][0] . '</value></block>'));
|
||||
|
|
|
@ -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('<block><key>' . _('User quota') . '</key><td width="20%"><b>' . _('Mountpoint') . '</b></td><td width="20%"><b>' . _('Soft block') . '</b></td><td width="20%"><b>' . _('Soft inode') . '</b></td><td width="20%"><b>' . _('Hard block') . '</b></td><td width="20%"><b>' . _('Hard inode') . '</b></td></block>'));
|
||||
}
|
||||
|
||||
|
|
|
@ -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('<block><key>' . _('Display name') . '</key><value' . $this->attributes['displayName'][0] . '</value></block>'),
|
||||
'sambaAccount_uid' => array('<block><key>' . _('Username') . '</key><value>' . $this->attributes['uid'][0] . '</value></block>'),
|
||||
'sambaAccount_smbHome' => array('<block><key>' . _('Home path') . '</key><value>' . $this->attributes['smbHome'][0] . '</value></block>'),
|
||||
|
|
|
@ -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('<block><key>' . _('GID number') . '</key><value>' . $this->attributes['gidNumber'][0] . '</value></block>'),
|
||||
'sambaGroupMapping_sambaSID' => array('<block><key>' . _('Windows group') . '</key><value>' . $this->attributes['sambaSID'][0] . '</value></block>'),
|
||||
'sambaGroupMapping_displayName' => array('<block><key>' . _('Display name') . '</key><value>' . $this->attributes['displayName'][0] . '</value></block>'),
|
||||
|
|
|
@ -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('<block><key>' . _('Display name') . '</key><value' . $this->attributes['displayName'][0] . '</value></block>'),
|
||||
'sambaSamAccount_uid' => array('<block><key>' . _('Username') . '</key><value>' . $this->attributes['uid'][0] . '</value></block>'),
|
||||
'sambaSamAccount_sambaHomePath' => array('<block><key>' . _('Home path') . '</key><value>' . $this->attributes['sambaHomeDrive'][0] . '</value></block>'),
|
||||
|
|
|
@ -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('<block><key>' . _('Last shadow password change') . '</key><value>' . $this->attributes['shadowLastChange'][0] . '</value></block>'),
|
||||
'shadowAccount_shadowWarning' => array('<block><key>' . _('Password warn') . '</key><value>' . $this->attributes['shadowWarn'][0] . '</value><block>'),
|
||||
'shadowAccount_shadowInactive' => array('<block><key>' . _('Account inactive') . '</key><value>' . $this->attributes['shadowInactive'][0] . '</value></block>'),
|
||||
|
|
521
lam/lib/pdf.inc
521
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 . "<br>\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 = '/<block>.*<value>(.*)<\/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;$j<count($groups);$j++) {
|
||||
$text .= ", " . $groups[$j];
|
||||
}
|
||||
$pdfFile->setFont("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;$j<count($quotas);$j++) {
|
||||
$pdfFile->Cell(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; $i<count($subdirs); $i++ ) $filename .= '../';
|
||||
// use timestamp and random number from ldap.inc as filename so it should be unique.
|
||||
$filename .= 'tmp/' . $_SESSION['ldap']->rand . 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; $i<count($subdirs); $i++ ) $filename .= '../';
|
||||
// use timestamp and random number from ldap.inc as filename so it should be unique.
|
||||
$filename .= 'tmp/' . $_SESSION['ldap']->rand . 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; $i<count($subdirs); $i++ ) $filename .= '../';
|
||||
// use timestamp and random number from ldap.inc as filename so it should be unique.
|
||||
$filename .= 'tmp/' . $_SESSION['ldap']->rand . 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 {
|
||||
|
|
|
@ -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 ("<input type=\"submit\" name=\"del_group\" value=\"" . _("Delete Group(s)") . "\">\n");
|
||||
echo ("<br><br><br>\n");
|
||||
echo "<fieldset><legend><b>PDF</b></legend>\n";
|
||||
echo ("<p>" . _('Select PDF structure to use:') . " <select name=\"pdf_structure\">\n");
|
||||
$pdf_structures = getAvailablePDFStructures('group');
|
||||
foreach($pdf_structures as $pdf_structure) {
|
||||
echo "<option value=\"" . $pdf_structure . "\"" . (($pdf_structure == 'default.xml') ? " selected" : "") . ">" . substr($pdf_structure,0,strlen($pdf_structure)-4) . "</option>";
|
||||
}
|
||||
echo "</select></p><br>\n";
|
||||
echo ("<input type=\"submit\" name=\"pdf_group\" value=\"" . _("Create PDF for selected group(s)") . "\">\n");
|
||||
echo " ";
|
||||
echo ("<input type=\"submit\" name=\"pdf_all\" value=\"" . _("Create PDF for all groups") . "\">\n");
|
||||
|
|
|
@ -77,6 +77,7 @@ if ($_POST['new_host'] || $_POST['del_host'] || $_POST['pdf_host'] || $_POST['pd
|
|||
}
|
||||
// PDF for selected hosts
|
||||
elseif ($_POST['pdf_host']){
|
||||
$pdf_structure = $_POST['pdf_structure'];
|
||||
// search for checkboxes
|
||||
$hosts = array_keys($_POST, "on");
|
||||
$list = array();
|
||||
|
@ -85,7 +86,7 @@ if ($_POST['new_host'] || $_POST['del_host'] || $_POST['pdf_host'] || $_POST['pd
|
|||
$list[$i] = loadhost($hosts[$i]);
|
||||
}
|
||||
if (sizeof($list) > 0) {
|
||||
createHostPDF($list);
|
||||
createHostPDF($list,$pdf_structure);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +97,7 @@ if ($_POST['new_host'] || $_POST['del_host'] || $_POST['pdf_host'] || $_POST['pd
|
|||
$list[$i] = loadhost($_SESSION['hst_info'][$i]['dn']);
|
||||
}
|
||||
if (sizeof($list) > 0) {
|
||||
createHostPDF($list);
|
||||
createHostPDF($list,$_POST['pdf_structure']);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
@ -312,6 +313,12 @@ if (sizeof($hst_info) > 0) {
|
|||
echo ("<input type=\"submit\" name=\"del_host\" value=\"" . _("Delete Host(s)") . "\">\n");
|
||||
echo ("<br><br><br>\n");
|
||||
echo "<fieldset><legend><b>PDF</b></legend>\n";
|
||||
echo ("<p>" . _('Select PDF structure to use:') . " <select name=\"pdf_structure\">\n");
|
||||
$pdf_structures = getAvailablePDFStructures('host');
|
||||
foreach($pdf_structures as $pdf_structure) {
|
||||
echo "<option value=\"" . $pdf_structure . "\"" . (($pdf_structure == 'default.xml') ? " selected" : "") . ">" . substr($pdf_structure,0,strlen($pdf_structure)-4) . "</option>";
|
||||
}
|
||||
echo "</select></p><br>\n";
|
||||
echo ("<input type=\"submit\" name=\"pdf_host\" value=\"" . _("Create PDF for selected host(s)") . "\">\n");
|
||||
echo " ";
|
||||
echo ("<input type=\"submit\" name=\"pdf_all\" value=\"" . _("Create PDF for all hosts") . "\">\n");
|
||||
|
|
|
@ -99,6 +99,7 @@ if ($_POST['new_user'] || $_POST['del_user'] || $_POST['pdf_user'] || $_POST['pd
|
|||
}
|
||||
// PDF for selected users
|
||||
elseif ($_POST['pdf_user']){
|
||||
$pdf_structure = $_POST['pdf_structure'];
|
||||
// search for checkboxes
|
||||
while ($entry = @array_pop($_POST)) {
|
||||
if (eregi("^uid=.*$", $entry)) $users[] = $entry;
|
||||
|
@ -111,7 +112,7 @@ if ($_POST['new_user'] || $_POST['del_user'] || $_POST['pdf_user'] || $_POST['pd
|
|||
$list[$i] = $_SESSION["accountPDF-$i"];
|
||||
}
|
||||
if (sizeof($list) > 0) {
|
||||
createModulePDF($list, "user");
|
||||
createModulePDF($list,$pdf_structure);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +125,7 @@ if ($_POST['new_user'] || $_POST['del_user'] || $_POST['pdf_user'] || $_POST['pd
|
|||
$list[$i] = $_SESSION["accountPDF-$i"];
|
||||
}
|
||||
if (sizeof($list) > 0) {
|
||||
createModulePDF($list, "user");
|
||||
createModulePDF($list,$_POST['pdf_structure']);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
@ -382,6 +383,12 @@ if ($user_count != 0) {
|
|||
echo ("<input type=\"submit\" name=\"del_user\" value=\"" . _("Delete user(s)") . "\">\n");
|
||||
echo ("<br><br><br>\n");
|
||||
echo "<fieldset><legend><b>PDF</b></legend>\n";
|
||||
echo ("<p>" . _('Select PDF structure to use:') . " <select name=\"pdf_structure\">\n");
|
||||
$pdf_structures = getAvailablePDFStructures('user');
|
||||
foreach($pdf_structures as $pdf_structure) {
|
||||
echo "<option value=\"" . $pdf_structure . "\"" . (($pdf_structure == 'default.xml') ? " selected" : "") . ">" . substr($pdf_structure,0,strlen($pdf_structure)-4) . "</option>";
|
||||
}
|
||||
echo "</select></p><br>\n";
|
||||
echo ("<input type=\"submit\" name=\"pdf_user\" value=\"" . _("Create PDF for selected user(s)") . "\">\n");
|
||||
echo " ";
|
||||
echo ("<input type=\"submit\" name=\"pdf_all\" value=\"" . _("Create PDF for all users") . "\">\n");
|
||||
|
|
|
@ -33,6 +33,15 @@ session_save_path("../../sess");
|
|||
|
||||
setlanguage();
|
||||
|
||||
// Unset pdf structure definitions in session if set
|
||||
if(isset($_SESSION['currentPDFStructure'])) {
|
||||
unset($_SESSION['currentPDFStructure']);
|
||||
unset($_SESSION['availablePDFFields']);
|
||||
session_unregister('currentPDFStructure');
|
||||
session_unregister('availablePDFFields');
|
||||
}
|
||||
|
||||
|
||||
// check if user is logged in, if not go to login
|
||||
if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) {
|
||||
metaRefresh("../login.php");
|
||||
|
|
|
@ -41,114 +41,176 @@ if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) {
|
|||
exit;
|
||||
}
|
||||
|
||||
// Write $_POST variables to $_GET when form was submitted via post
|
||||
if(isset($_POST['type'])) {
|
||||
$_GET = $_POST;
|
||||
}
|
||||
|
||||
// Abort and go back to main pdf structure page
|
||||
if(isset($_GET['abort'])) {
|
||||
unset($_SESSION['currentPDFStructure']);
|
||||
unset($_SESSION['availablePDFFields']);
|
||||
session_unregister('currentPDFStructure');
|
||||
session_unregister('availablePDFFields');
|
||||
metarefresh('pdfmain.php');
|
||||
exit;
|
||||
}
|
||||
// Check if pdfname is valid, then save current structure to file and go to
|
||||
// main pdf structure page
|
||||
elseif(isset($_GET['submit'])) {
|
||||
savePDFStructureDefinitions($_GET['type'],$_GET['pdfname'] . '.xml');
|
||||
unset($_SESSION['currentPDFStructure']);
|
||||
unset($_SESSION['availablePDFFields']);
|
||||
session_unregister('currentPDFStructure');
|
||||
session_unregister('availablePDFFields');
|
||||
metarefresh('pdfmain.php');
|
||||
exit;
|
||||
}
|
||||
elseif(isset($_GET['add_section'])) {
|
||||
$attributes = array();
|
||||
if($_GET['section_type'] == 'text') {
|
||||
$attributes['NAME'] = $_GET['section_text'];
|
||||
if(!isset($_GET['pdfname']) || !preg_match('/[a-zA-Z0-9\-\_\.]+/',$_GET['pdfname'])) {
|
||||
StatusMessage('ERROR',_('PDF-structure name not valid'),_('The name for that PDF-structure you submitted is not valid. A valid name must constist at least of one of the following characters \'a-z\',\'A-Z\',\'0-9\',\'_\',\'-\',\'.\'.'));
|
||||
}
|
||||
elseif($_GET['section_type'] == 'item') {
|
||||
$attributes['NAME'] = '_' . $_GET['section_item'];
|
||||
else {
|
||||
savePDFStructureDefinitions($_GET['type'],$_GET['pdfname'] . '.xml');
|
||||
metarefresh('pdfmain.php');
|
||||
exit;
|
||||
}
|
||||
$newSectionStart = array('tag' => 'SECTION','type' => 'open','level' => '2','attributes' => $attributes);
|
||||
$newSectionEnd = array('tag' => 'SECTION','type' => 'close','level' => '2');
|
||||
$_SESSION['currentPDFStructure'][] = $newSectionStart;
|
||||
$_SESSION['currentPDFStructure'][] = $newSectionEnd;
|
||||
}
|
||||
// Add a new section or static text
|
||||
elseif(isset($_GET['add'])) {
|
||||
// Check if name for new section is specified when needed
|
||||
if($_GET['add_type'] == 'section' && $_GET['section_type'] == 'text' && (!isset($_GET['section_text']) || $_GET['section_text'] == '')) {
|
||||
StatusMessage('ERROR',_('No section text specified'),_('The headline for a new section must contain at least one character.'));
|
||||
}
|
||||
// Check if text for static text field is specified
|
||||
elseif($_GET['add_type'] == 'text' && (!isset($_GET['text_text']) || $_GET['text_text'] == '')) {
|
||||
StatusMessage('ERROR',_('No static text specified'),_('The static text must contain at least one character.'));
|
||||
}
|
||||
else {
|
||||
// Add a new section
|
||||
if($_GET['add_type'] == 'section') {
|
||||
$attributes = array();
|
||||
// Add a new section with user headline
|
||||
if($_GET['section_type'] == 'text') {
|
||||
$attributes['NAME'] = $_GET['section_text'];
|
||||
}
|
||||
// Add a new section with a module value headline
|
||||
elseif($_GET['section_type'] == 'item') {
|
||||
$attributes['NAME'] = '_' . $_GET['section_item'];
|
||||
}
|
||||
$entry = array(array('tag' => 'SECTION','type' => 'open','level' => '2','attributes' => $attributes),array('tag' => 'SECTION','type' => 'close','level' => '2'));
|
||||
}
|
||||
// Add new static text field
|
||||
elseif($_GET['add_type'] == 'text') {
|
||||
$entry = array(array('tag' => 'TEXT','type' => 'complete','level' => '2','value' => $_GET['text_text']));
|
||||
}
|
||||
// Insert new field in structure
|
||||
array_splice($_SESSION['currentPDFStructure'],$_GET['add_position'],0,$entry);
|
||||
}
|
||||
}
|
||||
// Add a new value field
|
||||
elseif(isset($_GET['add_field'])) {
|
||||
// Get available modules
|
||||
$modules = explode(',',$_GET['modules']);
|
||||
$fields = array();
|
||||
// Search each module for selected values
|
||||
foreach($modules as $module) {
|
||||
if(isset($_GET[$module])) {
|
||||
foreach($_GET[$module] as $field) {
|
||||
// Create ne value entry
|
||||
$fields[] = array('tag' => 'ENTRY','type' => 'complete','level' => '3','attributes' => array('NAME' => $module . '_' . $field));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(count($fields) > 0) {
|
||||
$pos = 0;
|
||||
// Find begin section to insert into
|
||||
while($pos < $_GET['section']) {
|
||||
next($_SESSION['currentPDFStructure']);
|
||||
$pos++;
|
||||
}
|
||||
$current = next($_SESSION['currentPDFStructure']);
|
||||
$pos++;
|
||||
// End of section to insert into
|
||||
while($current && $current['tag'] != 'SECTION' && $current['type'] != 'close') {
|
||||
$current = next($_SESSION['currentPDFStructure']);
|
||||
$pos++;
|
||||
}
|
||||
// Insert new entry before closing section tag
|
||||
array_splice($_SESSION['currentPDFStructure'],$pos,0,$fields);
|
||||
}
|
||||
}
|
||||
// Change section headline
|
||||
elseif(isset($_GET['change'])) {
|
||||
$alter = explode('_',$_GET['change']);
|
||||
$newvalue = $_GET['section_' . $alter[0]];
|
||||
if($alter[1] == 'item') {
|
||||
$newvalue = '_' . $newvalue;
|
||||
}
|
||||
$_SESSION['currentPDFStructure'][$alter[0]]['attributes']['NAME'] = $newvalue;
|
||||
}
|
||||
// Remove section, static text or value entry from structure
|
||||
elseif(isset($_GET['remove'])) {
|
||||
$start = 0;
|
||||
// Find element to remove
|
||||
while($start < $_GET['remove']) {
|
||||
next($_SESSION['currentPDFStructure']);
|
||||
$start++;
|
||||
}
|
||||
$remove = current($_SESSION['currentPDFStructure']);
|
||||
// We have a section to remove
|
||||
if($remove['tag'] == "SECTION") {
|
||||
$end = $start;
|
||||
$current = next($_SESSION['currentPDFStructure']);
|
||||
$end++;
|
||||
// Find end of section to remove
|
||||
while($current && $current['tag'] != 'SECTION' && $current['type'] != 'close') {
|
||||
$current = next($_SESSION['currentPDFStructure']);
|
||||
$end++;
|
||||
}
|
||||
// Remove complete section with all value entries in it from structure
|
||||
array_splice($_SESSION['currentPDFStructure'],$start,$end - $start + 1);
|
||||
}
|
||||
// We have a value entry to remove
|
||||
elseif($remove['tag'] == "ENTRY") {
|
||||
array_splice($_SESSION['currentPDFStructure'],$start,1);
|
||||
}
|
||||
// We hava a static text to remove
|
||||
elseif($remove['tag'] == "TEXT") {
|
||||
array_splice($_SESSION['currentPDFStructure'],$start,1);
|
||||
}
|
||||
}
|
||||
// Move a section, static text or value entry upwards
|
||||
elseif(isset($_GET['up'])) {
|
||||
$tmp = $_SESSION['currentPDFStructure'][$_GET['up']];
|
||||
$prev = $_SESSION['currentPDFStructure'][$_GET['up'] - 1];
|
||||
if($tmp['tag'] == 'SECTION') {
|
||||
// We have a section or static text to move
|
||||
if($tmp['tag'] == 'SECTION' || $tmp['tag'] == 'TEXT') {
|
||||
$pos = 0;
|
||||
$borders = array();
|
||||
$current = current($_SESSION['currentPDFStructure']);
|
||||
// Add borders of sections and static text entry to array
|
||||
if($current['tag'] == 'SECTION') {
|
||||
$borders[$current['type']][] = $pos;
|
||||
}
|
||||
elseif($current['tag'] == 'TEXT') {
|
||||
$borders['open'][] = $pos;
|
||||
$borders['close'][] = $pos;
|
||||
}
|
||||
// Find all sections and statci text fields before the section or static
|
||||
// text entry to move upwards
|
||||
while($pos < $_GET['up']) {
|
||||
$current = next($_SESSION['currentPDFStructure']);
|
||||
$pos++;
|
||||
if($current['tag'] == 'SECTION') {
|
||||
$borders[$current['type']][] = $pos;
|
||||
}
|
||||
elseif($current['tag'] == 'TEXT') {
|
||||
$borders['open'][] = $pos;
|
||||
$borders['close'][] = $pos;
|
||||
}
|
||||
}
|
||||
// Move only when not topmost element
|
||||
if(count($borders['close']) > 0) {
|
||||
$current = next($_SESSION['currentPDFStructure']);
|
||||
$pos++;
|
||||
while($current && $current['tag'] != 'SECTION' && $current['type'] != 'close') {
|
||||
// We have a section to move up
|
||||
if($current['tag'] == 'SECTION') {
|
||||
$current = next($_SESSION['currentPDFStructure']);
|
||||
$pos++;
|
||||
// Find end of section to move
|
||||
while($current && $current['tag'] != 'SECTION' && $current['type'] != 'close') {
|
||||
$current = next($_SESSION['currentPDFStructure']);
|
||||
$pos++;
|
||||
}
|
||||
$borders['close'][] = $pos;
|
||||
}
|
||||
$borders['close'][] = $pos;
|
||||
// Calculate the entries to move and move them
|
||||
$cut_start = $borders['open'][count($borders['open']) - 1];
|
||||
$cut_count = $borders['close'][count($borders['close']) - 1] - $borders['open'][count($borders['open']) - 1] + 1;
|
||||
$insert_pos = $borders['open'][count($borders['open']) - 2];
|
||||
|
@ -156,52 +218,71 @@ elseif(isset($_GET['up'])) {
|
|||
array_splice($_SESSION['currentPDFStructure'],$insert_pos,0,$tomove);
|
||||
}
|
||||
}
|
||||
// We have a value entry to move; move it only if its not the topmost
|
||||
// entry in this section
|
||||
elseif($tmp['tag'] == 'ENTRY' && $prev['tag'] == 'ENTRY') {
|
||||
$_SESSION['currentPDFStructure'][$_GET['up']] = $_SESSION['currentPDFStructure'][$_GET['up'] - 1];
|
||||
$_SESSION['currentPDFStructure'][$_GET['up']] = $prev;
|
||||
$_SESSION['currentPDFStructure'][$_GET['up'] - 1] = $tmp;
|
||||
}
|
||||
elseif($tmp['tag'] == 'TEXT') {
|
||||
if($_GET['up'] != 0) {
|
||||
$tomove = array_splice($_SESSION['currentPDFStructure'],$_GET['up'],1);
|
||||
array_splice($_SESSION['currentPDFStructure'],0,0,$tomove);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Move a section, static text field or value entry downwards
|
||||
elseif(isset($_GET['down'])) {
|
||||
$tmp = $_SESSION['currentPDFStructure'][$_GET['down']];
|
||||
$next = $_SESSION['currentPDFStructure'][$_GET['down'] + 1];
|
||||
if($tmp['tag'] == 'SECTION') {
|
||||
// We have a section or static text to move
|
||||
if($tmp['tag'] == 'SECTION' || $tmp['tag'] == 'TEXT') {
|
||||
$pos = 0;
|
||||
$current = current($_SESSION['currentPDFStructure']);
|
||||
// Find section or static text entry to move
|
||||
while($pos < $_GET['down']) {
|
||||
$current = next($_SESSION['currentPDFStructure']);
|
||||
$pos++;
|
||||
}
|
||||
$borders = array();
|
||||
$borders[$current['type']][] = $pos;
|
||||
$current = next($_SESSION['currentPDFStructure']);
|
||||
$pos++;
|
||||
while($current && $current['tag'] != 'SECTION' && $current['type'] != 'close') {
|
||||
$current = next($_SESSION['currentPDFStructure']);
|
||||
$pos++;
|
||||
}
|
||||
$borders['close'][] = $pos;
|
||||
$current = next($_SESSION['currentPDFStructure']);
|
||||
$pos++;
|
||||
if($current) {
|
||||
// We have a section to move
|
||||
if($current['tag'] == 'SECTION'){
|
||||
$borders[$current['type']][] = $pos;
|
||||
$current = next($_SESSION['currentPDFStructure']);
|
||||
$pos++;
|
||||
// Find end of section to move
|
||||
while($current && $current['tag'] != 'SECTION' && $current['type'] != 'close') {
|
||||
if($current['tag'] == 'SECTION') {
|
||||
$borders[$current['type']][] = $pos;
|
||||
}
|
||||
$current = next($_SESSION['currentPDFStructure']);
|
||||
$pos++;
|
||||
}
|
||||
$borders['close'][] = $pos;
|
||||
}
|
||||
// We have a static text entry to move
|
||||
elseif($current['tag'] == 'TEXT') {
|
||||
$borders['open'][] = $pos;
|
||||
$borders['close'][] = $pos;
|
||||
}
|
||||
$current = next($_SESSION['currentPDFStructure']);
|
||||
$pos++;
|
||||
// Find next section or static text entry in structure
|
||||
if($current) {
|
||||
// Next is a section
|
||||
if($current['tag'] == 'SECTION') {
|
||||
$borders[$current['type']][] = $pos;
|
||||
$current = next($_SESSION['currentPDFStructure']);
|
||||
$pos++;
|
||||
// Find end of this section
|
||||
while($current && $current['tag'] != 'SECTION' && $current['type'] != 'close') {
|
||||
if($current['tag'] == 'SECTION') {
|
||||
$borders[$current['type']][] = $pos;
|
||||
}
|
||||
$current = next($_SESSION['currentPDFStructure']);
|
||||
$pos++;
|
||||
}
|
||||
}
|
||||
// Next is static text entry
|
||||
elseif($current['tag'] == 'TEXT') {
|
||||
$borders['open'][] = $pos;
|
||||
}
|
||||
$borders['close'][] = $pos;
|
||||
}
|
||||
// Move only downwars if not bottenmost element of this structure
|
||||
if(count($borders['open']) > 1) {
|
||||
// Calculate entries to move and move them
|
||||
$cut_start = $borders['open'][count($borders['open']) - 1];
|
||||
$cut_count = $borders['close'][count($borders['close']) - 1] - $borders['open'][count($borders['open']) - 1] + 1;
|
||||
$insert_pos = $borders['open'][count($borders['open']) - 2];
|
||||
|
@ -209,50 +290,40 @@ elseif(isset($_GET['down'])) {
|
|||
array_splice($_SESSION['currentPDFStructure'],$insert_pos,0,$tomove);
|
||||
}
|
||||
}
|
||||
// We have a value entry to move; move it only if it is not the bottmmost
|
||||
// element of this section.
|
||||
elseif($tmp['tag'] == 'ENTRY' && $next['tag'] == 'ENTRY') {
|
||||
$_SESSION['currentPDFStructure'][$_GET['down']] = $_SESSION['currentPDFStructure'][$_GET['down'] + 1];
|
||||
$_SESSION['currentPDFStructure'][$_GET['down'] + 1] = $tmp;
|
||||
}
|
||||
elseif($tmp['tag'] == 'TEXT') {
|
||||
if($_GET['down'] != (count($_SESSION['currentPDFStructure']) -1)) {
|
||||
$tomove = array_splice($_SESSION['currentPDFStructure'],$_GET['down'],1);
|
||||
array_splice($_SESSION['currentPDFStructure'],count($_SESSION['currentPDFStructure']),0,$tomove);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif(isset($_GET['add_text'])) {
|
||||
if($_GET['text_type'] == 'config') {
|
||||
$entry = array('tag' => 'TEXT','type' => 'complete','level' => '2','attributes' => array('type' => $_GET['type']));
|
||||
}
|
||||
else {
|
||||
$entry = array('tag' => 'TEXT','type' => 'complete','level' => '2','value' => $_GET['text_text']);
|
||||
}
|
||||
if($_GET['text_position'] == 'top') {
|
||||
array_splice($_SESSION['currentPDFStructure'],0,0,array($entry));
|
||||
}
|
||||
else {
|
||||
array_push($_SESSION['currentPDFStructure'],$entry);
|
||||
}
|
||||
}
|
||||
|
||||
// Load PDF structure from file if it is not defined in session
|
||||
if(!isset($_SESSION['currentPDFStructure'])) {
|
||||
// Load structure file to be edit
|
||||
if($_GET['edit']) {
|
||||
$_SESSION['currentPDFStructure'] = loadPDFStructureDefinitions($_GET['type'],$_GET['edit']);
|
||||
}
|
||||
// Load default structure file when creating a new one
|
||||
else {
|
||||
$_SESSION['currentPDFStructure'] = loadPDFStructureDefinitions($_GET['type']);
|
||||
}
|
||||
}
|
||||
|
||||
// Load available fields from modules when not set in session
|
||||
if(!isset($_SESSION['availablePDFFields'])) {
|
||||
$_SESSION['availablePDFFields'] = getAvailablePDFFields($_GET['type']);
|
||||
}
|
||||
|
||||
// Create the values for the dropdown boxes for section headline defined by
|
||||
// value entries and fetch all available modules
|
||||
$modules = array();
|
||||
$section_items_array = array();
|
||||
$section_items = '';
|
||||
foreach($_SESSION['availablePDFFields'] as $module => $values) {
|
||||
$modules[] = $module;
|
||||
foreach($values as $attribute) {
|
||||
$section_items_array[] = $module . '_' . $attribute;
|
||||
$section_items .= "\t\t\t\t\t\t\t\t\t\t\t\t<option>" . $module . '_' . $attribute . "</option>\n";
|
||||
}
|
||||
}
|
||||
|
@ -277,26 +348,44 @@ echo $_SESSION['header'];
|
|||
</legend>
|
||||
<table>
|
||||
<?php
|
||||
$sections = '<option value="0">' . _('Beginning') . "</option>\n";
|
||||
// Print every entry in the current structure
|
||||
foreach($_SESSION['currentPDFStructure'] as $key => $entry) {
|
||||
// Create the up/down/remove links
|
||||
$links = "\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<a href=\"pdfpage.php?type=" . $_GET['type'] . "&up=" . $key . (($_GET['edit']) ? 'edit=' . $_GET['edit'] : '') . "\">" . _('Up') . "</a>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t<td width=\"10\">\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<a href=\"pdfpage.php?type=" . $_GET['type'] . "&down=" . $key . (($_GET['edit']) ? 'edit=' . $_GET['edit'] : '') . "\">" . _('Down') . "</a>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t<td width=\"10\">\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<a href=\"pdfpage.php?type=" . $_GET['type'] . "&remove=" . $key . (($_GET['edit']) ? 'edit=' . $_GET['edit'] : '') . "\">" . _('Remove') . "</a>\n\t\t\t\t\t\t\t\t\t</td>\n";
|
||||
$uplink = 'pdfpage.php?type=' . $_GET['type'] . '&up=' . $i . (($_GET['edit']) ? 'edit=' . $_GET['edit'] : '');
|
||||
$downlink = 'pdfpage.php?type=' . $_GET['type'] . '&down=' . urlencode($entry['tag']) . (($_GET['edit']) ? 'edit=' . $_GET['edit'] : '');
|
||||
// We have a new section to start
|
||||
if($entry['tag'] == "SECTION" && $entry['type'] == "open") {
|
||||
$name = $entry['attributes']['NAME'];
|
||||
if(preg_match("/^\_[a-zA-Z\_]+/",$name)) {
|
||||
$section_headline = substr($name,1);
|
||||
}
|
||||
else {
|
||||
$section_headline = $name;
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td width="20" align="left">
|
||||
<input type="radio" name="section" value="<?php echo $key;?>">
|
||||
</td>
|
||||
<td colspan="2">
|
||||
<b><?php echo $section_headline;?></b>
|
||||
<?php
|
||||
// Section headline is a value entry
|
||||
if(preg_match("/^\_[a-zA-Z\_]+/",$name)) {
|
||||
?>
|
||||
<select name="section_<?php echo $key;?>">
|
||||
<!-- <?php echo $section_items;?> -->
|
||||
<?php
|
||||
foreach($section_items_array as $item) {
|
||||
?>
|
||||
<option value="_<?php echo $item;?>"<?php echo ((substr($name,1) == $item) ? ' selected' : '');?>><?php echo $item;?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<button type="submit" name="change" value="<?php echo $key;?>_item"><?php echo _('Change');?></button>
|
||||
<?php
|
||||
}
|
||||
// Section headline is a user text
|
||||
else {
|
||||
?>
|
||||
<input type="text" name="section_<?php echo $key;?>" value="<?php echo $name;?>"> <button type="submit" name="change" value="<?php echo $key;?>"><?php echo _('Change');?></button>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td width="20">
|
||||
</td>
|
||||
|
@ -306,6 +395,15 @@ foreach($_SESSION['currentPDFStructure'] as $key => $entry) {
|
|||
}
|
||||
// We have a section to end
|
||||
elseif($entry['tag'] == "SECTION" && $entry['type'] == "close") {
|
||||
if(preg_match("/^\_[a-zA-Z\_]+/",$name)) {
|
||||
$section_headline = substr($name,1);
|
||||
}
|
||||
else {
|
||||
$section_headline = $name;
|
||||
}
|
||||
// Add current section for dropdown box needed for the position when inserting a new
|
||||
// section or static text entry
|
||||
$sections .= '<option value="' . ($key + 1) . '">' . $section_headline . "</option>\n";
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="9">
|
||||
|
@ -316,31 +414,10 @@ foreach($_SESSION['currentPDFStructure'] as $key => $entry) {
|
|||
}
|
||||
// We have to include a static text.
|
||||
elseif($entry['tag'] == "TEXT") {
|
||||
if(!isset($entry['value'])) {
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td colspan="2">
|
||||
<b><?php echo _('Static text');?></b>
|
||||
</td>
|
||||
<td width="20">
|
||||
</td>
|
||||
<?php echo $links;?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
</td>
|
||||
<td>
|
||||
<?php echo _('Print PDF text from config.');?>
|
||||
</td>
|
||||
<td colspan="6">
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
?>
|
||||
// Add current satic text for dropdown box needed for the position when inserting a new
|
||||
// section or static text entry
|
||||
$sections .= '<option value="' . ($key + 1) . '">' . _('Static text') . "</option>\n";
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
|
@ -360,9 +437,6 @@ foreach($_SESSION['currentPDFStructure'] as $key => $entry) {
|
|||
<td colspan="6">
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="9">
|
||||
<br>
|
||||
|
@ -390,44 +464,19 @@ foreach($_SESSION['currentPDFStructure'] as $key => $entry) {
|
|||
<?php
|
||||
}
|
||||
}
|
||||
// Print the boxes for adding new sections and static text entries
|
||||
// Print save and abort buttons
|
||||
?>
|
||||
</table>
|
||||
<fieldset>
|
||||
<legend>
|
||||
<b><?php echo _("Add new section"); ?></b>
|
||||
</legend>
|
||||
<table align="left" width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<input type="radio" name="section_type" value="text" checked>
|
||||
</td>
|
||||
<td colspan="2">
|
||||
<input type="text" name="section_text">
|
||||
</td>
|
||||
<td colspan="6" rowspan="2" align="left">
|
||||
<input type="submit" name="add_section" value="<?php echo _('Add');?>">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="radio" name="section_type" value="item">
|
||||
</td>
|
||||
<td>
|
||||
<select name="section_item">
|
||||
<?php echo $section_items;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<p> </p>
|
||||
<fieldset>
|
||||
<b><?php echo _('Add section or static text');?></b>
|
||||
<legend>
|
||||
<b><?php echo _("Add static text"); ?></b>
|
||||
</legend>
|
||||
<table align="left" width="100%">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<td width="10">
|
||||
</td>
|
||||
<td>
|
||||
<fieldset style="margin:0px;">
|
||||
<legend>
|
||||
<?php echo _('Position');?>
|
||||
|
@ -435,46 +484,78 @@ foreach($_SESSION['currentPDFStructure'] as $key => $entry) {
|
|||
<table width="100%" style="margin:0px;">
|
||||
<tr>
|
||||
<td>
|
||||
<input type="radio" name="text_position" value="top" checked>
|
||||
<?php echo _('Add after');?>:
|
||||
</td>
|
||||
<td width="50%">
|
||||
<?php echo _('Top');?>
|
||||
<select name="add_position">
|
||||
<?php echo $sections;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<td>
|
||||
<td rowspan="5">
|
||||
<input type="submit" name="add" value="<?php echo _('Add');?>">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="center">
|
||||
<input type="radio" name="add_type" value="section" checked>
|
||||
</td>
|
||||
<td>
|
||||
<fieldset>
|
||||
<legend>
|
||||
<b><?php echo _("Section"); ?></b>
|
||||
</legend>
|
||||
<table align="left" width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<input type="radio" name="section_type" value="text" checked>
|
||||
</td>
|
||||
<td colspan="2">
|
||||
<input type="text" name="section_text">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="radio" name="section_type" value="item">
|
||||
</td>
|
||||
<td>
|
||||
<input type="radio" name="text_position" value="bottom">
|
||||
</td>
|
||||
<td width="50%">
|
||||
<?php echo _('Bottom');?>
|
||||
<select name="section_item">
|
||||
<?php echo $section_items;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</td>
|
||||
<td rowspan="2">
|
||||
<input type="submit" name="add_text" value="<?php echo _('Add');?>">
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="10" valign="center">
|
||||
<input type="radio" name="add_type" value="text">
|
||||
</td>
|
||||
<td>
|
||||
<fieldset>
|
||||
<legend>
|
||||
<?php echo _('Text');?>
|
||||
<b><?php echo _("Static text"); ?></b>
|
||||
</legend>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<input type="radio" name="text_type" value="config" checked>
|
||||
<td width="10">
|
||||
</td>
|
||||
<td>
|
||||
<?php echo _('Insert static text from config.');?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="radio" name="text_type" value="textfield">
|
||||
</td>
|
||||
<td>
|
||||
<?php echo _('Use text from field below.');?>
|
||||
<?php echo _('Write your text in the field below.');?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -482,8 +563,8 @@ foreach($_SESSION['currentPDFStructure'] as $key => $entry) {
|
|||
</td>
|
||||
<td>
|
||||
<textarea name="text_text" rows="4" cols="40"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</td>
|
||||
|
@ -540,6 +621,7 @@ foreach($_SESSION['currentPDFStructure'] as $key => $entry) {
|
|||
</legend>
|
||||
<table>
|
||||
<?php
|
||||
// Print all available modules with the value fieds
|
||||
foreach($_SESSION['availablePDFFields'] as $module => $fields) {
|
||||
?>
|
||||
<tr>
|
||||
|
@ -553,6 +635,7 @@ foreach($_SESSION['availablePDFFields'] as $module => $fields) {
|
|||
<td>
|
||||
<select name="<?php echo $module?>[]" size="7" multiple>
|
||||
<?php
|
||||
// Print each value field
|
||||
foreach($fields as $field) {
|
||||
?>
|
||||
<option><?php echo $field;?></option>
|
||||
|
|
Loading…
Reference in New Issue