當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Lang::setTitle方法代碼示例

本文整理匯總了PHP中Thelia\Model\Lang::setTitle方法的典型用法代碼示例。如果您正苦於以下問題:PHP Lang::setTitle方法的具體用法?PHP Lang::setTitle怎麽用?PHP Lang::setTitle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Thelia\Model\Lang的用法示例。


在下文中一共展示了Lang::setTitle方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getT2Lang

 /**
  * @param $id_lang_thelia_1
  * @return Lang
  * @throws ImportException
  */
 public function getT2Lang($id_lang_thelia_1)
 {
     $lang = null;
     if (!isset($this->lang_cache[$id_lang_thelia_1])) {
         if ($id_lang_thelia_1 > 0) {
             $obj = $this->t1db->query_obj("select * from lang where id=?", array($id_lang_thelia_1));
         } else {
             $obj = $this->t1db->query_obj("select * from lang order by id asc limit 1");
         }
         if ($obj == false || $obj == null) {
             throw new ImportException(Translator::getInstance()->trans("Failed to find a Thelia 1 lang for id '%id'", array("%id" => $id_lang_thelia_1), ImportT1::DOMAIN));
         }
         if (isset($obj->code)) {
             $lang = LangQuery::create()->findOneByCode(strtolower($obj->code));
         } else {
             $lang = LangQuery::create()->filterByLocale("fr_FR")->findOneByTitle($obj->description);
         }
         if ($lang === null) {
             // If the lang id is not zero, create it in T2
             if ($id_lang_thelia_1 > 0) {
                 $lang = new Lang();
                 if (isset($obj->code)) {
                     $lang->setTitle($obj->description)->setCode($obj->code)->setLocale("{$obj->code}" . "_" . strtoupper($obj->code));
                 } else {
                     $lang->setTitle("Imported Thelia lang {$id_lang_thelia_1}")->setCode("")->setLocale("");
                 }
                 $lang->setDatetimeFormat('d/m/Y H:i:s')->setDecimals(2)->setDecimalSeparator('.')->setThousandsSeparator(' ')->setTimeFormat('H:i:s')->setDateFormat('d/m/Y')->save();
                 Tlog::getInstance()->addInfo("Created Thelia 2 lang from Thelia 1 lang ID={$id_lang_thelia_1}");
             }
             throw new ImportException(Translator::getInstance()->trans("Failed to find a Thelia 2 lang for Thelia 1 lang id %id", array("%id" => $id_lang_thelia_1), ImportT1::DOMAIN));
         }
         $this->lang_cache[$id_lang_thelia_1] = $lang;
     }
     return $this->lang_cache[$id_lang_thelia_1];
 }
開發者ID:JumBay,項目名稱:ImportT1,代碼行數:40,代碼來源:BaseImport.php


注:本文中的Thelia\Model\Lang::setTitle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。