added PDF for groups

This commit is contained in:
Roland Gruber 2003-10-18 17:04:45 +00:00
parent 7d0548ebaa
commit 72e6f80c55
2 changed files with 34 additions and 6 deletions

View File

@ -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,19 +44,37 @@ $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]);
}
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;
}
@ -280,7 +300,15 @@ if (sizeof($grp_units) > 1) {
echo ("<p align=\"left\">\n");
echo ("<input type=\"submit\" name=\"new_group\" value=\"" . _("New Group") . "\">\n");
if (sizeof($grp_info) > 0) echo ("<input type=\"submit\" name=\"del_group\" value=\"" . _("Delete Group(s)") . "\">\n");
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 ("<input type=\"submit\" name=\"pdf_group\" value=\"" . _("Create PDF for selected group(s)") . "\">\n");
echo "&nbsp;";
echo ("<input type=\"submit\" name=\"pdf_all\" value=\"" . _("Create PDF for all groups") . "\">\n");
echo "</fieldset>";
}
echo ("</p>\n");
echo ("</form>\n");

View File

@ -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++) {