| @@ 32-87 (lines=56) @@ | ||
| 29 | use Eccube\Event\EventArgs; |
|
| 30 | use Symfony\Component\HttpFoundation\Request; |
|
| 31 | ||
| 32 | class CustomerAgreementController extends AbstractController |
|
| 33 | { |
|
| 34 | public $form; |
|
| 35 | ||
| 36 | public function __construct() |
|
| 37 | { |
|
| 38 | } |
|
| 39 | ||
| 40 | public function index(Application $app, Request $request) |
|
| 41 | { |
|
| 42 | $Help = $app['eccube.repository.help']->get(); |
|
| 43 | ||
| 44 | $builder = $app['form.factory'] |
|
| 45 | ->createBuilder('customer_agreement', $Help); |
|
| 46 | ||
| 47 | $event = new EventArgs( |
|
| 48 | array( |
|
| 49 | 'builder' => $builder, |
|
| 50 | 'Help' => $Help, |
|
| 51 | ), |
|
| 52 | $request |
|
| 53 | ); |
|
| 54 | ||
| 55 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SHOP_CUSTOMER_AGREEMENT_INDEX_INITIALIZE, $event); |
|
| 56 | $form = $builder->getForm(); |
|
| 57 | ||
| 58 | if ('POST' === $app['request']->getMethod()) { |
|
| 59 | $form->handleRequest($app['request']); |
|
| 60 | if ($form->isValid()) { |
|
| 61 | $Help = $form->getData(); |
|
| 62 | $app['orm.em']->persist($Help); |
|
| 63 | ||
| 64 | $app['orm.em']->flush(); |
|
| 65 | ||
| 66 | $event = new EventArgs( |
|
| 67 | array( |
|
| 68 | 'form' => $form, |
|
| 69 | 'Help' => $Help, |
|
| 70 | ), |
|
| 71 | $request |
|
| 72 | ); |
|
| 73 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SHOP_CUSTOMER_AGREEMENT_INDEX_COMPLETE, $event); |
|
| 74 | ||
| 75 | $app->addSuccess('admin.register.complete', 'admin'); |
|
| 76 | return $app->redirect($app->url('admin_setting_shop_customer_agreement')); |
|
| 77 | } else { |
|
| 78 | $app->addError('admin.register.failed', 'admin'); |
|
| 79 | } |
|
| 80 | } |
|
| 81 | ||
| 82 | return $app->render('Setting/Shop/customer_agreement.twig', array( |
|
| 83 | 'form' => $form->createView(), |
|
| 84 | )); |
|
| 85 | } |
|
| 86 | } |
|
| 87 | ||
| @@ 33-79 (lines=47) @@ | ||
| 30 | use Eccube\Event\EventArgs; |
|
| 31 | use Symfony\Component\HttpFoundation\Request; |
|
| 32 | ||
| 33 | class ShopController extends AbstractController |
|
| 34 | { |
|
| 35 | public function index(Application $app, Request $request) |
|
| 36 | { |
|
| 37 | $BaseInfo = $app['eccube.repository.base_info']->get(); |
|
| 38 | ||
| 39 | $builder = $app['form.factory'] |
|
| 40 | ->createBuilder('shop_master', $BaseInfo); |
|
| 41 | ||
| 42 | $event = new EventArgs( |
|
| 43 | array( |
|
| 44 | 'builder' => $builder, |
|
| 45 | 'BaseInfo' => $BaseInfo, |
|
| 46 | ), |
|
| 47 | $request |
|
| 48 | ); |
|
| 49 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SHOP_SHOP_INDEX_INITIALIZE, $event); |
|
| 50 | ||
| 51 | $form = $builder->getForm(); |
|
| 52 | ||
| 53 | if ($app['request']->getMethod() === 'POST') { |
|
| 54 | $form->handleRequest($app['request']); |
|
| 55 | if ($form->isValid()) { |
|
| 56 | $app['orm.em']->persist($BaseInfo); |
|
| 57 | $app['orm.em']->flush(); |
|
| 58 | ||
| 59 | $event = new EventArgs( |
|
| 60 | array( |
|
| 61 | 'form' => $form, |
|
| 62 | 'BaseInfo' => $BaseInfo, |
|
| 63 | ), |
|
| 64 | $request |
|
| 65 | ); |
|
| 66 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SHOP_SHOP_INDEX_COMPLETE, $event); |
|
| 67 | ||
| 68 | $app->addSuccess('admin.shop.save.complete', 'admin'); |
|
| 69 | ||
| 70 | return $app->redirect($app->url('admin_setting_shop')); |
|
| 71 | } |
|
| 72 | $app->addError('admin.shop.save.error', 'admin'); |
|
| 73 | } |
|
| 74 | ||
| 75 | return $app->render('Setting/Shop/shop_master.twig', array( |
|
| 76 | 'form' => $form->createView(), |
|
| 77 | )); |
|
| 78 | } |
|
| 79 | } |
|
| 80 | ||
| @@ 33-88 (lines=56) @@ | ||
| 30 | use Eccube\Event\EventArgs; |
|
| 31 | use Symfony\Component\HttpFoundation\Request; |
|
| 32 | ||
| 33 | class TradelawController extends AbstractController |
|
| 34 | { |
|
| 35 | public $form; |
|
| 36 | ||
| 37 | public function __construct() |
|
| 38 | { |
|
| 39 | } |
|
| 40 | ||
| 41 | public function index(Application $app, Request $request) |
|
| 42 | { |
|
| 43 | $Help = $app['eccube.repository.help']->get(); |
|
| 44 | ||
| 45 | $builder = $app['form.factory'] |
|
| 46 | ->createBuilder('tradelaw', $Help); |
|
| 47 | ||
| 48 | $event = new EventArgs( |
|
| 49 | array( |
|
| 50 | 'builder' => $builder, |
|
| 51 | 'Help' => $Help, |
|
| 52 | ), |
|
| 53 | $request |
|
| 54 | ); |
|
| 55 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SHOP_TRADE_LAW_INDEX_INITIALIZE, $event); |
|
| 56 | ||
| 57 | $form = $builder->getForm(); |
|
| 58 | ||
| 59 | if ('POST' === $app['request']->getMethod()) { |
|
| 60 | $form->handleRequest($app['request']); |
|
| 61 | if ($form->isValid()) { |
|
| 62 | $Help = $form->getData(); |
|
| 63 | $app['orm.em']->persist($Help); |
|
| 64 | ||
| 65 | $app['orm.em']->flush(); |
|
| 66 | ||
| 67 | $event = new EventArgs( |
|
| 68 | array( |
|
| 69 | 'form' => $form, |
|
| 70 | 'Help' => $Help, |
|
| 71 | ), |
|
| 72 | $request |
|
| 73 | ); |
|
| 74 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SHOP_TRADE_LAW_INDEX_COMPLETE, $event); |
|
| 75 | ||
| 76 | $app->addSuccess('admin.register.complete', 'admin'); |
|
| 77 | ||
| 78 | return $app->redirect($app->url('admin_setting_shop_tradelaw')); |
|
| 79 | } else { |
|
| 80 | $app->addError('admin.register.failed', 'admin'); |
|
| 81 | } |
|
| 82 | } |
|
| 83 | ||
| 84 | return $app->render('Setting/Shop/tradelaw.twig', array( |
|
| 85 | 'form' => $form->createView(), |
|
| 86 | )); |
|
| 87 | } |
|
| 88 | } |
|
| 89 | ||