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


PHP Application::trans方法代码示例

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


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

示例1: index

 /**
  * 納品書の設定画面表示.
  *
  * @param Application $app
  * @param Request     $request
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse|Response
  *
  * @throws NotFoundHttpException
  */
 public function index(Application $app, Request $request)
 {
     // requestから受注番号IDの一覧を取得する.
     $ids = $this->getIds($request);
     if (count($ids) == 0) {
         $app->addError('admin.plugin.order_pdf.parameter.notfound', 'admin');
         log_info('The Order cannot found!');
         return $app->redirect($app->url('admin_order'));
     }
     /* @var OrderPdfRepository $repos */
     $repos = $app['orderpdf.repository.order_pdf'];
     $OrderPdf = $repos->find($app->user());
     if (EntityUtil::isEmpty($OrderPdf)) {
         $OrderPdf = new OrderPdf();
         $OrderPdf->setTitle($app->trans('admin.plugin.order_pdf.title.default'))->setMessage1($app->trans('admin.plugin.order_pdf.message1.default'))->setMessage2($app->trans('admin.plugin.order_pdf.message2.default'))->setMessage3($app->trans('admin.plugin.order_pdf.message3.default'));
     }
     /**
      * @var FormBuilder $builder
      */
     $builder = $app['form.factory']->createBuilder('admin_order_pdf', $OrderPdf);
     /* @var Form $form */
     $form = $builder->getForm();
     // Formへの設定
     $form->get('ids')->setData(implode(',', $ids));
     return $app->render('OrderPdf/Resource/template/admin/order_pdf.twig', array('form' => $form->createView()));
 }
开发者ID:EC-CUBE,项目名称:order-pdf-plugin,代码行数:36,代码来源:OrderPdfController.php

示例2: setDefaultData

 /**
  * データが設定されていない場合にデフォルト値を設定する.
  *
  * @param array $formData
  */
 protected function setDefaultData(array &$formData)
 {
     $defaultList = array('title' => $this->app->trans('admin.plugin.order_pdf.title.default'), 'message1' => $this->app->trans('admin.plugin.order_pdf.message1.default'), 'message2' => $this->app->trans('admin.plugin.order_pdf.message2.default'), 'message3' => $this->app->trans('admin.plugin.order_pdf.message3.default'));
     foreach ($defaultList as $key => $value) {
         if (is_null($formData[$key])) {
             $formData[$key] = $value;
         }
     }
 }
开发者ID:EC-CUBE,项目名称:order-pdf-plugin,代码行数:14,代码来源:OrderPdfService.php

示例3: restoreDiscount

 /**
  * 合計金額がマイナスになっていた場合、値引き処理を元に戻す
  *
  * @param Order $Order
  */
 private function restoreDiscount(Order $Order)
 {
     // クーポンが未入力でクーポン情報が存在すればクーポン情報を削除
     $CouponOrder = $this->app['eccube.plugin.coupon.service.coupon']->getCouponOrder($Order->getPreOrderId());
     if ($CouponOrder) {
         $total = $Order->getSubtotal() + $Order->getCharge() + $Order->getDeliveryFeeTotal();
         // 合計金額
         $totalAmount = $total - $Order->getDiscount();
         if ($totalAmount < 0) {
             // 合計金額がマイナスのため、金額を値引き前に戻す
             $this->app['orm.em']->remove($CouponOrder);
             $this->app['orm.em']->flush($CouponOrder);
             $discount = $Order->getDiscount() - $CouponOrder->getDiscount();
             $Order->setDiscount($discount);
             $total = $total - $discount;
             $Order->setTotal($total);
             $Order->setPaymentTotal($total);
             $this->app['orm.em']->flush($Order);
             $this->app->addError($this->app->trans('front.plugin.coupon.shopping.use.minus'), 'front.request');
         }
     }
 }
开发者ID:EC-CUBE,项目名称:coupon-plugin,代码行数:27,代码来源:Coupon.php

示例4: onAdminProductCategoryFormInitialize

 /**
  * 管理画面:カテゴリ登録画面に, カテゴリコンテンツのフォームを追加する.
  *
  * @param EventArgs $event
  */
 public function onAdminProductCategoryFormInitialize(EventArgs $event)
 {
     log_info('CategoryContent admin.product.category.index.initialize start');
     /* @var Category $TargetCategory */
     $TargetCategory = $event->getArgument('TargetCategory');
     $id = $TargetCategory->getId();
     $CategoryContent = null;
     if ($id) {
         // カテゴリ編集時は初期値を取得
         $CategoryContent = $this->app['eccube.plugin.category_content.repository.category_content']->find($id);
     }
     // カテゴリ新規登録またはコンテンツが未登録の場合
     if (!$CategoryContent) {
         $CategoryContent = new CategoryContent();
     }
     // フォームの追加
     /** @var FormInterface $builder */
     $builder = $event->getArgument('builder');
     $builder->add(self::CATEGORY_CONTENT_TEXTAREA_NAME, 'textarea', array('required' => false, 'label' => false, 'mapped' => false, 'constraints' => array(new Assert\Length(array('max' => $this->app['config']['category_text_area_len']))), 'attr' => array('maxlength' => $this->app['config']['category_text_area_len'], 'placeholder' => $this->app->trans('admin.plugin.category.content'))));
     // 初期値を設定
     $builder->get(self::CATEGORY_CONTENT_TEXTAREA_NAME)->setData($CategoryContent->getContent());
     log_info('CategoryContent admin.product.category.index.initialize end');
 }
开发者ID:EC-CUBE,项目名称:category-content-plugin,代码行数:28,代码来源:Event.php

示例5: index

 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)) {
             $message = $app->trans('admin.install.warning', array('installphpPath' => 'html/install.php'));
             $app->addWarning($message, 'admin');
         }
         $fileOnRoot = $app['config']['root_dir'] . '/install.php';
         if (file_exists($fileOnRoot)) {
             $message = $app->trans('admin.install.warning', array('installphpPath' => 'install.php'));
             $app->addWarning($message, 'admin');
         }
     }
     // 受注マスター検索用フォーム
     $searchOrderBuilder = $app['form.factory']->createBuilder('admin_search_order');
     // 商品マスター検索用フォーム
     $searchProductBuilder = $app['form.factory']->createBuilder('admin_search_product');
     // 会員マスター検索用フォーム
     $searchCustomerBuilder = $app['form.factory']->createBuilder('admin_search_customer');
     $event = new EventArgs(array('searchOrderBuilder' => $searchOrderBuilder, 'searchProductBuilder' => $searchProductBuilder, 'searchCustomerBuilder' => $searchCustomerBuilder), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ADMIM_INDEX_INITIALIZE, $event);
     // 受注マスター検索用フォーム
     $searchOrderForm = $searchOrderBuilder->getForm();
     // 商品マスター検索用フォーム
     $searchProductForm = $searchProductBuilder->getForm();
     // 会員マスター検索用フォーム
     $searchCustomerForm = $searchCustomerBuilder->getForm();
     /**
      * 受注状況.
      */
     $excludes = array();
     $excludes[] = $app['config']['order_pending'];
     $excludes[] = $app['config']['order_processing'];
     $excludes[] = $app['config']['order_cancel'];
     $excludes[] = $app['config']['order_deliv'];
     $event = new EventArgs(array('excludes' => $excludes), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ADMIM_INDEX_ORDER, $event);
     // 受注ステータスごとの受注件数.
     $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'];
     $event = new EventArgs(array('excludes' => $excludes), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ADMIM_INDEX_SALES, $event);
     // 今日の売上/件数
     $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']);
     $event = new EventArgs(array('Orders' => $Orders, 'OrderStatuses' => $OrderStatuses, 'salesThisMonth' => $salesThisMonth, 'salesToday' => $salesToday, 'salesYesterday' => $salesYesterday, 'countNonStockProducts' => $countNonStockProducts, 'countCustomers' => $countCustomers), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ADMIM_INDEX_COMPLETE, $event);
     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));
 }
开发者ID:ec-cube,项目名称:ec-cube,代码行数:69,代码来源:AdminController.php

示例6: buildForm

 /**
  * buildForm.
  *
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('content', 'textarea', array('label' => 'カテゴリ別表示用コンテンツ', 'mapped' => false, 'required' => false, 'constraints' => array(new Assert\Length(array('max' => $this->app['config']['category_text_area_len']))), 'attr' => array('maxlength' => $this->app['config']['category_text_area_len'], 'placeholder' => $this->app->trans('admin.plugin.category.content'))));
 }
开发者ID:EC-CUBE,项目名称:category-content-plugin,代码行数:10,代码来源:CategoryContentExtension.php

示例7: shippingMultiple

 /**
  * 複数配送処理
  */
 public function shippingMultiple(Application $app, Request $request)
 {
     $cartService = $app['eccube.service.cart'];
     // カートチェック
     if (!$cartService->isLocked()) {
         // カートが存在しない、カートがロックされていない時はエラー
         log_info('カートが存在しません');
         return $app->redirect($app->url('cart'));
     }
     // カートチェック
     if (count($cartService->getCart()->getCartItems()) <= 0) {
         // カートが存在しない時はエラー
         log_info('カートに商品が入っていないためショッピングカート画面にリダイレクト');
         return $app->redirect($app->url('cart'));
     }
     /** @var \Eccube\Entity\Order $Order */
     $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
     if (!$Order) {
         log_info('購入処理中の受注情報がないため購入エラー');
         $app->addError('front.shopping.order.error');
         return $app->redirect($app->url('shopping_error'));
     }
     // 複数配送時は商品毎でお届け先を設定する為、商品をまとめた数量を設定
     $compItemQuantities = array();
     foreach ($Order->getShippings() as $Shipping) {
         foreach ($Shipping->getShipmentItems() as $ShipmentItem) {
             $itemId = $ShipmentItem->getProductClass()->getId();
             $quantity = $ShipmentItem->getQuantity();
             if (array_key_exists($itemId, $compItemQuantities)) {
                 $compItemQuantities[$itemId] = $compItemQuantities[$itemId] + $quantity;
             } else {
                 $compItemQuantities[$itemId] = $quantity;
             }
         }
     }
     // 商品に紐づく商品情報を取得
     $shipmentItems = array();
     $productClassIds = array();
     foreach ($Order->getShippings() as $Shipping) {
         foreach ($Shipping->getShipmentItems() as $ShipmentItem) {
             if (!in_array($ShipmentItem->getProductClass()->getId(), $productClassIds)) {
                 $shipmentItems[] = $ShipmentItem;
             }
             $productClassIds[] = $ShipmentItem->getProductClass()->getId();
         }
     }
     $builder = $app->form();
     $builder->add('shipping_multiple', 'collection', array('type' => 'shipping_multiple', 'data' => $shipmentItems, 'allow_add' => true, 'allow_delete' => true));
     $event = new EventArgs(array('builder' => $builder, 'Order' => $Order), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_SHIPPING_MULTIPLE_INITIALIZE, $event);
     $form = $builder->getForm();
     $form->handleRequest($request);
     $errors = array();
     if ($form->isSubmitted() && $form->isValid()) {
         log_info('複数配送設定処理開始', array($Order->getId()));
         $data = $form['shipping_multiple'];
         // 数量が超えていないか、同一でないとエラー
         $itemQuantities = array();
         foreach ($data as $mulitples) {
             /** @var \Eccube\Entity\ShipmentItem $multipleItem */
             $multipleItem = $mulitples->getData();
             foreach ($mulitples as $items) {
                 foreach ($items as $item) {
                     $quantity = $item['quantity']->getData();
                     $itemId = $multipleItem->getProductClass()->getId();
                     if (array_key_exists($itemId, $itemQuantities)) {
                         $itemQuantities[$itemId] = $itemQuantities[$itemId] + $quantity;
                     } else {
                         $itemQuantities[$itemId] = $quantity;
                     }
                 }
             }
         }
         foreach ($compItemQuantities as $key => $value) {
             if (array_key_exists($key, $itemQuantities)) {
                 if ($itemQuantities[$key] != $value) {
                     $errors[] = array('message' => $app->trans('shopping.multiple.quantity.diff'));
                     // 対象がなければエラー
                     log_info('複数配送設定入力チェックエラー', array($Order->getId()));
                     return $app->render('Shopping/shipping_multiple.twig', array('form' => $form->createView(), 'shipmentItems' => $shipmentItems, 'compItemQuantities' => $compItemQuantities, 'errors' => $errors));
                 }
             }
         }
         // お届け先情報をdelete/insert
         $shippings = $Order->getShippings();
         foreach ($shippings as $Shipping) {
             $Order->removeShipping($Shipping);
             $app['orm.em']->remove($Shipping);
         }
         foreach ($data as $mulitples) {
             /** @var \Eccube\Entity\ShipmentItem $multipleItem */
             $multipleItem = $mulitples->getData();
             foreach ($mulitples as $items) {
                 foreach ($items as $item) {
                     // 追加された配送先情報を作成
                     $Delivery = $multipleItem->getShipping()->getDelivery();
                     // 選択された情報を取得
//.........这里部分代码省略.........
开发者ID:ec-cube,项目名称:ec-cube,代码行数:101,代码来源:ShoppingController.php

示例8: index

 /**
  * 購入画面表示
  *
  * @param Application $app
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\RedirectResponse|Response
  */
 public function index(Application $app, Request $request)
 {
     $cartService = $app['eccube.service.cart'];
     // カートチェック
     if (!$cartService->isLocked()) {
         // カートが存在しない、カートがロックされていない時はエラー
         return $app->redirect($app->url('cart'));
     }
     // カートチェック
     if (count($cartService->getCart()->getCartItems()) <= 0) {
         // カートが存在しない時はエラー
         return $app->redirect($app->url('cart'));
     }
     // 登録済みの受注情報を取得
     $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
     // 初回アクセス(受注情報がない)の場合は, 受注情報を作成
     if (is_null($Order)) {
         // 未ログインの場合, ログイン画面へリダイレクト.
         if (!$app->isGranted('IS_AUTHENTICATED_FULLY')) {
             // 非会員でも一度会員登録されていればショッピング画面へ遷移
             $Customer = $app['eccube.service.shopping']->getNonMember($this->sessionKey);
             if (is_null($Customer)) {
                 return $app->redirect($app->url('shopping_login'));
             }
         } else {
             $Customer = $app->user();
         }
         try {
             // 受注情報を作成
             $Order = $app['eccube.service.shopping']->createOrder($Customer);
         } catch (CartException $e) {
             $app->addRequestError($e->getMessage());
             return $app->redirect($app->url('cart'));
         }
         // セッション情報を削除
         $app['session']->remove($this->sessionOrderKey);
         $app['session']->remove($this->sessionMultipleKey);
     }
     // 受注関連情報を最新状態に更新
     $app['orm.em']->refresh($Order);
     // form作成
     $builder = $app['eccube.service.shopping']->getShippingFormBuilder($Order);
     $event = new EventArgs(array('builder' => $builder, 'Order' => $Order), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_INDEX_INITIALIZE, $event);
     $form = $builder->getForm();
     if ($Order->getTotalPrice() < 0) {
         // 合計金額がマイナスの場合、エラー
         $message = $app->trans('shopping.total.price', array('totalPrice' => number_format($Order->getTotalPrice())));
         $app->addError($message);
         return $app->redirect($app->url('shopping_error'));
     }
     // 複数配送の場合、エラーメッセージを一度だけ表示
     if (!$app['session']->has($this->sessionMultipleKey)) {
         if (count($Order->getShippings()) > 1) {
             $app->addRequestError('shopping.multiple.delivery');
         }
         $app['session']->set($this->sessionMultipleKey, 'multiple');
     }
     return $app->render('Shopping/index.twig', array('form' => $form->createView(), 'Order' => $Order));
 }
开发者ID:shhirose,项目名称:ec-cube,代码行数:67,代码来源:ShoppingController.php


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