1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* ____ _ _ _ _ |
5
|
|
|
* | _ \| |__ | |_ ___ _ __ ___ __ _(_) | |
6
|
|
|
* | |_) | '_ \| __/ _ \ '_ ` _ \ / _` | | | |
7
|
|
|
* | __/| | | | || __/ | | | | | (_| | | | |
8
|
|
|
* |_| |_| |_|\__\___|_| |_| |_|\__,_|_|_| |
9
|
|
|
* |
10
|
|
|
* This file is part of Kristuff\Phtemail. |
11
|
|
|
* |
12
|
|
|
* (c) Kristuff <[email protected]> |
13
|
|
|
* |
14
|
|
|
* For the full copyright and license information, please view the LICENSE |
15
|
|
|
* file that was distributed with this source code. |
16
|
|
|
* |
17
|
|
|
* @version 0.2.0 |
18
|
|
|
* @copyright 2017-2020 Kristuff |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace Kristuff\Phtemail\HtmlElements; |
22
|
|
|
|
23
|
|
|
use Kristuff\Phtemail\Core\HtmlContainerElement; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Class Row |
27
|
|
|
* The main containers inside the email body |
28
|
|
|
*/ |
29
|
|
|
class Row extends HtmlContainerElement |
30
|
|
|
{ |
31
|
|
|
/** |
32
|
|
|
* Gets the HTML |
33
|
|
|
* |
34
|
|
|
* @access public |
35
|
|
|
* @param string $indent |
36
|
|
|
* |
37
|
|
|
* @return string The html string content |
38
|
|
|
*/ |
39
|
|
|
public function getHtml(string $indent) |
40
|
|
|
{ |
41
|
|
|
// html result. start with an empty string or a html comment |
42
|
|
|
$html = $this->getBuilder()->getHtmlComment('ROW CONTAINER' . ' //', $indent); |
43
|
|
|
|
44
|
|
|
$html .= $indent . '<tr>'.PHP_EOL; |
45
|
|
|
$html .= $indent . ' <td align="center" valign="top">'.PHP_EOL; |
46
|
|
|
|
47
|
|
|
$html .= $this->getBuilder()->getHtmlComment('CENTERING TABLE //', $indent . ' '); |
48
|
|
|
|
49
|
|
|
$html .= $indent . ' <table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="'. $this->getEffectiveStyle('background-color').'">'.PHP_EOL; |
50
|
|
|
$html .= $indent . ' <tr '. $this->getRowStyle() .'>'.PHP_EOL; |
51
|
|
|
$html .= $indent . ' <td align="center" valign="top">'.PHP_EOL; |
52
|
|
|
|
53
|
|
|
$html .= $this->getBuilder()->getHtmlComment('FLEXIBLE CONTAINER //', $indent . ' '); |
54
|
|
|
|
55
|
|
|
$html .= $indent . ' <table border="0" cellspacing="0" cellpadding="' . $this->cellPadding . |
56
|
|
|
'" bgcolor="'. $this->getEffectiveStyle('background-color'). |
57
|
|
|
'" width="'. $this->getBuilder()->emailBodyWidth() . |
58
|
|
|
'" class="flexibleContainer">'.PHP_EOL; |
59
|
|
|
$html .= $indent . ' <tr>'.PHP_EOL; |
60
|
|
|
$html .= $indent . ' <td '. $this->getRowStyle() . |
61
|
|
|
' align="center" valign="top" width="'. $this->getBuilder()->emailBodyWidth() . |
62
|
|
|
'" class="flexibleContainerCell">'.PHP_EOL; |
63
|
|
|
|
64
|
|
|
$html .= $this->getBuilder()->getHtmlComment('CONTENT TABLE //', $indent . ' '); |
65
|
|
|
|
66
|
|
|
$html .= $indent . ' <table border="0" cellpadding="0" cellspacing="0" width="100%">'.PHP_EOL; |
67
|
|
|
$html .= $indent . ' <tr>'.PHP_EOL; |
68
|
|
|
$html .= $indent . ' <td align="'. $this->horizontalAlign .'" valign="'. $this->verticalAlign .'" style="color:'. $this->getEffectiveStyle('color') . ';" bgcolor="'. $this->getEffectiveStyle('background-color') . '">'.PHP_EOL; |
69
|
|
|
|
70
|
|
|
// render child elements collection |
71
|
|
|
foreach ($this->childElements as $element){ |
72
|
|
|
$html .= $element->getHtml($indent . ' '). PHP_EOL; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
$html .= $indent . ' </td>'.PHP_EOL; |
76
|
|
|
$html .= $indent . ' </tr>'.PHP_EOL; |
77
|
|
|
$html .= $indent . ' </table>'.PHP_EOL; |
78
|
|
|
|
79
|
|
|
$html .= $this->getBuilder()->getHtmlComment('// CONTENT TABLE', $indent . ' '); |
80
|
|
|
|
81
|
|
|
$html .= $indent . ' </td>'.PHP_EOL; |
82
|
|
|
$html .= $indent . ' </tr>'.PHP_EOL; |
83
|
|
|
$html .= $indent . ' </table>'.PHP_EOL; |
84
|
|
|
|
85
|
|
|
$html .= $this->getBuilder()->getHtmlComment('// FLEXIBLE CONTAINER', $indent . ' '); |
86
|
|
|
|
87
|
|
|
$html .= $indent . ' </td>'.PHP_EOL; |
88
|
|
|
$html .= $indent . ' </tr>'.PHP_EOL; |
89
|
|
|
$html .= $indent . ' </table>'.PHP_EOL; |
90
|
|
|
|
91
|
|
|
$html .= $this->getBuilder()->getHtmlComment('// CENTERING TABLE', $indent . ' '); |
92
|
|
|
|
93
|
|
|
$html .= $indent . ' </td>'.PHP_EOL; |
94
|
|
|
$html .= $indent . '</tr>'.PHP_EOL; |
95
|
|
|
|
96
|
|
|
$html .= $this->getBuilder()->getHtmlComment('// ' . 'ROW CONTAINER', $indent); |
97
|
|
|
return $html; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
} |