Ejemplo n.º 1
0
<?php

require_once "autoloader.php";
$html_header = new \html\Header(array('title' => "WorldCat Similar Titles", 'css' => array("style.min.css"), 'js' => array('jquery.min.js', 'bootstrap.min.js')));
?>
<!DOCTYPE html>
<html lang="en">
<?php 
echo $html_header->html();
?>
<body><?php 
if (isset($_POST['submit'])) {
    $params = array();
    $idlist = "";
    if (isset($_POST['idlist_textarea'])) {
        $idlist = \util\Misc::cleanCSV($_POST['idlist_textarea']);
        $parms['idlist_textarea'] = $_POST['idlist_textarea'];
    }
    $file = new \util\FileUpload('idlist_file');
    if (($txt = $file->read()) !== FALSE) {
        if ($idlist) {
            $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;
        $type = preg_replace("#[\\s]#", '', $_POST['type']);
        $chart = new \reports\Chart();
        $chart->setTitle($title)->setAxisLabels($vAxis, $hAxis)->setColumnNames(array($column1, $column2))->setType($type);
        $report = new \reports\Report();
        $report->setTitle($title)->setQuery($query)->setChart($chart);
        if (isset($_POST['submit_type']) && $_POST['submit_type'] === 'save_report') {
            \reports\Report::add($report);
            header("Location: run_report.php?report={$title}");
        } else {
            $serial = $report->serialize();
            header("Location: run_report.php?serial={$serial}");
        }
        exit;
    }
}
$header = new \html\Header();
$header->title(\util\Config::$app->name)->css('css/style.min.css')->js('js/jquery.min.js', 'js/bootstrap.min.js');
$form = new \html\FormPanel("Import Spreadsheets", "form-panel", 'md-10', "form-horizontal", "");
foreach ($errors as $err) {
    $form->error($err);
}
echo "<header>" . \util\Html::genNavbar() . "</header>";
$form = new \html\FormPanel("Create Report", "form-panel", 'md-10', "form-horizontal", "");
if (isset($_POST['errormsg'])) {
    $form->error($_POST['errormsg']);
}
$form->textInput('title', 'Title*', true)->textArea('sql', 'SQL*', true)->select('type', 'Chart Type*', true)->option('AreaChart', 'Area Chart')->option('BarChart', 'Bar Chart')->option('BubbleChart', 'Bubble Chart')->option('CandlestickChart', 'Candlestick Chart')->option('ColumnChart', 'Column Chart')->option('ComboChart', 'Combo Chart')->option('LineChart', 'Line Chart')->option('PieChart', 'Pie Chart')->option('ScatterChart', 'Scatter Chart')->option('SteppedAreaChart', 'Stepped Area Chart')->option('Table', 'Table')->option('Timeline', 'Timeline')->option('Histogram', 'Histogram')->textInput('hAxis', 'hAxis Label')->textInput('vAxis', 'vAxis Label')->textInput('column1', 'Column #1 Name')->textInput('column2', 'Column #2 Name')->numberInput('sortcolumn', 'Sort by Column#', 1)->select('submit_type', 'Submit Type*', true)->option('preview_report', "View Only")->option('save_report', 'Save and View')->button('submit', 'Confirm/Upload', 'btn btn-primary');
$container = new \html\GridDiv("container");
$container->row()->column('md-1')->column('md-10', null, $form->html())->column('md-1');
echo "<!DOCTYPE html>\n<html lang='en'>" . $header->html() . "<body>";
echo "<header>" . \util\Html::genNavbar() . "</header>";
Ejemplo n.º 3
0
<?php

require_once __DIR__ . "/bootstrap.php";
$sql = new \sql\Database();
$report = null;
if (isset($_GET['report'])) {
    $report = \reports\Report::get($_GET['report']);
    $sql->selectDB(\util\Config::$database->tablesDB);
    $report->run($sql);
} else {
    if (isset($_GET['table'])) {
        $sql->selectDB(\util\Config::$database->tablesDB);
        $table = $_GET['table'];
        $chart = new \reports\Chart();
        $chart->setType('Table');
        $report = new \reports\Report();
        $report->setTitle($table)->setQuery("SELECT * FROM {$table}")->setChart($chart)->run($sql);
    } else {
        if (isset($_GET['serial'])) {
            $report = \reports\Report::unserialize($_GET['serial']);
            $sql->selectDB(\util\Config::$database->tablesDB);
            $report->run($sql);
        }
    }
}
if (!is_null($report)) {
    $header = new \html\Header();
    $header->title(\util\Config::$app->name)->css('css/style.min.css')->js('js/jquery.min.js', 'js/bootstrap.min.js')->addToIncludes($report->script('chart_container'));
    $content = "<div id='chart_container' class='chart'></div>";
    echo "<!DOCTYPE html>\n<html lang='en'>" . $header->html() . "<body>\n\t\t\t<header>" . \util\Html::genNavbar() . "</header>\n\t\t\t<article>\n\t\t\t\t{$content}\n\t\t\t</article>\n\t\t\t<footer>\n\t\t\t</footer>\n\t\t</body>\n\t</html>";
}
$file_tables = array();
if (!empty($_POST["spreadsheet"])) {
    $file_table = \excel2sql\SqlConvert::convertToSql($_POST['spreadsheet'], \util\Config::$database->tablesDB);
    unlink($_POST['spreadsheet']);
}
$sql = new \sql\Database();
$sql->selectDB(\util\Config::$database->tablesDB);
$reports = array();
foreach ($file_table as $tname) {
    $chart = new \reports\Chart();
    $chart->setType('Table');
    $report = new \reports\Report();
    $report->setTitle($tname)->setQuery("SELECT * FROM {$tname}")->setChart($chart)->run($sql);
    $reports[] = $report;
}
$header = new \html\Header();
$header->title(\util\Config::$app->name)->css('css/style.min.css')->js('js/jquery.min.js', 'js/bootstrap.min.js');
if (!empty($reports)) {
    $head = '';
    for ($ir = 0; $ir < count($reports); ++$ir) {
        $head .= $reports[$ir]->script("chart_container_{$ir}");
    }
    $content = "";
    for ($ir = 0; $ir < count($reports); ++$ir) {
        $content .= "<div id=\"chart_container_{$ir}\"></div><br><br>";
    }
    $header->addToIncludes($head);
} else {
    $content = "<div class='box half-width center'>'No tables were Uploaded!'</div>";
}
echo "<!DOCTYPE html>\n<html lang='en'>" . $header->html() . "<body>\n\t\t\t<header>\n\t\t\t\t<noscript>\n\t\t\t\t\tJavaScript must be enabled in order for you to use this service.\n\t\t\t\t\tHowever, it seems JavaScript is either disabled or not supported by your browser.\n\t\t\t\t\tTo use this service, enable JavaScript by changing your  browser options,\n\t\t\t\t\tthen try again.\n\t\t\t\t</noscript>" . \util\Html::genNavbar() . "</header>\n\t\t\t<article>\n\t\t\t\t{$content}\n\t\t\t</article>\n\t\t\t<footer>\n\t\t\t</footer>\n\t\t</body>\n\t</html>";