示例#1
0
function latex_docs($db)
{
    $messages = "";
    // Instanciate a template object
    $tpl = new Template(".");
    $config = GetConfig($db);
    $tex_dir = $config['uploadDir'] . "/";
    InstanciateConfigVars($config, $tpl);
    // OK, now load the template files
    $tpl->set_file(array("proceedings" => TPLDIR . "texProceedings.tpl", "latex" => TPLDIR . "latex.tpl", "booklet" => TPLDIR . "texBooklet.tpl"));
    // Extract the templates
    $tpl->set_block("latex", "PCMember", "PCMembers");
    $tpl->set_var("PCMembers", "");
    $messages .= "Now creating the PC committee list...";
    // Output a file with the program committee
    $pclist = parsePC($tpl, "PCMember", $db);
    $messages .= write_tex($tex_dir, "pc.tex", $pclist);
    // Abstracts
    $messages .= "Now creating the list of abstracts...";
    $abstracts = parseAbstracts($tpl, "texAbstracts.tpl", $db);
    $messages .= write_tex($tex_dir, "abstracts.tex", $abstracts);
    // Program of the conference
    $messages .= "Now creating the program of the conference...";
    $program = parseProgram($tpl, "texProgram.tpl", $db);
    $messages .= write_tex($tex_dir, "program.tex", $program);
    // Booklet of abstracts
    $messages .= "Now creating the booklet of abstracts...";
    $tpl->parse("BODY", "booklet");
    $contents = $tpl->get_var("BODY");
    $messages .= write_tex($tex_dir, "booklet.tex", $contents);
    // Papers for the proceedings
    $messages .= "Now creating the list of papers for the proceedings...";
    $papers = parsePapers($tpl, "texProcPapers.tpl", $db, $messages);
    $messages .= write_tex($tex_dir, "papers.tex", $papers);
    // Output the proceedings
    $messages .= "Now creating the proceedings...";
    $tpl->parse("BODY", "proceedings");
    $contents = $tpl->get_var("BODY");
    $messages .= write_tex($tex_dir, "proceedings.tex", $contents);
    // CD ROM
    $messages .= "Now creating the CD ROM...";
    $tpl->set_file(array("CDROM" => TPLDIR . "texCDROM.tpl"));
    $tpl->parse("BODY", "CDROM");
    $contents = $tpl->get_var("BODY");
    $messages .= write_tex($tex_dir, "CDROM.tex", $contents);
    return $messages;
}
 function latexAction()
 {
     $this->view->setFile("content", "latex.xml");
     $this->view->setBlock("content", "message", "messages");
     // Instantiate the data export object
     $dataExport = new dataExport($this->view->getScriptPaths());
     // The directory of the proceedings files
     $tex_dir = "proceedings/";
     // Load the latex templates
     $this->view->setFile(array("proceedings" => "Proceedings.tex", "booklet" => "Booklet.tex"));
     // Extract the templates
     // $this->view->setBlock ("latex", "PCMember", "PCMembers");
     $this->view->info = "Now creating the PC committee list...";
     $this->view->append("messages", "message");
     // Output a file with the program committee
     $pclist = $dataExport->exportProgramCommittee("member.tex");
     $dataExport->writeFile($tex_dir, "pc.tex", $pclist);
     // Abstracts
     $this->view->info = "Now creating the list of abstracts...";
     $this->view->append("messages", "message");
     $abstracts = $dataExport->exportAbstracts("abstract.tex");
     $dataExport->writeFile($tex_dir, "abstracts.tex", $abstracts);
     // Booklet of abstracts
     $this->view->info = "Now creating the booklet of abstracts...";
     $this->view->append("messages", "message");
     $this->view->assign("booklet_tex", "booklet");
     $booklet = $this->view->get_var("booklet_tex");
     $dataExport->writeFile($tex_dir, "booklet.tex", $booklet);
     // Now, the same in plain text
     unset($dataExport);
     $dataExport = new dataExport($this->view->getScriptPaths());
     $abstracts = $dataExport->exportAbstracts("abstract.txt", DataExport::TEXT);
     $dataExport->writeFile($tex_dir, "abstracts.txt", $abstracts);
     echo $this->view->render("layout");
     return;
     // Program of the conference
     $messages .= "Now creating the program of the conference...";
     $program = parseProgram($this->view, "texProgram.tpl", $db);
     $messages .= write_tex($tex_dir, "program.tex", $program);
     // Papers for the proceedings
     $messages .= "Now creating the list of papers for the proceedings...";
     $papers = parsePapers($this->view, "texProcPapers.tpl", $db, $messages);
     $messages .= write_tex($tex_dir, "papers.tex", $papers);
     // Output the proceedings
     $messages .= "Now creating the proceedings...";
     $this->view->parse("BODY", "proceedings");
     $contents = $this->view->get_var("BODY");
     $messages .= write_tex($tex_dir, "proceedings.tex", $contents);
     return $messages;
 }
示例#3
0
 function parseJSON($json)
 {
     $ast = json_decode($json);
     grokit_assert($ast !== null, 'Unable to decode JSON.');
     return parseProgram($ast);
 }