本文整理匯總了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];
}