$idlist .= ", " . \util\Misc::cleanCSV($txt);
        } else {
            $idlist = \util\Misc::cleanCSV($txt);
        }
    }
    $idtype = $_POST['idtype'];
    $outputFormat = $_POST['outputFormat'];
    $params['idtype'] = $idtype;
    $params['outputFormat'] = $outputFormat;
    $params['hideunique'] = isset($_POST['hide_unique']) ? 1 : 0;
    if (trim($idlist) == "") {
        $params['errormsg'] = "Cannot submit without IDs!";
        echo \html\FormPanel::makeHiddenForm("CSVForm", "index.php", $params);
    } else {
        $params = array('idlist' => $idlist, 'idtype' => $idtype, 'outputFormat' => $outputFormat, 'hideunique' => isset($_POST['hideunique']) ? 1 : 0);
        echo \html\FormPanel::makeHiddenForm("CSVForm", "process.php", $params);
    }
} else {
    $form = new \html\FormPanel("WorldCat Similar Titles Search", "form-panel", 'md-10', "form-horizontal", "");
    if (isset($_POST['errormsg'])) {
        $form->error($_POST['errormsg']);
    }
    $form->select('idtype', 'ID Type', true, array('isbn' => 'ISBN Numbers', 'issn' => 'ISSN Numbers'))->select('outputFormat', 'Output Format', true, array('html' => 'HTML', 'xml' => 'XML'))->file('idlist_file', 'Import IDs (CSV or line breaks)')->textarea('idlist_textarea', 'ID List (CSV or line breaks)')->checkbox("hideunique", "Ignore entries w/o related titles")->button('submit', 'Submit', 'btn btn-primary');
    $container = new \html\GridDiv("container");
    $container->row()->column('md-1')->column('md-10', null, $form->html())->column('md-1');
    echo $container->html();
}
?>
</body>
</html>
Example #2
0
<?php

require_once __DIR__ . "/bootstrap.php";
$header = new \html\Header();
$header->title(\util\Config::$app->name)->css('css/style.min.css')->js('js/jquery.min.js', 'js/bootstrap.min.js');
echo "<!DOCTYPE html>\n<html lang='en'>" . $header->html() . "<body>";
$fname = false;
if (isset($_POST['submit'])) {
    $file = new \util\FileUpload('spreadsheet');
    if (($fname = $file->moveToDir("tmp")) === false) {
        $_POST['errormsg'] = "Upload Failed!";
    }
}
if ($fname) {
    echo \html\FormPanel::makeHiddenForm("UploadForm", "upload_form_submit.php", array('spreadsheet' => $fname));
} else {
    echo "<header>" . \util\Html::genNavbar() . "</header>";
    $form = new \html\FormPanel("Import Spreadsheets", "form-panel", 'md-10', "form-horizontal", "");
    if (isset($_POST['errormsg'])) {
        $form->error($_POST['errormsg']);
    }
    $form->file('spreadsheet', '')->button('submit', 'Confirm/Upload', 'btn btn-primary');
    $container = new \html\GridDiv("container");
    $container->row()->column('md-1')->column('md-10', null, "\n                        <h1>Welcome!</h1>\n                        <p>\n                        Uploading Spreadsheet files will convert them into a database\n                        for use in generating reports.\n                        <br>Multiple files may be uploaded at one time.\n                        <br><b>Supported file extensions: [ .xls , .xml ]</b>\n                        </p>\n                    ")->row()->column('md-1')->column('md-10', null, $form->html())->column('md-1');
    echo $container->html();
}
echo "</body></html>";