forked from loulou6666/Giftcard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHTMLTemplateCardPdf.php
84 lines (74 loc) · 2.36 KB
/
HTMLTemplateCardPdf.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
<?php
class HTMLTemplateCardPdf extends HTMLTemplate
{
public $image;
public $order;
public function __construct($giftcard_object, $smarty)
{
$this->image = $giftcard_object->cardimage;
$this->order = $giftcard_object;
$this->shop = new Shop((int)$this->order->id_shop);
$this->smarty = $smarty;
$this->title = $giftcard_object->title;
$this->conditions = $giftcard_object->conditions;
}
public function getHeader()
{
$shop_name = Configuration::get('PS_SHOP_NAME', null, null, (int)$this->order->id_shop);
$path_logo = $this->getLogo();
$width = 0;
$height = 0;
if (!empty($path_logo))
list($width, $height) = getimagesize($path_logo);
$this->smarty->assign(array(
'logo_path' => $path_logo,
'img_ps_dir' => 'http://'.Tools::getMediaServer(_PS_IMG_)._PS_IMG_,
'img_update_time' => Configuration::get('PS_IMG_UPDATE_TIME'),
'title' => $this->title,
'date' => date('d/m/Y'),
'shop_name' => $shop_name,
'width_logo' => $width,
'height_logo' => $height
));
return $this->smarty->fetch(_PS_MODULE_DIR_ . 'giftcard/pdf/giftcard_header.tpl');
}
/**
* Returns the template's HTML content
* @return string HTML content
*/
public function getContent()
{
$this->smarty->assign(array(
'image' => $this->image,
'conditions' => $this->conditions
));
return $this->smarty->fetch(_PS_MODULE_DIR_ . 'giftcard/pdf/giftcard_content.tpl');
}
public function getFooter()
{
$this->smarty->assign(array(
'shop_url' => Tools::getHttpHost(true).__PS_BASE_URI__,
'shop_address' => $this->getShopAddress(),
'shop_fax' => Configuration::get('PS_SHOP_FAX', null, null, (int)$this->order->id_shop),
'shop_phone' => Configuration::get('PS_SHOP_PHONE', null, null, (int)$this->order->id_shop),
'shop_details' => Configuration::get('PS_SHOP_DETAILS', null, null, (int)$this->order->id_shop),
));
return $this->smarty->fetch(_PS_MODULE_DIR_ . 'giftcard/pdf/giftcard_footer.tpl');
}
/**
* Returns the template filename
* @return string filename
*/
public function getFilename()
{
return 'giftcard.pdf';
}
/**
* Returns the template filename when using bulk rendering
* @return string filename
*/
public function getBulkFilename()
{
return 'giftcard.pdf';
}
}