本文整理汇总了PHP中ilObject::applyDefaults方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObject::applyDefaults方法的具体用法?PHP ilObject::applyDefaults怎么用?PHP ilObject::applyDefaults使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObject
的用法示例。
在下文中一共展示了ilObject::applyDefaults方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterSave
/**
* save object
* @access public
*/
function afterSave(ilObject $a_new_object)
{
$tstdef = $this->getDidacticTemplateVar("tstdef");
if ($tstdef) {
$testDefaultsId = $tstdef;
$testDefaults = ilObjTest::_getTestDefaults($testDefaultsId);
$a_new_object->applyDefaults($testDefaults);
}
$template_id = $this->getDidacticTemplateVar("tsttpl");
if ($template_id) {
include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
$template = new ilSettingsTemplate($template_id, ilObjAssessmentFolderGUI::getSettingsTemplateConfig());
$template_settings = $template->getSettings();
if ($template_settings) {
$this->applyTemplate($template_settings, $a_new_object);
}
$a_new_object->setTemplate($template_id);
}
$a_new_object->saveToDb();
// always send a message
ilUtil::sendSuccess($this->lng->txt("object_added"), true);
$this->ctrl->setParameter($this, 'ref_id', $a_new_object->getRefId());
$this->ctrl->redirectByClass('ilObjTestSettingsGeneralGUI');
}
示例2: afterSave
/**
* save object
* @access public
*/
function afterSave(ilObject $a_new_object)
{
// added by JP and moved here by BH
// BH: why is the property not initialised with true within the object class per default .. ?
$a_new_object->setPoolUsage(true);
$tstdef = $this->getDidacticTemplateVar("tstdef");
if ($tstdef) {
$testDefaultsId = $tstdef;
$testDefaults = ilObjTest::_getTestDefaults($testDefaultsId);
$a_new_object->applyDefaults($testDefaults);
}
$template_id = $this->getDidacticTemplateVar("tsttpl");
if ($template_id) {
include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
$template = new ilSettingsTemplate($template_id, ilObjAssessmentFolderGUI::getSettingsTemplateConfig());
$template_settings = $template->getSettings();
if ($template_settings) {
$this->applyTemplate($template_settings, $a_new_object);
}
$a_new_object->setTemplate($template_id);
}
$a_new_object->saveToDb();
// always send a message
ilUtil::sendSuccess($this->lng->txt("object_added"), true);
ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&ref_id=" . $a_new_object->getRefId() . "&cmd=properties");
}