-
Notifications
You must be signed in to change notification settings - Fork 1
/
pdf_tafssear.php
199 lines (177 loc) · 5.95 KB
/
pdf_tafssear.php
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
<?php
if(substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
if(!ini_get('zlib.output_compression') && function_exists('ob_gzhandler'))ob_start('ob_gzhandler'); else ob_start();
}
include("db.php");
include_once 'includes/globales.php';
// if (empty($_GET['type'])) {
//$act = intval(1);
// }else if(isset($_GET['type'])) {
//$act = intval($_GET['act']);
//$act = intval($_GET['type']);
//$ayaID = intval($_GET['aya']);
//$SuraID = intval($_GET['sura']);
//}
$ayaID = intval($_GET['aya']);
$SuraID = intval($_GET['sura']);
$type = intval($_GET['type']);
$alsura = sorah($SuraID);
$alaya = al_aya($ayaID,$SuraID);
switch($_GET['type']){
case '1':
$tafseer = altafsire($ayaID,$SuraID,'tfs_ar_katheer');
$tafseer_title = 'تفسير إبن كثير';
$direction='rtl';
break;
case '2':
$tafseer = altafsire($ayaID,$SuraID,'tfs_ar_muyassar');
$tafseer_title = 'التفسير الميسر';
$direction='rtl';
break;
case '3':
$tafseer = altafsire($ayaID,$SuraID,'tfs_ar_jalalayn');
$tafseer_title = 'تفسير الجلالين';
$direction='rtl';
break;
case '4':
$tafseer = altafsire($ayaID,$SuraID,'tfs_fr_hamidullah');
$tafseer_title = 'Francais - Hamidullah Le Coran traduction en langue francaise ';
$direction='ltr';
break;
case '5':
$tafseer = altafsire($ayaID,$SuraID,'tfs_en_sahih');
$tafseer_title = 'The Saheeh International Quran Translation';
$direction='ltr';
break;
case '6':
$tafseer = altafsire($ayaID,$SuraID,'tfs_en_transliteration');
$tafseer_title = 'English Transliteration';
$direction='ltr';
break;
case '7':
$tafseer = altafsire($ayaID,$SuraID,'tfs_ber_mensur');
$tafseer_title = 'Amazigh Ramdane At Mansour';
$direction='ltr';
break;
case '8':
$tafseer = altafsire($ayaID,$SuraID,'tfs_ar_sa3dy');
$tafseer_title = 'تفسير السعدي';
$direction='rtl';
break;
case '9':
$tafseer = altafsire($ayaID,$SuraID,'tfs_ar_e3rab');
$tafseer_title = 'إعراب القرأن الكريم';
$direction='rtl';
break;
case '10':
$tafseer = altafsire($ayaID,$SuraID,'tfs_ar_baghawy');
$tafseer_title = 'تفسير البغوي ';
$direction='rtl';
break;
default:
$tafseer = altafsire($ayaID,$SuraID,'ar_muyassar');
$tafseer_title = 'التفسير الميسر';
$direction='rtl';
break;
}
$el_tafseer = htmlspecialchars_decode($tafseer, ENT_QUOTES);
$el_tafseer = strip_tags($el_tafseer);
define ('K_PATH_CACHE',dirname(__FILE__).'/cache/');
define ('K_PATH_IMAGES', dirname(__FILE__).'/images/');
define ('PDF_HEADER_LOGO', 'quran.png');
define ('PDF_HEADER_LOGO_WIDTH', 25);
define ('K_BLANK_IMAGE', '_blank.png');
define ('PDF_PAGE_FORMAT', 'A4');
/**
* Page orientation (P=portrait, L=landscape).
*/
define ('PDF_PAGE_ORIENTATION', 'P');
define ('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\www.tcpdf.org");
/**
* Document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch].
*/
define ('PDF_UNIT', 'mm');
require_once('tcpdf/tcpdf.php');
set_time_limit(0);
@ini_set("max_execution_time", 1000);
@ini_set("default_socket_timeout", 240);
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 018');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
define ('PDF_HEADER_TITLE', ''.$tafseer_title.'');
// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.'', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language dependent data:
$lg = Array();
$lg['a_meta_charset'] = 'UTF-8';
$lg['a_meta_dir'] = 'rtl';
$l['a_meta_language'] = 'ar';
// TRANSLATIONS --------------------------------------
$l['w_page'] = 'صفحة';
// set some language-dependent strings (optional)
$pdf->setLanguageArray($lg);
// set LTR direction for english translation
$pdf->setRTL(true);
// set font
//$pdf->SetFont('bahijjannab', '', 18);
//$pdf->SetFontSize(10);
$pdf->Ln();
// add a page
$pdf->AddPage();
$htmlpsura = '
<style>
h1 {
color: navy;
font-family: amiri;
font-size: 24pt;
}
.first {
color: navy;
font-family: amiri;
font-size: 22px;
line-height: 65px;
word-wrap: break-word;
}
</style>
<h1 class="title">'.$tafseer_title.' <i style="color:#990000"></i></h1>
<div class="first">';
$htmlpsura .= $alaya[0]['text'].'<br>';
$htmlpsura .= $el_tafseer;
$htmlpsura .='</div>';
$pdf->WriteHTML($htmlpsura, true, 0, true, 0);
// reset pointer to the last page
//$pdf->lastPage();
//Close and output PDF document
// save PDF to a local file
/*$f = fopen($name, 'wb');
if (!$f) {
echo'Unable to create output file: '.$name;
}
fwrite($f, $this->getBuffer(), $this->bufferlen);
fclose($f);*/
$pdf->Output(''.$SuraID.'.pdf', 'I');
//$pdf->Output(''.sura_versesura($SuraID).'.pdf', 'D');
//$pdf->Output('example_052333.pdf', 'F');
//$pdf->Output('example_052333.pdf', 'S');
?>