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; }
function write_worksheet($in, $file, $options = array()) { $ext = pathinfo($file, PATHINFO_EXTENSION); if (isset($options["write"])) { if ($ext != "" && $options["write"] != $ext) { fputs(STDERR, "Warning: Ignored the extension to adopt {$options["write"]}.\n"); } $ext = $options["write"]; } switch (strtolower($ext)) { case "raw": $out = fopen($file, "w"); while (($line = fgets($in)) !== false) { fputs($out, $line); } fclose($out); break; case "csv": $options["delimiter"] = ","; write_csv($in, $file, $options); break; case "tsv": $options["delimiter"] = "\t"; write_csv($in, $file, $options); break; case "xlsx": write_excel($in, $file, $options); break; case "json": write_json($in, $file, $options); break; case "yml": case "yaml": write_yaml($in, $file, $options); break; case "xml": write_xml($in, $file, $options); break; case "htm": case "html": // a write only converter write_html($in, $file, $options); break; case "tex": // a write only converter write_tex($in, $file, $options); break; case "sql": // a write only converter write_sql($in, $file, $options); break; default: fputs(STDERR, "Error[{$ext}]: No writer is available.\n"); break; } return; }