/** * 商品検索画面を表示する * @param Application $app * @param Request $request * @return \Symfony\Component\HttpFoundation\Response */ public function searchProduct(Application $app, Request $request) { if ($request->isXmlHttpRequest()) { $app['monolog']->addDebug('search product start.'); $searchData = array('name' => $request->get('id')); if ($categoryId = $request->get('category_id')) { $Category = $app['eccube.repository.category']->find($categoryId); $searchData['category_id'] = $Category; } /** @var $Products \Eccube\Entity\Product[] */ $qb = $app['eccube.repository.product']->getQueryBuilderBySearchData($searchData); // 除外するproduct_idを設定する $existProductId = $request->get('exist_product_id'); if (strlen($existProductId > 0)) { $qb->andWhere($qb->expr()->notin('p.id', ':existProductId'))->setParameter('existProductId', explode(",", $existProductId)); } $Products = $qb->getQuery()->getResult(); if (is_null($Products)) { $app['monolog']->addDebug('search product not found.'); } $forms = array(); foreach ($Products as $Product) { /* @var $builder \Symfony\Component\Form\FormBuilderInterface */ $builder = $app['form.factory']->createNamedBuilder('', 'add_cart', null, array('product' => $Product)); $addCartForm = $builder->getForm(); $forms[$Product->getId()] = $addCartForm->createView(); } return $app->render('Recommend/View/admin/search_product.twig', array('forms' => $forms, 'Products' => $Products)); } }
/** * 作成ボタンクリック時の処理 * 帳票のPDFをダウンロードする * * @param Application $app * @param Request $request * @throws BadRequestHttpException * @return \Symfony\Component\HttpFoundation\Response */ public function download(Application $app, Request $request) { // POSTでない場合は終了する if ('POST' !== $request->getMethod()) { throw new BadRequestHttpException(); } $form = $app['form.factory']->createBuilder('admin_order_pdf')->getForm(); $form->handleRequest($request); // validation if (!$form->isValid()) { return $app->render('OrderPdf/View/admin/order_pdf.twig', array('form' => $form->createView())); } // サービスの取得 $service = $app['eccube.plugin.order_pdf.service.order_pdf']; // 購入情報からPDFを作成する $status = $service->makePdf($form->getData()); // 異常終了した場合の処理 if (!$status) { $service->close(); $app->addError('admin.order_pdf.download.failure', 'admin'); return $app->render('OrderPdf/View/admin/order_pdf.twig', array('form' => $form->createView())); } // ダウンロードする $response = new Response($service->outputPdf(), 200, array('content-type' => 'application/pdf')); // レスポンスヘッダーにContent-Dispositionをセットし、ファイル名をreceipt.pdfに指定 $response->headers->set('Content-Disposition', 'attachment; filename="' . $service->getPdfFileName() . '"'); return $response; }
public function index(Application $app, Request $request) { $form = $app['form.factory']->createBuilder('plugin_Uzaitaikai_mypage_question')->getForm(); if ('POST' === $request->getMethod()) { $form->handleRequest($request); if ($form->isValid()) { $Question = $form['question']->getData(); return $app->render('Uzaitaikai/Resource/template/mypage/withdraw_complete.twig', array('form' => $form->createView(), 'Question' => $Question)); } } return $app->render('Uzaitaikai/Resource/template/mypage/withdraw.twig', array('form' => $form->createView())); }
public function index(Application $app, Request $request) { $email = $request->cookies->get('email'); /* @var $form \Symfony\Component\Form\FormInterface */ $form = $app['form.factory']->createNamedBuilder('', 'customer_login')->getForm(); return $app->render('Block/login.twig', array('error' => $app['security.last_error']($request), 'email' => $email, 'form' => $form->createView())); }
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)); }
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())); }
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)); }
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)); }
public function index(Application $app) { $DeviceType = $app['eccube.repository.master.device_type']->find(DeviceType::DEVICE_TYPE_PC); // 登録されているブロック一覧の取得 $Blocks = $app['eccube.repository.block']->getList($DeviceType); return $app->render('Content/block.twig', array('Blocks' => $Blocks)); }
/** * 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)); }
/** * 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 index(Application $app, Request $request, $id) { $repos = $app['eccube.plugin.holiday.repository.holiday']; $TargetHoliday = new \Plugin\Holiday\Entity\Holiday(); if ($id) { $TargetHoliday = $repos->find($id); if (!$TargetHoliday) { throw new NotFoundHttpException(); } } $form = $app['form.factory']->createBuilder('admin_holiday', $TargetHoliday)->getForm(); if ('POST' === $request->getMethod()) { $form->handleRequest($request); if ($form->isValid()) { $status = $repos->save($TargetHoliday); if ($status) { $app->addSuccess('admin.holiday.save.complete', 'admin'); return $app->redirect($app->url('admin_holiday')); } else { $app->addError('admin.holiday.save.error', 'admin'); } } } $Holidays = $app['eccube.plugin.holiday.repository.holiday']->findAll(); return $app->render('Holiday/View/admin/holiday.twig', array('form' => $form->createView(), 'Holidays' => $Holidays, 'TargetHoliday' => $TargetHoliday)); }
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)); }
/** * 税率設定の初期表示・登録 * * @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) { $TargetTaxRule = null; if ($id == null) { $TargetTaxRule = $app['eccube.repository.tax_rule']->newTaxRule(); } else { $TargetTaxRule = $app['eccube.repository.tax_rule']->find($id); if (is_null($TargetTaxRule)) { throw new NotFoundHttpException(); } } /** @var $BaseInfo \Eccube\Entity\BaseInfo */ $BaseInfo = $app['eccube.repository.base_info']->get(); $builder = $app['form.factory']->createBuilder('tax_rule', $TargetTaxRule); $builder->get('option_product_tax_rule')->setData($BaseInfo->getOptionProductTaxRule()); if ($TargetTaxRule->isDefaultTaxRule()) { // 基本税率設定は適用日時の変更は行わない $builder = $builder->remove('apply_date'); } /* @var $form \Symfony\Component\Form\FormInterface */ $form = $builder->getForm(); if ('POST' === $request->getMethod()) { $form->handleRequest($request); if ($this->isValid($app['orm.em'], $form)) { $app['orm.em']->persist($TargetTaxRule); $app['orm.em']->flush(); $app->addSuccess('admin.shop.tax.save.complete', 'admin'); return $app->redirect($app->url('admin_setting_shop_tax')); } } // 共通税率一覧 $TaxRules = $app['eccube.repository.tax_rule']->getList(); return $app->render('Setting/Shop/tax_rule.twig', array('TargetTaxRule' => $TargetTaxRule, 'TaxRules' => $TaxRules, 'form' => $form->createView())); }
public function index(Application $app) { $Cart = $app['eccube.service.cart']->getCart(); /* @var $BaseInfo \Eccube\Entity\BaseInfo */ /* @var $Cart \Eccube\Entity\Cart */ $BaseInfo = $app['eccube.repository.base_info']->get(); $isDeliveryFree = false; $least = 0; $quantity = 0; if ($BaseInfo->getDeliveryFreeAmount()) { if ($BaseInfo->getDeliveryFreeAmount() <= $Cart->getTotalPrice()) { // 送料無料(金額)を超えている $isDeliveryFree = true; } else { $least = $BaseInfo->getDeliveryFreeAmount() - $Cart->getTotalPrice(); } } if ($BaseInfo->getDeliveryFreeQuantity()) { if ($BaseInfo->getDeliveryFreeQuantity() <= $Cart->getTotalQuantity()) { // 送料無料(個数)を超えている $isDeliveryFree = true; } else { $quantity = $BaseInfo->getDeliveryFreeQuantity() - $Cart->getTotalQuantity(); } } return $app->render('Cart/index.twig', array('Cart' => $Cart, 'least' => $least, 'quantity' => $quantity, 'is_delivery_free' => $isDeliveryFree)); }
/** * 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)); }
/** * 新着情報を登録・編集する。 * * @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)); }
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)); }
/** * Load block. * * @param Application $app * * @return Response */ public function index(Application $app) { $Disp = $app['eccube.repository.master.disp']->find(Disp::DISPLAY_SHOW); /** * @var ArrayCollection */ $arrRecommendProduct = $app['eccube.plugin.recommend.repository.recommend_product']->getRecommendProduct($Disp); return $app->render('Block/recommend_product_block.twig', array('recommend_products' => $arrRecommendProduct)); }
public function index(Application $app, Request $request) { $DeviceType = $app['eccube.repository.master.device_type']->find(DeviceType::DEVICE_TYPE_PC); // 登録されているブロック一覧の取得 $Blocks = $app['eccube.repository.block']->getList($DeviceType); $event = new EventArgs(array('DeviceType' => $DeviceType, 'Blocks' => $Blocks), $request); $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_CONTENT_BLOCK_INDEX_COMPLETE, $event); return $app->render('Content/block.twig', array('Blocks' => $Blocks)); }
/** * get product information. * * @param Application $app * @param Request $request * * @return \Symfony\Component\HttpFoundation\Response */ public function getProduct(Application $app, Request $request) { if (!$request->isXmlHttpRequest()) { return null; } $productId = $request->get('product_id'); $index = $request->get('index'); $Product = $app['eccube.repository.product']->find($productId); return $app->render('RelatedProduct/Resource/template/admin/product.twig', array('Product' => $Product, 'index' => $index)); }
/** * 納品書の設定画面表示. * @param Application $app * @param Request $request * @param unknown $id * @throws NotFoundHttpException * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response */ public function index(Application $app, Request $request) { // リクエストGETで良ければ削除 // // POSTでない場合は終了する // if ('POST' !== $request->getMethod()) { // throw new BadRequestHttpException(); // } $searchForm = $app['form.factory']->createBuilder('admin_coupon_search')->getForm(); $pagination = null; $pagination = $app['eccube.plugin.coupon.repository.coupon']->findAll(); return $app->render('Coupon/View/admin/index.twig', array('searchForm' => $searchForm->createView(), 'pagination' => $pagination, 'totalItemCount' => count($pagination))); }
public function index(Application $app, Request $request) { /** @var $form \Symfony\Component\Form\Form */ $builder = $app['form.factory']->createNamedBuilder('', 'search_product_block')->setMethod('GET'); $event = new EventArgs(array('builder' => $builder), $request); $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_BLOCK_SEARCH_PRODUCT_INDEX_INITIALIZE, $event); /** @var $request \Symfony\Component\HttpFoundation\Request */ $request = $app['request_stack']->getMasterRequest(); $form = $builder->getForm(); $form->handleRequest($request); return $app->render('Block/search_product.twig', array('form' => $form->createView())); }
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)); }
public function index(Application $app) { $position = $app['request']->get('position'); $blocks = array(); if ($app['eccube.layout']) { foreach ($app['eccube.layout']->getBlocPositions() as $blocPositions) { if ($blocPositions->getTargetId() == constant("Eccube\\Entity\\BlocPosition::" . $position)) { $blocks[] = $blocPositions->getBloc(); } } } return $app->render('block.twig', array('blocks' => $blocks)); }
public function index(Application $app, Request $request) { $pagination = null; $searchForm = $app['form.factory']->createBuilder('admin_search_customer')->getForm(); $searchForm->handleRequest($request); $searchData = array(); if ($searchForm->isValid()) { $searchData = $searchForm->getData(); } if ('POST' === $request->getMethod()) { $qb = $app['eccube.repository.customer']->getQueryBuilderBySearchData($searchData); $pagination = $app['paginator']()->paginate($qb, empty($searchData['pageno']) ? 1 : $searchData['pageno'], empty($searchData['pagemax']) ? 10 : $searchData['pagemax']->getId()); } return $app->render('Customer/index.twig', array('searchForm' => $searchForm->createView(), 'pagination' => $pagination)); }
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 function index(Application $app, Request $request, $route) { $DeviceType = $app['orm.em']->getRepository('Eccube\\Entity\\Master\\DeviceType')->find(DeviceType::DEVICE_TYPE_PC); $PageLayout = $app['eccube.repository.page_layout']->findOneBy(array('url' => $route, 'DeviceType' => $DeviceType, 'edit_flg' => PageLayout::EDIT_FLG_USER)); if (is_null($PageLayout)) { throw new NotFoundHttpException(); } // user_dataディレクトリを探索パスに追加. $paths = array(); $paths[] = $app['config']['user_data_realdir']; $app['twig.loader']->addLoader(new \Twig_Loader_Filesystem($paths)); $file = $PageLayout->getFileName() . '.twig'; $event = new EventArgs(array('DeviceType' => $DeviceType, 'PageLayout' => $PageLayout, 'file' => $file), $request); $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_USER_DATA_INDEX_INITIALIZE, $event); return $app->render($file); }
private function response(Application $app, Request $request, $reportType = null) { /* @var $form \Symfony\Component\Form\Form */ $builder = $app['form.factory']->createBuilder('sales_report'); if (!is_null($reportType) && $reportType !== 'term') { $builder->remove('unit'); } $form = $builder->getForm(); $form->handleRequest($request); $data = array('graph' => null, 'raw' => null); if (!is_null($reportType) && $form->isValid()) { $data = $app['eccube.plugin.service.sales_report']->setReportType($reportType)->setTerm($form->get('term_type')->getData(), $form->getData())->getData(); } $template = is_null($reportType) ? 'term' : $reportType; return $app->render('SalesReport/Resource/template/' . $template . '.twig', array('form' => $form->createView(), 'graphData' => json_encode($data['graph']), 'rawData' => $data['raw'], 'type' => $reportType)); }