account upload\n"; echo "\n"; echo "\n"; echo "\n"; // check if account specific page should be shown if ($_POST['user']) showMainPage('user'); elseif ($_POST['group']) showMainPage('group'); elseif ($_POST['host']) showMainPage('host'); // 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"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\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 "

\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 "

\n"; echo "

 

\n"; echo "

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

\n"; echo "

 

\n"; echo "" . _("Columns:") . "\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; echo "

\n" . 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($scope, $modules[$m], $columns[$modules[$m]][$i]); echo "\n"; showColumnData($scope, $modules[$m], $columns[$modules[$m]][$i]); echo "\n"; showColumnData($scope, $modules[$m], $columns[$modules[$m]][$i]); echo "
\n"; echo "
"; } echo "

\n"; echo "

 

\n"; // print table example echo "" . _("This is an example how it would look in your spreadsheet program before you convert to CSV:") . "\n"; echo "

\n"; echo "\n"; echo "\n"; for ($m = 0; $m < sizeof($modules); $m++) { if (sizeof($columns[$modules[$m]]) < 1) continue; for ($i = 0; $i < sizeof($columns[$modules[$m]]); $i++) { echo "\n"; } } echo "\n"; echo "\n"; for ($m = 0; $m < sizeof($modules); $m++) { if (sizeof($columns[$modules[$m]]) < 1) continue; for ($i = 0; $i < sizeof($columns[$modules[$m]]); $i++) { echo "\n"; } } echo "\n"; echo "
\n"; echo $columns[$modules[$m]][$i]['name']; echo "
\n"; echo $columns[$modules[$m]][$i]['example']; echo "
\n"; echo "

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