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


PHP Model\Lang类代码示例

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


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

示例1: buildDataSet

 /**
  * @param  Lang                                                                                   $lang
  * @return array|\Propel\Runtime\ActiveQuery\ModelCriteria|\Thelia\Core\Template\Element\BaseLoop
  */
 public function buildDataSet(Lang $lang)
 {
     $locale = $lang->getLocale();
     $productJoin = new Join(ProductTableMap::ID, ProductI18nTableMap::ID, Criteria::LEFT_JOIN);
     $attributeAvJoin = new Join(AttributeAvTableMap::ID, AttributeAvI18nTableMap::ID, Criteria::LEFT_JOIN);
     $query = AttributeCombinationQuery::create()->useProductSaleElementsQuery()->useProductPriceQuery()->useCurrencyQuery()->addAsColumn("currency_CODE", CurrencyTableMap::CODE)->endUse()->addAsColumn("price_PRICE", ProductPriceTableMap::PRICE)->addAsColumn("price_PROMO_PRICE", ProductPriceTableMap::PROMO_PRICE)->endUse()->useProductQuery()->addJoinObject($productJoin, "product_join")->addJoinCondition("product_join", ProductI18nTableMap::LOCALE . " = ?", $locale, null, \PDO::PARAM_STR)->addAsColumn("product_TITLE", ProductI18nTableMap::TITLE)->addAsColumn("product_ID", ProductTableMap::ID)->endUse()->addAsColumn("product_sale_elements_REF", ProductSaleElementsTableMap::REF)->addAsColumn("product_sale_elements_EAN_CODE", ProductSaleElementsTableMap::EAN_CODE)->addAsColumn("product_sale_elements_PROMO", ProductSaleElementsTableMap::PROMO)->endUse()->useAttributeAvQuery()->addJoinObject($attributeAvJoin, "attribute_av_join")->addJoinCondition("attribute_av_join", AttributeAvI18nTableMap::LOCALE . " = ?", $locale, null, \PDO::PARAM_STR)->addAsColumn("attribute_av_i18n_ATTRIBUTES", "GROUP_CONCAT(DISTINCT " . AttributeAvI18nTableMap::TITLE . ")")->endUse()->select(["product_sale_elements_REF", "product_sale_elements_EAN_CODE", "product_sale_elements_PROMO", "price_PRICE", "price_PROMO_PRICE", "currency_CODE", "product_TITLE", "attribute_av_i18n_ATTRIBUTES"])->groupBy("product_sale_elements_REF");
     return $query;
 }
开发者ID:alex63530,项目名称:thelia,代码行数:12,代码来源:ProductPricesExport.php

示例2: getQuery

 /**
  * @return ContentQuery
  */
 public function getQuery(Lang $lang)
 {
     $locale = $lang->getLocale();
     $contentI18nJoin = new Join(ContentTableMap::ID, ContentI18nTableMap::ID, Criteria::LEFT_JOIN);
     $folderI18nJoin = new Join(FolderTableMap::ID, FolderI18nTableMap::ID, Criteria::LEFT_JOIN);
     $urlJoin = new Join(ContentTableMap::ID, RewritingUrlTableMap::VIEW_ID, Criteria::LEFT_JOIN);
     $query = ContentQuery::create()->select([ContentTableMap::ID, ContentTableMap::VISIBLE, "content_TITLE", "content_CHAPO", "content_DESCRIPTION", "content_CONCLUSION", "content_seo_TITLE", "content_seo_DESCRIPTION", "content_seo_KEYWORDS", "url_URL", "folder_TITLE", "folder_ID", "folder_IS_DEFAULT"])->_if($this->isImageExport())->useContentImageQuery("content_image_join", Criteria::LEFT_JOIN)->addAsColumn("content_IMAGES", "GROUP_CONCAT(DISTINCT `content_image_join`.FILE)")->addSelectColumn("content_IMAGES")->groupByContentId()->endUse()->_endif()->_if($this->isDocumentExport())->useContentDocumentQuery("content_document_join", Criteria::LEFT_JOIN)->addAsColumn("content_DOCUMENTS", "GROUP_CONCAT(DISTINCT `content_document_join`.FILE)")->addSelectColumn("content_DOCUMENTS")->groupByContentId()->endUse()->_endif()->useContentFolderQuery(null, Criteria::LEFT_JOIN)->useFolderQuery(null, Criteria::LEFT_JOIN)->_if($this->isDocumentExport())->useFolderDocumentQuery(null, Criteria::LEFT_JOIN)->addAsColumn("folder_DOCUMENTS", "GROUP_CONCAT(DISTINCT " . FolderDocumentTableMap::FILE . ")")->addSelectColumn("folder_DOCUMENTS")->endUse()->_endif()->_if($this->isImageExport())->useFolderImageQuery(null, Criteria::LEFT_JOIN)->addAsColumn("folder_IMAGES", "GROUP_CONCAT(DISTINCT " . FolderImageTableMap::FILE . ")")->addSelectColumn("folder_IMAGES")->endUse()->_endif()->addJoinObject($folderI18nJoin, "folder_i18n_join")->addJoinCondition("folder_i18n_join", FolderI18nTableMap::LOCALE . " = ?", $locale, null, \PDO::PARAM_STR)->addAsColumn("folder_TITLE", FolderI18nTableMap::TITLE)->addAsColumn("folder_ID", FolderTableMap::ID)->endUse()->addAsColumn("folder_IS_DEFAULT", ContentFolderTableMap::DEFAULT_FOLDER)->endUse()->addJoinObject($contentI18nJoin, "content_i18n_join")->addJoinCondition("content_i18n_join", ContentI18nTableMap::LOCALE . " = ?", $locale, null, \PDO::PARAM_STR)->addAsColumn("content_TITLE", ContentI18nTableMap::TITLE)->addAsColumn("content_CHAPO", ContentI18nTableMap::CHAPO)->addAsColumn("content_DESCRIPTION", ContentI18nTableMap::DESCRIPTION)->addAsColumn("content_CONCLUSION", ContentI18nTableMap::POSTSCRIPTUM)->addAsColumn("content_seo_TITLE", ContentI18nTableMap::META_TITLE)->addAsColumn("content_seo_DESCRIPTION", ContentI18nTableMap::META_DESCRIPTION)->addAsColumn("content_seo_KEYWORDS", ContentI18nTableMap::META_KEYWORDS)->addJoinObject($urlJoin, "url_rewriting_join")->addJoinCondition("url_rewriting_join", RewritingUrlTableMap::VIEW . " = ?", (new Content())->getRewrittenUrlViewName(), null, \PDO::PARAM_STR)->addJoinCondition("url_rewriting_join", RewritingUrlTableMap::VIEW_LOCALE . " = ?", $locale, null, \PDO::PARAM_STR)->addAsColumn("url_URL", RewritingUrlTableMap::URL)->groupBy(ContentTableMap::ID)->groupBy("folder_ID")->orderById();
     return $query;
 }
开发者ID:margery,项目名称:thelia,代码行数:12,代码来源:ContentExport.php

示例3: buildDataSet

 /**
  * @param  Lang                                            $lang
  * @return array|\Propel\Runtime\ActiveQuery\ModelCriteria
  */
 public function buildDataSet(Lang $lang)
 {
     $locale = $this->locale = $lang->getLocale();
     $query = ProductQuery::create();
     $urlJoin = new Join(ProductTableMap::ID, RewritingUrlTableMap::VIEW_ID, Criteria::LEFT_JOIN);
     $productJoin = new Join(ProductTableMap::ID, ProductI18nTableMap::ID, Criteria::LEFT_JOIN);
     $query->addJoinObject($urlJoin, "rewriting_url_join")->addJoinCondition("rewriting_url_join", RewritingUrlTableMap::VIEW_LOCALE . " = ?", $locale, null, \PDO::PARAM_STR)->addJoinCondition("rewriting_url_join", RewritingUrlTableMap::VIEW . " = ?", (new Product())->getRewrittenUrlViewName(), null, \PDO::PARAM_STR)->addJoinCondition("rewriting_url_join", "ISNULL(" . RewritingUrlTableMap::REDIRECTED . ")")->addJoinObject($productJoin, "product_join")->addJoinCondition("product_join", ProductI18nTableMap::LOCALE . " = ?", $locale, null, \PDO::PARAM_STR);
     $query->addAsColumn("product_i18n_TITLE", ProductI18nTableMap::TITLE)->addAsColumn("product_REF", ProductTableMap::REF)->addAsColumn("product_VISIBLE", ProductTableMap::VISIBLE)->addAsColumn("product_seo_TITLE", ProductI18nTableMap::META_TITLE)->addAsColumn("product_seo_META_DESCRIPTION", ProductI18nTableMap::META_DESCRIPTION)->addAsColumn("product_seo_META_KEYWORDS", ProductI18nTableMap::META_KEYWORDS)->addAsColumn("product_URL", RewritingUrlTableMap::URL)->select(["product_REF", "product_VISIBLE", "product_i18n_TITLE", "product_URL", "product_seo_TITLE", "product_seo_META_DESCRIPTION", "product_seo_META_KEYWORDS"]);
     return $query;
 }
开发者ID:margery,项目名称:thelia,代码行数:14,代码来源:ProductSEOExport.php

示例4: getQuery

 protected function getQuery(Lang $lang)
 {
     $locale = $lang->getLocale();
     $query = OrderQuery::create()->useCurrencyQuery()->addAsColumn("currency_CODE", CurrencyTableMap::CODE)->endUse()->useCustomerQuery()->addAsColumn("customer_REF", CustomerTableMap::REF)->endUse()->useOrderProductQuery()->useOrderProductTaxQuery(null, Criteria::LEFT_JOIN)->addAsColumn("product_TAX", "IF(" . OrderProductTableMap::WAS_IN_PROMO . "," . "SUM(" . OrderProductTaxTableMap::PROMO_AMOUNT . ")," . "SUM(" . OrderProductTaxTableMap::AMOUNT . ")" . ")")->addAsColumn("tax_TITLE", OrderProductTableMap::TAX_RULE_TITLE)->endUse()->addAsColumn("product_TITLE", OrderProductTableMap::TITLE)->addAsColumn("product_PRICE", "IF(" . OrderProductTableMap::WAS_IN_PROMO . "," . OrderProductTableMap::PROMO_PRICE . "," . OrderProductTableMap::PRICE . ")")->addAsColumn("product_QUANTITY", OrderProductTableMap::QUANTITY)->addAsColumn("product_WAS_IN_PROMO", OrderProductTableMap::WAS_IN_PROMO)->groupById()->endUse()->orderById()->groupById()->useOrderCouponQuery(null, Criteria::LEFT_JOIN)->addAsColumn("coupon_COUPONS", "GROUP_CONCAT(" . OrderCouponTableMap::TITLE . ")")->groupBy(OrderCouponTableMap::ORDER_ID)->endUse()->useModuleRelatedByPaymentModuleIdQuery("payment_module")->addAsColumn("payment_module_TITLE", "`payment_module`.CODE")->endUse()->useModuleRelatedByDeliveryModuleIdQuery("delivery_module")->addAsColumn("delivery_module_TITLE", "`delivery_module`.CODE")->endUse()->useOrderAddressRelatedByDeliveryOrderAddressIdQuery("delivery_address_join")->useCustomerTitleQuery("delivery_address_customer_title_join")->useCustomerTitleI18nQuery("delivery_address_customer_title_i18n_join")->addAsColumn("delivery_address_TITLE", "`delivery_address_customer_title_i18n_join`.SHORT")->endUse()->endUse()->useCountryQuery("delivery_address_country_join")->useCountryI18nQuery("delivery_address_country_i18n_join")->addAsColumn("delivery_address_country_TITLE", "`delivery_address_country_i18n_join`.TITLE")->endUse()->addAsColumn("delivery_address_COMPANY", "`delivery_address_join`.COMPANY")->addAsColumn("delivery_address_FIRSTNAME", "`delivery_address_join`.FIRSTNAME")->addAsColumn("delivery_address_LASTNAME", "`delivery_address_join`.LASTNAME")->addAsColumn("delivery_address_ADDRESS1", "`delivery_address_join`.ADDRESS1")->addAsColumn("delivery_address_ADDRESS2", "`delivery_address_join`.ADDRESS2")->addAsColumn("delivery_address_ADDRESS3", "`delivery_address_join`.ADDRESS3")->addAsColumn("delivery_address_ZIPCODE", "`delivery_address_join`.ZIPCODE")->addAsColumn("delivery_address_CITY", "`delivery_address_join`.CITY")->addAsColumn("delivery_address_PHONE", "`delivery_address_join`.PHONE")->endUse()->endUse()->useOrderAddressRelatedByInvoiceOrderAddressIdQuery("invoice_address_join")->useCustomerTitleQuery("invoice_address_customer_title_join")->useCustomerTitleI18nQuery("invoice_address_customer_title_i18n_join")->addAsColumn("invoice_address_TITLE", "`invoice_address_customer_title_i18n_join`.SHORT")->endUse()->endUse()->useCountryQuery("invoice_address_country_join")->useCountryI18nQuery("invoice_address_country_i18n_join")->addAsColumn("invoice_address_country_TITLE", "`invoice_address_country_i18n_join`.TITLE")->endUse()->endUse()->addAsColumn("invoice_address_COMPANY", "`invoice_address_join`.COMPANY")->addAsColumn("invoice_address_FIRSTNAME", "`invoice_address_join`.FIRSTNAME")->addAsColumn("invoice_address_LASTNAME", "`invoice_address_join`.LASTNAME")->addAsColumn("invoice_address_ADDRESS1", "`invoice_address_join`.ADDRESS1")->addAsColumn("invoice_address_ADDRESS2", "`invoice_address_join`.ADDRESS2")->addAsColumn("invoice_address_ADDRESS3", "`invoice_address_join`.ADDRESS3")->addAsColumn("invoice_address_ZIPCODE", "`invoice_address_join`.ZIPCODE")->addAsColumn("invoice_address_CITY", "`invoice_address_join`.CITY")->addAsColumn("invoice_address_PHONE", "`invoice_address_join`.PHONE")->endUse()->useOrderStatusQuery()->useOrderStatusI18nQuery()->addAsColumn("order_status_TITLE", OrderStatusI18nTableMap::TITLE)->endUse()->endUse()->select([OrderTableMap::REF, "customer_REF", "product_TITLE", "product_PRICE", "product_TAX", "tax_TITLE", "product_QUANTITY", "product_WAS_IN_PROMO", OrderTableMap::DISCOUNT, "coupon_COUPONS", OrderTableMap::POSTAGE, "payment_module_TITLE", OrderTableMap::INVOICE_REF, OrderTableMap::DELIVERY_REF, "delivery_module_TITLE", "delivery_address_TITLE", "delivery_address_COMPANY", "delivery_address_FIRSTNAME", "delivery_address_LASTNAME", "delivery_address_ADDRESS1", "delivery_address_ADDRESS2", "delivery_address_ADDRESS3", "delivery_address_ZIPCODE", "delivery_address_CITY", "delivery_address_country_TITLE", "delivery_address_PHONE", "invoice_address_TITLE", "invoice_address_COMPANY", "invoice_address_FIRSTNAME", "invoice_address_LASTNAME", "invoice_address_ADDRESS1", "invoice_address_ADDRESS2", "invoice_address_ADDRESS3", "invoice_address_ZIPCODE", "invoice_address_CITY", "invoice_address_country_TITLE", "invoice_address_PHONE", "order_status_TITLE", "currency_CODE", OrderTableMap::CREATED_AT])->orderByCreatedAt(Criteria::DESC);
     I18n::addI18nCondition($query, CustomerTitleI18nTableMap::TABLE_NAME, "`delivery_address_customer_title_join`.ID", CustomerTitleI18nTableMap::ID, "`delivery_address_customer_title_i18n_join`.LOCALE", $locale);
     I18n::addI18nCondition($query, CustomerTitleI18nTableMap::TABLE_NAME, "`invoice_address_customer_title_join`.ID", CustomerTitleI18nTableMap::ID, "`invoice_address_customer_title_i18n_join`.LOCALE", $locale);
     I18n::addI18nCondition($query, CountryI18nTableMap::TABLE_NAME, "`delivery_address_country_join`.ID", CountryI18nTableMap::ID, "`delivery_address_country_i18n_join`.LOCALE", $locale);
     I18n::addI18nCondition($query, CountryI18nTableMap::TABLE_NAME, "`invoice_address_country_join`.ID", CountryI18nTableMap::ID, "`invoice_address_country_i18n_join`.LOCALE", $locale);
     I18n::addI18nCondition($query, OrderStatusI18nTableMap::TABLE_NAME, OrderStatusI18nTableMap::ID, OrderStatusTableMap::ID, OrderStatusI18nTableMap::LOCALE, $locale);
     return $query;
 }
开发者ID:NandoKstroNet,项目名称:thelia,代码行数:11,代码来源:OrderExport.php

示例5: testImportWorks

 public function testImportWorks()
 {
     // Export data
     $data = $this->exportHandler->buildData(Lang::getDefaultLanguage());
     $compareData = array();
     $currentData = $data->getData();
     // Replace the prices
     foreach ($currentData as $key => &$entry) {
         // let  6/10 prices be changed.
         if (rand(1, 100) >= 60) {
             $compareData[$key] = $rand = rand(1, 1000);
             $entry["price"] = $rand;
         } else {
             $compareData[$key] = $entry["price"];
         }
     }
     // Import new prices
     $this->importHandler->retrieveFromFormatterData($data->setData($currentData));
     // Export once again
     $newData = $this->exportHandler->buildData(Lang::getDefaultLanguage());
     $newDataEntries = $newData->getData();
     // Check them
     foreach ($compareData as $key => $price) {
         $this->assertEquals($price, $newDataEntries[$key]["price"]);
     }
 }
开发者ID:margery,项目名称:thelia,代码行数:26,代码来源:ExportPriceThenImportItTest.php

示例6: generateAction

 /**
  * render the RSS feed
  *
  * @param $context string   The context of the feed : catalog, content. default: catalog
  * @param $lang string      The lang of the feed : fr_FR, en_US, ... default: default language of the site
  * @param $id string        The id of the parent element. The id of the main parent category for catalog context.
  *                          The id of the content folder for content context
  * @return Response
  * @throws \RuntimeException
  */
 public function generateAction($context, $lang, $id)
 {
     /** @var Request $request */
     $request = $this->getRequest();
     // context
     if ("" === $context) {
         $context = "catalog";
     } else {
         if (!in_array($context, array("catalog", "content", "brand"))) {
             $this->pageNotFound();
         }
     }
     // the locale : fr_FR, en_US,
     if ("" !== $lang) {
         if (!$this->checkLang($lang)) {
             $this->pageNotFound();
         }
     } else {
         try {
             $lang = Lang::getDefaultLanguage();
             $lang = $lang->getLocale();
         } catch (\RuntimeException $ex) {
             // @todo generate error page
             throw new \RuntimeException("No default language is defined. Please define one.");
         }
     }
     if (null === ($lang = LangQuery::create()->findOneByLocale($lang))) {
         $this->pageNotFound();
     }
     $lang = $lang->getId();
     // check if element exists and is visible
     if ("" !== $id) {
         if (false === $this->checkId($context, $id)) {
             $this->pageNotFound();
         }
     }
     $flush = $request->query->get("flush", "");
     // check if feed already in cache
     $cacheContent = false;
     $cacheDir = $this->getCacheDir();
     $cacheKey = self::FEED_CACHE_KEY . $lang . $context . $id;
     $cacheExpire = intval(ConfigQuery::read("feed_ttl", '7200')) ?: 7200;
     $cacheDriver = new FilesystemCache($cacheDir);
     if (!($this->checkAdmin() && "" !== $flush)) {
         $cacheContent = $cacheDriver->fetch($cacheKey);
     } else {
         $cacheDriver->delete($cacheKey);
     }
     // if not in cache
     if (false === $cacheContent) {
         // render the view
         $cacheContent = $this->renderRaw("feed", array("_context_" => $context, "_lang_" => $lang, "_id_" => $id));
         // save cache
         $cacheDriver->save($cacheKey, $cacheContent, $cacheExpire);
     }
     $response = new Response();
     $response->setContent($cacheContent);
     $response->headers->set('Content-Type', 'application/rss+xml');
     return $response;
 }
开发者ID:margery,项目名称:thelia,代码行数:70,代码来源:FeedController.php

示例7: testQuery

 public function testQuery()
 {
     new Translator(new Container());
     $export = new ProductSEOExport(new Container());
     $data = $export->buildData(Lang::getDefaultLanguage());
     $keys = ["ref", "visible", "product_title", "url", "page_title", "meta_description", "meta_keywords"];
     sort($keys);
     $rawData = $data->getData();
     $max = count($rawData);
     /**
      * If there's more that 50 entries,
      * just pick 50, it would be faster and as tested as if we test 1000 entries.
      */
     if ($max > 50) {
         $max = 50;
     }
     for ($i = 0; $i < $max; ++$i) {
         $row = $rawData[$i];
         $rowKeys = array_keys($row);
         $this->assertTrue(sort($rowKeys));
         $this->assertEquals($keys, $rowKeys);
         $product = ProductQuery::create()->findOneByRef($row["ref"]);
         $this->assertNotNull($product);
         $this->assertEquals($product->getVisible(), $row["visible"]);
         $this->assertEquals($product->getTitle(), $row["product_title"]);
         $this->assertEquals($product->getMetaTitle(), $row["page_title"]);
         $this->assertEquals($product->getMetaDescription(), $row["meta_description"]);
         $this->assertEquals($product->getMetaKeywords(), $row["meta_keywords"]);
         $this->assertEquals($product->getRewrittenUrl("en_US"), $row["url"]);
     }
 }
开发者ID:margery,项目名称:thelia,代码行数:31,代码来源:ProductSEOExportTest.php

示例8: testRenderLoop

 public function testRenderLoop()
 {
     $customerId = CustomerQuery::create()->findOne()->getId();
     $this->handler->expects($this->any())->method("buildDataSet")->willReturn($this->handler->renderLoop("address", ["customer" => $customerId]));
     $lang = Lang::getDefaultLanguage();
     $loop = $this->handler->buildDataSet($lang);
     $this->assertInstanceOf("Thelia\\Core\\Template\\Loop\\Address", $loop);
     $data = $this->handler->buildData($lang);
     $addresses = AddressQuery::create()->filterByCustomerId($customerId)->find()->toArray("Id");
     foreach ($data->getData() as $row) {
         $this->assertArrayHasKey("id", $row);
         $this->assertArrayHasKey($row["id"], $addresses);
         $this->assertEquals(count($addresses), $row["loop_total"]);
         $address = $addresses[$row["id"]];
         $this->assertEquals($row["address1"], $address["Address1"]);
         $this->assertEquals($row["address2"], $address["Address2"]);
         $this->assertEquals($row["address3"], $address["Address3"]);
         $this->assertEquals($row["cellphone"], $address["Cellphone"]);
         $this->assertEquals($row["city"], $address["City"]);
         $this->assertEquals($row["company"], $address["Company"]);
         $this->assertEquals($row["country"], $address["CountryId"]);
         $this->assertEquals($row["create_date"], $address["CreatedAt"]);
         $this->assertEquals($row["update_date"], $address["UpdatedAt"]);
         $this->assertEquals($row["firstname"], $address["Firstname"]);
         $this->assertEquals($row["lastname"], $address["Lastname"]);
         $this->assertEquals($row["id"], $address["Id"]);
         $this->assertEquals($row["label"], $address["Label"]);
         $this->assertEquals($row["phone"], $address["Phone"]);
         $this->assertEquals($row["title"], $address["TitleId"]);
         $this->assertEquals($row["zipcode"], $address["Zipcode"]);
     }
 }
开发者ID:alex63530,项目名称:thelia,代码行数:32,代码来源:ExportHandlerTest.php

示例9: update_status

 /**
  * Checks if we are the payment module for the order, and if the order is paid,
  * then send a confirmation email to the customer.
  *
  * @params OrderEvent $order
  */
 public function update_status(OrderEvent $event)
 {
     $payzen = new Payzen();
     if ($event->getOrder()->isPaid() && $payzen->isPaymentModuleFor($event->getOrder())) {
         $contact_email = ConfigQuery::read('store_email', false);
         $lang = Lang::getDefaultLanguage();
         $locale = $lang->getLocale();
         Tlog::getInstance()->debug("Sending confirmation email from store contact e-mail {$contact_email}");
         if ($contact_email) {
             $message = MessageQuery::create()->filterByName(Payzen::CONFIRMATION_MESSAGE_NAME)->findOne();
             if (false === $message) {
                 throw new \Exception(sprintf("Failed to load message '%s'.", Payzen::CONFIRMATION_MESSAGE_NAME));
             }
             $order = $event->getOrder();
             $customer = $order->getCustomer();
             $this->parser->assign('order_id', $order->getId());
             $this->parser->assign('order_ref', $order->getRef());
             $this->parser->assign('locale', $locale);
             $message->setLocale($order->getLang()->getLocale());
             $instance = \Swift_Message::newInstance()->addTo($customer->getEmail(), $customer->getFirstname() . " " . $customer->getLastname())->addFrom($contact_email, ConfigQuery::read('store_name'));
             // Build subject and body
             $message->buildMessage($this->parser, $instance);
             $this->getMailer()->send($instance);
             Tlog::getInstance()->debug("Confirmation email sent to customer " . $customer->getEmail());
         }
     } else {
         Tlog::getInstance()->debug("No confirmation email sent (order not paid, or not the proper payment module).");
     }
 }
开发者ID:nabil509,项目名称:Payzen,代码行数:35,代码来源:SendConfirmationEmail.php

示例10: buildForm

 protected function buildForm($change_mode = false)
 {
     $name_constraints = array(new Constraints\NotBlank());
     if (!$change_mode) {
         $name_constraints[] = new Constraints\Callback(array("methods" => array(array($this, "checkDuplicateName"))));
     }
     $this->formBuilder->add("name", "text", array("constraints" => $name_constraints, "label" => Translator::getInstance()->trans('Name'), "label_attr" => array("for" => "name", 'help' => Translator::getInstance()->trans("This is an identifier that will be used in the code to get this message")), 'attr' => ['placeholder' => Translator::getInstance()->trans("Mail template name")]))->add("title", "text", array("constraints" => array(new Constraints\NotBlank()), "label" => Translator::getInstance()->trans('Purpose'), "label_attr" => array("for" => "purpose", 'help' => Translator::getInstance()->trans("Enter here the mail template purpose in the default language (%title%)", ['%title%' => Lang::getDefaultLanguage()->getTitle()])), 'attr' => ['placeholder' => Translator::getInstance()->trans("Mail template purpose")]))->add("locale", "hidden", array("constraints" => array(new Constraints\NotBlank())))->add("secured", "hidden", array());
 }
开发者ID:badelas,项目名称:thelia,代码行数:8,代码来源:MessageCreationForm.php

示例11: __construct

 public function __construct(Request $request)
 {
     if ($request->getSession() != null) {
         $this->locale = $request->getLocale();
     } else {
         $this->locale = Lang::getDefaultLanguage()->getLocale();
     }
 }
开发者ID:zorn-v,项目名称:thelia,代码行数:8,代码来源:TinyMCELanguage.php

示例12: addI18nCondition

 public static function addI18nCondition(ModelCriteria $query, $i18nTableName, $tableIdColumn, $i18nIdColumn, $localeColumn, $locale)
 {
     if (null === static::$defaultLocale) {
         static::$defaultLocale = Lang::getDefaultLanguage()->getLocale();
     }
     $locale = static::realEscape($locale);
     $defaultLocale = static::realEscape(static::$defaultLocale);
     $query->_and()->where("CASE WHEN " . $tableIdColumn . " IN" . "(SELECT DISTINCT " . $i18nIdColumn . " " . "FROM `" . $i18nTableName . "` " . "WHERE locale={$locale}) " . "THEN " . $localeColumn . " = {$locale} " . "ELSE " . $localeColumn . " = {$defaultLocale} " . "END");
 }
开发者ID:margery,项目名称:thelia,代码行数:9,代码来源:I18n.php

示例13: applyUserLocale

 protected function applyUserLocale(Admin $user)
 {
     // Set the current language according to Admin locale preference
     $locale = $user->getLocale();
     if (null === ($lang = LangQuery::create()->findOneByLocale($locale))) {
         $lang = Lang::getDefaultLanguage();
     }
     $this->getSession()->setLang($lang);
 }
开发者ID:alex63530,项目名称:thelia,代码行数:9,代码来源:SessionController.php

示例14: generateFacadeStub

 /**
  * Generate adapter stub
  *
  * @param int    $cartTotalPrice   Cart total price
  * @param string $checkoutCurrency Checkout currency
  * @param string $i18nOutput       Output from each translation
  *
  * @return \PHPUnit_Framework_MockObject_MockObject
  */
 public function generateFacadeStub($cartTotalPrice = 400, $checkoutCurrency = 'EUR', $i18nOutput = '')
 {
     $stubFacade = $this->getMockBuilder('\\Thelia\\Coupon\\BaseFacade')->disableOriginalConstructor()->getMock();
     $address = new Address();
     $address->setCountryId(10);
     $stubFacade->expects($this->any())->method('getDeliveryAddress')->will($this->returnValue($address));
     $stubFacade->expects($this->any())->method('getConditionEvaluator')->will($this->returnValue(new ConditionEvaluator()));
     $stubTranslator = $this->getMockBuilder('\\Thelia\\Core\\Translation\\Translator')->disableOriginalConstructor()->getMock();
     $stubTranslator->expects($this->any())->method('trans')->will($this->returnValue($i18nOutput));
     $stubFacade->expects($this->any())->method('getTranslator')->will($this->returnValue($stubTranslator));
     $lang = new Lang();
     $lang->setDateFormat("d/m/Y");
     $stubSession = $this->getMockBuilder('\\Thelia\\Core\\HttpFoundation\\Session\\Session')->disableOriginalConstructor()->getMock();
     $stubSession->expects($this->any())->method('getLang')->will($this->returnValue($lang));
     $stubRequest = $this->getMockBuilder('\\Thelia\\Core\\HttpFoundation\\Request')->disableOriginalConstructor()->getMock();
     $stubRequest->expects($this->any())->method('getSession')->will($this->returnValue($stubSession));
     $stubFacade->expects($this->any())->method('getRequest')->will($this->returnValue($stubRequest));
     return $stubFacade;
 }
开发者ID:alex63530,项目名称:thelia,代码行数:28,代码来源:StartDateTest.php

示例15: getProduct

 public function getProduct(ConnectionInterface $con = null, $locale = null)
 {
     $product = parent::getProduct($con);
     $translation = $product->getTranslation($locale);
     if ($translation->isNew()) {
         if (ConfigQuery::getDefaultLangWhenNoTranslationAvailable()) {
             $locale = Lang::getDefaultLanguage()->getLocale();
         }
     }
     $product->setLocale($locale);
     return $product;
 }
开发者ID:alex63530,项目名称:thelia,代码行数:12,代码来源:CartItem.php


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