diff options
author | root | 2013-08-13 12:25:45 +0530 |
---|---|---|
committer | root | 2013-08-13 12:25:45 +0530 |
commit | d08a74c09b2974ab9db2e4ac12627da62d19f912 (patch) | |
tree | db2297f62e563e3f3bbfa7643d7bc5b8e9882e01 /pdf/generate_pdf.inc | |
download | scilab_textbook_companion-d08a74c09b2974ab9db2e4ac12627da62d19f912.tar.gz scilab_textbook_companion-d08a74c09b2974ab9db2e4ac12627da62d19f912.tar.bz2 scilab_textbook_companion-d08a74c09b2974ab9db2e4ac12627da62d19f912.zip |
initial repo 13-08-2013
Diffstat (limited to 'pdf/generate_pdf.inc')
-rwxr-xr-x | pdf/generate_pdf.inc | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/pdf/generate_pdf.inc b/pdf/generate_pdf.inc new file mode 100755 index 0000000..9e30109 --- /dev/null +++ b/pdf/generate_pdf.inc @@ -0,0 +1,93 @@ +<?php + function generate_pdf() + { + require('fpdf/fpdf.php'); + global $user; + $x = $user->uid; + $book_id = arg(2); + $query2 = db_query("SELECT * FROM {textbook_companion_preference} WHERE id=".$book_id); + $data2 = db_fetch_object($query2); + $query3 = db_query("SELECT * FROM {textbook_companion_proposal} WHERE id=".$data2->proposal_id); + $data3 = db_fetch_object($query3); + if($data3->proposal_status == 3) + { + $pdf=new FPDF('L', 'mm', 'Letter'); + if (!$pdf) + { + echo "Error!"; + } + $pdf->AddPage(); + + $pdf->SetMargins(18,1,18); + + $pdf->Line(7.0,7.0,270.0,7.0); + $pdf->Line(7.0,7.0,7.0,210.0); + $pdf->Line(270.0,210.0,270.0,7.0); + $pdf->Line(7.0,210.0,270.0,210.0); + + //$pdf->Image("http://10.118.248.101/scilab_in/sites/all/modules/textbook_companion/pdf/images/garland_logo.png", 10, 9, 0, 15); + $path = drupal_get_path('module', 'textbook_companion'); + $pdf->Image($path."/pdf/images/fossee.png", 232, 9, 0, 15); + + $pdf->SetFont('Arial','B',25); + $pdf->Ln(30); + $pdf->Cell(240,8,'Certificate', 0,1,'C'); + + $pdf->SetFont('Arial','B',12); + $pdf->Cell(240,8,'Textbook Companion Project', '0','1','C'); + + $pdf->Ln(20); + $pdf->Cell(240,8,'IIT Bombay', '0','1','C'); + + $pdf->SetFont('Arial','',12); + if(strtolower($data3->branch)!="others") + { + $pdf->MultiCell(240,8,'This is to certify that Mr. /Ms. '.$data3->full_name.'from the Department Of '.$data3->branch.' '.$data3->university.' Universty has sucessfully completed training under the Textbook Companion Project for a duration equivalent to six weeks.He/She has coded, in Scilab, all the solved examples of the alloted textbook: '.$data2->book, 0); + } + else + { + $pdf->MultiCell(240,8,'This is to certify that Mr. /Ms. '.$data3->full_name.' from '.$data3->university.' Universty has sucessfully completed training under the Textbook Companion Project for a duration equivalent to six weeks.He/She has coded, in Scilab, all the solved examples of the alloted textbook: '.$data2->book, 0); + } $pdf->Cell(10,10,'The work done is available at ', '0','0','L'); + + $pdf->SetX(75); + $pdf->SetFont('','U'); + $pdf->SetTextColor(0,0,255); + $pdf->write(10,'http://scilab.in','http://scilab.in'); + + $pdf->Ln(10); + + $pdf->SetFont('Arial','',12); + $pdf->SetTextColor(0,0,0); + $pdf->Cell(10,10,'This work was funded by the FOSSEE project, IIT Bombay (for more details visit', '0','0','L'); + + $pdf->SetX(170); + $pdf->SetFont('','U'); + $pdf->SetTextColor(0,0,0); + $pdf->write(10,'http://fossee.in)','http://fossee.in'); + + $pdf->SetY(165); + + $pdf->SetX(209); + $pdf->SetFont('','B'); + $pdf->Cell(0,10,'Prof. Madhu Belur', 0,1,'L'); + + $pdf->SetX(201); + $pdf->Cell(0,10,'Electrical Engineering Dept.', 0,1,'L'); + + $pdf->SetX(200); + $pdf->Cell(0,10,'FOSSEE Project, IIT Bombay', 0,1,'L'); + + $cur_date=date('Y-m-d'); + $pdf->SetY(180); + $pdf->SetFont('',''); + $pdf->Cell(200,0,' Date: '.$cur_date.'',0,1,'L'); + $pdf->Cell(200,15,'Email: textbook@scilab.in', 0,1,'L'); + $pdf->Output(); + } + else + { + drupal_set_message('Your Book Is Still Under Review.', 'status'); + } +} +?> + |