1 | <?php |
||
29 | abstract class AbstractDataTablesTwigExtension extends Twig_Extension { |
||
30 | |||
31 | /** |
||
32 | * jQuery DataTables. |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | const JQUERY_DATATABLES = <<<'EOT' |
||
37 | $(document).ready(function () { |
||
38 | var %var% = $("%selector%").DataTable(%options%); |
||
39 | }); |
||
40 | EOT; |
||
41 | |||
42 | /** |
||
43 | * jQuery DataTables. |
||
44 | * |
||
45 | * @var string |
||
46 | */ |
||
47 | const JQUERY_DATATABLES_STANDALONE = <<<'EOT' |
||
48 | $(document).ready(function () { |
||
49 | $("%selector%").DataTable(%options%); |
||
50 | }); |
||
51 | EOT; |
||
52 | |||
53 | /** |
||
54 | * Renderer |
||
55 | * |
||
56 | * @var BootstrapRendererTwigExtension |
||
57 | */ |
||
58 | private $renderer; |
||
59 | |||
60 | /** |
||
61 | * Constructor. |
||
62 | * |
||
63 | * @param BootstrapRendererTwigExtension $renderer The renderer. |
||
64 | */ |
||
65 | public function __construct(BootstrapRendererTwigExtension $renderer) { |
||
68 | |||
69 | /** |
||
70 | * Encode the options. |
||
71 | * |
||
72 | * @param array $options The options. |
||
73 | * @return string Returns the encoded options. |
||
74 | */ |
||
75 | protected function encodeOptions(array $options) { |
||
83 | |||
84 | /** |
||
85 | * Get the renderer. |
||
86 | * |
||
87 | * @return BootstrapRendererTwigExtension Returns the renderer. |
||
88 | */ |
||
89 | public function getRenderer() { |
||
92 | |||
93 | /** |
||
94 | * Displays a jQuery DataTables. |
||
95 | * |
||
96 | * @param DataTablesWrapper $dtWrapper The wrapper. |
||
97 | * @param string $selector The selector. |
||
98 | * @param string $language The language. |
||
99 | * @return string Returns the jQuery DataTables. |
||
100 | * @throws FileNotFoundException Throws a file not found exception if the language file does not exist. |
||
101 | */ |
||
102 | protected function jQueryDataTables(DataTablesWrapper $dtWrapper, $selector, $language) { |
||
122 | |||
123 | /** |
||
124 | * Displays a jQuery DataTables "Standalone". |
||
125 | * |
||
126 | * @param string $selector The selector. |
||
127 | * @param string $language The language. |
||
128 | * @param array $options The options. |
||
129 | * @return string Returns the jQuery DataTables "Standalone". |
||
130 | * @throws FileNotFoundException Throws a file not found exception if the language file does not exist. |
||
131 | */ |
||
132 | protected function jQueryDataTablesStandalone($selector, $language, array $options) { |
||
147 | |||
148 | /** |
||
149 | * Render a DataTables. |
||
150 | * |
||
151 | * @param DataTablesWrapper $dtWrapper The wrapper. |
||
152 | * @param string $class The class. |
||
153 | * @param boolean $includeTHead Include thead ?. |
||
154 | * @param boolean $includeTFoot Include tfoot ? |
||
155 | * @returns string Returns the rendered DataTables. |
||
156 | */ |
||
157 | protected function renderDataTables(DataTablesWrapper $dtWrapper, $class, $includeTHead, $includeTFoot) { |
||
175 | |||
176 | /** |
||
177 | * Render a column. |
||
178 | * |
||
179 | * @param DataTablesColumn $dtColumn The column. |
||
180 | * @return string Returns the rendered column. |
||
181 | */ |
||
182 | private function renderDataTablesColumn(DataTablesColumn $dtColumn, $scopeRow = false) { |
||
205 | |||
206 | /** |
||
207 | * Render a footer. |
||
208 | * |
||
209 | * @param DataTablesWrapper $dtWrapper The wrapper. |
||
210 | * @return string Returns the rendered footer. |
||
211 | */ |
||
212 | private function renderDataTablesTFoot(DataTablesWrapper $dtWrapper) { |
||
230 | |||
231 | /** |
||
232 | * Render a header. |
||
233 | * |
||
234 | * @param DataTablesWrapper $dtWrapper The wrapper. |
||
235 | * @return string Returns the rendered header. |
||
236 | */ |
||
237 | private function renderDataTablesTHead(DataTablesWrapper $dtWrapper) { |
||
259 | |||
260 | /** |
||
261 | * Set the renderer. |
||
262 | * |
||
263 | * @param BootstrapRendererTwigExtension $renderer The renderer. |
||
264 | * @return AbstractDataTablesTwigExtension Returns this Twig extension. |
||
265 | */ |
||
266 | protected function setRenderer(BootstrapRendererTwigExtension $renderer) { |
||
270 | |||
271 | } |
||
272 |