use foreach
This commit is contained in:
parent
e0fd0c8a51
commit
5cdcc495f4
|
@ -85,8 +85,8 @@ if (isset($_GET['DN'])) {
|
|||
$result = $_SESSION['account']->load_account($DN);
|
||||
if (sizeof($result) > 0) {
|
||||
include '../main_header.php';
|
||||
for ($i=0; $i<sizeof($result); $i++) {
|
||||
call_user_func_array("StatusMessage", $result[$i]);
|
||||
foreach ($result as $message) {
|
||||
call_user_func_array("StatusMessage", $message);
|
||||
}
|
||||
include '../main_footer.php';
|
||||
die();
|
||||
|
|
|
@ -105,7 +105,8 @@ if (isset($_GET['type']) && isset($_SESSION['delete_dn'])) {
|
|||
echo "<b>" . _("Do you really want to remove the following accounts?") . "</b>";
|
||||
echo "<br><br>\n";
|
||||
echo "<table border=0>\n";
|
||||
for ($i=0; $i<count($users); $i++) {
|
||||
$userCount = sizeof($users);
|
||||
for ($i = 0; $i < $userCount; $i++) {
|
||||
echo "<tr>\n";
|
||||
echo "<td><b>" . _("Account name:") . "</b> " . htmlspecialchars($users[$i]) . "</td>\n";
|
||||
echo "<td> <b>" . _('DN') . ":</b> " . htmlspecialchars($_SESSION['delete_dn'][$i]) . "</td>\n";
|
||||
|
@ -173,11 +174,11 @@ if (isset($_POST['delete'])) {
|
|||
// Delete dns
|
||||
$allOk = true;
|
||||
$allErrors = array();
|
||||
for ($m=0; $m<count($_SESSION['delete_dn']); $m++) {
|
||||
foreach ($_SESSION['delete_dn'] as $deleteDN) {
|
||||
// Set to true if an real error has happened
|
||||
$stopprocessing = false;
|
||||
// First load DN.
|
||||
$_SESSION['account']->load_account($_SESSION['delete_dn'][$m]);
|
||||
$_SESSION['account']->load_account($deleteDN);
|
||||
// get commands and changes of each attribute
|
||||
$moduleNames = array_keys($_SESSION['account']->getAccountModules());
|
||||
$modules = $_SESSION['account']->getAccountModules();
|
||||
|
@ -267,7 +268,7 @@ if (isset($_POST['delete'])) {
|
|||
}
|
||||
if (!$stopprocessing) {
|
||||
$recursive = !$_SESSION['account']->hasOnlyVirtualChildren();
|
||||
$messages = deleteDN($_SESSION['delete_dn'][$m], $recursive);
|
||||
$messages = deleteDN($deleteDN, $recursive);
|
||||
$errors = array_merge($errors, $messages);
|
||||
if (sizeof($errors) > 0) {
|
||||
$stopprocessing = true;
|
||||
|
@ -287,7 +288,7 @@ if (isset($_POST['delete'])) {
|
|||
}
|
||||
}
|
||||
if (!$stopprocessing) {
|
||||
echo sprintf(_('Deleted DN: %s'), $_SESSION['delete_dn'][$m]) . "<br>\n";
|
||||
echo sprintf(_('Deleted DN: %s'), $deleteDN) . "<br>\n";
|
||||
foreach ($errors as $error) {
|
||||
call_user_func_array('StatusMessage', $error);
|
||||
}
|
||||
|
@ -295,7 +296,7 @@ if (isset($_POST['delete'])) {
|
|||
flush();
|
||||
}
|
||||
else {
|
||||
echo sprintf(_('Error while deleting DN: %s'), $_SESSION['delete_dn'][$m]) . "<br>\n";
|
||||
echo sprintf(_('Error while deleting DN: %s'), $deleteDN) . "<br>\n";
|
||||
foreach ($errors as $error) {
|
||||
call_user_func_array('StatusMessage', $error);
|
||||
}
|
||||
|
|
|
@ -196,23 +196,18 @@ foreach ($sortedTypes as $typeId => $title) {
|
|||
'scope' => $type->getScope(),
|
||||
'title' => $title,
|
||||
'icon' => $type->getIcon(),
|
||||
'templates' => "");
|
||||
'templates' => \LAM\PDF\getPDFStructures($type->getId()));
|
||||
$availableTypes[$title] = $type->getId();
|
||||
}
|
||||
// get list of templates for each account type
|
||||
for ($i = 0; $i < sizeof($templateClasses); $i++) {
|
||||
$templateClasses[$i]['templates'] = \LAM\PDF\getPDFStructures($templateClasses[$i]['typeId']);
|
||||
}
|
||||
|
||||
// check if a template should be edited
|
||||
for ($i = 0; $i < sizeof($templateClasses); $i++) {
|
||||
if (isset($_POST['editTemplate_' . $templateClasses[$i]['typeId']]) || isset($_POST['editTemplate_' . $templateClasses[$i]['typeId'] . '_x'])) {
|
||||
metaRefresh('pdfpage.php?type=' . htmlspecialchars($templateClasses[$i]['typeId']) . '&edit=' . htmlspecialchars($_POST['template_' . $templateClasses[$i]['typeId']]));
|
||||
foreach ($templateClasses as $templateClass) {
|
||||
if (isset($_POST['editTemplate_' . $templateClass['typeId']]) || isset($_POST['editTemplate_' . $templateClass['typeId'] . '_x'])) {
|
||||
metaRefresh('pdfpage.php?type=' . htmlspecialchars($templateClass['typeId']) . '&edit=' . htmlspecialchars($_POST['template_' . $templateClass['typeId']]));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
include '../main_header.php';
|
||||
|
||||
?>
|
||||
<div class="user-bright smallPaddingContent">
|
||||
<form enctype="multipart/form-data" action="pdfmain.php" method="post" name="pdfmainForm" >
|
||||
|
@ -247,38 +242,38 @@ include '../main_header.php';
|
|||
// existing templates
|
||||
$container->addElement(new htmlSubTitle(_("Manage existing PDF structures")), true);
|
||||
$existingContainer = new htmlTable();
|
||||
for ($i = 0; $i < sizeof($templateClasses); $i++) {
|
||||
foreach ($templateClasses as $templateClass) {
|
||||
if ($i > 0) {
|
||||
$existingContainer->addElement(new htmlSpacer(null, '10px'), true);
|
||||
}
|
||||
|
||||
$existingContainer->addElement(new htmlImage('../../graphics/' . $templateClasses[$i]['icon']));
|
||||
$existingContainer->addElement(new htmlImage('../../graphics/' . $templateClass['icon']));
|
||||
$existingContainer->addElement(new htmlSpacer('3px', null));
|
||||
$existingContainer->addElement(new htmlOutputText($templateClasses[$i]['title']));
|
||||
$existingContainer->addElement(new htmlOutputText($templateClass['title']));
|
||||
$existingContainer->addElement(new htmlSpacer('3px', null));
|
||||
$select = new htmlSelect('template_' . $templateClasses[$i]['typeId'], $templateClasses[$i]['templates']);
|
||||
$select = new htmlSelect('template_' . $templateClass['typeId'], $templateClass['templates']);
|
||||
$select->setWidth('15em');
|
||||
$existingContainer->addElement($select);
|
||||
$existingContainer->addElement(new htmlSpacer('3px', null));
|
||||
$exEditButton = new htmlButton('editTemplate_' . $templateClasses[$i]['typeId'], 'edit.png', true);
|
||||
$exEditButton = new htmlButton('editTemplate_' . $templateClass['typeId'], 'edit.png', true);
|
||||
$exEditButton->setTitle(_('Edit'));
|
||||
$existingContainer->addElement($exEditButton);
|
||||
$deleteLink = new htmlLink(null, '#', '../../graphics/delete.png');
|
||||
$deleteLink->setTitle(_('Delete'));
|
||||
$deleteLink->setOnClick("profileShowDeleteDialog('" . _('Delete') . "', '" . _('Ok') . "', '" . _('Cancel') . "', '" . $templateClasses[$i]['typeId'] . "', '" . 'template_' . $templateClasses[$i]['typeId'] . "');");
|
||||
$deleteLink->setOnClick("profileShowDeleteDialog('" . _('Delete') . "', '" . _('Ok') . "', '" . _('Cancel') . "', '" . $templateClass['typeId'] . "', '" . 'template_' . $templateClass['typeId'] . "');");
|
||||
$existingContainer->addElement($deleteLink);
|
||||
|
||||
if (count($configProfiles) > 1) {
|
||||
$importLink = new htmlLink(null, '#', '../../graphics/import.png');
|
||||
$importLink->setTitle(_('Import PDF structures'));
|
||||
$importLink->setOnClick("showDistributionDialog('" . _("Import PDF structures") . "', '" .
|
||||
_('Ok') . "', '" . _('Cancel') . "', '" . $templateClasses[$i]['typeId'] . "', 'import');");
|
||||
_('Ok') . "', '" . _('Cancel') . "', '" . $templateClass['typeId'] . "', 'import');");
|
||||
$existingContainer->addElement($importLink);
|
||||
}
|
||||
$exportLink = new htmlLink(null, '#', '../../graphics/export.png');
|
||||
$exportLink->setTitle(_('Export PDF structure'));
|
||||
$exportLink->setOnClick("showDistributionDialog('" . _("Export PDF structure") . "', '" .
|
||||
_('Ok') . "', '" . _('Cancel') . "', '" . $templateClasses[$i]['typeId'] . "', 'export', '" . 'template_' . $templateClasses[$i]['typeId'] . "', '" . $_SESSION['config']->getName() . "');");
|
||||
_('Ok') . "', '" . _('Cancel') . "', '" . $templateClass['typeId'] . "', 'export', '" . 'template_' . $templateClass['typeId'] . "', '" . $_SESSION['config']->getName() . "');");
|
||||
$existingContainer->addElement($exportLink);
|
||||
$existingContainer->addNewLine();
|
||||
}
|
||||
|
@ -315,9 +310,9 @@ include '../main_header.php';
|
|||
echo "</form>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
for ($i = 0; $i < sizeof($templateClasses); $i++) {
|
||||
$typeId = $templateClasses[$i]['typeId'];
|
||||
$scope = $templateClasses[$i]['scope'];
|
||||
foreach ($templateClasses as $templateClass) {
|
||||
$typeId = $templateClass['typeId'];
|
||||
$scope = $templateClass['scope'];
|
||||
$importOptions = array();
|
||||
foreach ($configProfiles as $profile) {
|
||||
$typeManagerImport = new TypeManager($serverProfiles[$profile]);
|
||||
|
|
Loading…
Reference in New Issue