MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
mezpdfreport.class
Ir para a documentação deste ficheiro.
1<?php
2
7class MCpdf extends Cpdf
8{
9}
10
15class MCezpdf extends Cezpdf
16{
17
28 function __construct($paper = 'a4', $orientation = 'portrait')
29 {
30 parent::CezPDF($paper, $orientation);
31 $this->pageWidth = $this->ez['pageWidth'];
32 $this->pageHeight = $this->ez['pageHeight'];
33 }
34
44 function CallTrigger($trigger)
45 {
46 $method = array
47 (
48 $trigger[0],
49 $trigger[1]
50 );
51
52 call_user_func($method, $trigger[2]);
53 }
54
67 function SetTrigger($trigger, $class, $module, $param)
68 {
69 $this->trigger[$trigger] = array
70 (
71 $class,
72 $module,
73 $param
74 );
75 }
76
87 function ezSetDy($dy, $mod = '')
88 {
89 parent::ezSetDy($dy, $mod);
90 return $this->y;
91 }
92
100 function ezNewPage()
101 {
102 if ($this->trigger['BeforeNewPage'])
103 {
104 $this->CallTrigger($this->trigger['BeforeNewPage']);
105 }
106
107 parent::ezNewPage();
108
109 if ($this->trigger['AfterNewPage'])
110 {
111 $this->CallTrigger($this->trigger['AfterNewPage']);
112 }
113 }
114
124 function getWidthFromPercent($percent)
125 {
126 $total = $this->ez['pageWidth'] - $this->ez['leftMargin'] - $this->ez['rightMargin'];
127 return $percent * $total / 100;
128 }
129
142 function ezSetMargins($top, $bottom, $left, $right)
143 {
144 parent::ezSetMargins($top, $bottom, $left, $right);
145 $this->top = $this->pageHeight - $this->ez['topMargin'];
146 $this->bottom = $this->ez['bottomMargin'];
147 $this->left = $this->ez['leftMargin'];
148 $this->right = $this->pageWidth - $this->ez['rightMargin'];
149 }
150
158 function HorizontalLine()
159 {
160 $this->line($this->left, $this->y, $this->right, $this->y);
161 }
162}
163
169{
173 var $type;
174
178 var $pdf;
179
183 var $font;
184
188 var $diff;
189
194
199
209 function __construct($type = '2', $orientation = 'portrait')
210 {
211 global $MIOLO;
212
213 $this->type = $type;
214
215 if ($this->type == '1')
216 $this->pdf = new MCpdf();
217 else
218 $this->pdf = new MCezpdf('a4',$orientation);
219
220 $this->diff = array
221 (
222 ".notdef",
223 ".notdef",
224 ".notdef",
225 ".notdef",
226 ".notdef",
227 ".notdef",
228 ".notdef",
229 ".notdef",
230 ".notdef",
231 ".notdef",
232 ".notdef",
233 ".notdef",
234 ".notdef",
235 ".notdef",
236 ".notdef",
237 ".notdef",
238 ".notdef",
239 ".notdef",
240 ".notdef",
241 ".notdef",
242 ".notdef",
243 ".notdef",
244 ".notdef",
245 ".notdef",
246 ".notdef",
247 ".notdef",
248 ".notdef",
249 ".notdef",
250 ".notdef",
251 ".notdef",
252 ".notdef",
253 ".notdef",
254 "space",
255 "exclam",
256 "quotedbl",
257 "numbersign",
258 "dollar",
259 "percent",
260 "ampersand",
261 "quoteright",
262 "parenleft",
263 "parenright",
264 "asterisk",
265 "plus",
266 "comma",
267 "minus",
268 "period",
269 "slash",
270 "zero",
271 "one",
272 "two",
273 "three",
274 "four",
275 "five",
276 "six",
277 "seven",
278 "eight",
279 "nine",
280 "colon",
281 "semicolon",
282 "less",
283 "equal",
284 "greater",
285 "question",
286 "at",
287 "A",
288 "B",
289 "C",
290 "D",
291 "E",
292 "F",
293 "G",
294 "H",
295 "I",
296 "J",
297 "K",
298 "L",
299 "M",
300 "N",
301 "O",
302 "P",
303 "Q",
304 "R",
305 "S",
306 "T",
307 "U",
308 "V",
309 "W",
310 "X",
311 "Y",
312 "Z",
313 "bracketleft",
314 "backslash",
315 "bracketright",
316 "asciicircum",
317 "underscore",
318 "quoteleft",
319 "a",
320 "b",
321 "c",
322 "d",
323 "e",
324 "f",
325 "g",
326 "h",
327 "i",
328 "j",
329 "k",
330 "l",
331 "m",
332 "n",
333 "o",
334 "p",
335 "q",
336 "r",
337 "s",
338 "t",
339 "u",
340 "v",
341 "w",
342 "x",
343 "y",
344 "z",
345 "braceleft",
346 "bar",
347 "braceright",
348 "asciitilde",
349 ".notdef",
350 ".notdef",
351 ".notdef",
352 ".notdef",
353 ".notdef",
354 ".notdef",
355 ".notdef",
356 ".notdef",
357 ".notdef",
358 ".notdef",
359 ".notdef",
360 ".notdef",
361 ".notdef",
362 ".notdef",
363 ".notdef",
364 ".notdef",
365 ".notdef",
366 "dotlessi",
367 "grave",
368 "acute",
369 "circumflex",
370 "tilde",
371 "macron",
372 "breve",
373 "dotaccent",
374 "dieresis",
375 ".notdef",
376 "ring",
377 "cedilla",
378 ".notdef",
379 "hungarumlaut",
380 "ogonek",
381 "caron",
382 "space",
383 "exclamdown",
384 "cent",
385 "sterling",
386 "currency",
387 "yen",
388 "brokenbar",
389 "section",
390 "dieresis",
391 "copyright",
392 "ordfeminine",
393 "guillemotleft",
394 "logicalnot",
395 "hyphen",
396 "registered",
397 "macron",
398 "degree",
399 "plusminus",
400 "twosuperior",
401 "threesuperior",
402 "acute",
403 "mu",
404 "paragraph",
405 "periodcentered",
406 "cedilla",
407 "onesuperior",
408 "ordmasculine",
409 "guillemotright",
410 "onequarter",
411 "onehalf",
412 "threequarters",
413 "questiondown",
414 "Agrave",
415 "Aacute",
416 "Acircumflex",
417 "Atilde",
418 "Adieresis",
419 "Aring",
420 "AE",
421 "Ccedilla",
422 "Egrave",
423 "Eacute",
424 "Ecircumflex",
425 "Edieresis",
426 "Igrave",
427 "Iacute",
428 "Icircumflex",
429 "Idieresis",
430 "Eth",
431 "Ntilde",
432 "Ograve",
433 "Oacute",
434 "Ocircumflex",
435 "Otilde",
436 "Odieresis",
437 "multiply",
438 "Oslash",
439 "Ugrave",
440 "Uacute",
441 "Ucircumflex",
442 "Udieresis",
443 "Yacute",
444 "Thorn",
445 "germandbls",
446 "agrave",
447 "aacute",
448 "acircumflex",
449 "atilde",
450 "adieresis",
451 "aring",
452 "ae",
453 "ccedilla",
454 "egrave",
455 "eacute",
456 "ecircumflex",
457 "edieresis",
458 "igrave",
459 "iacute",
460 "icircumflex",
461 "idieresis",
462 "eth",
463 "ntilde",
464 "ograve",
465 "oacute",
466 "ocircumflex",
467 "otilde",
468 "odieresis",
469 "divide",
470 "oslash",
471 "ugrave",
472 "uacute",
473 "ucircumflex",
474 "udieresis",
475 "yacute",
476 "thorn",
477 "ydieresis"
478 );
479
480 $fonts_path = $MIOLO->GetConf('home.classes') . '/ezpdf/fonts';
481 $this->pdf->SetFontsPath($fonts_path);
482 $this->SetFont('Helvetica.afm');
483 }
484
494 function SetFont($font)
495 {
496 $this->font = $font;
497 $this->pdf->selectFont($this->font, array('encoding' => 'ISOLatin1Encoding', 'differences' => $this->diff));
498 }
499
500 function &GetPdf()
501 {
502 return $this->pdf;
503 }
504
514 function SetOutput($value = '')
515 {
516 if ($value != '')
517 {
518 $this->output = $value;
519 }
520 else
521 {
522 $this->output = ($this->type == '1') ? $this->pdf->output() : $this->pdf->ezOutput();
523 }
524 }
525
533 function GetOutput()
534 {
535 if ($this->output == NULL)
536 {
537 $this->SetOutput();
538 }
539
540 return $this->output;
541 }
542
550 function Execute()
551 {
552 global $MIOLO, $MIOLOCONF, $page;
553
554 $pdfcode = $this->GetOutput();
555 $fname = substr(uniqid(md5(uniqid(""))), 0, 10) . '.pdf';
556 $this->fileexp = $MIOLO->GetConf('home.reports') . '/' . $fname;
557 $fp = fopen($this->fileexp, 'x');
558 fwrite($fp, $pdfcode);
559 fclose ($fp);
560 $this->fileout = $MIOLO->GetActionURL('miolo', 'reports:' . $fname);
561
562 // $this->fileout = $MIOLO->GetConf('url') . "/report.php?fname=$fname";
563 //echo "$this->fileexp<br>";
564 //echo "$this->fileout<br>";
565 //echo $this->pdf->messages;
566 $page->Redirect($this->fileout);
567 }
568}
569?>
getWidthFromPercent($percent)
ezSetMargins($top, $bottom, $left, $right)
__construct($paper='a4', $orientation='portrait')
CallTrigger($trigger)
ezSetDy($dy, $mod='')
SetTrigger($trigger, $class, $module, $param)
SetOutput($value='')
__construct($type='2', $orientation='portrait')