Ejemplo n.º 1
0
$confirm = get_input('confirm', false);
/// Set the parameters
$upload->setEncoding($encoding);
$upload->setDelimiter($delimiter);
$upload->setNotification($notification);
if (!$confirm) {
    /// Open the file
    if (!$upload->openFile('csvfile')) {
        forward("admin/users/upload");
    }
    /// Process the file
    if (!$upload->processFile()) {
        forward("admin/users/upload");
    }
    /// Check the users
    $upload->checkUsers();
    /// Print the processed users for confirmation
    $body = $upload->getConfirmationReport();
    $title = elgg_view_title(elgg_echo('upload_users:process_report'));
    /// Create the users and print the report
} else {
    /// Create the users
    $upload->createUsers($_POST);
    /// Everything was fine -> Display the creation report
    $body = $upload->getCreationReport();
    $title = elgg_view_title(elgg_echo('upload_users:creation_report'));
}
elgg_pop_context();
header('Content-type: text/html');
print $body;
exit;