@@ -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,15 +72,15 @@ 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 ); |
|
| 77 | + $cntl = $this->createClient($request, $site, $resource); |
|
| 78 | 78 | |
| 79 | - if( ( $html = $cntl->copy() ) == '' ) { |
|
| 79 | + if (($html = $cntl->copy()) == '') { |
|
| 80 | 80 | return $cntl->getView()->response(); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - return $this->getHtml( $html ); |
|
| 83 | + return $this->getHtml($html); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | |
@@ -92,15 +92,15 @@ discard block |
||
| 92 | 92 | * @param string $site Unique site code |
| 93 | 93 | * @return Response Generated output |
| 94 | 94 | */ |
| 95 | - public function createAction( Request $request, $resource, $site = 'default' ) |
|
| 95 | + public function createAction(Request $request, $resource, $site = 'default') |
|
| 96 | 96 | { |
| 97 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
| 97 | + $cntl = $this->createClient($request, $site, $resource); |
|
| 98 | 98 | |
| 99 | - if( ( $html = $cntl->create() ) == '' ) { |
|
| 99 | + if (($html = $cntl->create()) == '') { |
|
| 100 | 100 | return $cntl->getView()->response(); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - return $this->getHtml( $html ); |
|
| 103 | + return $this->getHtml($html); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -112,15 +112,15 @@ discard block |
||
| 112 | 112 | * @param string $site Unique site code |
| 113 | 113 | * @return Response Generated output |
| 114 | 114 | */ |
| 115 | - public function deleteAction( Request $request, $resource, $site = 'default' ) |
|
| 115 | + public function deleteAction(Request $request, $resource, $site = 'default') |
|
| 116 | 116 | { |
| 117 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
| 117 | + $cntl = $this->createClient($request, $site, $resource); |
|
| 118 | 118 | |
| 119 | - if( ( $html = $cntl->delete() ) == '' ) { |
|
| 119 | + if (($html = $cntl->delete()) == '') { |
|
| 120 | 120 | return $cntl->getView()->response(); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - return $this->getHtml( $html ); |
|
| 123 | + return $this->getHtml($html); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
@@ -132,15 +132,15 @@ discard block |
||
| 132 | 132 | * @param string $site Unique site code |
| 133 | 133 | * @return Response Generated output |
| 134 | 134 | */ |
| 135 | - public function exportAction( Request $request, $resource, $site = 'default' ) |
|
| 135 | + public function exportAction(Request $request, $resource, $site = 'default') |
|
| 136 | 136 | { |
| 137 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
| 137 | + $cntl = $this->createClient($request, $site, $resource); |
|
| 138 | 138 | |
| 139 | - if( ( $html = $cntl->export() ) == '' ) { |
|
| 139 | + if (($html = $cntl->export()) == '') { |
|
| 140 | 140 | return $cntl->getView()->response(); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - return $this->getHtml( $html ); |
|
| 143 | + return $this->getHtml($html); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | |
@@ -152,15 +152,15 @@ discard block |
||
| 152 | 152 | * @param string $site Unique site code |
| 153 | 153 | * @return Response Generated output |
| 154 | 154 | */ |
| 155 | - public function getAction( Request $request, $resource, $site = 'default' ) |
|
| 155 | + public function getAction(Request $request, $resource, $site = 'default') |
|
| 156 | 156 | { |
| 157 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
| 157 | + $cntl = $this->createClient($request, $site, $resource); |
|
| 158 | 158 | |
| 159 | - if( ( $html = $cntl->get() ) == '' ) { |
|
| 159 | + if (($html = $cntl->get()) == '') { |
|
| 160 | 160 | return $cntl->getView()->response(); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - return $this->getHtml( $html ); |
|
| 163 | + return $this->getHtml($html); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | |
@@ -172,15 +172,15 @@ discard block |
||
| 172 | 172 | * @param string $site Unique site code |
| 173 | 173 | * @return Response Generated output |
| 174 | 174 | */ |
| 175 | - public function saveAction( Request $request, $resource, $site = 'default' ) |
|
| 175 | + public function saveAction(Request $request, $resource, $site = 'default') |
|
| 176 | 176 | { |
| 177 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
| 177 | + $cntl = $this->createClient($request, $site, $resource); |
|
| 178 | 178 | |
| 179 | - if( ( $html = $cntl->save() ) == '' ) { |
|
| 179 | + if (($html = $cntl->save()) == '') { |
|
| 180 | 180 | return $cntl->getView()->response(); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - return $this->getHtml( $html ); |
|
| 183 | + return $this->getHtml($html); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | |
@@ -192,15 +192,15 @@ discard block |
||
| 192 | 192 | * @param string $site Unique site code |
| 193 | 193 | * @return Response Generated output |
| 194 | 194 | */ |
| 195 | - public function searchAction( Request $request, $resource, $site = 'default' ) |
|
| 195 | + public function searchAction(Request $request, $resource, $site = 'default') |
|
| 196 | 196 | { |
| 197 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
| 197 | + $cntl = $this->createClient($request, $site, $resource); |
|
| 198 | 198 | |
| 199 | - if( ( $html = $cntl->search() ) == '' ) { |
|
| 199 | + if (($html = $cntl->search()) == '') { |
|
| 200 | 200 | return $cntl->getView()->response(); |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - return $this->getHtml( $html ); |
|
| 203 | + return $this->getHtml($html); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | |
@@ -212,26 +212,26 @@ discard block |
||
| 212 | 212 | * @param string $resource Resource location, e.g. "product" |
| 213 | 213 | * @return \Aimeos\Admin\JQAdm\Iface Context item |
| 214 | 214 | */ |
| 215 | - protected function createClient( Request $request, $site, $resource ) |
|
| 215 | + protected function createClient(Request $request, $site, $resource) |
|
| 216 | 216 | { |
| 217 | - $lang = $request->get( 'lang', 'en' ); |
|
| 217 | + $lang = $request->get('lang', 'en'); |
|
| 218 | 218 | |
| 219 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
| 220 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' ); |
|
| 219 | + $aimeos = $this->get('aimeos')->get(); |
|
| 220 | + $templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates'); |
|
| 221 | 221 | |
| 222 | - $context = $this->get( 'aimeos_context' )->get( false, 'backend' ); |
|
| 223 | - $context->setI18n( $this->get( 'aimeos_i18n' )->get( array( $lang, 'en' ) ) ); |
|
| 224 | - $context->setLocale( $this->get( 'aimeos_locale' )->getBackend( $context, $site ) ); |
|
| 222 | + $context = $this->get('aimeos_context')->get(false, 'backend'); |
|
| 223 | + $context->setI18n($this->get('aimeos_i18n')->get(array($lang, 'en'))); |
|
| 224 | + $context->setLocale($this->get('aimeos_locale')->getBackend($context, $site)); |
|
| 225 | 225 | |
| 226 | - $view = $this->get( 'aimeos_view' )->create( $context, $templatePaths, $lang ); |
|
| 226 | + $view = $this->get('aimeos_view')->create($context, $templatePaths, $lang); |
|
| 227 | 227 | |
| 228 | 228 | $view->aimeosType = 'Symfony'; |
| 229 | - $view->aimeosVersion = $this->get( 'aimeos' )->getVersion(); |
|
| 230 | - $view->aimeosExtensions = implode( ',', $this->get( 'aimeos' )->get()->getExtensions() ); |
|
| 229 | + $view->aimeosVersion = $this->get('aimeos')->getVersion(); |
|
| 230 | + $view->aimeosExtensions = implode(',', $this->get('aimeos')->get()->getExtensions()); |
|
| 231 | 231 | |
| 232 | - $context->setView( $view ); |
|
| 232 | + $context->setView($view); |
|
| 233 | 233 | |
| 234 | - return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $aimeos, $resource ); |
|
| 234 | + return \Aimeos\Admin\JQAdm\Factory::createClient($context, $aimeos, $resource); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | |
@@ -241,8 +241,8 @@ discard block |
||
| 241 | 241 | * @param string $content Content from admin client |
| 242 | 242 | * @return Response View for rendering the output |
| 243 | 243 | */ |
| 244 | - protected function getHtml( $content ) |
|
| 244 | + protected function getHtml($content) |
|
| 245 | 245 | { |
| 246 | - return $this->render( 'AimeosShopBundle:Jqadm:index.html.twig', array( 'content' => $content ) ); |
|
| 246 | + return $this->render('AimeosShopBundle:Jqadm:index.html.twig', array('content' => $content)); |
|
| 247 | 247 | } |
| 248 | 248 | } |