Abstract |
Date/Time |
- |
Venue |
$pdficon='';
include("User/common.php");
include("User/templates.php");
$link=mk_connection();
mysql_select_db("people");
function mk_name($forenames,$surname,$title="") {
$forenames=trim($forenames);
$initials="";
while ($forenames!="") {
$initials=$initials . substr($forenames,0,1) . ".";
$spaceat=strpos($forenames . " "," ");
$forenames=trim(substr($forenames,$spaceat));
}
return StripSlashes("$title $initials $surname");
}
function LaTeX_safe($text)
{
$ans=$text;
$ans=str_replace('&','\\&',$text);
$ans=str_replace('\\\\','\\hfill\\break',$ans);
return $ans;
}
function HTML_safe($text)
{
$ans=str_replace('\\\\','
',$text);
return $ans;
}
//first tidyup from previous runs....
//I don't know why the tidying up at the end doesn't always work - timing?
$d = opendir(".");
while (false !== ($entry = readdir($d))) {
if (preg_match("/^semtmp/i",$entry))
unlink($entry);
}
closedir($d);
if (isset($HTTP_GET_VARS['id']))
{
$id=$HTTP_GET_VARS['id'];
}
if (isset($HTTP_GET_VARS['all']))
{
$all=$HTTP_GET_VARS['all'];
}
$result=mysql_query("
select
s.id,
DAYNAME(date) as dow,
DATE_FORMAT(date,'%D %M %Y') as date,
date as real_date,
LOWER(TIME_FORMAT(time,'%l.%i %p')) as time,
speaker,
institution,
title,
abstract,
room,
note,
s.category_id as category_id,
sc1.category as category1,
sc2.category as category2
from
seminars as s,seminar_categories as sc1,seminar_categories as sc2
where
s.category_id=sc1.category_id
and
s.joint_id=sc2.category_id
and
s.id='$id'
");
if (mysql_num_rows($result)>0)
{
$row=mysql_fetch_assoc($result);
extract($row);
$category=$category1;
if (trim($category2)!=="None")
{
$category.="/$category2";
}
if (trim($room==""))
{
$room="To be announced";
}
if (trim($institution)!=="") $institution="($institution)";
if ($HTTP_GET_VARS['fmt']=='pdf')
{
$filename=tempnam(".","semtmp");
$texfilename=$filename . '.tex';
$logfilename=$filename . '.log';
$auxfilename=$filename . '.aux';
$outfilename=$filename . '.out';
$pdffilename=$filename . '.pdf';
$today=date('jS F Y');
rename($filename,$texfilename);
chmod($texfilename,0770);
$fp=fopen($texfilename,'w');
fwrite($fp,
"\\documentclass[11pt,a4paper,pdftex]{article}
\\usepackage{amsfonts}
\\usepackage[colorlinks=true,pdfstartview=FitH,linkcolor=blue,citecolor=blue,urlcolor=blue,bookmarks=false]{hyperref}
\\setlength{\\textwidth}{8.276in} \\setlength{\\textheight}{11.705in}
\\addtolength{\\textwidth}{-2in}
\\addtolength{\\textheight}{-2in}
\\setlength{\\oddsidemargin}{0pt}
\\setlength{\\evensidemargin}{\\oddsidemargin}
\\setlength{\\topmargin}{0pt}
\\addtolength{\\topmargin}{-\\headheight}
\\addtolength{\\topmargin}{-\\headsep}
\\pagestyle{empty}
\\begin{document}
\\begin{center}
\LARGE University of Glasgow\\\\Department of Mathematics
\\end{center}\n");
$speaker=LaTeX_safe($speaker);
$title=LaTeX_safe($title);
$abstract=LaTeX_safe($abstract);
fwrite($fp,"\\section*{{$category} seminar abstract}");
if (trim($title)!=="" and trim($title)!=="To be announced")
{
$title='\\emph{``' . $title . "''}";
}
fwrite($fp,"\\begin{center}$title\\\\{$speaker} $institution\\end{center}");
fwrite($fp,"\\paragraph{Abstract} $abstract \\par\\bigskip\\bigskip");
fwrite($fp,"\\noindent\\textbf{Date:} $dow $date\\\\\\textbf{Time:} $time\\\\\\textbf{Venue:} $room");
fwrite($fp,"\\flushright{{$today}}\\end{document}");
fclose($fp);
# exec("/local/teTeX/bin/pdflatex $texfilename",$output,$return_value);
exec("/usr/share/texmf/teTeX/bin/x86_64-linux/pdflatex $texfilename",$output,$return_value);
if ($return_value>0)
{
$content.="
Here is the likely reason for the error:
$errors"; } else { $content.= "
Sorry!. Please let me know about this problem and try the html version instead."; } echo $content; exit; } header("Content-type: application/pdf"); $fp=fopen($pdffilename,'r'); fpassthru($fp); fclose($fp); unlink($texfilename); unlink($logfilename); unlink($auxfilename); unlink($outfilename); unlink($pdffilename); exit; } //end pdf creation else { $tmp_title=TeX2HTML($title); if ($tmp_title) $title=$tmp_title; $tmp_abstract=TeX2HTML($abstract); if ($tmp_abstract) $abstract=$tmp_abstract; if (trim($title)!=="" and trim($title)!=="To be announced") { $title='"' . HTML_safe($title) . '"'; } $aspdf=stripslashes("View as PDF"); $template="../phpTemplates/abstract.dwt"; $regions["doctitle"]="$category seminar abstract"; $regions["title"]=$title; $regions["speaker"]="$speaker $institution"; $regions["date"]="$dow $date"; $regions["time"]=$time; $regions["venue"]=$room; $replace = array("
");
$abstract = str_replace($replace, "
", $abstract);
$regions["abstract"]=html_safe($abstract);
$regions["category"]=$category;
$regions["aspdf"]=$aspdf;
$regions["back"]='Back to seminar list';
$breadcrumb='' . $category . ' Seminars';
// echo fill_out_template($template,$regions);
}
}
?>
include("User/www/navbar.php");
?>