Ejemplo n.º 1
0
            $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 . ",";
    }
}
$fileBuilder = new FileBuilder($preambleInputs["name"], $latexBuilder->beginTag(new Statement('documentclass', [$documentClassOptionalInputString], [$preambleInputs["type"]])));
$fileBuilder->saveFile();
//build begin document tag
file_put_contents("Output/" . $preambleInputs["name"] . ".tex", $latexBuilder->beginTag(new Statement('begin', [], ['document'])), FILE_APPEND);
//build preambleinputs
foreach ($preambleInputs as $input => $inputValue) {
    if ($input == "sameTitle") {
        if ($inputValue == "on") {
            file_put_contents("Output/" . $preambleInputs['name'] . ".tex", $latexBuilder->beginTag(new Statement('title', [], [$preambleInputs['name']])), FILE_APPEND);
        } else {
            file_put_contents("Output/" . $preambleInputs['name'] . ".tex", $latexBuilder->beginTag(new Statement('title', [], [$preambleInputs['newTitle']])), FILE_APPEND);
        }
    }
    if ($input == "makeTitle") {
        if ($inputValue == "on") {
            file_put_contents("Output/" . $preambleInputs['name'] . ".tex", $latexBuilder->beginTag(new Statement('maketitle', [], [])), FILE_APPEND);
Ejemplo n.º 2
0
<?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);