@@ -29,35 +29,35 @@ discard block |
||
29 | 29 | * @param $type File type, i.e. "css" or "js" |
30 | 30 | * @return Response Response object |
31 | 31 | */ |
32 | - public function fileAction( $type ) |
|
32 | + public function fileAction($type) |
|
33 | 33 | { |
34 | 34 | $contents = ''; |
35 | 35 | $files = array(); |
36 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
36 | + $aimeos = $this->get('aimeos')->get(); |
|
37 | 37 | |
38 | - foreach( $aimeos->getCustomPaths( 'admin/jqadm' ) as $base => $paths ) |
|
38 | + foreach ($aimeos->getCustomPaths('admin/jqadm') as $base => $paths) |
|
39 | 39 | { |
40 | - foreach( $paths as $path ) |
|
40 | + foreach ($paths as $path) |
|
41 | 41 | { |
42 | - $jsbAbsPath = $base . '/' . $path; |
|
43 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
44 | - $files = array_merge( $files, $jsb2->getFiles( $type ) ); |
|
42 | + $jsbAbsPath = $base.'/'.$path; |
|
43 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
44 | + $files = array_merge($files, $jsb2->getFiles($type)); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | - foreach( $files as $file ) |
|
48 | + foreach ($files as $file) |
|
49 | 49 | { |
50 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
50 | + if (($content = file_get_contents($file)) !== false) { |
|
51 | 51 | $contents .= $content; |
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | - $response = new Response( $contents ); |
|
55 | + $response = new Response($contents); |
|
56 | 56 | |
57 | - if( $type === 'js' ) { |
|
58 | - $response->headers->set( 'Content-Type', 'application/javascript' ); |
|
59 | - } elseif( $type === 'css' ) { |
|
60 | - $response->headers->set( 'Content-Type', 'text/css' ); |
|
57 | + if ($type === 'js') { |
|
58 | + $response->headers->set('Content-Type', 'application/javascript'); |
|
59 | + } elseif ($type === 'css') { |
|
60 | + $response->headers->set('Content-Type', 'text/css'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return $response; |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | * @param string $site Unique site code |
73 | 73 | * @return Response Generated output |
74 | 74 | */ |
75 | - public function copyAction( Request $request, $resource, $site = 'default' ) |
|
75 | + public function copyAction(Request $request, $resource, $site = 'default') |
|
76 | 76 | { |
77 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
78 | - return $this->getHtml( $cntl->copy() ); |
|
77 | + $cntl = $this->createClient($request, $site, $resource); |
|
78 | + return $this->getHtml($cntl->copy()); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | * @param string $site Unique site code |
88 | 88 | * @return Response Generated output |
89 | 89 | */ |
90 | - public function createAction( Request $request, $resource, $site = 'default' ) |
|
90 | + public function createAction(Request $request, $resource, $site = 'default') |
|
91 | 91 | { |
92 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
93 | - return $this->getHtml( $cntl->create() ); |
|
92 | + $cntl = $this->createClient($request, $site, $resource); |
|
93 | + return $this->getHtml($cntl->create()); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | * @param string $site Unique site code |
103 | 103 | * @return Response Generated output |
104 | 104 | */ |
105 | - public function deleteAction( Request $request, $resource, $site = 'default' ) |
|
105 | + public function deleteAction(Request $request, $resource, $site = 'default') |
|
106 | 106 | { |
107 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
108 | - return $this->getHtml( $cntl->delete() . $cntl->search() ); |
|
107 | + $cntl = $this->createClient($request, $site, $resource); |
|
108 | + return $this->getHtml($cntl->delete().$cntl->search()); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | * @param string $site Unique site code |
118 | 118 | * @return Response Generated output |
119 | 119 | */ |
120 | - public function getAction( Request $request, $resource, $site = 'default' ) |
|
120 | + public function getAction(Request $request, $resource, $site = 'default') |
|
121 | 121 | { |
122 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
123 | - return $this->getHtml( $cntl->get() ); |
|
122 | + $cntl = $this->createClient($request, $site, $resource); |
|
123 | + return $this->getHtml($cntl->get()); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -132,10 +132,10 @@ discard block |
||
132 | 132 | * @param string $site Unique site code |
133 | 133 | * @return Response Generated output |
134 | 134 | */ |
135 | - public function saveAction( Request $request, $resource, $site = 'default' ) |
|
135 | + public function saveAction(Request $request, $resource, $site = 'default') |
|
136 | 136 | { |
137 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
138 | - return $this->getHtml( ( $cntl->save() ? : $cntl->search() ) ); |
|
137 | + $cntl = $this->createClient($request, $site, $resource); |
|
138 | + return $this->getHtml(($cntl->save() ?: $cntl->search())); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | * @param string $site Unique site code |
148 | 148 | * @return Response Generated output |
149 | 149 | */ |
150 | - public function searchAction( Request $request, $resource, $site = 'default' ) |
|
150 | + public function searchAction(Request $request, $resource, $site = 'default') |
|
151 | 151 | { |
152 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
153 | - return $this->getHtml( $cntl->search() ); |
|
152 | + $cntl = $this->createClient($request, $site, $resource); |
|
153 | + return $this->getHtml($cntl->search()); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -162,21 +162,21 @@ discard block |
||
162 | 162 | * @param string $resource Resource location, e.g. "product" |
163 | 163 | * @return \Aimeos\Admin\JQAdm\Iface Context item |
164 | 164 | */ |
165 | - protected function createClient( Request $request, $site, $resource ) |
|
165 | + protected function createClient(Request $request, $site, $resource) |
|
166 | 166 | { |
167 | - $lang = $request->get( 'lang', 'en' ); |
|
167 | + $lang = $request->get('lang', 'en'); |
|
168 | 168 | |
169 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
170 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' ); |
|
169 | + $aimeos = $this->get('aimeos')->get(); |
|
170 | + $templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates'); |
|
171 | 171 | |
172 | - $context = $this->get( 'aimeos_context' )->get( false, 'backend' ); |
|
173 | - $context->setI18n( $this->get( 'aimeos_i18n' )->get( array( $lang, 'en' ) ) ); |
|
174 | - $context->setLocale( $this->get( 'aimeos_locale' )->getBackend( $context, $site ) ); |
|
172 | + $context = $this->get('aimeos_context')->get(false, 'backend'); |
|
173 | + $context->setI18n($this->get('aimeos_i18n')->get(array($lang, 'en'))); |
|
174 | + $context->setLocale($this->get('aimeos_locale')->getBackend($context, $site)); |
|
175 | 175 | |
176 | - $view = $this->get( 'aimeos_view' )->create( $context, $templatePaths, $lang ); |
|
177 | - $context->setView( $view ); |
|
176 | + $view = $this->get('aimeos_view')->create($context, $templatePaths, $lang); |
|
177 | + $context->setView($view); |
|
178 | 178 | |
179 | - return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource )->setAimeos( $aimeos ); |
|
179 | + return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource)->setAimeos($aimeos); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -186,12 +186,12 @@ discard block |
||
186 | 186 | * @param string $content Content from admin client |
187 | 187 | * @return Response View for rendering the output |
188 | 188 | */ |
189 | - protected function getHtml( $content ) |
|
189 | + protected function getHtml($content) |
|
190 | 190 | { |
191 | - $version = $this->get( 'aimeos' )->getVersion(); |
|
192 | - $extnames = implode( ',', $this->get( 'aimeos' )->get()->getExtensions() ); |
|
193 | - $content = str_replace( ['{type}', '{version}', '{extensions}'], ['Symfony', $version, $extnames], $content ); |
|
191 | + $version = $this->get('aimeos')->getVersion(); |
|
192 | + $extnames = implode(',', $this->get('aimeos')->get()->getExtensions()); |
|
193 | + $content = str_replace(['{type}', '{version}', '{extensions}'], ['Symfony', $version, $extnames], $content); |
|
194 | 194 | |
195 | - return $this->render( 'AimeosShopBundle:Jqadm:index.html.twig', array( 'content' => $content ) ); |
|
195 | + return $this->render('AimeosShopBundle:Jqadm:index.html.twig', array('content' => $content)); |
|
196 | 196 | } |
197 | 197 | } |