示例#1
0
 public function index(Application $app, Request $request, $id = null)
 {
     $Mail = null;
     if ($id) {
         $Mail = $app['orm.em']->getRepository('\\Eccube\\Entity\\MailTemplate')->find($id);
         if (is_null($Mail)) {
             throw new NotFoundHttpException();
         }
     }
     $form = $app['form.factory']->createBuilder('mail', $Mail)->getForm();
     $form['template']->setData($Mail);
     if ('POST' === $request->getMethod()) {
         $form->handleRequest($request);
         // 新規登録は現時点では未実装とする.
         if (is_null($Mail)) {
             $app->addError('admin.shop.mail.save.error', 'admin');
             return $app->redirect($app->url('admin_setting_shop_mail'));
         }
         if ($form->isValid()) {
             $app['orm.em']->flush();
             $app->addSuccess('admin.shop.mail.save.complete', 'admin');
             return $app->redirect($app->url('admin_setting_shop_mail_edit', array('id' => $id)));
         }
     }
     return $app->render('Setting/Shop/mail.twig', array('form' => $form->createView(), 'id' => $id));
 }
示例#2
0
 public function index(Application $app, Request $request)
 {
     $builder = $app['form.factory']->createBuilder('admin_security');
     $form = $builder->getForm();
     if ('POST' === $request->getMethod()) {
         $form->handleRequest($request);
         if ($form->isValid()) {
             $data = $form->getData();
             // 現在のセキュリティ情報を更新
             $adminRoot = $app['config']['admin_route'];
             $configFile = $app['config']['root_dir'] . '/app/config/eccube/config.yml';
             $config = Yaml::parse(file_get_contents($configFile));
             // trim処理
             $allowHost = Str::convertLineFeed($data['admin_allow_host']);
             if (empty($allowHost)) {
                 $config['admin_allow_host'] = null;
             } else {
                 $config['admin_allow_host'] = explode("\n", $allowHost);
             }
             if ($data['force_ssl']) {
                 // SSL制限にチェックをいれた場合、https経由で接続されたか確認
                 if ($request->isSecure()) {
                     // httpsでアクセスされたらSSL制限をチェック
                     $config['force_ssl'] = Constant::ENABLED;
                 } else {
                     // httpから変更されたらfalseのまま
                     $config['force_ssl'] = Constant::DISABLED;
                     $data['force_ssl'] = (bool) Constant::DISABLED;
                 }
             } else {
                 $config['force_ssl'] = Constant::DISABLED;
             }
             $form = $builder->getForm();
             $form->setData($data);
             file_put_contents($configFile, Yaml::dump($config));
             if ($adminRoot != $data['admin_route_dir']) {
                 // admin_routeが変更されればpath.ymlを更新
                 $pathFile = $app['config']['root_dir'] . '/app/config/eccube/path.yml';
                 $config = Yaml::parse(file_get_contents($pathFile));
                 $config['admin_route'] = $data['admin_route_dir'];
                 file_put_contents($pathFile, Yaml::dump($config));
                 $app->addSuccess('admin.system.security.route.dir.complete', 'admin');
                 // ログアウト
                 $this->getSecurity($app)->setToken(null);
                 // 管理者画面へ再ログイン
                 return $app->redirect($request->getBaseUrl() . '/' . $config['admin_route']);
             }
             $app->addSuccess('admin.system.security.save.complete', 'admin');
         }
     } else {
         // セキュリティ情報の取得
         $form->get('admin_route_dir')->setData($app['config']['admin_route']);
         $allowHost = $app['config']['admin_allow_host'];
         if (count($allowHost) > 0) {
             $form->get('admin_allow_host')->setData(Str::convertLineFeed(implode("\n", $allowHost)));
         }
         $form->get('force_ssl')->setData((bool) $app['config']['force_ssl']);
     }
     return $app->render('Setting/System/security.twig', array('form' => $form->createView()));
 }
 public function index(Application $app, Request $request, $class_name_id, $id = null)
 {
     //
     $ClassName = $app['eccube.repository.class_name']->find($class_name_id);
     if (!$ClassName) {
         throw new NotFoundHttpException();
     }
     if ($id) {
         $TargetClassCategory = $app['eccube.repository.class_category']->find($id);
         if (!$TargetClassCategory || $TargetClassCategory->getClassName() != $ClassName) {
             throw new NotFoundHttpException();
         }
     } else {
         $TargetClassCategory = new \Eccube\Entity\ClassCategory();
         $TargetClassCategory->setClassName($ClassName);
     }
     //
     $form = $app['form.factory']->createBuilder('admin_class_category', $TargetClassCategory)->getForm();
     if ($request->getMethod() === 'POST') {
         $form->handleRequest($request);
         if ($form->isValid()) {
             $status = $app['eccube.repository.class_category']->save($TargetClassCategory);
             if ($status) {
                 $app->addSuccess('admin.class_category.save.complete', 'admin');
                 return $app->redirect($app->url('admin_product_class_category', array('class_name_id' => $ClassName->getId())));
             } else {
                 $app->addError('admin.class_category.save.error', 'admin');
             }
         }
     }
     $ClassCategories = $app['eccube.repository.class_category']->getList($ClassName);
     return $app->render('Product/class_category.twig', array('form' => $form->createView(), 'ClassName' => $ClassName, 'ClassCategories' => $ClassCategories, 'TargetClassCategory' => $TargetClassCategory));
 }
示例#4
0
 public function edit(Application $app, $id = null)
 {
     $Payment = $app['eccube.repository.payment']->findOrCreate($id);
     $form = $app['form.factory']->createBuilder('payment_register')->getForm();
     $form->setData($Payment);
     // 登録ボタン押下
     if ('POST' === $app['request']->getMethod()) {
         $form->handleRequest($app['request']);
         if ($form->isValid()) {
             $PaymentData = $form->getData();
             // 手数料を設定できない場合には、手数料を0にする
             if ($PaymentData->getChargeFlg() == 2) {
                 $PaymentData->setCharge(0);
             }
             // ファイルアップロード
             $file = $form['payment_image']->getData();
             $fs = new Filesystem();
             if ($file && $fs->exists($app['config']['image_temp_realdir'] . '/' . $file)) {
                 $fs->rename($app['config']['image_temp_realdir'] . '/' . $file, $app['config']['image_save_realdir'] . '/' . $file);
             }
             $app['orm.em']->persist($PaymentData);
             $app['orm.em']->flush();
             $app->addSuccess('admin.register.complete', 'admin');
             return $app->redirect($app->url('admin_setting_shop_payment'));
         }
     }
     return $app->render('Setting/Shop/payment_edit.twig', array('form' => $form->createView(), 'payment_id' => $id, 'Payment' => $Payment));
 }
示例#5
0
 /**
  * List, add, edit maker.
  *
  * @param Application $app
  * @param Request     $request
  * @param null        $id
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function index(Application $app, Request $request, $id = null)
 {
     $repos = $app['eccube.plugin.maker.repository.maker'];
     $TargetMaker = new Maker();
     if ($id) {
         $TargetMaker = $repos->find($id);
         if (!$TargetMaker) {
             log_error('The Maker not found!', array('Maker id' => $id));
             throw new NotFoundHttpException();
         }
     }
     $form = $app['form.factory']->createBuilder('admin_maker', $TargetMaker)->getForm();
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         log_info('Maker add/edit start.');
         $status = $repos->save($TargetMaker);
         if ($status) {
             log_info('Maker add/edit success', array('Maker id' => $TargetMaker->getId()));
             $app->addSuccess('admin.plugin.maker.save.complete', 'admin');
             return $app->redirect($app->url('admin_plugin_maker_index'));
         } else {
             log_info('Maker add/edit fail!', array('Maker id' => $TargetMaker->getId()));
             $app->addError('admin.plugin.maker.save.error', 'admin');
         }
     }
     /**
      * @var ArrayCollection $arrMaker
      */
     $arrMaker = $app['eccube.plugin.maker.repository.maker']->findBy(array(), array('rank' => 'DESC'));
     return $app->render('Maker/Resource/template/admin/maker.twig', array('form' => $form->createView(), 'arrMaker' => $arrMaker, 'TargetMaker' => $TargetMaker));
 }
示例#6
0
 /**
  * edit
  *
  * @param  Application $app
  * @request  Symfony\Component\HttpFoundation\Request $app
  * @return mixed
  */
 public function edit(Application $app, Request $request, $id = null)
 {
     $Customer = $app['user'];
     $CustomerAddress = $app['eccube.repository.customer_address']->findOrCreateByCustomerAndId($Customer, $id);
     $parentPage = $request->get('parent_page', null);
     // 正しい遷移かをチェック
     $allowdParents = array($app->url('mypage_delivery'), $app->url('shopping_delivery'));
     // 遷移が正しくない場合、デフォルトであるマイページの配送先追加の画面を設定する
     if (!in_array($parentPage, $allowdParents)) {
         $parentPage = $app->url('mypage_delivery');
     }
     /* @var $form \Symfony\Component\Form\FormInterface */
     $form = $app['form.factory']->createBuilder('customer_address', $CustomerAddress)->getForm();
     if ($request->getMethod() === 'POST') {
         $form->handleRequest($request);
         if ($form->isValid()) {
             $app['orm.em']->persist($CustomerAddress);
             $app['orm.em']->flush();
             $app->addSuccess('mypage.delivery.add.complete');
             return $app->redirect($app->url('mypage_delivery'));
         }
     }
     $BaseInfo = $app['eccube.repository.base_info']->get();
     return $app->render('Mypage/delivery_edit.twig', array('form' => $form->createView(), 'parentPage' => $parentPage, 'BaseInfo' => $BaseInfo));
 }
 public function edit(Application $app, Request $request, $id)
 {
     $repos = $app['eccube.plugin.holiday.repository.holidayconfig'];
     $TargetHolidayConfig = new \Plugin\Holiday\Entity\HolidayConfig();
     if ($id) {
         $TargetHolidayConfig = $repos->find($id);
         if (!$TargetHolidayConfig) {
             throw new NotFoundHttpException();
         }
     }
     $form = $app['form.factory']->createBuilder('admin_holiday_config', $TargetHolidayConfig)->getForm();
     if ('POST' === $request->getMethod()) {
         $form->handleRequest($request);
         if ($form->isValid()) {
             $status = $repos->save($TargetHolidayConfig);
             if ($status) {
                 $app->addSuccess('admin.holiday.save.complete', 'admin');
                 return $app->redirect($app->url('plugin_holiday_config'));
             } else {
                 $app->addError('admin.holiday.save.error', 'admin');
             }
         }
     }
     return $app->render('Holiday/View/admin/holiday_config.twig', array('form' => $form->createView(), 'TargetHolidayConfig' => $TargetHolidayConfig));
 }
示例#8
0
 /**
  * 新着情報を登録・編集する。
  *
  * @param Application $app
  * @param Request $request
  * @param integer $id
  * @throws NotFoundHttpException
  * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function edit(Application $app, Request $request, $id = null)
 {
     if ($id) {
         $News = $app['eccube.repository.news']->find($id);
         if (!$News) {
             throw new NotFoundHttpException();
         }
         $News->setLinkMethod((bool) $News->getLinkMethod());
     } else {
         $News = new \Eccube\Entity\News();
     }
     $form = $app['form.factory']->createBuilder('admin_news', $News)->getForm();
     if ('POST' === $request->getMethod()) {
         $form->handleRequest($request);
         if ($form->isValid()) {
             $data = $form->getData();
             if (empty($data['url'])) {
                 $News->setLinkMethod(Constant::DISABLED);
             }
             $status = $app['eccube.repository.news']->save($News);
             if ($status) {
                 $app->addSuccess('admin.news.save.complete', 'admin');
                 return $app->redirect($app->url('admin_content_news'));
             }
             $app->addError('admin.news.save.error', 'admin');
         }
     }
     return $app->render('Content/news_edit.twig', array('form' => $form->createView(), 'News' => $News));
 }
示例#9
0
 public function index(Application $app, Request $request, $parent_id = null, $id = null)
 {
     if ($parent_id) {
         $Parent = $app['eccube.repository.category']->find($parent_id);
         if (!$Parent) {
             throw new NotFoundHttpException('親カテゴリが存在しません');
         }
     } else {
         $Parent = null;
     }
     if ($id) {
         $TargetCategory = $app['eccube.repository.category']->find($id);
         if (!$TargetCategory) {
             throw new NotFoundHttpException('カテゴリが存在しません');
         }
         $Parent = $TargetCategory->getParent();
     } else {
         $TargetCategory = new \Eccube\Entity\Category();
         $TargetCategory->setParent($Parent);
         if ($Parent) {
             $TargetCategory->setLevel($Parent->getLevel() + 1);
         } else {
             $TargetCategory->setLevel(1);
         }
     }
     //
     $builder = $app['form.factory']->createBuilder('admin_category', $TargetCategory);
     $event = new EventArgs(array('builder' => $builder, 'Parent' => $Parent, 'TargetCategory' => $TargetCategory), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_PRODUCT_CATEGORY_INDEX_INITIALIZE, $event);
     $form = $builder->getForm();
     //
     if ($request->getMethod() === 'POST') {
         $form->handleRequest($request);
         if ($form->isValid()) {
             if ($app['config']['category_nest_level'] < $TargetCategory->getLevel()) {
                 throw new BadRequestHttpException('リクエストが不正です');
             }
             log_info('カテゴリ登録開始', array($id));
             $status = $app['eccube.repository.category']->save($TargetCategory);
             if ($status) {
                 log_info('カテゴリ登録完了', array($id));
                 $event = new EventArgs(array('form' => $form, 'Parent' => $Parent, 'TargetCategory' => $TargetCategory), $request);
                 $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_PRODUCT_CATEGORY_INDEX_COMPLETE, $event);
                 $app->addSuccess('admin.category.save.complete', 'admin');
                 if ($Parent) {
                     return $app->redirect($app->url('admin_product_category_show', array('parent_id' => $Parent->getId())));
                 } else {
                     return $app->redirect($app->url('admin_product_category'));
                 }
             } else {
                 log_info('カテゴリ登録エラー', array($id));
                 $app->addError('admin.category.save.error', 'admin');
             }
         }
     }
     $Categories = $app['eccube.repository.category']->getList($Parent);
     // ツリー表示のため、ルートからのカテゴリを取得
     $TopCategories = $app['eccube.repository.category']->getList(null);
     return $app->render('Product/category.twig', array('form' => $form->createView(), 'Parent' => $Parent, 'Categories' => $Categories, 'TopCategories' => $TopCategories, 'TargetCategory' => $TargetCategory));
 }
示例#10
0
 public function index(Application $app, Request $request)
 {
     $builder = $app['form.factory']->createBuilder('admin_cache');
     $form = $builder->getForm();
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         $data = $form->get('cache')->getData();
         $cacheDir = $app['config']['root_dir'] . '/app/cache';
         $filesystem = new Filesystem();
         foreach ($data as $dir) {
             if (is_dir($cacheDir . '/' . $dir)) {
                 // 指定されたキャッシュディレクトリを削除
                 $finder = Finder::create()->in($cacheDir . '/' . $dir);
                 $filesystem->remove($finder);
             }
             if ($dir == 'doctrine') {
                 // doctrineが指定された場合は, cache driver経由で削除.
                 $config = $app['orm.em']->getConfiguration();
                 $this->deleteDoctrineCache($config->getMetadataCacheImpl());
                 $this->deleteDoctrineCache($config->getQueryCacheImpl());
                 $this->deleteDoctrineCache($config->getResultCacheImpl());
                 $this->deleteDoctrineCache($config->getHydrationCacheImpl());
             }
         }
         $app->addSuccess('admin.content.cache.save.complete', 'admin');
     }
     return $app->render('Content/cache.twig', array('form' => $form->createView()));
 }
示例#11
0
 /**
  * edit
  *
  * @param  Application $app
  * @request  Symfony\Component\HttpFoundation\Request $app
  * @return mixed
  */
 public function edit(Application $app, Request $request, $id = null)
 {
     $Customer = $app['user'];
     // 配送先住所最大値判定
     // $idが存在する際は、追加処理ではなく、編集の処理ため本ロジックスキップ
     if (is_null($id)) {
         $addressCurrNum = count($Customer->getCustomerAddresses());
         $addressMax = $app['config']['deliv_addr_max'];
         if ($addressCurrNum >= $addressMax) {
             throw new NotFoundHttpException();
         }
     }
     $CustomerAddress = $app['eccube.repository.customer_address']->findOrCreateByCustomerAndId($Customer, $id);
     $parentPage = $request->get('parent_page', null);
     // 正しい遷移かをチェック
     $allowdParents = array($app->url('mypage_delivery'), $app->url('shopping_delivery'));
     // 遷移が正しくない場合、デフォルトであるマイページの配送先追加の画面を設定する
     if (!in_array($parentPage, $allowdParents)) {
         $parentPage = $app->url('mypage_delivery');
     }
     /* @var $form \Symfony\Component\Form\FormInterface */
     $form = $app['form.factory']->createBuilder('customer_address', $CustomerAddress)->getForm();
     if ($request->getMethod() === 'POST') {
         $form->handleRequest($request);
         if ($form->isValid()) {
             $app['orm.em']->persist($CustomerAddress);
             $app['orm.em']->flush();
             $app->addSuccess('mypage.delivery.add.complete');
             return $app->redirect($app->url('mypage_delivery'));
         }
     }
     $BaseInfo = $app['eccube.repository.base_info']->get();
     return $app->render('Mypage/delivery_edit.twig', array('form' => $form->createView(), 'parentPage' => $parentPage, 'BaseInfo' => $BaseInfo));
 }
示例#12
0
 public function index(Application $app, Request $request, $id = null)
 {
     $Mail = null;
     if ($id) {
         $Mail = $app['orm.em']->getRepository('\\Eccube\\Entity\\MailTemplate')->find($id);
         if (is_null($Mail)) {
             throw new NotFoundHttpException();
         }
     }
     $builder = $app['form.factory']->createBuilder('mail', $Mail);
     $event = new EventArgs(array('builder' => $builder, 'Mail' => $Mail), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SHOP_MAIL_INDEX_INITIALIZE, $event);
     $form = $builder->getForm();
     $form['template']->setData($Mail);
     if ('POST' === $request->getMethod()) {
         $form->handleRequest($request);
         // 新規登録は現時点では未実装とする.
         if (is_null($Mail)) {
             $app->addError('admin.shop.mail.save.error', 'admin');
             return $app->redirect($app->url('admin_setting_shop_mail'));
         }
         if ($form->isValid()) {
             $app['orm.em']->flush();
             $event = new EventArgs(array('form' => $form, 'Mail' => $Mail), $request);
             $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SHOP_MAIL_INDEX_COMPLETE, $event);
             $app->addSuccess('admin.shop.mail.save.complete', 'admin');
             return $app->redirect($app->url('admin_setting_shop_mail_edit', array('id' => $id)));
         }
     }
     return $app->render('Setting/Shop/mail.twig', array('form' => $form->createView(), 'id' => $id));
 }
 public function index(Application $app, Request $request, $id)
 {
     $repos = $app['eccube.plugin.holiday.repository.holidayweek'];
     $TargetHolidayWeek = new \Plugin\Holiday\Entity\HolidayWeek();
     if ($id) {
         $TargetHolidayWeek = $repos->find($id);
         if (!$TargetHolidayWeek) {
             throw new NotFoundHttpException();
         }
         $TargetHolidayWeek->week = unserialize($TargetHolidayWeek->week);
     }
     $form = $app['form.factory']->createBuilder('admin_holiday_week', $TargetHolidayWeek)->getForm();
     if ('POST' === $request->getMethod()) {
         $form->handleRequest($request);
         if ($form->isValid()) {
             // 取得した曜日選択情報をシリアライズ
             $TargetHolidayWeek->week = serialize($TargetHolidayWeek->week);
             $status = $repos->save($TargetHolidayWeek);
             if ($status) {
                 $app->addSuccess('admin.holiday.save.complete', 'admin');
                 return $app->redirect($app->url('admin_holiday_week'));
             } else {
                 $app->addError('admin.holiday.save.error', 'admin');
             }
         }
     }
     return $app->render('Holiday/View/admin/week.twig', array('form' => $form->createView(), 'TargetHolidayWeek' => $TargetHolidayWeek));
 }
示例#14
0
 public function index(Application $app, Request $request, $id = null)
 {
     if ($id) {
         $TargetClassName = $app['eccube.repository.class_name']->find($id);
         if (!$TargetClassName) {
             throw new NotFoundHttpException();
         }
     } else {
         $TargetClassName = new \Eccube\Entity\ClassName();
     }
     $builder = $app['form.factory']->createBuilder('admin_class_name', $TargetClassName);
     $event = new EventArgs(array('builder' => $builder, 'TargetClassName' => $TargetClassName), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_PRODUCT_CLASS_NAME_INDEX_INITIALIZE, $event);
     $form = $builder->getForm();
     if ($request->getMethod() === 'POST') {
         $form->handleRequest($request);
         if ($form->isValid()) {
             $status = $app['eccube.repository.class_name']->save($TargetClassName);
             if ($status) {
                 $event = new EventArgs(array('form' => $form, 'TargetClassName' => $TargetClassName), $request);
                 $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_PRODUCT_CLASS_NAME_INDEX_COMPLETE, $event);
                 $app->addSuccess('admin.class_name.save.complete', 'admin');
                 return $app->redirect($app->url('admin_product_class_name'));
             } else {
                 $app->addError('admin.class_name.save.error', 'admin');
             }
         }
     }
     $ClassNames = $app['eccube.repository.class_name']->getList();
     return $app->render('Product/class_name.twig', array('form' => $form->createView(), 'ClassNames' => $ClassNames, 'TargetClassName' => $TargetClassName));
 }
 /**
  * Create & Edit.
  *
  * @param Application $app
  * @param Request     $request
  * @param int         $id
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function edit(Application $app, Request $request, $id = null)
 {
     /* @var RecommendProduct $Recommend */
     $Recommend = null;
     $Product = null;
     if (!is_null($id)) {
         // IDからおすすめ商品情報を取得する
         $Recommend = $app['eccube.plugin.recommend.repository.recommend_product']->find($id);
         if (!$Recommend) {
             $app->addError('admin.recommend.not_found', 'admin');
             log_info('The recommend product is not found.', array('Recommend id' => $id));
             return $app->redirect($app->url('admin_recommend_list'));
         }
         $Product = $Recommend->getProduct();
     }
     // formの作成
     /* @var Form $form */
     $form = $app['form.factory']->createBuilder('admin_recommend', $Recommend)->getForm();
     $form->handleRequest($request);
     $data = $form->getData();
     if ($form->isSubmitted() && $form->isValid()) {
         $service = $app['eccube.plugin.recommend.service.recommend'];
         if (is_null($data['id'])) {
             if ($status = $service->createRecommend($data)) {
                 $app->addSuccess('admin.plugin.recommend.register.success', 'admin');
                 log_info('Add the new recommend product success.', array('Product id' => $data['Product']->getId()));
             }
         } else {
             if ($status = $service->updateRecommend($data)) {
                 $app->addSuccess('admin.plugin.recommend.update.success', 'admin');
                 log_info('Update the recommend product success.', array('Recommend id' => $Recommend->getId(), 'Product id' => $data['Product']->getId()));
             }
         }
         if (!$status) {
             $app->addError('admin.recommend.not_found', 'admin');
             log_info('Failed the recommend product updating.', array('Product id' => $data['Product']->getId()));
         }
         return $app->redirect($app->url('admin_recommend_list'));
     }
     if (!empty($data['Product'])) {
         $Product = $data['Product'];
     }
     $arrProductIdByRecommend = $app['eccube.plugin.recommend.repository.recommend_product']->getRecommendProductIdAll();
     return $this->registerView($app, array('form' => $form->createView(), 'recommend_products' => json_encode($arrProductIdByRecommend), 'Product' => $Product));
 }
 public function delete(Application $app, $id)
 {
     $Customer = $app['user'];
     // 別のお届け先削除
     if ($app['eccube.repository.customer_address']->deleteByCustomerAndId($Customer, $id)) {
         $app->addError('mypage.address.delete.failed');
     } else {
         $app->addSuccess('mypage.address.delete.complete');
     }
     return $app->redirect($app->url('mypage_delivery'));
 }
示例#17
0
 public function index(Application $app, Request $request, $parent_id = null, $id = null)
 {
     if ($parent_id) {
         $Parent = $app['eccube.repository.category']->find($parent_id);
         if (!$Parent) {
             throw new NotFoundHttpException();
         }
     } else {
         $Parent = null;
     }
     if ($id) {
         $TargetCategory = $app['eccube.repository.category']->find($id);
         if (!$TargetCategory) {
             throw new NotFoundHttpException();
         }
         $Parent = $TargetCategory->getParent();
     } else {
         $TargetCategory = new \Eccube\Entity\Category();
         $TargetCategory->setParent($Parent);
         if ($Parent) {
             $TargetCategory->setLevel($Parent->getLevel() + 1);
         } else {
             $TargetCategory->setLevel(1);
         }
     }
     //
     $form = $app['form.factory']->createBuilder('admin_category', $TargetCategory)->getForm();
     //
     if ($request->getMethod() === 'POST') {
         $form->handleRequest($request);
         if ($form->isValid()) {
             if ($app['config']['category_nest_level'] < $TargetCategory->getLevel()) {
                 throw new BadRequestHttpException();
             }
             $status = $app['eccube.repository.category']->save($TargetCategory);
             if ($status) {
                 $app->addSuccess('admin.category.save.complete', 'admin');
                 if ($Parent) {
                     return $app->redirect($app->url('admin_product_category_show', array('parent_id' => $Parent->getId())));
                 } else {
                     return $app->redirect($app->url('admin_product_category'));
                 }
             } else {
                 $app->addError('admin.category.save.error', 'admin');
             }
         }
     }
     $Children = $app['eccube.repository.category']->getList(null);
     $Categories = $app['eccube.repository.category']->getList($Parent);
     $TopCategories = $app['eccube.repository.category']->findBy(array('Parent' => null), array('rank' => 'DESC'));
     $category_count = $app['eccube.repository.category']->getTotalCount();
     return $app->render('Product/category.twig', array('form' => $form->createView(), 'Children' => $Children, 'Parent' => $Parent, 'Categories' => $Categories, 'TopCategories' => $TopCategories, 'TargetCategory' => $TargetCategory, 'category_count' => $category_count));
 }
示例#18
0
 public function delete(Application $app, Request $request, $id)
 {
     $Customer = $app['orm.em']->getRepository('Eccube\\Entity\\Customer')->find($id);
     if (is_null($Customer)) {
         throw new NotFoundHttpException();
     }
     $Customer->setDelFlg(1);
     $app['orm.em']->persist($Customer);
     $app['orm.em']->flush();
     $app->addSuccess('admin.customer.delete.complete', 'admin');
     return $app->redirect($app->url('admin_customer'));
 }
示例#19
0
 public function edit(Application $app, Request $request, $id = null)
 {
     $previous_password = null;
     if ($id) {
         $Member = $app['eccube.repository.member']->find($id);
         if (!$Member) {
             throw new NotFoundHttpException();
         }
         $previous_password = $Member->getPassword();
         $Member->setPassword($app['config']['default_password']);
     } else {
         $Member = new \Eccube\Entity\Member();
     }
     $LoginMember = clone $app->user();
     $app['orm.em']->detach($LoginMember);
     $builder = $app['form.factory']->createBuilder('admin_member', $Member);
     $event = new EventArgs(array('builder' => $builder, 'Member' => $Member), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SYSTEM_MEMBER_EDIT_INITIALIZE, $event);
     $form = $builder->getForm();
     if ('POST' === $request->getMethod()) {
         $form->handleRequest($request);
         if ($form->isValid()) {
             if (!is_null($previous_password) && $Member->getpassword() === $app['config']['default_password']) {
                 // 編集時にPWを変更していなければ
                 // 変更前のパスワード(暗号化済み)をセット
                 $Member->setPassword($previous_password);
             } else {
                 $salt = $Member->getSalt();
                 if (!isset($salt)) {
                     $salt = $app['eccube.repository.member']->createSalt(5);
                     $Member->setSalt($salt);
                 }
                 // 入力されたPWを暗号化してセット
                 $password = $app['eccube.repository.member']->encryptPassword($Member);
                 $Member->setPassword($password);
             }
             $status = $app['eccube.repository.member']->save($Member);
             if ($status) {
                 $event = new EventArgs(array('form' => $form, 'Member' => $Member), $request);
                 $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SYSTEM_MEMBER_EDIT_COMPLETE, $event);
                 $app->addSuccess('admin.member.save.complete', 'admin');
                 return $app->redirect($app->url('admin_setting_system_member'));
             } else {
                 $app->addError('admin.member.save.error', 'admin');
             }
         }
     }
     $app['security']->getToken()->setUser($LoginMember);
     return $app->render('Setting/System/member_edit.twig', array('form' => $form->createView(), 'Member' => $Member));
 }
示例#20
0
 public function index(Application $app)
 {
     $BaseInfo = $app['eccube.repository.base_info']->get();
     $form = $app['form.factory']->createBuilder('shop_master', $BaseInfo)->getForm();
     if ($app['request']->getMethod() === 'POST') {
         $form->handleRequest($app['request']);
         if ($form->isValid()) {
             $app['orm.em']->persist($BaseInfo);
             $app['orm.em']->flush();
             $app->addSuccess('admin.shop.save.complete', 'admin');
             return $app->redirect($app->url('admin_setting_shop'));
         }
         $app->addError('admin.shop.save.error', 'admin');
     }
     return $app->render('Setting/Shop/shop_master.twig', array('form' => $form->createView()));
 }
 /**
  * @public
  * @param Application $app
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function index(Application $app, Request $request, $id = null)
 {
     $err = '';
     $data = array();
     $method = $request->getMethod();
     $form = $app['form.factory']->createBuilder('appiaries_settings', null)->getForm();
     $app['eccube.plugin.appiaries.repository.settings']->get_settings($data, $err);
     // No problem with "no_data", "no_database_id", "no_app_id", or "no_app_token".
     if ($err && preg_match('/^no_(?:data|datastore_id|app_id|app_token)$/', $err)) {
         $err = '';
     }
     $queries = array();
     if (!$err && $method == 'POST') {
         $form->handleRequest($request);
         $queries = $form->getData();
         if (!$form->isValid()) {
             error_log('[AppiariesAdminPushControrller]   ' . $form->getErrors());
             $err = 'validation_failed';
         } else {
             $settings = new \Plugin\Appiaries\Entity\AppiariesSettings();
             $settings->setDatastoreId($queries['datastore_id']);
             $settings->setAppId($queries['app_id']);
             $settings->setAppToken($queries['app_token']);
             if (!$app['eccube.plugin.appiaries.repository.settings']->save($settings, $err)) {
                 error_log('[ConfigController]   ' . $err);
                 $err = 'settings_save_failed';
             } else {
                 $app->addSuccess('admin_appiaries_settings_save_success', 'admin');
                 $data['datastore_id'] = $queries['datastore_id'];
                 $data['app_id'] = $queries['app_id'];
                 $data['app_token'] = $queries['app_token'];
             }
             $settings = null;
         }
     }
     if ($err) {
         error_log('[ConfigController]   ' . $err);
         $app->addError('admin_appiaries_' . $err, 'admin');
     }
     $data['config_form'] = $form->createView();
     $err = null;
     $request = null;
     $form = null;
     $queries = null;
     return $app->render('Appiaries/templates/admin/config/index.twig', $data);
 }
示例#22
0
 public function index(Application $app, Request $request, $id = CsvType::CSV_TYPE_ORDER)
 {
     $CsvType = $app['eccube.repository.master.csv_type']->find($id);
     if (is_null($CsvType)) {
         throw new NotFoundHttpException();
     }
     $builder = $app->form();
     $builder->add('csv_type', 'csv_type', array('label' => 'CSV出力項目', 'required' => true, 'constraints' => array(new Assert\NotBlank()), 'data' => $CsvType));
     $CsvNotOutput = $app['eccube.repository.csv']->findBy(array('CsvType' => $CsvType, 'enable_flg' => Constant::DISABLED), array('rank' => 'ASC'));
     $builder->add('csv_not_output', 'entity', array('class' => 'Eccube\\Entity\\Csv', 'property' => 'disp_name', 'required' => false, 'expanded' => false, 'multiple' => true, 'choices' => $CsvNotOutput));
     $CsvOutput = $app['eccube.repository.csv']->findBy(array('CsvType' => $CsvType, 'enable_flg' => Constant::ENABLED), array('rank' => 'ASC'));
     $builder->add('csv_output', 'entity', array('class' => 'Eccube\\Entity\\Csv', 'property' => 'disp_name', 'required' => false, 'expanded' => false, 'multiple' => true, 'choices' => $CsvOutput));
     $event = new EventArgs(array('builder' => $builder, 'CsvOutput' => $CsvOutput, 'CsvType' => $CsvType), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SHOP_CSV_INDEX_INITIALIZE, $event);
     $form = $builder->getForm();
     if ('POST' === $request->getMethod()) {
         $data = $request->get('form');
         if (isset($data['csv_not_output'])) {
             $Csvs = $data['csv_not_output'];
             $rank = 1;
             foreach ($Csvs as $csv) {
                 $c = $app['eccube.repository.csv']->find($csv);
                 $c->setRank($rank);
                 $c->setEnableFlg(Constant::DISABLED);
                 $rank++;
             }
         }
         if (isset($data['csv_output'])) {
             $Csvs = $data['csv_output'];
             $rank = 1;
             foreach ($Csvs as $csv) {
                 $c = $app['eccube.repository.csv']->find($csv);
                 $c->setRank($rank);
                 $c->setEnableFlg(Constant::ENABLED);
                 $rank++;
             }
         }
         $app['orm.em']->flush();
         $event = new EventArgs(array('form' => $form, 'CsvOutput' => $CsvOutput, 'CsvType' => $CsvType), $request);
         $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SHOP_CSV_INDEX_COMPLETE, $event);
         $app->addSuccess('admin.shop.csv.save.complete', 'admin');
         return $app->redirect($app->url('admin_setting_shop_csv', array('id' => $id)));
     }
     return $app->render('Setting/Shop/csv.twig', array('form' => $form->createView(), 'id' => $id));
 }
 /**
  * 新規登録・編集画面
  *
  * @param Application $app
  * @param Request $request
  * @param null $id
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function edit(Application $app, Request $request, $id = null)
 {
     $Question = null;
     if (!is_null($id)) {
         $Question = $app['plugin.Uzaitaikai.repository.question']->find($id);
     }
     $form = $app['form.factory']->createBuilder('plugin_Uzaitaikai_question', $Question)->getForm();
     if ('POST' === $request->getMethod()) {
         $form->handleRequest($request);
         if ($form->isValid()) {
             $Question = $form->getData();
             $app['orm.em']->persist($Question);
             $app['orm.em']->flush();
             $app->addSuccess('質問を登録しました。', 'admin');
         }
     }
     return $app->render('Uzaitaikai/Resource/template/admin/config_edit.twig', array('form' => $form->createView(), 'Question' => $Question));
 }
示例#24
0
 public function index(Application $app)
 {
     $Help = $app['eccube.repository.help']->get();
     $form = $app['form.factory']->createBuilder('tradelaw', $Help)->getForm();
     if ('POST' === $app['request']->getMethod()) {
         $form->handleRequest($app['request']);
         if ($form->isValid()) {
             $Help = $form->getData();
             $app['orm.em']->persist($Help);
             $app['orm.em']->flush();
             $app->addSuccess('admin.register.complete', 'admin');
             return $app->redirect($app->url('admin_setting_shop_tradelaw'));
         } else {
             $app->addError('admin.register.failed', 'admin');
         }
     }
     return $app->render('Setting/Shop/tradelaw.twig', array('form' => $form->createView()));
 }
示例#25
0
 public function index(Application $app, Request $request)
 {
     $AuthorityRoles = $app['eccube.repository.authority_role']->findAllSort();
     $builder = $app['form.factory']->createBuilder();
     $builder->add('AuthorityRoles', 'collection', array('type' => 'admin_authority_role', 'allow_add' => true, 'allow_delete' => true, 'prototype' => true, 'data' => $AuthorityRoles));
     $event = new EventArgs(array('builder' => $builder, 'AuthorityRoles' => $AuthorityRoles), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SYSTEM_AUTHORITY_INDEX_INITIALIZE, $event);
     $form = $builder->getForm();
     if (count($AuthorityRoles) == 0) {
         // 1件もない場合、空行を追加
         $form->get('AuthorityRoles')->add(uniqid(), 'admin_authority_role');
     }
     if ('POST' === $request->getMethod()) {
         $form->handleRequest($request);
         if ($form->isValid()) {
             $data = $form->getData();
             foreach ($AuthorityRoles as $AuthorityRole) {
                 $app['orm.em']->remove($AuthorityRole);
             }
             foreach ($data['AuthorityRoles'] as $AuthorityRole) {
                 $Authority = $AuthorityRole->getAuthority();
                 $denyUrl = $AuthorityRole->getDenyUrl();
                 if ($Authority && !empty($denyUrl)) {
                     $app['orm.em']->persist($AuthorityRole);
                 } else {
                     $id = $AuthorityRole->getId();
                     if (!empty($id)) {
                         $role = $app['eccube.repository.authority_role']->find($id);
                         if ($role) {
                             // 削除
                             $app['orm.em']->remove($AuthorityRole);
                         }
                     }
                 }
             }
             $app['orm.em']->flush();
             $event = new EventArgs(array('form' => $form, 'AuthorityRoles' => $AuthorityRoles), $request);
             $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SYSTEM_AUTHORITY_INDEX_COMPLETE, $event);
             $app->addSuccess('admin.system.authority.save.complete', 'admin');
             return $app->redirect($app->url('admin_setting_system_authority'));
         }
     }
     return $app->render('Setting/System/authority.twig', array('form' => $form->createView()));
 }
示例#26
0
 public function edit(Application $app, Request $request, $id = null)
 {
     $previous_password = null;
     if ($id) {
         $Member = $app['eccube.repository.member']->find($id);
         if (!$Member) {
             throw new NotFoundHttpException();
         }
         $previous_password = $Member->getPassword();
         $Member->setPassword($app['config']['default_password']);
     } else {
         $Member = new \Eccube\Entity\Member();
     }
     $form = $app['form.factory']->createBuilder('admin_member', $Member)->getForm();
     if ('POST' === $request->getMethod()) {
         $form->handleRequest($request);
         if ($form->isValid()) {
             if (!is_null($previous_password) && $Member->getpassword() === $app['config']['default_password']) {
                 // 編集時にPWを変更していなければ
                 // 変更前のパスワード(暗号化済み)をセット
                 $Member->setPassword($previous_password);
             } else {
                 $salt = $Member->getSalt();
                 if (!isset($salt)) {
                     $salt = $app['eccube.repository.member']->createSalt(5);
                     $Member->setSalt($salt);
                 }
                 // 入力されたPWを暗号化してセット
                 $password = $app['eccube.repository.member']->encryptPassword($Member);
                 $Member->setPassword($password);
             }
             $status = $app['eccube.repository.member']->save($Member);
             if ($status) {
                 $app->addSuccess('admin.member.save.complete', 'admin');
                 return $app->redirect($app->url('admin_setting_system_member'));
             } else {
                 $app->addError('admin.member.save.error', 'admin');
             }
         }
     }
     return $app->render('Setting/System/member_edit.twig', array('form' => $form->createView(), 'Member' => $Member));
 }
示例#27
0
 public function edit(Application $app, $id = null)
 {
     $DeviceType = $app['eccube.repository.master.device_type']->find(DeviceType::DEVICE_TYPE_PC);
     $PageLayout = $app['eccube.repository.page_layout']->findOrCreate($id, $DeviceType);
     $editable = true;
     $form = $app['form.factory']->createBuilder('main_edit', $PageLayout)->getForm();
     // 更新時
     if ($id) {
         // 編集不可ページはURL、ページ名、ファイル名を保持
         if ($PageLayout->getEditFlg() == PageLayout::EDIT_FLG_DEFAULT) {
             $editable = false;
             $PrevPageLayout = clone $PageLayout;
         }
         // テンプレートファイルの取得
         $file = $app['eccube.repository.page_layout']->getReadTemplateFile($PageLayout->getFileName(), $editable);
         $form->get('tpl_data')->setData($file['tpl_data']);
     }
     if ('POST' === $app['request']->getMethod()) {
         $form->handleRequest($app['request']);
         if ($form->isValid()) {
             $PageLayout = $form->getData();
             if (!$editable) {
                 $PageLayout->setUrl($PrevPageLayout->getUrl())->setFileName($PrevPageLayout->getFileName())->setName($PrevPageLayout->getName());
             }
             // DB登録
             $app['orm.em']->persist($PageLayout);
             $app['orm.em']->flush();
             // ファイル生成・更新
             $templatePath = $app['eccube.repository.page_layout']->getWriteTemplatePath($editable);
             $filePath = $templatePath . '/' . $PageLayout->getFileName() . '.twig';
             $fs = new Filesystem();
             $fs->dumpFile($filePath, $form->get('tpl_data')->getData());
             $app->addSuccess('admin.register.complete', 'admin');
             // twig キャッシュの削除.
             $finder = Finder::create()->in($app['config']['root_dir'] . '/app/cache/twig');
             $fs->remove($finder);
             return $app->redirect($app->url('admin_content_page_edit', array('id' => $PageLayout->getId())));
         }
     }
     $templatePath = $app['eccube.repository.page_layout']->getWriteTemplatePath($editable);
     return $app->render('Content/page_edit.twig', array('form' => $form->createView(), 'page_id' => $PageLayout->getId(), 'editable' => $editable, 'template_path' => $templatePath));
 }
 /**
  * ラッピング用設定画面
  *
  * @param Application $app
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function index(Application $app, Request $request)
 {
     $Wrapping = $app['eccube.plugin.repository.wrapping']->find(1);
     if (!$Wrapping) {
         $Wrapping = new Wrapping();
     }
     $form = $app['form.factory']->createBuilder('giftwrapping_config', $Wrapping)->getForm();
     if ('POST' === $request->getMethod()) {
         $form->handleRequest($request);
         if ($form->isValid()) {
             $Wrapping = $form->getData();
             // IDは1固定
             $Wrapping->setId(1);
             $app['orm.em']->persist($Wrapping);
             $app['orm.em']->flush();
             $app->addSuccess('admin.gift_wrapping.save.complete', 'admin');
         }
     }
     return $app->render('GiftWrapping/Resource/template/admin/config.twig', array('form' => $form->createView(), 'Wrapping' => $Wrapping));
 }
示例#29
0
 public function delete(Application $app, Request $request, $id)
 {
     $repos = $app['eccube.plugin.holiday.repository.holiday'];
     $TargetHoliday = $repos->find($id);
     if (!$TargetHoliday) {
         throw new NotFoundHttpException();
     }
     $form = $app['form.factory']->createNamedBuilder('admin_holiday', 'form', null, array('allow_extra_fields' => true))->getForm();
     $status = false;
     if ('DELETE' === $request->getMethod()) {
         $form->handleRequest($request);
         $status = $repos->delete($TargetHoliday);
     }
     if ($status === true) {
         $app->addSuccess('admin.holiday.delete.complete', 'admin');
     } else {
         $app->addError('admin.holiday.delete.error', 'admin');
     }
     return $app->redirect($app->url('admin_holiday'));
 }
示例#30
0
 public function index(Application $app, Request $request, $class_name_id, $id = null)
 {
     //
     $ClassName = $app['eccube.repository.class_name']->find($class_name_id);
     if (!$ClassName) {
         throw new NotFoundHttpException('商品規格が存在しません');
     }
     if ($id) {
         $TargetClassCategory = $app['eccube.repository.class_category']->find($id);
         if (!$TargetClassCategory || $TargetClassCategory->getClassName() != $ClassName) {
             throw new NotFoundHttpException('商品規格が存在しません');
         }
     } else {
         $TargetClassCategory = new \Eccube\Entity\ClassCategory();
         $TargetClassCategory->setClassName($ClassName);
     }
     //
     $builder = $app['form.factory']->createBuilder('admin_class_category', $TargetClassCategory);
     $event = new EventArgs(array('builder' => $builder, 'ClassName' => $ClassName, 'TargetClassCategory' => $TargetClassCategory), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_PRODUCT_CLASS_CATEGORY_INDEX_INITIALIZE, $event);
     $form = $builder->getForm();
     if ($request->getMethod() === 'POST') {
         $form->handleRequest($request);
         if ($form->isValid()) {
             log_info('規格分類登録開始', array($id));
             $status = $app['eccube.repository.class_category']->save($TargetClassCategory);
             if ($status) {
                 log_info('規格分類登録完了', array($id));
                 $event = new EventArgs(array('form' => $form, 'ClassName' => $ClassName, 'TargetClassCategory' => $TargetClassCategory), $request);
                 $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_PRODUCT_CLASS_CATEGORY_INDEX_COMPLETE, $event);
                 $app->addSuccess('admin.class_category.save.complete', 'admin');
                 return $app->redirect($app->url('admin_product_class_category', array('class_name_id' => $ClassName->getId())));
             } else {
                 log_info('規格分類登録エラー', array($id));
                 $app->addError('admin.class_category.save.error', 'admin');
             }
         }
     }
     $ClassCategories = $app['eccube.repository.class_category']->getList($ClassName);
     return $app->render('Product/class_category.twig', array('form' => $form->createView(), 'ClassName' => $ClassName, 'ClassCategories' => $ClassCategories, 'TargetClassCategory' => $TargetClassCategory));
 }