1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
<?php
function generate_pdf()
{
$mpath = drupal_get_path('module', 'textbook_companion');
require($mpath . '/pdf/fpdf/fpdf.php');
global $user;
$x = $user->uid;
$proposal_id = arg(2);
$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();
//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'
);
} //$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();
$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("/Sites/scilab_in_2015/sites/default/files/scilab_logo.png", 10, 9, 0, 15);
$path = drupal_get_path('module', 'textbook_companion');
$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 Scilab, all the solved examples of the allotted textbook: ' . $data2->book . ' by ' . $data2->author . '.', 0);
} //strtolower($data3->branch) != "others"
else
{
$pdf->MultiCell(240, 8, 'This is to certify that ' . $gender['salutation'] . " " . $data3->full_name . ' from ' . $data3->university . ' has successfully completed training under Scilab Textbook Companion for a duration equivalent to six weeks. ' . $gender['gender'] . ' has coded, in Scilab, 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://scilab.in', 'http://scilab.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. Madhu Belur', 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 Electrical 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: textbook@scilab.in', 0, 1, 'L');
$filename = str_replace(' ', '-', $data3->full_name) . '-Scilab-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(); // this doesn't really matter.
$fp = fopen($file, "r");
while (!feof($fp))
{
echo fread($fp, 65536);
flush(); // this is essential for large downloads
} //!feof($fp)
fclose($fp);
unlink($file);
drupal_goto('certificate');
return;
}
function generate_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();
//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'
);
} //$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 Scilab 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) . '-Scilab-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(); // this doesn't really matter.
$fp = fopen($file, "r");
while (!feof($fp))
{
echo fread($fp, 65536);
flush(); // this is essential for large downloads
} //!feof($fp)
fclose($fp);
unlink($file);
drupal_goto('Summer_Internship_Forms/copyright-form');
return;
}
|