summaryrefslogtreecommitdiff
path: root/pdf/generate_pdf.inc
diff options
context:
space:
mode:
authorPrashant S2017-05-26 11:13:52 +0530
committerGitHub2017-05-26 11:13:52 +0530
commit4d6a167dbb4d49b3f0277e49c9072f152e932197 (patch)
treee11fda27689c3b00e4a3f720d3ed637782df5117 /pdf/generate_pdf.inc
parent0a5c88a06cae1df5db5f3f38e5c37ce0eaf68651 (diff)
parent408610bcc3d9bb795fcdbe00fbd1b14f3be3704e (diff)
downloadopenmodelica_textbook_companion-4d6a167dbb4d49b3f0277e49c9072f152e932197.tar.gz
openmodelica_textbook_companion-4d6a167dbb4d49b3f0277e49c9072f152e932197.tar.bz2
openmodelica_textbook_companion-4d6a167dbb4d49b3f0277e49c9072f152e932197.zip
Merge pull request #4 from prashantsinalkar/drupal_7.x
added certificate generator with varification links
Diffstat (limited to 'pdf/generate_pdf.inc')
-rwxr-xr-xpdf/generate_pdf.inc520
1 files changed, 395 insertions, 125 deletions
diff --git a/pdf/generate_pdf.inc b/pdf/generate_pdf.inc
index db76a88..9ee6fa5 100755
--- a/pdf/generate_pdf.inc
+++ b/pdf/generate_pdf.inc
@@ -1,127 +1,397 @@
<?php
function generate_pdf()
- {
- require('fpdf/fpdf.php');
- global $user;
- $x = $user->uid;
- $proposal_id = arg(3);
- /*$query2 = db_query("SELECT * FROM {textbook_companion_preference} WHERE approval_status=1 AND proposal_id=". $proposal_id);
- $data2 = db_fetch_object($query2);*/
- $query = db_select('textbook_companion_preference');
- $query->fields('textbook_companion_preference');
- $query->condition('approval_status', 1);
- $query->condition('proposal_id', $proposal_id);
- $result = $query->execute();
- $data2 = $result->fetchObject();
- /*$query3 = db_query("SELECT * FROM {textbook_companion_proposal} WHERE id=".$proposal_id);
- $data3 = db_fetch_object($query3);*/
- $query = db_select('textbook_companion_proposal');
- $query->fields('textbook_companion_proposal');
- $query->condition('id', $proposal_id);
- $result = $query->execute();
- $data3 = $result->fetchObject();
- //var_dump($data3->gender);
- $gender = array(
- 'salutation' => 'Mr. /Ms.',
- 'gender' => 'He/She'
- );
- if ($data3->gender)
- {
- if ($data3->gender == 'M')
- {
- $gender = array(
- 'salutation' => 'Mr.',
- 'gender' => 'He'
- );
- }
- else
- {
- $gender = array(
- 'salutation' => 'Ms.',
- 'gender' => 'She'
- );
- }
- }
- //die;
- /*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);
- $path = drupal_get_path('module', 'textbook_companion');
- $pdf->Image($path . "/pdf/images/dwsim_logo.png", 10, 9, 0, 15);
- $pdf->Image($path . "/pdf/images/fossee.png", 228, 9, 0, 15);
- $pdf->SetFont('Arial', 'B', 25);
- $pdf->Ln(30);
- $pdf->Cell(240, 8, 'Certificate', 0, 1, 'C');
- $pdf->Ln(5);
- $pdf->SetFont('Arial', 'B', 12);
- $pdf->Cell(240, 8, 'Textbook Companion', '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 '.$gender['salutation']." ".$data3->full_name.' from the Department of '.$data3->branch.', '.$data3->university.' has successfully completed Internship under Scilab Textbook Companion for a duration equivalent to six weeks. '.$gender['gender'].' has coded, in DWSIM, all the solved examples of the allotted textbook: '.$data2->book.' by '.$data2->author.'.', 0);
- }
- else
- {*/
- $pdf->MultiCell(240, 8, 'This is to certify that ' . $gender['salutation'] . " " . $data3->full_name . ' from ' . $data3->university . ' has successfully completed training under DWSIM Textbook Companion for a duration equivalent to six weeks. ' . $gender['gender'] . ' has coded, in DWSIM, all the solved examples of the allotted textbook: ' . $data2->book . ' by ' . $data2->author . '.', 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://dwsim.fossee.in', 'http://dwsim.fossee.in');
- $pdf->SetFont('', '');
- $pdf->SetTextColor(0, 0, 0);
- $pdf->write(10, '.', '.');
- $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, 255);
- $pdf->write(10, 'http://fossee.in', 'http://fossee.in');
- $pdf->SetX(198);
- $pdf->SetFont('', '');
- $pdf->SetTextColor(0, 0, 0);
- $pdf->write(10, ').');
- $pdf->SetY(-50);
- $pdf->SetX(209);
- $pdf->SetTextColor(0, 0, 0);
- $pdf->SetFont('', 'B');
- $pdf->Image($path . "/pdf/images/sign.png", 212, 151, 0, 15);
- //$pdf->SetX(206);
- $pdf->Cell(0, 7, 'Prof. Kannan M Moudgalya', 0, 1, 'L');
- $pdf->SetX(195);
- $pdf->Cell(0, 7, 'Principal Investigator - FOSSEE', 0, 1, 'L');
- $pdf->SetX(195);
- $pdf->Cell(0, 7, ' Dept. of Chemical Engineering', 0, 1, 'L');
- $pdf->SetX(216);
- $pdf->Cell(0, 7, 'IIT Bombay', 0, 1, 'L');
- $cur_date = date('jS F, Y');
- $pdf->SetY(180);
- $pdf->SetFont('', '');
- $pdf->Cell(200, 0, ' Date: ' . $cur_date . '', 0, 1, 'L');
- //$pdf->Cell(200,0,' Date: 28th August, 2013',0,1,'L');
- $pdf->Cell(200, 15, 'Email: contact-dwsim@sfossee.in', 0, 1, 'L');
- $name = $data3->full_name;
- $certificate_name = str_replace(' ', '_', $name);
- $pdf->Output($certificate_name . '_DWSIM_TBC_Certificate.pdf', 'D');
- /*}
- else
- {
- drupal_set_message('Your Book Is Still Under Review.', 'status');
- }*/
- }
-?>
+{
+ $mpath = drupal_get_path('module', 'textbook_companion');
+ require($mpath . '/pdf/fpdf/fpdf.php');
+ require($mpath . '/pdf/phpqrcode/qrlib.php');
+ global $user;
+ $x = $user->uid;
+ $proposal_id = arg(3);
+ $query2 = db_query("SELECT * FROM {textbook_companion_preference} WHERE approval_status=1 AND proposal_id= :prop_id", array(
+ ':prop_id' => $proposal_id
+ ));
+ $data2 = $query2->fetchObject();
+ $query3 = db_query("SELECT * FROM {textbook_companion_proposal} WHERE id= :prop_id AND proposal_status =3", array(
+ ':prop_id' => $proposal_id
+ ));
+ $data3 = $query3->fetchObject();
+ if($data3){
+ if($data3->uid != $x){
+ drupal_set_message('Certificate is not available','error');
+ return;
+ }
+ }
+ $query4 = db_query("SELECT COUNT( tce.id ) AS example_count FROM textbook_companion_example tce
+ LEFT JOIN textbook_companion_chapter tcc ON tce.chapter_id = tcc.id
+ LEFT JOIN textbook_companion_preference tcpe ON tcc.preference_id = tcpe.id
+ LEFT JOIN textbook_companion_proposal tcpo ON tcpe.proposal_id = tcpo.id
+ WHERE tcpo.proposal_status =3 AND tce.approval_status =1 AND tce.approval_status=1 AND tcpo.id = :prop_id", array(
+ ':prop_id' => $proposal_id
+ ));
+ $data4 = $query4->fetchObject();
+ if($data4->example_count == 0) {
+ drupal_set_message('Certificate is not available','error');
+ return;
+ }
+ $number_of_example = $data4->example_count;
+ $gender = array(
+ 'salutation' => 'Mr. /Ms.',
+ 'gender' => 'He/She'
+ );
+ if ($data3->gender) {
+ if ($data3->gender == 'M') {
+ $gender = array(
+ 'salutation' => 'Mr.',
+ 'gender' => 'He'
+ );
+ } //$data3->gender == 'M'
+ else {
+ $gender = array(
+ 'salutation' => 'Ms.',
+ 'gender' => 'She'
+ );
+ }
+ } //$data3->gender
+ $pdf = new FPDF('L', 'mm', 'Letter');
+ if (!$pdf) {
+ echo "Error!";
+ } //!$pdf
+ $pdf->AddPage();
+ $image_bg = $mpath . "/pdf/images/bg.png";
+ $pdf->Image($image_bg, 0, 0, $pdf->w, $pdf->h);
+ //$pdf->Rect(5, 5, 267, 207, 'D');
+ $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);
+ $path = drupal_get_path('module', 'textbook_companion');
+ $image1 = $mpath . "/pdf/images/om_logo.png";
+ $pdf->Ln(15);
+ //$pdf->Cell(200, 8, $pdf->Image($image1, 105, 15, 0, 28), 0, 1, 'C');
+ $pdf->Ln(20);
+ $pdf->SetFont('Arial', 'BI', 25);
+ $pdf->SetTextColor(0, 147, 211);
+ $pdf->Cell(240, 8, 'Certificate of Participation', '0', 1, 'C');
+ $pdf->Ln(4);
+ $pdf->SetFont('Arial', 'BI', 12);
+ $pdf->SetTextColor(0, 0, 0);
+ $pdf->Cell(240, 8, 'This is to certify that', '0', '1', 'C');
+ $pdf->Ln(4);
+ $pdf->SetFont('Arial', 'BI', 25);
+ $pdf->SetTextColor(0, 147, 211);
+ $pdf->Cell(240, 8, $data3->full_name, '0', '1', 'C');
+ $pdf->Ln(5);
+ $pdf->SetFont('Arial', 'I', 12);
+ if (strtolower($data3->branch) != "others") {
+ $pdf->SetTextColor(0, 0, 0);
+ //$pdf->Cell(240, 8, 'from ' . $data3->university . ' has successfully', '0', '1', 'C');
+ $pdf->MultiCell(240, 8, 'from ' . $data3->university . ' has successfully', '0','C');
+ $pdf->Ln(0);
+ $pdf->Cell(240, 8, 'completed Internship under OpenModelica Textbook Companion', '0', '1', 'C');
+ $pdf->Ln(0);
+ $pdf->Cell(240, 8, 'He/she has coded ' . $number_of_example . ' solved examples using OpenModelica from the', '0', '1', 'C');
+ $pdf->Ln(0);
+ //$pdf->Cell(240, 8, 'Book: ' . $data2->book . ', Author: ' . $data2->author . '.', '0', '1', 'C');
+ $pdf->MultiCell(240, 8, 'Book: ' . $data2->book . ', Author: ' . $data2->author . '.', '0','C');
+ $pdf->Ln(0);
+ } //strtolower($data3->branch) != "others"
+ else {
+ $pdf->SetTextColor(0, 0, 0);
+ $pdf->Cell(240, 8, 'from ' . $data3->university . ' has successfully', '0', '1', 'C');
+ $pdf->Ln(0);
+ $pdf->Cell(240, 8, 'completed Internship under OpenModelica Textbook Companion', '0', '1', 'C');
+ $pdf->Ln(0);
+ $pdf->Cell(240, 8, 'He/she has coded ' . $number_of_example . ' solved examples using OpenModelica from the', '0', '1', 'C');
+ $pdf->Ln(0);
+ $pdf->Cell(240, 8, 'Book: ' . $data2->book . ', Author: ' . $data2->author . '.', '0', '1', 'C');
+ $pdf->Ln(0);
+ }
+ $proposal_get_id = 0;
+ $UniqueString = "";
+ $tempDir = $path . "/pdf/temp_prcode/";
+ $query = db_select('textbook_companion_qr_code');
+ $query->fields('textbook_companion_qr_code');
+ $query->condition('proposal_id', $proposal_id);
+ $result = $query->execute();
+ $data = $result->fetchObject();
+ $DBString = $data->qr_code;
+ $proposal_get_id = $data->proposal_id;
+ if ($DBString == "" || $DBString == "null") {
+ $UniqueString = generateRandomString();
+ $query = "
+ INSERT INTO textbook_companion_qr_code
+ (proposal_id,qr_code)
+ VALUES
+ (:proposal_id,:qr_code)
+ ";
+ $args = array(
+ ":proposal_id" => $proposal_id,
+ ":qr_code" => $UniqueString
+ );
+ $result = db_query($query, $args, array(
+ 'return' => Database::RETURN_INSERT_ID
+ ));
+ } //$DBString == "" || $DBString == "null"
+ else {
+ $UniqueString = $DBString;
+ }
+ $codeContents = "http://om.fossee.in/textbook-companion/certificate/verify/" . $UniqueString;
+ $fileName = 'generated_qrcode.png';
+ $pngAbsoluteFilePath = $tempDir . $fileName;
+ $urlRelativeFilePath = $path . "/pdf/temp_prcode/" . $fileName;
+ QRcode::png($codeContents, $pngAbsoluteFilePath);
+ $pdf->Cell(240, 4, '', '0', '1', 'C');
+ $pdf->SetX(95);
+ $pdf->write(0, 'The work done is available at ');
+ $pdf->SetFont('', 'U');
+ $pdf->SetTextColor(0, 147, 211);
+ $pdf->write(0, 'http://om.fossee.in/', 'http://om.fossee.in/');
+ $pdf->SetFont('', '');
+ $pdf->SetTextColor(0, 0, 0);
+ $pdf->write(0, '.', '.');
+ $pdf->Ln(5);
+ $pdf->SetX(198);
+ $pdf->SetFont('', '');
+ $pdf->SetTextColor(0, 0, 0);
+ $pdf->SetY(-85);
+ $pdf->SetX(200);
+ $pdf->SetTextColor(0, 0, 0);
+ $pdf->SetFont('', '');
+ //$sign = $path . "/pdf/images/sign.png";
+ //$pdf->Image($sign, $pdf->GetX(), $pdf->GetY() - 20, 50, 0);
+ $pdf->Cell(0, 8, 'Prof. Kannan M. Moudgalya', 0, 1, 'L');
+ $pdf->SetX(199);
+ $pdf->SetFont('Arial', '', 10);
+ $pdf->Cell(0, 7, 'Co - Principal Investigator - FOSSEE', 0, 1, 'L');
+ $pdf->SetX(190);
+ $pdf->Cell(0, 7, ' Dept. of Chemical Engineering, IIT Bombay.', 0, 1, 'L');
+ $pdf->SetX(29);
+ $pdf->SetFont('Arial', 'B', 10);
+ $pdf->SetY(-58);
+ $pdf->SetX(28);
+ $pdf->Cell(0, 2, $UniqueString, 0, 0, 'C');
+ $pdf->SetX(29);
+ $pdf->SetY(-50);
+ $image4 = $path . "/pdf/images/verify_content.png";
+ //$pdf->Image($image4, $pdf->GetX(), $pdf->GetY(), 20, 0);
+ $pdf->SetY(-50);
+ $pdf->SetX(80);
+ $image3 = $path . "/pdf/images/iitb.png";
+ $image2 = $path . "/pdf/images/fossee.png";
+ $pdf->Image($image2, $pdf->GetX() - 15, $pdf->GetY() + 7, 40, 0);
+ $pdf->Image($pngAbsoluteFilePath, $pdf->GetX() + 50, $pdf->GetY() - 5, 30, 0);
+ $pdf->Image($image3, $pdf->GetX() + 110, $pdf->GetY() + 3, 15, 0);
+ $pdf->Image($image4, $pdf->GetX() - 15, $pdf->GetY() + 28, 150, 0);
+ $pdf->SetFont('Arial', 'I', 8);
+ $pdf->SetTextColor(0, 0, 0);
+ $filename = str_replace(' ', '-', $data3->full_name) . '-OM-Textbook-Certificate.pdf';
+ $file = $path . '/pdf/temp_certificate/' . $proposal_id . '_' . $filename;
+ $pdf->Output($file, 'F');
+ header("Content-Type: application/octet-stream");
+ header("Content-Disposition: attachment; filename=" . $filename);
+ header("Content-Type: application/octet-stream");
+ header("Content-Type: application/download");
+ header("Content-Description: File Transfer");
+ header("Content-Length: " . filesize($file));
+ flush();
+ $fp = fopen($file, "r");
+ while (!feof($fp)) {
+ echo fread($fp, 65536);
+ flush();
+ } //!feof($fp)
+ fclose($fp);
+ unlink($file);
+ drupal_goto('certificate');
+ return;
+}
+function generateRandomString($length = 5)
+{
+ $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ $charactersLength = strlen($characters);
+ $randomString = '';
+ for ($i = 0; $i < $length; $i++) {
+ $randomString .= $characters[rand(0, $charactersLength - 1)];
+ } //$i = 0; $i < $length; $i++
+ return $randomString;
+}
+function generate_copyright_form_pdf()
+{
+ $mpath = drupal_get_path('module', 'textbook_companion');
+ require($mpath . '/pdf/fpdf/fpdf.php');
+ global $user;
+ $x = $user->uid;
+ $proposal_id = arg(3);
+ $query2 = db_query("SELECT * FROM {textbook_companion_preference} WHERE approval_status=1 AND proposal_id= :prop_id", array(
+ ':prop_id' => $proposal_id
+ ));
+ $data2 = $query2->fetchObject();
+ $query3 = db_query("SELECT * FROM {textbook_companion_proposal} WHERE id= :prop_id", array(
+ ':prop_id' => $proposal_id
+ ));
+ $data3 = $query3->fetchObject();
+ $gender = array(
+ 'salutation' => 'Mr. /Ms.',
+ 'gender' => 'He/She'
+ );
+ if ($data3->gender) {
+ if ($data3->gender == 'M') {
+ $gender = array(
+ 'salutation' => 'Mr.',
+ 'gender' => 'He'
+ );
+ } //$data3->gender == 'M'
+ else {
+ $gender = array(
+ 'salutation' => 'Ms.',
+ 'gender' => 'She'
+ );
+ }
+ } //$data3->gender
+ $pdf = new FPDF('P', 'mm', 'Letter');
+ if (!$pdf) {
+ echo "Error!";
+ } //!$pdf
+ $pdf->AddPage();
+ $path = drupal_get_path('module', 'textbook_companion');
+ $pdf->SetFont('Arial', 'B', 25);
+ $pdf->Ln(30);
+ $pdf->Cell(200, 8, 'Copyright Transfer Form', 0, 1, 'C');
+ $pdf->Ln(20);
+ $pdf->SetFont('Arial', '', 12);
+ $pdf->MultiCell(200, 8, 'I hereby transfer the copyrights of the OpenModelica Textbook Companion for ' . $data2->book . ' ( Author: ' . $data2->author . ', Edition: ' . $data2->edition . ', Publisher: ' . $data2->publisher . ', Year: ' . $data2->year . ') to FOSSEE Project, IIT Bombay.', 0);
+ $pdf->Ln(10);
+ $pdf->MultiCell(200, 8, 'I understand that the FOSSEE project will release the Textbook Companion under the Creative Commons (CC) license.');
+ $pdf->SetX(75);
+ $pdf->SetFont('', 'U');
+ $pdf->SetTextColor(0, 0, 255);
+ $pdf->SetFont('', '');
+ $pdf->SetTextColor(0, 0, 0);
+ $pdf->SetFont('', '');
+ $pdf->SetTextColor(0, 0, 0);
+ $pdf->SetY(-10);
+ $pdf->SetX(209);
+ $cur_date = date('jS F, Y');
+ $pdf->SetY(140);
+ $pdf->SetFont('', '');
+ $pdf->Ln(0);
+ $pdf->Cell(200, 0, ' Date: ' . $cur_date . '', 0, 1, 'L');
+ $pdf->Cell(200, 20, ' Place: _________________', 0, 1, 'L');
+ $pdf->SetY(140);
+ $pdf->SetX(120);
+ $pdf->Cell(180, 0, 'Signature: _________________', 0, 1, 'L');
+ $pdf->SetY(144);
+ $pdf->SetX(120);
+ $pdf->multicell(140, 14, 'Name: ' . $gender['salutation'] . ' ' . $data3->full_name . '', 0, '');
+ $filename = str_replace(' ', '-', $data3->full_name) . '-OM-Textbook-Companion-copyright-form.pdf';
+ $file = $path . '/pdf/temp_certificate/' . $proposal_id . '_' . $filename;
+ $pdf->Output($file, 'F');
+ header("Content-Type: application/octet-stream");
+ header("Content-Disposition: attachment; filename=" . $filename);
+ header("Content-Type: application/octet-stream");
+ header("Content-Type: application/download");
+ header("Content-Description: File Transfer");
+ header("Content-Length: " . filesize($file));
+ flush();
+ $fp = fopen($file, "r");
+ while (!feof($fp)) {
+ echo fread($fp, 65536);
+ flush();
+ } //!feof($fp)
+ fclose($fp);
+ unlink($file);
+ drupal_goto('Summer_Internship_Forms/forms');
+ return;
+}
+function generate_undertaking_form_pdf()
+{
+ $mpath = drupal_get_path('module', 'textbook_companion');
+ require($mpath . '/pdf/fpdf/fpdf.php');
+ global $user;
+ $x = $user->uid;
+ $proposal_id = arg(3);
+ $query2 = db_query("SELECT * FROM {textbook_companion_preference} WHERE approval_status=1 AND proposal_id= :prop_id", array(
+ ':prop_id' => $proposal_id
+ ));
+ $data2 = $query2->fetchObject();
+ $query3 = db_query("SELECT * FROM {textbook_companion_proposal} WHERE id= :prop_id", array(
+ ':prop_id' => $proposal_id
+ ));
+ $data3 = $query3->fetchObject();
+ $gender = array(
+ 'salutation' => 'Mr. /Ms.',
+ 'gender' => 'He/She'
+ );
+ if ($data3->gender) {
+ if ($data3->gender == 'M') {
+ $gender = array(
+ 'salutation' => 'Mr.',
+ 'gender' => 'He'
+ );
+ } //$data3->gender == 'M'
+ else {
+ $gender = array(
+ 'salutation' => 'Ms.',
+ 'gender' => 'She'
+ );
+ }
+ } //$data3->gender
+ $pdf = new FPDF('P', 'mm', 'Letter');
+ if (!$pdf) {
+ echo "Error!";
+ } //!$pdf
+ $pdf->AddPage();
+ $path = drupal_get_path('module', 'textbook_companion');
+ $pdf->SetFont('Arial', 'B', 25);
+ $pdf->Ln(30);
+ $pdf->Cell(200, 8, 'Undertaking Form', 0, 1, 'C');
+ $pdf->Ln(0);
+ $pdf->SetFont('Arial', 'B', 10);
+ $pdf->Cell(200, 8, '(To be signed by college teacher)', 0, 1, 'C');
+ $pdf->Ln(20);
+ $pdf->SetFont('Arial', '', 12);
+ $pdf->MultiCell(200, 8, 'I hereby certify that all the codes written by ' . $gender['salutation'] . ' ' . $data3->full_name . ' under the OpenModelica Textbook Companion Project for the book ' . $data2->book . ' ( Author: ' . $data2->author . ', Edition: ' . $data2->edition . ', Publisher: ' . $data2->publisher . ', Year: ' . $data2->year . ') are correctly reproducing the results given in the aforementioned book.', 0);
+ $pdf->Ln(10);
+ $pdf->MultiCell(200, 8, 'I understand that the OpenModelica Textbook Companion created is a part of FOSSEE project, IIT Bombay, and is sponsored by the National Mission on Education through Information and Communication Technology (NMEICT), under MHRD, Govt. of India. The project requires that the textbook companion is made available for public access as an open source document. Hence I undertake that this OpenModelica Textbook Companion can be made public along with the information that I have certified all the codes as giving the correct answer.');
+ $pdf->SetX(75);
+ $pdf->SetFont('', 'U');
+ $pdf->SetTextColor(0, 0, 255);
+ $pdf->SetFont('', '');
+ $pdf->SetTextColor(0, 0, 0);
+ $pdf->SetFont('', '');
+ $pdf->SetTextColor(0, 0, 0);
+ $pdf->SetY(-10);
+ $pdf->SetX(209);
+ $cur_date = date('jS F, Y');
+ $pdf->SetY(180);
+ $pdf->SetFont('', '');
+ $pdf->Ln(0);
+ $pdf->Cell(200, 0, ' Date: ' . $cur_date . '', 0, 1, 'L');
+ $pdf->Cell(200, 20, ' Place: _________________', 0, 1, 'L');
+ $pdf->SetY(180);
+ $pdf->SetX(120);
+ $pdf->Cell(140, 0, 'Signature: _________________', 0, 1, 'L');
+ $pdf->SetX(120);
+ $pdf->multicell(140, 14, 'Name: ' . '____________________', 0, '');
+ $pdf->SetX(120);
+ $pdf->multicell(140, 14, 'Designation: ' . '______________', 0, '');
+ $filename = str_replace(' ', '-', $data3->full_name) . '-OM-Textbook-Companion-undertaking-form.pdf';
+ $file = $path . '/pdf/temp_certificate/' . $proposal_id . '_' . $filename;
+ $pdf->Output($file, 'F');
+ header("Content-Type: application/octet-stream");
+ header("Content-Disposition: attachment; filename=" . $filename);
+ header("Content-Type: application/octet-stream");
+ header("Content-Type: application/download");
+ header("Content-Description: File Transfer");
+ header("Content-Length: " . filesize($file));
+ flush();
+ $fp = fopen($file, "r");
+ while (!feof($fp)) {
+ echo fread($fp, 65536);
+ flush();
+ } //!feof($fp)
+ fclose($fp);
+ unlink($file);
+ drupal_goto('Summer_Internship_Forms/forms');
+ return;
+}