4
4
* Configuration script for the Ranking plugin
5
5
* @package chamilo.plugin.ranking
6
6
*/
7
- /**
8
- * Initialization
9
- */
10
- require_once dirname (__FILE__ ) . '/test2pdf.lib.php ' ;
7
+
11
8
require_once '../../../main/inc/global.inc.php ' ;
12
- require_once 'test2pdf_plugin.class.php ' ;
13
-
9
+
14
10
$ test2pdfPlugin = Test2pdfPlugin::create ();
15
11
$ enable = $ test2pdfPlugin ->get ('enable_plugin ' );
16
12
if ($ enable != "true " ) {
17
13
header ('Location: ../../../index.php ' );
18
14
}
19
15
20
- require ('../class/fpdf.php ' );
21
-
22
16
api_protect_course_script ();
23
17
24
- $ course_id = (int ) $ _GET ['c_id ' ];
25
- $ id_quiz = (int ) $ _GET ['id_quiz ' ];
18
+ $ course_id = (int )$ _GET ['c_id ' ];
19
+ $ id_quiz = (int )$ _GET ['id_quiz ' ];
26
20
27
- class PDF extends FPDF
21
+ class TestToPDF extends FPDF
28
22
{
29
23
public function Header ()
30
24
{
@@ -33,13 +27,13 @@ public function Header()
33
27
34
28
$ logo = '../resources/img/logo.png ' ;
35
29
$ this ->Image ($ logo , 10 , 0 );
36
-
30
+
37
31
// Title
38
32
$ this ->SetFont ('Courier ' , 'I ' , 14 );
39
33
$ this ->Cell (0 , 5 , $ title_course , 0 , 1 , 'R ' );
40
34
$ this ->SetFont ('Helvetica ' , 'I ' , 14 );
41
35
$ this ->Cell (0 , 5 , $ title_quiz , 0 , 1 , 'R ' );
42
-
36
+
43
37
// Line break
44
38
$ this ->SetLineWidth (0.5 );
45
39
$ this ->SetDrawColor (60 , 120 , 255 );
@@ -49,7 +43,7 @@ public function Header()
49
43
$ this ->Line (11 , 24.5 , 199 , 24.5 );
50
44
$ this ->Ln (10 );
51
45
}
52
-
46
+
53
47
public function Footer ()
54
48
{
55
49
global $ test2pdfPlugin ;
@@ -63,8 +57,8 @@ public function Footer()
63
57
$ this ->SetLineWidth (0.4 );
64
58
$ this ->SetDrawColor (200 );
65
59
$ this ->Line (11 , $ y +0.5 , 199 , $ y +0.5 );
66
-
67
-
60
+
61
+
68
62
// Arial italic 8
69
63
$ this ->SetFont ('Arial ' , 'I ' , 8 );
70
64
// Text color in gray
@@ -73,15 +67,15 @@ public function Footer()
73
67
$ this ->Cell (0 , 10 , utf8_decode (sprintf ($ test2pdfPlugin ->get_lang ('PageX ' ), $ this ->PageNo ())), 0 , 0 , 'C ' );
74
68
$ this ->Cell (0 , 10 , date ('Y ' ), 0 , 0 , 'R ' );
75
69
}
76
-
70
+
77
71
public $ B ;
78
72
public $ I ;
79
73
public $ U ;
80
74
public $ HREF ;
81
75
public $ fontList ;
82
76
public $ issetfont ;
83
77
public $ issetcolor ;
84
-
78
+
85
79
public function PDF ($ orientation ='P ' , $ unit ='mm ' , $ format ='A4 ' )
86
80
{
87
81
//Call parent constructor
@@ -95,7 +89,7 @@ public function PDF($orientation='P', $unit='mm', $format='A4')
95
89
$ this ->issetfont =false ;
96
90
$ this ->issetcolor =false ;
97
91
}
98
-
92
+
99
93
public function WriteHTML ($ html )
100
94
{
101
95
//HTML parser
@@ -129,7 +123,7 @@ public function WriteHTML($html)
129
123
}
130
124
}
131
125
}
132
-
126
+
133
127
public function OpenTag ($ tag , $ attr )
134
128
{
135
129
//Opening tag
@@ -180,7 +174,7 @@ public function OpenTag($tag, $attr)
180
174
break ;
181
175
}
182
176
}
183
-
177
+
184
178
public function CloseTag ($ tag )
185
179
{
186
180
//Closing tag
@@ -206,7 +200,7 @@ public function CloseTag($tag)
206
200
}
207
201
}
208
202
}
209
-
203
+
210
204
public function SetStyle ($ tag , $ enable )
211
205
{
212
206
//Modify style and select corresponding font
@@ -219,7 +213,7 @@ public function SetStyle($tag, $enable)
219
213
}
220
214
$ this ->SetFont ('' , $ style );
221
215
}
222
-
216
+
223
217
public function PutLink ($ URL , $ txt )
224
218
{
225
219
//Put a hyperlink
@@ -231,15 +225,14 @@ public function PutLink($URL, $txt)
231
225
}
232
226
}
233
227
234
-
235
228
//Obtener nombre del curso y nombre del ejercicio
236
229
//$info_course = CourseManager::get_course_information_by_id($course_id);
237
230
$ info_course = api_get_course_info_by_id ($ course_id );
238
231
$ info_quiz = getInfoQuiz ($ course_id , $ id_quiz );
239
232
$ title_course = utf8_decode (removeHtml ($ info_course ['title ' ]));
240
233
$ title_quiz = utf8_decode (removeHtml ($ info_quiz ['title ' ]));
241
234
242
- $ pdf = new PDF ();
235
+ $ pdf = new TestToPDF ();
243
236
$ pdf ->SetTitle ($ title_course .' - ' .$ title_quiz );
244
237
$ pdf ->AddPage ();
245
238
@@ -256,7 +249,7 @@ public function PutLink($URL, $txt)
256
249
}
257
250
$ pdf ->SetFont ('Arial ' , '' , 12 );
258
251
$ pdf ->SetTextColor (64 );
259
-
252
+
260
253
if (trim ($ InfoQuestion ['description ' ])!='' ) {
261
254
$ j = 0 ;
262
255
$ pdf ->WriteHTML (utf8_decode (removeQuotes ($ InfoQuestion ['description ' ])));
0 commit comments