|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Dtc\GridBundle\Grid\Renderer; |
|
4
|
|
|
|
|
5
|
|
|
use Symfony\Component\Routing\Router; |
|
6
|
|
|
use Symfony\Bundle\TwigBundle\TwigEngine; |
|
|
|
|
|
|
7
|
|
|
|
|
8
|
|
|
class RendererFactory |
|
9
|
|
|
{ |
|
10
|
|
|
protected $twigEngine; |
|
11
|
|
|
protected $router; |
|
12
|
|
|
protected $themeCss; |
|
13
|
|
|
protected $themeJs; |
|
14
|
|
|
protected $pageDivStyle; |
|
15
|
|
|
protected $jqGridJs; |
|
16
|
|
|
protected $jqGridCss; |
|
17
|
|
|
protected $dataTablesCss; |
|
18
|
|
|
protected $dataTablesJs; |
|
19
|
|
|
protected $jQuery; |
|
20
|
|
|
protected $purl; |
|
21
|
|
|
|
|
22
|
|
|
public function __construct( |
|
23
|
|
|
TwigEngine $twigEngine, |
|
24
|
|
|
Router $router, |
|
25
|
|
|
array $config |
|
26
|
|
|
) { |
|
27
|
|
|
$this->twigEngine = $twigEngine; |
|
28
|
|
|
$this->router = $router; |
|
29
|
|
|
$this->themeCss = $config['theme.css']; |
|
30
|
|
|
$this->themeJs = $config['theme.js']; |
|
31
|
|
|
$this->pageDivStyle = $config['page_div_style']; |
|
32
|
|
|
$this->jQuery = $config['jquery']; |
|
33
|
|
|
$this->purl = $config['purl']; |
|
34
|
|
|
$this->dataTablesCss = $config['datatables.css']; |
|
35
|
|
|
$this->dataTablesJs = $config['datatables.js']; |
|
36
|
|
|
$this->jqGridCss = $config['jq_grid.css']; |
|
37
|
|
|
$this->jqGridJs = $config['jq_grid.js']; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Creates a new renderer of type $type, throws an exception if it's not known how to create a renderer of type $type. |
|
42
|
|
|
* |
|
43
|
|
|
* @param $type |
|
44
|
|
|
* |
|
45
|
|
|
* @return AbstractRenderer |
|
46
|
|
|
*/ |
|
47
|
|
|
public function create($type) |
|
48
|
|
|
{ |
|
49
|
|
|
switch ($type) { |
|
50
|
|
|
case 'datatables': |
|
51
|
|
|
$renderer = new DataTablesRenderer($this->twigEngine, $this->router); |
|
52
|
|
|
break; |
|
53
|
|
|
case 'jq_grid': |
|
54
|
|
|
$renderer = new JQGridRenderer($this->twigEngine, $this->router); |
|
55
|
|
|
break; |
|
56
|
|
|
case 'table': |
|
57
|
|
|
$renderer = new TableGridRenderer($this->twigEngine, $this->router); |
|
58
|
|
|
break; |
|
59
|
|
|
default: |
|
60
|
|
|
throw new \Exception("No renderer for type '$type''"); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
if (method_exists($renderer, 'setThemeCss')) { |
|
64
|
|
|
$renderer->setThemeCss($this->themeCss); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
if (method_exists($renderer, 'setThemeJs')) { |
|
68
|
|
|
$renderer->setThemeJs($this->themeJs); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
if (method_exists($renderer, 'setJQuery')) { |
|
72
|
|
|
$renderer->setJQuery($this->jQuery); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
if (method_exists($renderer, 'setPurl')) { |
|
76
|
|
|
$renderer->setPurl($this->purl); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
if (method_exists($renderer, 'setPageDivStyle')) { |
|
80
|
|
|
$renderer->setPageDivStyle($this->pageDivStyle); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
if (method_exists($renderer, 'setJqGridCss')) { |
|
84
|
|
|
$renderer->setJqGridCss($this->jqGridCss); |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
if (method_exists($renderer, 'setJqGridJs')) { |
|
88
|
|
|
$renderer->setJqGridJs($this->jqGridJs); |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
if (method_exists($renderer, 'setDataTablesCss')) { |
|
92
|
|
|
$renderer->setDataTablesCss($this->dataTablesCss); |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
if (method_exists($renderer, 'setDataTablesJs')) { |
|
96
|
|
|
$renderer->setDataTablesJs($this->dataTablesJs); |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
return $renderer; |
|
100
|
|
|
} |
|
101
|
|
|
} |
|
102
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths