当前位置: 首页>>代码示例>>PHP>>正文


PHP Eccube\Application类代码示例

本文整理汇总了PHP中Eccube\Application的典型用法代码示例。如果您正苦于以下问题:PHP Application类的具体用法?PHP Application怎么用?PHP Application使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Application类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 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));
 }
开发者ID:geany-y,项目名称:LikeNiko,代码行数:7,代码来源:BlockController.php

示例2: index

 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()));
 }
开发者ID:ec-cube,项目名称:ec-cube,代码行数:28,代码来源:CacheController.php

示例3: searchProduct

 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));
     }
 }
开发者ID:k-yamamura,项目名称:related-product-plugin,代码行数:31,代码来源:RelatedProductController.php

示例4: searchProduct

 /**
  * 商品検索画面を表示する
  * @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));
     }
 }
开发者ID:sai-ken-tanaka,项目名称:recommend_plugin,代码行数:36,代码来源:RecommendSearchModelController.php

示例5: index

 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()));
 }
开发者ID:hiroyasu55,项目名称:ec-cube,代码行数:7,代码来源:LoginController.php

示例6: download

 /**
  * 作成ボタンクリック時の処理
  * 帳票の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;
 }
开发者ID:k-yamamura,项目名称:order-pdf-plugin,代码行数:37,代码来源:OrderPdfController.php

示例7: index

 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()));
 }
开发者ID:naow9y,项目名称:ec-cube,代码行数:60,代码来源:SecurityController.php

示例8: setUp

 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();
 }
开发者ID:noadless,项目名称:ec-cube,代码行数:9,代码来源:TelTypeTest.php

示例9: index

 /**
  * 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));
 }
开发者ID:EC-CUBE,项目名称:Recommend-plugin,代码行数:16,代码来源:RecommendController.php

示例10: createApplication

 /**
  * {@inheritdoc}
  */
 public function createApplication()
 {
     $app = new Application();
     $app->initialize();
     $app['session.test'] = true;
     $app['exception_handler']->disable();
     $app->boot();
     return $app;
 }
开发者ID:hiroyasu55,项目名称:ec-cube,代码行数:12,代码来源:AbstractRepositoryTestCase.php

示例11: index

 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));
 }
开发者ID:ec-cube,项目名称:ec-cube,代码行数:9,代码来源:BlockController.php

示例12: getProduct

 /**
  * 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));
 }
开发者ID:EC-CUBE,项目名称:related-product-plugin,代码行数:18,代码来源:RelatedProductController.php

示例13: delete

 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'));
 }
开发者ID:nanasess,项目名称:nagoya-eccube-study,代码行数:11,代码来源:DeliveryController.php

示例14: __construct

 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;
 }
开发者ID:nanasess,项目名称:nagoya-eccube-study,代码行数:11,代码来源:PhpStormCommand.php

示例15: index

 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()));
 }
开发者ID:chihiro-adachi,项目名称:eccube3-uzaitaikai-plugin,代码行数:12,代码来源:WithdrawController.php


注:本文中的Eccube\Application类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。