get_ActiveTypes(); echo $_SESSION['header']; echo "account upload\n"; echo "\n"; for ($i = 0; $i < sizeof($types); $i++) { echo "\n"; } echo "\n"; echo "\n"; // check if account specific page should be shown if (isset($_POST['type'])) showMainPage($_POST['type']); // show start page else { echo "

" . _("Account creation via file upload") . "

\n"; echo "

 

\n"; echo "

 

\n"; echo "

\n"; echo _("Here you can create multiple accounts by providing a CSV file."); echo "

\n"; echo "

 

\n"; echo "

\n"; echo _("Please select your account type:"); echo "

\n"; echo "
\n"; echo "\n"; for ($i = 0; $i < sizeof($types); $i++) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; } echo "
" . getTypeAlias($types[$i]) . "
\n"; echo "

\n"; echo "    \n"; echo "
\n"; echo "\n"; echo "\n"; } /** * Displays the acount type specific main page of the upload. * * @param string $scope account type */ function showMainPage($scope) { echo "

" . _("File upload") . "

"; echo "

\n"; echo _("Please provide a CSV formated file with your account data. The cells in the first row must be filled with the column identifiers. The following rows represent one account for each row."); echo "
"; echo _("Check your input carefully. LAM will only do some basic checks on the upload data."); echo "

"; echo _("Hint: Format all cells as text in your spreadsheet program and turn off auto correction."); echo "

\n"; echo "

 

\n"; echo "
\n"; echo "

\n"; echo "" . _("CSV file:") . "   "; echo "\n"; echo "\n"; echo "

\n"; echo "
\n"; echo "

 

\n"; echo _("Here is a list of possible columns. The red columns must be included in the CSV file and filled with data for all accounts."); echo "

" . _("Columns:") . "

\n"; // DN options echo "
\n" . _("DN settings") . "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo "" . _("DN suffix") . "\n"; // help link echo " "; echo "\"""; echo "\n"; echo "
\n"; echo "
    \n"; echo "
  • " . _("Identifier") . ": " . "dn_suffix
  • \n"; echo "
  • " . _("Example value") . ": " . _("ou=accounts,dc=yourdomain,dc=org") . "
  • \n"; echo "
  • " . _("Default value") . ": " . $_SESSION['config']->get_Suffix($scope) . "
  • \n"; echo "
\n"; echo "
\n"; echo "" . _("RDN identifier") . "\n"; // help link echo " "; echo "\"""; echo "\n"; echo "
\n"; echo "
    \n"; echo "
  • " . _("Identifier") . ": " . "dn_rdn
  • \n"; echo "
  • " . _("Possible values") . ": " . implode(", ", getRDNAttributes($scope)) . "
  • \n"; echo "
\n"; echo "
\n"; echo "

\n"; // get input fields from modules $columns = getUploadColumns($scope); // print input fields $modules = array_keys($columns); for ($m = 0; $m < sizeof($modules); $m++) { if (sizeof($columns[$modules[$m]]) < 1) continue; $icon = ''; $module = new $modules[$m]($scope); $iconImage = $module->getIcon(); if ($iconImage != null) { $icon = '' . $iconImage . ' '; } echo "
\n$icon" . getModuleAlias($modules[$m], $scope) . "
\n"; echo "\n"; for ($i = 0; $i < sizeof($columns[$modules[$m]]); $i++) { echo "\n"; echo "\n"; $i++; if ($i < sizeof($columns[$modules[$m]])) { echo "\n"; $i++; if ($i < sizeof($columns[$modules[$m]])) { echo "\n"; } else echo ""; // empty cell if no more fields } else echo ""; // empty cell if no more fields echo "\n"; } echo "
\n"; showColumnData($modules[$m], $columns[$modules[$m]][$i], $scope); echo "\n"; showColumnData($modules[$m], $columns[$modules[$m]][$i], $scope); echo "\n"; showColumnData($modules[$m], $columns[$modules[$m]][$i], $scope); echo "
\n"; echo "

"; } echo "

 

\n"; // print table example and build sample CSV $sampleCSV = ""; $sampleCSV_head = array(); $sampleCSV_row = array(); echo "" . _("This is an example how it would look in your spreadsheet program before you convert to CSV:") . "

\n"; echo "\n"; echo "\n"; // DN attributes $sampleCSV_head[] = "\"dn_suffix\""; $sampleCSV_head[] = "\"dn_rdn\""; echo "\n"; echo "\n"; // module attributes for ($m = 0; $m < sizeof($modules); $m++) { if (sizeof($columns[$modules[$m]]) < 1) continue; for ($i = 0; $i < sizeof($columns[$modules[$m]]); $i++) { $sampleCSV_head[] = "\"" . $columns[$modules[$m]][$i]['name'] . "\""; echo "\n"; } } echo "\n"; echo "\n"; $RDNs = getRDNAttributes($scope); // DN attributes $sampleCSV_row[] = "\"" . $_SESSION['config']->get_Suffix($scope) . "\""; $sampleCSV_row[] = "\"" . $RDNs[0] . "\""; echo "\n"; echo "\n"; // module attributes for ($m = 0; $m < sizeof($modules); $m++) { if (sizeof($columns[$modules[$m]]) < 1) continue; for ($i = 0; $i < sizeof($columns[$modules[$m]]); $i++) { $sampleCSV_row[] = "\"" . $columns[$modules[$m]][$i]['example'] . "\""; echo "\n"; } } echo "\n"; echo "
\n"; echo "dn_suffix"; echo "\n"; echo "dn_rdn"; echo "\n"; echo $columns[$modules[$m]][$i]['name']; echo "
\n"; echo $_SESSION['config']->get_Suffix($scope); echo "\n"; echo $RDNs[0]; echo "\n"; echo $columns[$modules[$m]][$i]['example']; echo "
\n"; $sampleCSV = implode(",", $sampleCSV_head) . "\n" . implode(",", $sampleCSV_row) . "\n"; $_SESSION['mass_csv'] = $sampleCSV; // link to CSV sample echo "

\n"; echo "

\n"; echo "" . _("Download sample CSV file") . "\n"; echo "

\n"; echo "\n"; echo "\n"; die; } /** * Prints the properties of one input field. * * @param string $module account module name * @param array $data field data from modules * @param string $scope account type */ function showColumnData($module, $data, $scope) { if (isset($data['required']) && ($data['required'] == true)) { echo "\n"; echo $data['description']; echo "\n"; } else { echo "\n"; echo $data['description']; echo "\n"; } // help link echo " "; echo "\"""; echo "\n"; echo "
\n"; echo "

\n"; } ?>