forked from science-ation/science-ation
add api/project/signatureform API
This commit is contained in:
parent
8aaff3cbd7
commit
8d7eb7ca72
16
api.php
16
api.php
@ -1073,6 +1073,22 @@ switch($request[0]) {
|
||||
}
|
||||
break;
|
||||
|
||||
/* APIDOC: project/signatureform
|
||||
description(generate and download the signature page PDF for the currently logged in user/project, as a BASE64 ENCODED string)
|
||||
return(pdf base64 encoded string)
|
||||
*/
|
||||
case 'signatureform':
|
||||
ob_start();
|
||||
//this tells it to simply return the [S]tring instead of outputting headers to force pdf display in a browser
|
||||
$PDFDEST="S";
|
||||
include "register_participants_signature.php";
|
||||
$c=ob_get_contents();
|
||||
ob_end_clean();
|
||||
$b64=base64_encode($c);
|
||||
$ret['status']="ok";
|
||||
$ret['pdf']=$b64;
|
||||
break;
|
||||
|
||||
default:
|
||||
$ret['status']="error";
|
||||
$ret['error']="invalid project API command ({$request[1]})";
|
||||
|
@ -191,10 +191,10 @@ echo "<table><tr><td>";
|
||||
echo "</td></tr>";
|
||||
|
||||
//FIXME: this should be a global detection so we can use the results elsewhere, especially for all the reports!
|
||||
if(function_exists("pdf_new"))
|
||||
if(file_exists("tcpdf/tcpdf.php"))
|
||||
$sigfile="register_participants_signature.php";
|
||||
else if(file_exists("tcpdf/tcpdf.php"))
|
||||
$sigfile="register_participants_signature_tcpdf.php";
|
||||
else if(function_exists("pdf_new"))
|
||||
$sigfile="register_participants_signature_pdflib.php";
|
||||
else
|
||||
$sigfile="";
|
||||
|
||||
|
@ -64,8 +64,6 @@
|
||||
}
|
||||
//END OF AUTH, now lets try to generate a PDF using only PHP :) this should be fun!
|
||||
|
||||
|
||||
|
||||
$pdf=new pdf( "Participant Signature Page ($registration_number)" );
|
||||
|
||||
$pdf->setFontSize(11);
|
||||
@ -215,5 +213,8 @@ function sig($pdf, $text)
|
||||
$pdf->WriteHTML("<br><hr>");
|
||||
}
|
||||
|
||||
echo $pdf->output();
|
||||
if(isset($PDFDEST))
|
||||
echo $pdf->output('',$PDFDEST);
|
||||
else
|
||||
echo $pdf->output();
|
||||
?>
|
||||
|
@ -538,8 +538,7 @@ class pdf extends TCPDF {
|
||||
$filename=strtolower($this->subject);
|
||||
$filename=ereg_replace("[^a-z0-9]","_",$filename).'.pdf';
|
||||
}
|
||||
parent::Output($filename, $dest);
|
||||
return parent::Output($filename, $dest);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user