From 72e6f80c55199e3ca1ac2900a9287231318a6c67 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 18 Oct 2003 17:04:45 +0000 Subject: [PATCH] added PDF for groups --- lam/templates/lists/listgroups.php | 38 ++++++++++++++++++++++++++---- lam/templates/lists/listhosts.php | 2 +- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/lam/templates/lists/listgroups.php b/lam/templates/lists/listgroups.php index 1bc38728..c1bb6b59 100644 --- a/lam/templates/lists/listgroups.php +++ b/lam/templates/lists/listgroups.php @@ -25,6 +25,8 @@ $Id$ include_once ("../../lib/config.inc"); include_once ("../../lib/ldap.inc"); include_once ("../../lib/status.inc"); +include_once("../../lib/account.inc"); +include_once("../../lib/pdf.inc"); // start session session_save_path("../../sess"); @@ -42,20 +44,38 @@ $grp_info = $_SESSION['grp_info']; $grp_units = $_SESSION['grp_units']; // check if button was pressed and if we have to add/delete a group -if ($_POST['new_group'] || $_POST['del_group']){ +if ($_POST['new_group'] || $_POST['del_group'] || $_POST['pdf_group'] || $_POST['pdf_all']){ // add new group if ($_POST['new_group']){ metaRefresh("../account/groupedit.php"); - exit; } // delete group(s) - if ($_POST['del_group']){ + elseif ($_POST['del_group']){ // search for checkboxes $groups = array_keys($_POST, "on"); $_SESSION['delete_dn'] = $groups; metaRefresh("../delete.php?type=group"); + } + // PDF for selected groups + elseif ($_POST['pdf_group']){ + // search for checkboxes + $hosts = array_keys($_POST, "on"); + $list = array(); + // load groups from LDAP + for ($i = 0; $i < sizeof($hosts); $i++) { + $list[$i] = loadgroup($hosts[$i]); } - exit; + if (sizeof($list) > 0) createGroupPDF($list); + } + // PDF for all groups + elseif ($_POST['pdf_all']){ + $list = array(); + for ($i = 0; $i < sizeof($_SESSION['grp_info']); $i++) { + $list[$i] = loadgroup($_SESSION['grp_info'][$i]['dn']); + } + if (sizeof($list) > 0) createGroupPDF($list); + } + exit; } echo $_SESSION['header']; @@ -280,7 +300,15 @@ if (sizeof($grp_units) > 1) { echo ("

\n"); echo ("\n"); -if (sizeof($grp_info) > 0) echo ("\n"); +if (sizeof($grp_info) > 0) { + echo ("\n"); + echo ("


\n"); + echo "

PDF\n"; + echo ("\n"); + echo " "; + echo ("\n"); + echo "
"; +} echo ("

\n"); echo ("\n"); diff --git a/lam/templates/lists/listhosts.php b/lam/templates/lists/listhosts.php index a2dc584e..2dd1b9dd 100644 --- a/lam/templates/lists/listhosts.php +++ b/lam/templates/lists/listhosts.php @@ -67,7 +67,7 @@ if ($_POST['new_host'] || $_POST['del_host'] || $_POST['pdf_host'] || $_POST['pd } if (sizeof($list) > 0) createHostPDF($list); } - // PDF for all users + // PDF for all hosts elseif ($_POST['pdf_all']){ $list = array(); for ($i = 0; $i < sizeof($_SESSION['hst_info']); $i++) {