Skip to content

Commit 0fd8e8a

Browse files
committed
Rename class PDF to TestToPDF to avoid composer errors.
Requires composer update
1 parent d6ae8d9 commit 0fd8e8a

File tree

1 file changed

+19
-26
lines changed

1 file changed

+19
-26
lines changed

plugin/test2pdf/src/download-pdf.php

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,21 @@
44
* Configuration script for the Ranking plugin
55
* @package chamilo.plugin.ranking
66
*/
7-
/**
8-
* Initialization
9-
*/
10-
require_once dirname(__FILE__) . '/test2pdf.lib.php';
7+
118
require_once '../../../main/inc/global.inc.php';
12-
require_once 'test2pdf_plugin.class.php';
13-
9+
1410
$test2pdfPlugin = Test2pdfPlugin::create();
1511
$enable = $test2pdfPlugin->get('enable_plugin');
1612
if ($enable != "true") {
1713
header('Location: ../../../index.php');
1814
}
1915

20-
require('../class/fpdf.php');
21-
2216
api_protect_course_script();
2317

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'];
2620

27-
class PDF extends FPDF
21+
class TestToPDF extends FPDF
2822
{
2923
public function Header()
3024
{
@@ -33,13 +27,13 @@ public function Header()
3327

3428
$logo = '../resources/img/logo.png';
3529
$this->Image($logo, 10, 0);
36-
30+
3731
// Title
3832
$this->SetFont('Courier', 'I', 14);
3933
$this->Cell(0, 5, $title_course, 0, 1, 'R');
4034
$this->SetFont('Helvetica', 'I', 14);
4135
$this->Cell(0, 5, $title_quiz, 0, 1, 'R');
42-
36+
4337
// Line break
4438
$this->SetLineWidth(0.5);
4539
$this->SetDrawColor(60, 120, 255);
@@ -49,7 +43,7 @@ public function Header()
4943
$this->Line(11, 24.5, 199, 24.5);
5044
$this->Ln(10);
5145
}
52-
46+
5347
public function Footer()
5448
{
5549
global $test2pdfPlugin;
@@ -63,8 +57,8 @@ public function Footer()
6357
$this->SetLineWidth(0.4);
6458
$this->SetDrawColor(200);
6559
$this->Line(11, $y+0.5, 199, $y+0.5);
66-
67-
60+
61+
6862
// Arial italic 8
6963
$this->SetFont('Arial', 'I', 8);
7064
// Text color in gray
@@ -73,15 +67,15 @@ public function Footer()
7367
$this->Cell(0, 10, utf8_decode(sprintf($test2pdfPlugin->get_lang('PageX'), $this->PageNo())), 0, 0, 'C');
7468
$this->Cell(0, 10, date('Y'), 0, 0, 'R');
7569
}
76-
70+
7771
public $B;
7872
public $I;
7973
public $U;
8074
public $HREF;
8175
public $fontList;
8276
public $issetfont;
8377
public $issetcolor;
84-
78+
8579
public function PDF($orientation='P', $unit='mm', $format='A4')
8680
{
8781
//Call parent constructor
@@ -95,7 +89,7 @@ public function PDF($orientation='P', $unit='mm', $format='A4')
9589
$this->issetfont=false;
9690
$this->issetcolor=false;
9791
}
98-
92+
9993
public function WriteHTML($html)
10094
{
10195
//HTML parser
@@ -129,7 +123,7 @@ public function WriteHTML($html)
129123
}
130124
}
131125
}
132-
126+
133127
public function OpenTag($tag, $attr)
134128
{
135129
//Opening tag
@@ -180,7 +174,7 @@ public function OpenTag($tag, $attr)
180174
break;
181175
}
182176
}
183-
177+
184178
public function CloseTag($tag)
185179
{
186180
//Closing tag
@@ -206,7 +200,7 @@ public function CloseTag($tag)
206200
}
207201
}
208202
}
209-
203+
210204
public function SetStyle($tag, $enable)
211205
{
212206
//Modify style and select corresponding font
@@ -219,7 +213,7 @@ public function SetStyle($tag, $enable)
219213
}
220214
$this->SetFont('', $style);
221215
}
222-
216+
223217
public function PutLink($URL, $txt)
224218
{
225219
//Put a hyperlink
@@ -231,15 +225,14 @@ public function PutLink($URL, $txt)
231225
}
232226
}
233227

234-
235228
//Obtener nombre del curso y nombre del ejercicio
236229
//$info_course = CourseManager::get_course_information_by_id($course_id);
237230
$info_course = api_get_course_info_by_id($course_id);
238231
$info_quiz = getInfoQuiz($course_id, $id_quiz);
239232
$title_course = utf8_decode(removeHtml($info_course['title']));
240233
$title_quiz = utf8_decode(removeHtml($info_quiz['title']));
241234

242-
$pdf = new PDF();
235+
$pdf = new TestToPDF();
243236
$pdf->SetTitle($title_course.' - '.$title_quiz);
244237
$pdf->AddPage();
245238

@@ -256,7 +249,7 @@ public function PutLink($URL, $txt)
256249
}
257250
$pdf->SetFont('Arial', '', 12);
258251
$pdf->SetTextColor(64);
259-
252+
260253
if (trim($InfoQuestion['description'])!='') {
261254
$j = 0;
262255
$pdf->WriteHTML(utf8_decode(removeQuotes($InfoQuestion['description'])));

0 commit comments

Comments
 (0)