use session object for PDF from edit page

This commit is contained in:
Roland Gruber 2010-03-08 18:18:31 +00:00
parent 00f3c3294d
commit 7096292dcd
2 changed files with 26 additions and 7 deletions

View File

@ -519,6 +519,11 @@ class lamList {
exit; exit;
} }
} }
elseif ($option == 'SESSION') {
createModulePDF(array($_SESSION[$_POST['PDFSessionID']]),$pdfStruct);
unset($_SESSION[$_GET['PDFSessionID']]);
exit;
}
} }
// check if back from configuration page // check if back from configuration page
if (sizeof($this->configOptions) > 0) { if (sizeof($this->configOptions) > 0) {
@ -542,6 +547,12 @@ class lamList {
* @param String $id account ID * @param String $id account ID
*/ */
private function showPDFPage($id) { private function showPDFPage($id) {
$sessionObject = null;
$PDFSessionID = null;
if (($id == null) && isset($_GET['PDFSessionID'])) {
$PDFSessionID = $_GET['PDFSessionID'];
$sessionObject = $_SESSION[$PDFSessionID];
}
// search for checkboxes // search for checkboxes
$selAccounts = array_keys($_POST, "on"); $selAccounts = array_keys($_POST, "on");
if (!in_array($id, $selAccounts)) { if (!in_array($id, $selAccounts)) {
@ -573,11 +584,19 @@ class lamList {
echo _('Create for') . " "; echo _('Create for') . " ";
echo '</td>'; echo '</td>';
echo '<td>'; echo '<td>';
// check if account object is already in session
if ($sessionObject != null) {
echo $sessionObject->finalDN;
echo "<input type=\"hidden\" name=\"createFor\" value=\"SESSION\">\n";
echo "<input type=\"hidden\" name=\"PDFSessionID\" value=\"$PDFSessionID\">\n";
}
else {
echo '<select name="createFor">'; echo '<select name="createFor">';
echo '<option value="DN">' . base64_decode($id) . '</option>'; echo '<option value="DN">' . base64_decode($id) . '</option>';
echo '<option value="SELECTED">' . sprintf(_('All selected accounts (%s)'), sizeof($selAccounts)) . '</option>'; echo '<option value="SELECTED">' . sprintf(_('All selected accounts (%s)'), sizeof($selAccounts)) . '</option>';
echo '<option value="ALL">' . sprintf(_('All accounts (%s)'), sizeof($this->entries)) . '</option>'; echo '<option value="ALL">' . sprintf(_('All accounts (%s)'), sizeof($this->entries)) . '</option>';
echo '</select>'; echo '</select>';
}
echo '</td>'; echo '</td>';
echo '</tr>'; echo '</tr>';
echo '<tr>'; echo '<tr>';
@ -705,7 +724,7 @@ class lamList {
protected function listGetParams() { protected function listGetParams() {
// check if only PDF should be shown // check if only PDF should be shown
if (isset($_GET['printPDF'])) { if (isset($_GET['printPDF'])) {
$this->showPDFPage($_GET['dn']); $this->showPDFPage(null);
exit(); exit();
} }
// get current page // get current page

View File

@ -1098,7 +1098,7 @@ class accountContainer {
} }
// create PDF file // create PDF file
if (isset($_POST['accountContainerCreatePDF'])) { if (isset($_POST['accountContainerCreatePDF'])) {
metaRefresh('../lists/list.php?printPDF=1&amp;type=' . $this->type . "&amp;dn=" . base64_encode($this->finalDN)); metaRefresh('../lists/list.php?printPDF=1&amp;type=' . $this->type . "&amp;PDFSessionID=" . $this->base);
exit; exit;
} }
// module actions // module actions