1 | <?php |
||
32 | abstract class AbstractDataTablesTwigExtension extends AbstractTwigExtension { |
||
33 | |||
34 | use RendererTwigExtensionTrait; |
||
35 | use TwigEnvironmentTrait; |
||
36 | |||
37 | /** |
||
38 | * jQuery DataTables. |
||
39 | * |
||
40 | * @var string |
||
41 | */ |
||
42 | const JQUERY_DATATABLES = <<<'EOT' |
||
43 | $(document).ready(function () { |
||
44 | var %var% = $("%selector%").DataTable(%options%); |
||
45 | }); |
||
46 | EOT; |
||
47 | |||
48 | /** |
||
49 | * jQuery DataTables. |
||
50 | * |
||
51 | * @var string |
||
52 | */ |
||
53 | const JQUERY_DATATABLES_STANDALONE = <<<'EOT' |
||
54 | $(document).ready(function () { |
||
55 | $("%selector%").DataTable(%options%); |
||
56 | }); |
||
57 | EOT; |
||
58 | |||
59 | /** |
||
60 | * Constructor. |
||
61 | * |
||
62 | * @param Twig_Environment $twigEnvironment The Twig environment. |
||
63 | * @param RendererTwigExtension $rendererTwigExtension The renderer Twig extension. |
||
64 | */ |
||
65 | protected function __construct(Twig_Environment $twigEnvironment, RendererTwigExtension $rendererTwigExtension) { |
||
69 | |||
70 | /** |
||
71 | * Encode the options. |
||
72 | * |
||
73 | * @param array $options The options. |
||
74 | * @return string Returns the encoded options. |
||
75 | */ |
||
76 | protected function encodeOptions(array $options) { |
||
84 | |||
85 | /** |
||
86 | * Displays a jQuery DataTables. |
||
87 | * |
||
88 | * @param DataTablesWrapperInterface $dtWrapper The wrapper. |
||
89 | * @param string $selector The selector. |
||
90 | * @param string $language The language. |
||
91 | * @return string Returns the jQuery DataTables. |
||
92 | * @throws FileNotFoundException Throws a file not found exception if the language file does not exist. |
||
93 | */ |
||
94 | protected function jQueryDataTables(DataTablesWrapperInterface $dtWrapper, $selector, $language) { |
||
114 | |||
115 | /** |
||
116 | * Displays a jQuery DataTables "Standalone". |
||
117 | * |
||
118 | * @param string $selector The selector. |
||
119 | * @param string $language The language. |
||
120 | * @param array $options The options. |
||
121 | * @return string Returns the jQuery DataTables "Standalone". |
||
122 | * @throws FileNotFoundException Throws a file not found exception if the language file does not exist. |
||
123 | */ |
||
124 | protected function jQueryDataTablesStandalone($selector, $language, array $options) { |
||
139 | |||
140 | /** |
||
141 | * Render a DataTables. |
||
142 | * |
||
143 | * @param DataTablesWrapperInterface $dtWrapper The wrapper. |
||
144 | * @param string $class The class. |
||
145 | * @param boolean $includeTHead Include thead ?. |
||
146 | * @param boolean $includeTFoot Include tfoot ? |
||
147 | * @returns string Returns the rendered DataTables. |
||
148 | */ |
||
149 | protected function renderDataTables(DataTablesWrapperInterface $dtWrapper, $class, $includeTHead, $includeTFoot) { |
||
167 | |||
168 | /** |
||
169 | * Render a column. |
||
170 | * |
||
171 | * @param DataTablesColumnInterface $dtColumn The column. |
||
172 | * @return string Returns the rendered column. |
||
173 | */ |
||
174 | private function renderDataTablesColumn(DataTablesColumnInterface $dtColumn, $scopeRow = false) { |
||
192 | |||
193 | /** |
||
194 | * Render a footer. |
||
195 | * |
||
196 | * @param DataTablesWrapperInterface $dtWrapper The wrapper. |
||
197 | * @return string Returns the rendered footer. |
||
198 | */ |
||
199 | private function renderDataTablesTFoot(DataTablesWrapperInterface $dtWrapper) { |
||
217 | |||
218 | /** |
||
219 | * Render a header. |
||
220 | * |
||
221 | * @param DataTablesWrapperInterface $dtWrapper The wrapper. |
||
222 | * @return string Returns the rendered header. |
||
223 | */ |
||
224 | private function renderDataTablesTHead(DataTablesWrapperInterface $dtWrapper) { |
||
246 | |||
247 | } |
||
248 |