本文整理匯總了PHP中ilObject::addTranslation方法的典型用法代碼示例。如果您正苦於以下問題:PHP ilObject::addTranslation方法的具體用法?PHP ilObject::addTranslation怎麽用?PHP ilObject::addTranslation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ilObject
的用法示例。
在下文中一共展示了ilObject::addTranslation方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: afterSave
protected function afterSave(ilObject $a_new_object)
{
global $ilUser, $tree;
// add default translation
$a_new_object->addTranslation($a_new_object->getTitle(), $a_new_object->getDescription(), $ilUser->getPref("language"), true);
// default: sort by title
include_once 'Services/Container/classes/class.ilContainerSortingSettings.php';
$settings = new ilContainerSortingSettings($a_new_object->getId());
$settings->setSortMode(ilContainer::SORT_TITLE);
$settings->save();
// inherit parents content style, if not individual
$parent_ref_id = $tree->getParentId($a_new_object->getRefId());
$parent_id = ilObject::_lookupObjId($parent_ref_id);
include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
$style_id = ilObjStyleSheet::lookupObjectStyle($parent_id);
if ($style_id > 0) {
if (ilObjStyleSheet::_lookupStandard($style_id)) {
ilObjStyleSheet::writeStyleUsage($a_new_object->getId(), $style_id);
}
}
// always send a message
ilUtil::sendSuccess($this->lng->txt("cat_added"), true);
$this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
$this->redirectToRefId($a_new_object->getRefId(), "");
}