1
|
|
|
<?php |
2
|
|
|
/*************************************************************************************/ |
3
|
|
|
/* This file is part of the RewriteUrl module for Thelia. */ |
4
|
|
|
/* */ |
5
|
|
|
/* Copyright (c) OpenStudio */ |
6
|
|
|
/* email : [email protected] */ |
7
|
|
|
/* web : http://www.thelia.net */ |
8
|
|
|
/* */ |
9
|
|
|
/* For the full copyright and license information, please view the LICENSE.txt */ |
10
|
|
|
/* file that was distributed with this source code. */ |
11
|
|
|
/*************************************************************************************/ |
12
|
|
|
|
13
|
|
|
namespace RewriteUrl\Controller\Admin; |
14
|
|
|
|
15
|
|
|
use Propel\Runtime\ActiveQuery\Criteria; |
16
|
|
|
use RewriteUrl\Model\RewritingUrlOverride; |
17
|
|
|
use RewriteUrl\Event\RewriteUrlEvent; |
18
|
|
|
use RewriteUrl\Event\RewriteUrlEvents; |
19
|
|
|
use RewriteUrl\Form\AddUrlForm; |
20
|
|
|
use RewriteUrl\Form\ReassignForm; |
21
|
|
|
use RewriteUrl\Form\SetDefaultForm; |
22
|
|
|
use RewriteUrl\RewriteUrl; |
23
|
|
|
use Thelia\Controller\Admin\BaseAdminController; |
24
|
|
|
use Thelia\Core\Security\AccessManager; |
25
|
|
|
use Thelia\Core\Security\Resource\AdminResources; |
26
|
|
|
use Thelia\Core\Translation\Translator; |
27
|
|
|
use Thelia\Form\Exception\FormValidationException; |
28
|
|
|
use Thelia\Model\BrandI18nQuery; |
29
|
|
|
use Thelia\Model\CategoryI18nQuery; |
30
|
|
|
use Thelia\Model\ContentI18nQuery; |
31
|
|
|
use Thelia\Model\FolderI18nQuery; |
32
|
|
|
use Thelia\Model\ProductI18nQuery; |
33
|
|
|
use Thelia\Model\ProductQuery; |
34
|
|
|
use Thelia\Model\RewritingUrl; |
35
|
|
|
use Thelia\Model\RewritingUrlQuery; |
36
|
|
|
use Thelia\Tools\URL; |
37
|
|
|
use Thelia\Log\Tlog; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Class RewriteUrlAdminController |
41
|
|
|
* @package RewriteUrl\Controller\Admin |
42
|
|
|
* @author Vincent Lopes <[email protected]> |
43
|
|
|
* @author Gilles Bourgeat <[email protected]> |
44
|
|
|
*/ |
45
|
|
|
class RewriteUrlAdminController extends BaseAdminController |
46
|
|
|
{ |
47
|
|
|
/** @var array */ |
48
|
|
|
private $correspondence = array( |
49
|
|
|
'brand' => 'brand', |
50
|
|
|
'category' => 'categories', |
51
|
|
|
'content' => 'content', |
52
|
|
|
'folder' => 'folders', |
53
|
|
|
'product' => 'products' |
54
|
|
|
); |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @return mixed |
58
|
|
|
*/ |
59
|
|
|
public function deleteAction() |
60
|
|
|
{ |
61
|
|
|
if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), 'RewriteUrl', AccessManager::DELETE)) { |
62
|
|
|
return $response; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
$id_url = $this->getRequest()->request->get('id_url'); |
66
|
|
|
$rewritingUrl = RewritingUrlQuery::create()->findOneById($id_url); |
67
|
|
|
|
68
|
|
|
if ($rewritingUrl !== null) { |
69
|
|
|
$event = new RewriteUrlEvent($rewritingUrl); |
70
|
|
|
$this->getDispatcher()->dispatch(RewriteUrlEvents::REWRITEURL_DELETE, $event); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
if (method_exists($this, 'generateSuccessRedirect')) { |
74
|
|
|
//for 2.1 |
75
|
|
|
return $this->generateRedirectFromRoute( |
76
|
|
|
'admin.'.$this->correspondence[$rewritingUrl->getView()].'.update', |
77
|
|
|
[ |
78
|
|
|
$rewritingUrl->getView().'_id'=>$rewritingUrl->getViewId(), |
79
|
|
|
'current_tab' => 'modules' |
80
|
|
|
], |
81
|
|
|
[ |
82
|
|
|
$rewritingUrl->getView().'_id'=>$rewritingUrl->getViewId() |
83
|
|
|
] |
84
|
|
|
); |
85
|
|
|
} else { |
86
|
|
|
//for 2.0 |
87
|
|
|
$this->redirectToRoute( |
88
|
|
|
'admin.'.$this->correspondence[$rewritingUrl->getView()].'.update', |
89
|
|
|
[ |
90
|
|
|
$rewritingUrl->getView().'_id'=>$rewritingUrl->getViewId(), |
91
|
|
|
'current_tab' => 'modules' |
92
|
|
|
], |
93
|
|
|
[ |
94
|
|
|
$rewritingUrl->getView().'_id'=>$rewritingUrl->getViewId() |
95
|
|
|
] |
96
|
|
|
); |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @return mixed |
102
|
|
|
*/ |
103
|
|
|
public function addAction() |
104
|
|
|
{ |
105
|
|
|
$message = null; |
106
|
|
|
$exception = null; |
107
|
|
|
|
108
|
|
|
if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), 'RewriteUrl', AccessManager::CREATE)) { |
109
|
|
|
return $response; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
$addForm = new AddUrlForm($this->getRequest()); |
113
|
|
|
|
114
|
|
|
try { |
115
|
|
|
$form = $this->validateForm($addForm); |
116
|
|
|
$data = $form->getData($form); |
117
|
|
|
|
118
|
|
|
$findExist = RewritingUrlQuery::create()->findOneByUrl(($data['url'])); |
119
|
|
|
|
120
|
|
|
if ($findExist !== null && !in_array($findExist->getView(), RewriteUrl::getUnknownSources()) && $findExist->getView() !== '') { |
121
|
|
|
$url = $this->generateUrlByRewritingUrl($findExist); |
122
|
|
|
|
123
|
|
|
throw new \Exception( |
124
|
|
|
Translator::getInstance()->trans( |
125
|
|
|
"This url is already used here %url.", |
126
|
|
|
['%url' => '<a href="' . $url . '">' . $url . '</a>'], |
127
|
|
|
RewriteUrl::MODULE_DOMAIN |
128
|
|
|
) |
129
|
|
|
); |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
$rewriting = $findExist !== null ? $findExist : new RewritingUrlOverride(); |
133
|
|
|
$rewriting->setUrl($data['url']) |
134
|
|
|
->setView($data['view']) |
135
|
|
|
->setViewId($data['view-id']) |
136
|
|
|
->setViewLocale($data['locale']); |
137
|
|
|
|
138
|
|
|
$rewriteDefault = RewritingUrlQuery::create() |
139
|
|
|
->filterByView($rewriting->getView()) |
140
|
|
|
->filterByViewId($rewriting->getViewId()) |
141
|
|
|
->filterByViewLocale($rewriting->getViewLocale()) |
142
|
|
|
->findOneByRedirected(null); |
143
|
|
|
|
144
|
|
|
if ($data['default'] == 1) { |
145
|
|
|
$rewriting->setRedirected(null); |
146
|
|
|
} else { |
147
|
|
|
if ($rewriteDefault !== null) { |
148
|
|
|
$rewriting->setRedirected($rewriteDefault->getId()); |
149
|
|
|
} else { |
150
|
|
|
$rewriting->setRedirected(null); |
151
|
|
|
} |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
$this->getDispatcher()->dispatch( |
155
|
|
|
RewriteUrlEvents::REWRITEURL_ADD, |
156
|
|
|
new RewriteUrlEvent($rewriting) |
157
|
|
|
); |
158
|
|
|
|
159
|
|
|
if (method_exists($this, 'generateSuccessRedirect')) { |
160
|
|
|
//for 2.1 |
161
|
|
|
return $this->generateSuccessRedirect($addForm); |
162
|
|
|
} else { |
163
|
|
|
//for 2.0 |
164
|
|
|
$this->redirectSuccess($addForm); |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
} catch (FormValidationException $exception) { |
168
|
|
|
$message = $this->createStandardFormValidationErrorMessage($exception); |
169
|
|
|
} catch (\Exception $exception) { |
170
|
|
|
$message = $exception->getMessage(); |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
if ($message !== null && $exception !== null) { |
174
|
|
|
Tlog::getInstance()->error(sprintf("Error during order delivery process : %s. Exception was %s", $message, $exception->getMessage())); |
175
|
|
|
|
176
|
|
|
$addForm->setErrorMessage($message); |
177
|
|
|
|
178
|
|
|
$this->getParserContext() |
179
|
|
|
->addForm($addForm) |
180
|
|
|
->setGeneralError($message) |
181
|
|
|
; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
if (method_exists($this, 'generateSuccessRedirect')) { |
185
|
|
|
//for 2.1 |
186
|
|
|
return $this->generateSuccessRedirect($addForm); |
187
|
|
|
} else { |
188
|
|
|
//for 2.0 |
189
|
|
|
$this->redirectSuccess($addForm); |
190
|
|
|
} |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* @return mixed |
195
|
|
|
*/ |
196
|
|
|
public function setDefaultAction() |
197
|
|
|
{ |
198
|
|
|
$message = false; |
199
|
|
|
|
200
|
|
|
if (null !== $response = $this->checkAuth(AdminResources::MODULE, 'RewriteUrl', AccessManager::UPDATE)) { |
201
|
|
|
return $response; |
202
|
|
|
} |
203
|
|
|
|
204
|
|
|
$setDefaultForm = new SetDefaultForm($this->getRequest()); |
205
|
|
|
|
206
|
|
|
try { |
207
|
|
|
$form = $this->validateForm($setDefaultForm); |
208
|
|
|
$data = $form->getData($form); |
209
|
|
|
|
210
|
|
|
$rewritingUrl = RewritingUrlQuery::create()->findOneById($data['rewrite-id']); |
211
|
|
|
$newEvent = new RewriteUrlEvent($rewritingUrl); |
212
|
|
|
$this->getDispatcher()->dispatch(RewriteUrlEvents::REWRITEURL_SET_DEFAULT, $newEvent); |
213
|
|
|
} catch (FormValidationException $e) { |
214
|
|
|
$message = $this->createStandardFormValidationErrorMessage($e); |
215
|
|
|
} catch (\Exception $e) { |
216
|
|
|
$message = $e->getMessage(); |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
if ($message !== false) { |
220
|
|
|
$setDefaultForm->setErrorMessage($message); |
221
|
|
|
|
222
|
|
|
$this->getParserContext() |
223
|
|
|
->addForm($setDefaultForm) |
224
|
|
|
->setGeneralError($message) |
225
|
|
|
; |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
if (method_exists($this, 'generateSuccessRedirect')) { |
229
|
|
|
//for 2.1 |
230
|
|
|
return $this->generateSuccessRedirect($setDefaultForm); |
231
|
|
|
} else { |
232
|
|
|
//for 2.0 |
233
|
|
|
$this->redirectSuccess($setDefaultForm); |
234
|
|
|
} |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* @return mixed |
239
|
|
|
*/ |
240
|
|
|
public function reassignAction() |
241
|
|
|
{ |
242
|
|
|
$message = false; |
243
|
|
|
if (null !== $response = $this->checkAuth(AdminResources::MODULE, 'RewriteUrl', AccessManager::UPDATE)) { |
244
|
|
|
return $response; |
245
|
|
|
} |
246
|
|
|
|
247
|
|
|
$reassignForm = new ReassignForm($this->getRequest()); |
248
|
|
|
|
249
|
|
|
try { |
250
|
|
|
$form = $this->validateForm($reassignForm); |
251
|
|
|
$data = $form->getData($form); |
252
|
|
|
|
253
|
|
|
$all = $data['all']; |
254
|
|
|
$newRewrite = explode('::', $data['select-reassign']); |
255
|
|
|
$rewriteId = $data['rewrite-id']; |
256
|
|
|
$newView = $newRewrite[1]; |
257
|
|
|
$newViewId = $newRewrite[0]; |
258
|
|
|
|
259
|
|
|
if ($all === 1) { |
260
|
|
|
self::allReassign($rewriteId, $newView, $newViewId); |
261
|
|
|
} else { |
262
|
|
|
self::simpleReassign($rewriteId, $newView, $newViewId); |
263
|
|
|
} |
264
|
|
|
|
265
|
|
|
if (method_exists($this, 'generateSuccessRedirect')) { |
266
|
|
|
//for 2.1 |
267
|
|
|
return $this->generateSuccessRedirect($reassignForm); |
268
|
|
|
} else { |
269
|
|
|
//for 2.0 |
270
|
|
|
$this->redirectSuccess($reassignForm); |
271
|
|
|
} |
272
|
|
|
} catch (FormValidationException $e) { |
273
|
|
|
$message = $this->createStandardFormValidationErrorMessage($e); |
274
|
|
|
} catch (\Exception $e) { |
275
|
|
|
$message = $e->getMessage(); |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
if ($message !== false) { |
279
|
|
|
$reassignForm->setErrorMessage($message); |
280
|
|
|
|
281
|
|
|
$this->getParserContext() |
282
|
|
|
->addForm($reassignForm) |
283
|
|
|
->setGeneralError($message) |
284
|
|
|
; |
285
|
|
|
} |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
/** |
289
|
|
|
* @param int $rewriteId |
290
|
|
|
* @param string $newView |
291
|
|
|
* @param int $newViewId |
292
|
|
|
*/ |
293
|
|
|
protected function allReassign($rewriteId, $newView, $newViewId) |
294
|
|
|
{ |
295
|
|
|
$origin = RewritingUrlQuery::create()->findOneById($rewriteId); |
296
|
|
|
|
297
|
|
|
$rewrites = RewritingUrlQuery::create() |
298
|
|
|
->filterByView($origin->getView()) |
299
|
|
|
->filterByViewId($origin->getViewId()) |
300
|
|
|
->find(); |
301
|
|
|
|
302
|
|
|
/** @var RewritingUrl $rewrite */ |
303
|
|
|
foreach ($rewrites as $rewrite) { |
304
|
|
|
$destination = RewritingUrlQuery::create() |
305
|
|
|
->filterByView($newView) |
306
|
|
|
->filterByViewId($newViewId) |
307
|
|
|
->filterByViewLocale($rewrite->getViewLocale()) |
308
|
|
|
->filterByRedirected(null) |
309
|
|
|
->findOne(); |
310
|
|
|
|
311
|
|
|
$rewrite |
312
|
|
|
->setView($newView) |
313
|
|
|
->setViewId($newViewId) |
314
|
|
|
->setRedirected(($destination === null) ? null : $destination->getId()); |
315
|
|
|
|
316
|
|
|
$this->getDispatcher()->dispatch( |
317
|
|
|
RewriteUrlEvents::REWRITEURL_UPDATE, |
318
|
|
|
new RewriteUrlEvent($rewrite) |
319
|
|
|
); |
320
|
|
|
} |
321
|
|
|
} |
322
|
|
|
|
323
|
|
|
/** |
324
|
|
|
* @param int $rewriteId |
325
|
|
|
* @param string $newView |
326
|
|
|
* @param int $newViewId |
327
|
|
|
*/ |
328
|
|
|
protected function simpleReassign($rewriteId, $newView, $newViewId) |
329
|
|
|
{ |
330
|
|
|
$rewrite = RewritingUrlQuery::create()->findOneById($rewriteId); |
331
|
|
|
|
332
|
|
|
// add new default url |
333
|
|
|
if (null !== $newDefault = RewritingUrlQuery::create()->findOneByRedirected($rewrite->getId())) { |
334
|
|
|
$this->getDispatcher()->dispatch( |
335
|
|
|
RewriteUrlEvents::REWRITEURL_UPDATE, |
336
|
|
|
new RewriteUrlEvent( |
337
|
|
|
$newDefault->setRedirected(null) |
338
|
|
|
) |
339
|
|
|
); |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
//Update urls who redirected to updated URL |
343
|
|
|
if (null !== $isRedirection = RewritingUrlQuery::create()->findByRedirected($rewrite->getId())) { |
344
|
|
|
/** @var \Thelia\Model\RewritingUrl $redirected */ |
345
|
|
|
foreach ($isRedirection as $redirected) { |
346
|
|
|
$this->getDispatcher()->dispatch( |
347
|
|
|
RewriteUrlEvents::REWRITEURL_UPDATE, |
348
|
|
|
new RewriteUrlEvent( |
349
|
|
|
$redirected->setRedirected( |
350
|
|
|
($newDefault !== null) ? $newDefault->getId() : $rewrite->getRedirected() |
351
|
|
|
) |
352
|
|
|
) |
353
|
|
|
); |
354
|
|
|
} |
355
|
|
|
} |
356
|
|
|
|
357
|
|
|
$rewrite->setView($newView) |
358
|
|
|
->setViewId($newViewId); |
359
|
|
|
|
360
|
|
|
//Check if default url already exist for the view with the locale |
361
|
|
|
$rewriteDefault = RewritingUrlQuery::create() |
362
|
|
|
->filterByView($newView) |
363
|
|
|
->filterByViewId($newViewId) |
364
|
|
|
->filterByViewLocale($rewrite->getViewLocale()) |
365
|
|
|
->findOneByRedirected(null); |
366
|
|
|
|
367
|
|
|
if ($rewriteDefault !== null) { |
368
|
|
|
$rewrite->setRedirected($rewriteDefault->getId()); |
369
|
|
|
} else { |
370
|
|
|
$rewrite->setRedirected(null); |
371
|
|
|
} |
372
|
|
|
|
373
|
|
|
$event = new RewriteUrlEvent($rewrite); |
374
|
|
|
$this->getDispatcher()->dispatch(RewriteUrlEvents::REWRITEURL_UPDATE, $event); |
375
|
|
|
} |
376
|
|
|
|
377
|
|
|
/** |
378
|
|
|
* @return mixed|\Thelia\Core\HttpFoundation\Response |
379
|
|
|
*/ |
380
|
|
|
public function existAction() |
381
|
|
|
{ |
382
|
|
|
if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), 'RewriteUrl', AccessManager::VIEW)) { |
383
|
|
|
return $response; |
384
|
|
|
} |
385
|
|
|
|
386
|
|
|
$search = $this->getRequest()->query->get('q'); |
387
|
|
|
|
388
|
|
|
$rewritingUrl = RewritingUrlQuery::create() |
389
|
|
|
->filterByView(RewriteUrl::getUnknownSources(), Criteria::NOT_IN) |
390
|
|
|
->findOneByUrl($search); |
391
|
|
|
|
392
|
|
|
if ($rewritingUrl !== null) { |
393
|
|
|
if (!in_array($rewritingUrl->getView(), $this->correspondence)) { |
394
|
|
|
return $this->jsonResponse(json_encode(false)); |
395
|
|
|
} |
396
|
|
|
|
397
|
|
|
$rewritingUrlArray = ["reassignUrl" => $this->generateUrlByRewritingUrl($rewritingUrl)]; |
398
|
|
|
|
399
|
|
|
return $this->jsonResponse(json_encode($rewritingUrlArray)); |
400
|
|
|
} else { |
401
|
|
|
return $this->jsonResponse(json_encode(false)); |
402
|
|
|
} |
403
|
|
|
} |
404
|
|
|
|
405
|
|
|
/** |
406
|
|
|
* @return mixed|\Thelia\Core\HttpFoundation\Response |
407
|
|
|
* @throws \Propel\Runtime\Exception\PropelException |
408
|
|
|
*/ |
409
|
|
|
public function searchAction() |
410
|
|
|
{ |
411
|
|
|
if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), 'RewriteUrl', AccessManager::VIEW)) { |
412
|
|
|
return $response; |
413
|
|
|
} |
414
|
|
|
|
415
|
|
|
$search = '%'.$this->getRequest()->query->get('q').'%'; |
416
|
|
|
|
417
|
|
|
$resultArray = array(); |
418
|
|
|
|
419
|
|
|
$categoriesI18n = CategoryI18nQuery::create()->filterByTitle($search)->limit(10); |
420
|
|
|
$contentsI18n = ContentI18nQuery::create()->filterByTitle($search)->limit(10); |
421
|
|
|
$foldersI18n = FolderI18nQuery::create()->filterByTitle($search)->limit(10); |
422
|
|
|
$brandsI18n = BrandI18nQuery::create()->filterByTitle($search)->limit(10); |
423
|
|
|
|
424
|
|
|
$productsI18n = ProductI18nQuery::create()->filterByTitle($search)->limit(10); |
425
|
|
|
$productsRef = ProductQuery::create()->filterByRef($search)->limit(10); |
426
|
|
|
|
427
|
|
|
/** @var \Thelia\Model\CategoryI18n $categoryI18n */ |
428
|
|
|
foreach ($categoriesI18n as $categoryI18n) { |
429
|
|
|
$category = $categoryI18n->getCategory(); |
430
|
|
|
$resultArray['category'][$category->getId()] = $categoryI18n->getTitle(); |
431
|
|
|
} |
432
|
|
|
|
433
|
|
|
/** @var \Thelia\Model\ContentI18n $contentI18n */ |
434
|
|
|
foreach ($contentsI18n as $contentI18n) { |
435
|
|
|
$content = $contentI18n->getContent(); |
436
|
|
|
$resultArray['content'][$content->getId()] = $contentI18n->getTitle(); |
437
|
|
|
} |
438
|
|
|
|
439
|
|
|
/** @var \Thelia\Model\FolderI18n $folderI18n */ |
440
|
|
|
foreach ($foldersI18n as $folderI18n) { |
441
|
|
|
$folder = $folderI18n->getFolder(); |
442
|
|
|
$resultArray['folder'][$folder->getId()] = $folderI18n->getTitle(); |
443
|
|
|
} |
444
|
|
|
|
445
|
|
|
/** @var \Thelia\Model\BrandI18n $brandI18n */ |
446
|
|
|
foreach ($brandsI18n as $brandI18n) { |
447
|
|
|
$brand = $brandI18n->getBrand(); |
448
|
|
|
$resultArray['brand'][$brand->getId()] = $brandI18n->getTitle(); |
449
|
|
|
} |
450
|
|
|
|
451
|
|
|
/** @var \Thelia\Model\ProductI18n $productI18n */ |
452
|
|
|
foreach ($productsI18n as $productI18n) { |
453
|
|
|
$product = $productI18n->getProduct(); |
454
|
|
|
$resultArray['product'][$product->getId()] = $product->getRef().' : '.$productI18n->getTitle(); |
455
|
|
|
} |
456
|
|
|
|
457
|
|
|
/** @var \Thelia\Model\Product $product */ |
458
|
|
|
foreach ($productsRef as $product) { |
459
|
|
|
$productI18n = ProductI18nQuery::create()->filterByProduct($product)->findOne(); |
460
|
|
|
$resultArray['product'][$product->getId()] = $productI18n->getTitle(); |
461
|
|
|
} |
462
|
|
|
|
463
|
|
|
return $this->jsonResponse(json_encode($resultArray)); |
464
|
|
|
} |
465
|
|
|
|
466
|
|
|
/** |
467
|
|
|
* @param RewritingUrl $rewritingUrl |
468
|
|
|
* @return null|string url |
469
|
|
|
*/ |
470
|
|
|
protected function generateUrlByRewritingUrl(RewritingUrl $rewritingUrl) |
471
|
|
|
{ |
472
|
|
|
if (isset($this->correspondence[$rewritingUrl->getView()])) { |
473
|
|
|
$route = $this->getRoute( |
474
|
|
|
"admin.".$this->correspondence[$rewritingUrl->getView()] . ".update", |
475
|
|
|
[$rewritingUrl->getView().'_id' => $rewritingUrl->getViewId()] |
476
|
|
|
); |
477
|
|
|
return URL::getInstance()->absoluteUrl( |
478
|
|
|
$route, |
479
|
|
|
[$rewritingUrl->getView().'_id' => $rewritingUrl->getViewId(), 'current_tab' => 'modules'] |
480
|
|
|
); |
481
|
|
|
} |
482
|
|
|
|
483
|
|
|
return null; |
484
|
|
|
} |
485
|
|
|
} |
486
|
|
|
|