本文整理汇总了PHP中Thelia\Model\Lang::setDatetimeFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP Lang::setDatetimeFormat方法的具体用法?PHP Lang::setDatetimeFormat怎么用?PHP Lang::setDatetimeFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thelia\Model\Lang
的用法示例。
在下文中一共展示了Lang::setDatetimeFormat方法的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];
}