<?php

session_start();
include "bin/src/Latex/LatexBuilder.php";
include "bin/src/Latex/Statement.php";
include "bin/src/Latex/FileBuilder.php";
use Latex\FileBuilder;
use Latex\LatexBuilder;
use Latex\Statement;
$latexBuilder = new LatexBuilder();
$preambleInputs = array("name" => isset($_POST['preambleDocumentName']) ? $_POST['preambleDocumentName'] : null, "sameTitle" => isset($_POST['preambleDocumentTitleSameAsName']) ? $_POST['preambleDocumentTitleSameAsName'] : null, "makeTitle" => isset($_POST['preambleDocumentMakeTitle']) ? $_POST['preambleDocumentMakeTitle'] : null, "newTitle" => isset($_POST['preambleDocumentNewTitle']) ? $_POST['preambleDocumentNewTitle'] : null, "author" => isset($_POST['preambleDocumentAuthor']) ? $_POST['preambleDocumentAuthor'] : null, "signed" => isset($_POST['preambleDocumentSignAuthor']) ? $_POST['preambleDocumentSignAuthor'] : null, "type" => isset($_POST['preambleDocumentType']) ? $_POST['preambleDocumentType'] : null);
$_SESSION["newFilename"] = $preambleInputs["name"];
$documentClassOptionalInputs = array("font" => isset($_POST['preambleDocumentFont']) ? $_POST['preambleDocumentFont'] : null, "paper" => isset($_POST['preambleDocumentPaperType']) ? $_POST['preambleDocumentPaperType'] : null, "twoColumn" => isset($_POST['preambleDocumentTwoColumn']) ? $_POST['preambleDocumentTwoColumn'] : null, "orientation" => isset($_POST['preambleDocumentOrientation']) ? $_POST['preambleDocumentOrientation'] : null, "titlePage" => isset($_POST['preambleDocumentTitlePage']) ? $_POST['preambleDocumentTitlePage'] : null);
//build documentclass inputs
$documentClassOptionalInputString = "";
foreach ($documentClassOptionalInputs as $input => $inputValue) {
    if ($inputValue == "on") {
        if ($input == "twoColumn") {
            $documentClassOptionalInputString .= "twocolumn,";
        } elseif ($input == "orientation") {
            $documentClassOptionalInputString .= "landscape,";
        } elseif ($input == "titlePage") {
            $documentClassOptionalInputString .= "titlepage,";
        }
    } elseif ($inputValue == "off") {
        $documentClassOptionalInputString .= "";
    }
    if ($input == "font") {
        $documentClassOptionalInputString .= $inputValue .= "pt,";
    } elseif ($input == "paper") {
        $documentClassOptionalInputString .= $inputValue . ",";
<?php

session_start();
include "bin/src/Latex/LatexBuilder.php";
include "bin/src/Latex/Statement.php";
include "bin/src/Latex/FileBuilder.php";
use Latex\LatexBuilder;
use Latex\FileBuilder;
$latexB = new LatexBuilder();
file_put_contents("Output/" . $_SESSION['newFilename'] . ".tex", $latexB->endTag("document") . PHP_EOL, FILE_APPEND);
$fileB = new FileBuilder($_SESSION['newFilename'], file_get_contents($_SESSION['newFilename'] . ".tex"));
$fileB->convert();
<?php

session_start();
include "bin/src/Latex/LatexBuilder.php";
include "bin/src/Latex/Statement.php";
include "bin/src/Latex/FileBuilder.php";
use Latex\LatexBuilder;
use Latex\Statement;
$latexBuilder = new LatexBuilder();
$inputs = array("type" => isset($_POST['inputType']) ? $_POST['inputType'] : null, "typeName" => isset($_POST['inputTypeName']) ? $_POST['inputTypeName'] : "", "text" => isset($_POST['ssText']) ? $_POST['ssText'] : null);
file_put_contents("Output/" . $_SESSION['newFilename'] . ".tex", $latexBuilder->beginTag(new Statement($inputs['type'], [], [$inputs['typeName']])), FILE_APPEND);
file_put_contents("Output/" . $_SESSION['newFilename'] . ".tex", $inputs['text'] . PHP_EOL, FILE_APPEND);