/** * 商品検索画面を表示する * @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)); } }
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)); }
public function searchProduct(Application $app, Request $request) { if ($request->isXmlHttpRequest()) { $searchData = array('id' => $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[] */ $Products = $app['eccube.repository.product']->getQueryBuilderBySearchDataForAdmin($searchData)->getQuery()->getResult(); // 表示されている商品は検索結果に含めない $productId = $request->get('product_id'); $ProductsData = array(); $count = count($Products); $i = 0; for ($i = 0; $i < $count; $i++) { $Product = $Products[$i]; if ($Product->getId() != $productId) { $ProductsData[] = $Product; } if ($i >= 10) { break; } } $message = ''; if ($count > $i) { $message = '検索結果の上限を超えています。検索条件を設定してください。'; } return $app->renderView('RelatedProduct/Resource/template/Admin/modal_result.twig', array('Products' => $ProductsData, 'message' => $message)); } }
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) { $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())); }
/** * 作成ボタンクリック時の処理 * 帳票の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) { $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 setUp() { parent::setUp(); $this->app = new \Eccube\Application(array('env' => 'test')); $this->app->initialize(); $this->app->boot(); // CSRF tokenを無効にしてFormを作成 $this->form = $this->app['form.factory']->createBuilder('form', null, array('csrf_protection' => false))->add('tel', 'tel')->getForm(); }
/** * 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)); }
/** * {@inheritdoc} */ public function createApplication() { $app = new Application(); $app->initialize(); $app['session.test'] = true; $app['exception_handler']->disable(); $app->boot(); return $app; }
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)); }
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')); }
public function __construct(\Eccube\Application $app, $name = null) { parent::__construct($name); $app['debug'] = true; $app->initialize(); // executeでdump($app)を使いたいので. $dumper = new \Sorien\Provider\PimpleDumpProvider(); $app->register($dumper, array('dumper' => $dumper)); $app->boot(); $this->app = $app; }
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())); }
/** * onRenderProductListBefore. * * @param FilterResponseEvent $event */ public function onRenderProductListBefore(FilterResponseEvent $event) { log_info('CategoryContent eccube.event.render.product_list.before start'); $app = $this->app; $request = $event->getRequest(); $response = $event->getResponse(); $id = $request->query->get('category_id'); // category_idがない場合、レンダリングを変更しない if (!$id) { return; } $CategoryContent = $app['eccube.plugin.category_content.repository.category_content']->find($id); // 登録がない、もしくは空で登録されている場合、レンダリングを変更しない if (!$CategoryContent || !$CategoryContent->getContent()) { log_info('CategoryContent eccube.event.render.product_list.before not content end'); return; } // twigから挿入するhtmlを生成する $snipet = $this->app->renderView('CategoryContent/Resource/template/default/category_content.twig', array('PluginCategoryContent' => $CategoryContent)); // htmlの挿入処理 $html = $response->getContent(); $search = self::CATEGORY_CONTENT_TAG; if (strpos($html, $search)) { // タグの位置に挿入する場合 log_info('Render category content with ', array('CATEGORY_CONTENT_TAG' => $search)); $replace = $search . $snipet; $newHtml = str_replace($search, $replace, $html); $response->setContent($newHtml); } else { // Elementを探して挿入する場合 libxml_use_internal_errors(true); $dom = new \DOMDocument(); $dom->loadHTML('<?xml encoding="UTF-8">' . $html); $dom->encoding = 'UTF-8'; $dom->formatOutput = true; // 基準となるElementを取得 $navElement = $dom->getElementById('topicpath'); if (!$navElement instanceof \DOMElement) { log_info('CategoryContent eccube.event.render.product_list.before not have dom end'); return; } // 挿入するNodeを生成 $template = $dom->createDocumentFragment(); $template->appendXML(htmlspecialchars($snipet)); $node = $dom->importNode($template, true); // 基準となるElementの直後にNodeを挿入し、Responsを書き換え $navElement->parentNode->insertBefore($node, $navElement->nextSibling); $newHtml = html_entity_decode($dom->saveHTML(), ENT_NOQUOTES, 'UTF-8'); $response->setContent($newHtml); } $event->setResponse($response); log_info('CategoryContent eccube.event.render.product_list.before end'); }
public function imageAdd(Application $app, Request $request) { $images = $request->files->get('payment_register'); $filename = null; if (isset($images['payment_image_file'])) { $image = $images['payment_image_file']; $extension = $image->guessExtension(); $filename = date('mdHis') . uniqid('_') . '.' . $extension; $image->move($app['config']['image_temp_realdir'], $filename); } return $app->json(array('filename' => $filename), 200); }
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 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')); }
public function searchProduct(Application $app, Request $request) { if ($request->isXmlHttpRequest()) { $searchData = array('id' => $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[] */ $Products = $app['eccube.repository.product']->getQueryBuilderBySearchDataForAdmin($searchData)->getQuery()->getResult(); return $app->renderView('RelatedProduct/Resource/template/Admin/modal_result.twig', array('Products' => $Products)); } }
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)); }
/** * 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)); }
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)); }
public function index(Application $app, Request $request, $page_no = null) { $session = $request->getSession(); $pagination = array(); $searchForm = $app['form.factory']->createBuilder('admin_search_customer')->getForm(); //アコーディオンの制御初期化( デフォルトでは閉じる ) $active = false; $pageMaxis = $app['eccube.repository.master.page_max']->findAll(); $page_count = $app['config']['default_page_count']; if ('POST' === $request->getMethod()) { $searchForm->handleRequest($request); if ($searchForm->isValid()) { $searchData = $searchForm->getData(); // paginator $qb = $app['eccube.repository.customer']->getQueryBuilderBySearchData($searchData); $page_no = 1; $pagination = $app['paginator']()->paginate($qb, $page_no, $page_count); // sessionのデータ保持 $session->set('eccube.admin.customer.search', $searchData); } } else { if (is_null($page_no)) { // sessionを削除 $session->remove('eccube.admin.customer.search'); } else { // pagingなどの処理 $searchData = $session->get('eccube.admin.customer.search'); if (!is_null($searchData)) { // 表示件数 $pcount = $request->get('page_count'); $page_count = empty($pcount) ? $page_count : $pcount; $qb = $app['eccube.repository.customer']->getQueryBuilderBySearchData($searchData); $pagination = $app['paginator']()->paginate($qb, $page_no, $page_count); // セッションから検索条件を復元 if (count($searchData['sex']) > 0) { $sex_ids = array(); foreach ($searchData['sex'] as $Sex) { $sex_ids[] = $Sex->getId(); } $searchData['sex'] = $app['eccube.repository.master.sex']->findBy(array('id' => $sex_ids)); } if (!is_null($searchData['pref'])) { $searchData['pref'] = $app['eccube.repository.master.pref']->find($searchData['pref']->getId()); } $searchForm->setData($searchData); } } } return $app->renderView('Customer/index.twig', array('searchForm' => $searchForm->createView(), 'pagination' => $pagination, 'pageMaxis' => $pageMaxis, 'page_no' => $page_no, 'page_count' => $page_count, 'active' => $active)); }
/** * AdContents constructor. * @param Application $app * @param Product $product */ public function __construct(Application $app, Product $product) { $shop_name = $app['eccube.repository.base_info']->get()->getShopName(); $homepage_url = $app->url('homepage'); $product_url = $app->url('product_detail', array('id' => $product->getId())); $this->headline = CsvContentsUtil::clipText($product->getName(), 15); $this->description1 = CsvContentsUtil::clipText($product->getDescriptionDetail(), 19); $this->description2 = CsvContentsUtil::clipText($shop_name, 19); $this->display_url = CsvContentsUtil::removeHttpText(CsvContentsUtil::clipText($homepage_url, 29)); $this->link_url = CsvContentsUtil::clipText($product_url, 1024); $now = new \DateTime(); $ad_name = $now->format('Ymd') . '_' . str_pad($product->getId(), 4, 0, STR_PAD_LEFT); $this->ad_inner_name = CsvContentsUtil::clipText($ad_name, 50); }
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)); }
/** * 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 = 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) { // install.phpのチェック. if (isset($app['config']['eccube_install']) && $app['config']['eccube_install'] == 1) { $file = $app['config']['root_dir'] . '/html/install.php'; if (file_exists($file)) { $app->addWarning('admin.install.warning', 'admin'); } } // 受注マスター検索用フォーム $searchOrderForm = $app['form.factory']->createBuilder('admin_search_order')->getForm(); // 商品マスター検索用フォーム $searchProductForm = $app['form.factory']->createBuilder('admin_search_product')->getForm(); // 会員マスター検索用フォーム $searchCustomerForm = $app['form.factory']->createBuilder('admin_search_customer')->getForm(); /** * 受注状況. */ $excludes = array(); $excludes[] = $app['config']['order_pending']; $excludes[] = $app['config']['order_processing']; $excludes[] = $app['config']['order_cancel']; $excludes[] = $app['config']['order_deliv']; // 受注ステータスごとの受注件数. $Orders = $this->getOrderEachStatus($app['orm.em'], $excludes); // 受注ステータスの一覧. $OrderStatuses = $this->findOrderStatus($app['orm.em'], $excludes); /** * 売り上げ状況 */ $excludes = array(); $excludes[] = $app['config']['order_processing']; $excludes[] = $app['config']['order_cancel']; $excludes[] = $app['config']['order_pending']; // 今日の売上/件数 $salesToday = $this->getSalesByDay($app['orm.em'], new \DateTime(), $excludes); // 昨日の売上/件数 $salesYesterday = $this->getSalesByDay($app['orm.em'], new \DateTime('-1 day'), $excludes); // 今月の売上/件数 $salesThisMonth = $this->getSalesByMonth($app['orm.em'], new \DateTime(), $excludes); /** * ショップ状況 */ // 在庫切れ商品数 $countNonStockProducts = $this->countNonStockProducts($app['orm.em']); // 本会員数 $countCustomers = $this->countCustomers($app['orm.em']); return $app->render('index.twig', array('searchOrderForm' => $searchOrderForm->createView(), 'searchProductForm' => $searchProductForm->createView(), 'searchCustomerForm' => $searchCustomerForm->createView(), 'Orders' => $Orders, 'OrderStatuses' => $OrderStatuses, 'salesThisMonth' => $salesThisMonth, 'salesToday' => $salesToday, 'salesYesterday' => $salesYesterday, 'countNonStockProducts' => $countNonStockProducts, 'countCustomers' => $countCustomers)); }
/** * * * @param FilterResponseEvent $event */ public function onRenderOembedAdminProductDetailEditBefore(FilterResponseEvent $event) { $request = $event->getRequest(); $response = $event->getResponse(); $parts_btn = $this->app->renderView('Oembed/Resource/template/admin/embed-button.twig', array()); $parts_modal = $this->app->renderView('Oembed/Resource/template/admin/embed-modal.twig', array()); $crawler = new HtmlPageCrawler($response->getContent()); $crawler->filter('#admin_product_free_area')->before($parts_btn); $crawler->filter('body')->append($parts_modal); // $html = $this->getHtml($crawler); $html = $crawler->html(); $html = html_entity_decode($html, ENT_NOQUOTES, 'UTF-8'); $response->setContent($html); $event->setResponse($response); }