| @@ 172-192 (lines=21) @@ | ||
| 169 | ||
| 170 | // ユーザーが作ったブロックのみ削除する |
|
| 171 | // テンプレートが変更されていた場合、DBからはブロック削除されるがtwigファイルは残る |
|
| 172 | if ($Block->getDeletableFlg() > 0) { |
|
| 173 | $tplDir = $app['config']['block_realdir']; |
|
| 174 | $file = $tplDir . '/' . $Block->getFileName() . '.twig'; |
|
| 175 | $fs = new Filesystem(); |
|
| 176 | if ($fs->exists($file)) { |
|
| 177 | $fs->remove($file); |
|
| 178 | } |
|
| 179 | $app['orm.em']->remove($Block); |
|
| 180 | $app['orm.em']->flush(); |
|
| 181 | ||
| 182 | $event = new EventArgs( |
|
| 183 | array( |
|
| 184 | 'Block' => $Block, |
|
| 185 | ), |
|
| 186 | $request |
|
| 187 | ); |
|
| 188 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_CONTENT_BLOCK_DELETE_COMPLETE, $event); |
|
| 189 | ||
| 190 | $app->addSuccess('admin.delete.complete', 'admin'); |
|
| 191 | \Eccube\Util\Cache::clear($app, false); |
|
| 192 | } |
|
| 193 | ||
| 194 | ||
| 195 | return $app->redirect($app->url('admin_content_block')); |
|
| @@ 171-192 (lines=22) @@ | ||
| 168 | } |
|
| 169 | ||
| 170 | // ユーザーが作ったページのみ削除する |
|
| 171 | if ($PageLayout->getEditFlg() == PageLayout::EDIT_FLG_USER) { |
|
| 172 | $templatePath = $app['eccube.repository.page_layout'] |
|
| 173 | ->getWriteTemplatePath($DeviceType, true); |
|
| 174 | $file = $templatePath . '/' . $PageLayout->getFileName() . '.twig'; |
|
| 175 | $fs = new Filesystem(); |
|
| 176 | if ($fs->exists($file)) { |
|
| 177 | $fs->remove($file); |
|
| 178 | } |
|
| 179 | $app['orm.em']->remove($PageLayout); |
|
| 180 | $app['orm.em']->flush(); |
|
| 181 | ||
| 182 | $event = new EventArgs( |
|
| 183 | array( |
|
| 184 | 'DeviceType' => $DeviceType, |
|
| 185 | 'PageLayout' => $PageLayout, |
|
| 186 | ), |
|
| 187 | $request |
|
| 188 | ); |
|
| 189 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_CONTENT_PAGE_DELETE_COMPLETE, $event); |
|
| 190 | ||
| 191 | $app->addSuccess('admin.delete.complete', 'admin'); |
|
| 192 | } |
|
| 193 | ||
| 194 | return $app->redirect($app->url('admin_content_page')); |
|
| 195 | } |
|