本文整理汇总了PHP中ilObject::getRefId方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObject::getRefId方法的具体用法?PHP ilObject::getRefId怎么用?PHP ilObject::getRefId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObject
的用法示例。
在下文中一共展示了ilObject::getRefId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterSave
/**
* save object
* @access public
*/
function afterSave(ilObject $a_new_object)
{
// always send a message
ilUtil::sendSuccess($this->lng->txt("object_added"), true);
ilUtil::redirect("ilias.php?ref_id=" . $a_new_object->getRefId() . "&baseClass=ilObjQuestionPoolGUI");
}
示例2: afterSave
protected function afterSave(ilObject $a_new_object)
{
// always send a message
ilUtil::sendSuccess($this->lng->txt("fold_added"), true);
$this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
$this->redirectToRefId($a_new_object->getRefId(), "");
}
示例3: putObjectInTree
/**
* Add object to tree at given position
*
* @param ilObject $a_obj
* @param int $a_parent_node_id
*/
protected function putObjectInTree(ilObject $a_obj, $a_parent_node_id = null)
{
global $rbacreview, $ilUser, $objDefinition;
$this->object_id = $a_obj->getId();
if (!$a_parent_node_id) {
$a_parent_node_id = $this->parent_id;
}
// add new object to custom parent container
if ((int) $_REQUEST["crtptrefid"]) {
$a_parent_node_id = (int) $_REQUEST["crtptrefid"];
}
switch ($this->id_type) {
case self::REPOSITORY_NODE_ID:
case self::REPOSITORY_OBJECT_ID:
if (!$this->node_id) {
$a_obj->createReference();
$this->node_id = $a_obj->getRefId();
}
$a_obj->putInTree($a_parent_node_id);
$a_obj->setPermissions($a_parent_node_id);
// rbac log
include_once "Services/AccessControl/classes/class.ilRbacLog.php";
$rbac_log_roles = $rbacreview->getParentRoleIds($this->node_id, false);
$rbac_log = ilRbacLog::gatherFaPa($this->node_id, array_keys($rbac_log_roles), true);
ilRbacLog::add(ilRbacLog::CREATE_OBJECT, $this->node_id, $rbac_log);
$this->ctrl->setParameter($this, "ref_id", $this->node_id);
break;
case self::WORKSPACE_NODE_ID:
case self::WORKSPACE_OBJECT_ID:
if (!$this->node_id) {
$this->node_id = $this->tree->insertObject($a_parent_node_id, $this->object_id);
}
$this->getAccessHandler()->setPermissions($a_parent_node_id, $this->node_id);
$this->ctrl->setParameter($this, "wsp_id", $this->node_id);
break;
case self::OBJECT_ID:
case self::PORTFOLIO_OBJECT_ID:
// do nothing
break;
}
// BEGIN ChangeEvent: Record save object.
require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
ilChangeEvent::_recordWriteEvent($this->object_id, $ilUser->getId(), 'create');
// END ChangeEvent: Record save object.
// use forced callback after object creation
self::handleAfterSaveCallback($a_obj, $_REQUEST["crtcb"]);
}
示例4: handleAutoRating
/**
* Activate rating automatically if parent container setting
*
* @param ilObject $a_new_obj
*/
protected function handleAutoRating(ilObject $a_new_obj)
{
if (ilObject::hasAutoRating($a_new_obj->getType(), $a_new_obj->getRefId()) && method_exists($a_new_obj, "setRating")) {
$a_new_obj->setRating(true);
$a_new_obj->update();
}
}
示例5: testTreeTrash
public function testTreeTrash()
{
global $tree;
$obj = new ilObject();
$obj->setType("xxx");
$obj->setTitle("TestObject");
$obj->setDescription("TestDescription");
$obj->setImportId("imp_44");
$obj->create();
$obj->createReference();
$id = $obj->getId();
$ref_id = $obj->getRefId();
$obj = new ilObject($ref_id);
$obj->putInTree(ROOT_FOLDER_ID);
$obj->createRoleFolder();
$obj->setPermissions(ROOT_FOLDER_ID);
if ($tree->isInTree($ref_id)) {
$value .= "tree1-";
}
if (ilObject::_hasUntrashedReference($id)) {
$value .= "tree2-";
}
// isSaved() uses internal cache!
$tree->useCache(false);
$tree->saveSubTree($ref_id, true);
if ($tree->isDeleted($ref_id)) {
$value .= "tree3-";
}
if ($tree->isSaved($ref_id)) {
$value .= "tree4-";
}
if (ilObject::_isInTrash($ref_id)) {
$value .= "tree5-";
}
if (!ilObject::_hasUntrashedReference($id)) {
$value .= "tree6-";
}
$saved_tree = new ilTree(-(int) $ref_id);
$node_data = $saved_tree->getNodeData($ref_id);
$saved_tree->deleteTree($node_data);
if (!ilObject::_isInTrash($ref_id)) {
$value .= "tree7-";
}
$obs = ilUtil::_getObjectsByOperations("cat", "read");
foreach ($obs as $ob) {
if (ilObject::_lookupType(ilObject::_lookupObjId($ob)) != "cat") {
$value .= "nocat-";
}
}
$obj->delete();
$this->assertEquals("tree1-tree2-tree3-tree4-tree5-tree6-tree7-", $value);
}
示例6: filterRoles
/**
* Filter roles
* @param ilObject $object
*/
protected function filterRoles(ilObject $source)
{
global $rbacreview;
include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateFilterPatternFactory.php';
$patterns = ilDidacticTemplateFilterPatternFactory::lookupPatternsByParentId($this->getActionId(), self::PATTERN_PARENT_TYPE);
$filtered = array();
foreach ($rbacreview->getParentRoleIds($source->getRefId()) as $role_id => $role) {
foreach ($patterns as $pattern) {
if ($pattern->valid(ilObject::_lookupTitle($role_id))) {
$GLOBALS['ilLog']->write(__METHOD__ . ' Role is valid: ' . ilObject::_lookupTitle($role_id));
$filtered[$role_id] = $role;
}
}
}
return $filtered;
}
示例7: afterSave
protected function afterSave(ilObject $a_new_object)
{
$a_new_object->notify("new", $_GET["ref_id"], $_GET["parent_non_rbac_id"], $_GET["ref_id"], $a_new_object->getRefId());
$a_new_object->setCleanFrames(true);
$a_new_object->update();
// create content object tree
$a_new_object->createLMTree();
// create a first chapter
$a_new_object->addFirstChapterAndPage();
// always send a message
ilUtil::sendSuccess($this->lng->txt($this->type . "_added"), true);
ilUtil::redirect("ilias.php?ref_id=" . $a_new_object->getRefId() . "&baseClass=ilLMEditorGUI");
}
示例8: afterSave
protected function afterSave(ilObject $a_new_object)
{
$target_obj_id = ilObject::_lookupObjId((int) $_REQUEST['target_id']);
$a_new_object->setTargetId($target_obj_id);
$a_new_object->update();
ilUtil::sendSuccess($this->lng->txt("object_added"), true);
$this->ctrl->setParameter($this, 'ref_id', $a_new_object->getRefId());
$this->ctrl->redirect($this, 'firstEdit');
}
示例9: 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(), "");
}
示例10: afterSave
protected function afterSave(ilObject $a_new_object)
{
$a_new_object->setOffline(true);
$a_new_object->setNumberOfSlots(4);
$a_new_object->update();
// always send a message
ilUtil::sendSuccess($this->lng->txt("book_pool_added"), true);
$this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
$this->ctrl->redirect($this, "edit");
}
示例11: afterSave
/**
* save object
* @access public
*/
protected function afterSave(ilObject $a_new_object)
{
global $rbacadmin, $ilUser;
$a_new_object->getMemberObject()->add($ilUser->getId(), IL_CRS_ADMIN);
$a_new_object->getMemberObject()->updateNotification($ilUser->getId(), 1);
$a_new_object->update();
// BEGIN ChangeEvent: Record write event.
require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
global $ilUser;
ilChangeEvent::_recordWriteEvent($a_new_object->getId(), $ilUser->getId(), 'create');
// END ChangeEvent: Record write event.
// always send a message
ilUtil::sendSuccess($this->lng->txt("crs_added"), true);
$this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
ilUtil::redirect($this->getReturnLocation("save", $this->ctrl->getLinkTarget($this, "edit", "", false, false)));
}
示例12: revertLocalPolicy
protected function revertLocalPolicy(ilObject $source, $role)
{
global $rbacadmin, $rbacreview, $ilDB;
$GLOBALS['ilLog']->write(__METHOD__ . ': Reverting policy for role: ' . print_r($role, true));
// Local policies can only be reverted for auto generated roles. Otherwise the
// original role settings are unknown
if (substr($role['title'], 0, 3) != 'il_') {
$GLOBALS['ilLog']->write(__METHOD__ . ': Cannot revert local policy for role ' . $role['title']);
return false;
}
$role_folder_id = $rbacreview->getRoleFolderIdOfObject($source->getRefId());
// No role folder found
if (!$role_folder_id) {
return false;
}
$exploded_title = explode('_', $role['title']);
$rolt_title = $exploded_title[0] . '_' . $exploded_title[1] . '_' . $exploded_title[2];
// Lookup role template
$query = 'SELECT obj_id FROM object_data ' . 'WHERE title = ' . $ilDB->quote($rolt_title, 'text') . ' ' . 'AND type = ' . $ilDB->quote('rolt', 'text');
$res = $ilDB->query($query);
while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
$rolt_id = $row->obj_id;
}
// No template found
if (!$rolt_id) {
return false;
}
$rbacadmin->copyRoleTemplatePermissions($rolt_id, ROLE_FOLDER_ID, $role_folder_id, $role['obj_id'], true);
// Change existing object
include_once './Services/AccessControl/classes/class.ilObjRole.php';
$role_obj = new ilObjRole($role['obj_id']);
$role_obj->changeExistingObjects($source->getRefId(), $role['protected'] ? ilObjRole::MODE_PROTECTED_DELETE_LOCAL_POLICIES : ilObjRole::MODE_UNPROTECTED_DELETE_LOCAL_POLICIES, array('all'));
}
示例13: putObjectInTree
/**
* Add object to tree at given position
*
* @param ilObject $a_obj
* @param int $a_parent_node_id
*/
protected function putObjectInTree(ilObject $a_obj, $a_parent_node_id = null)
{
global $rbacreview, $ilUser, $objDefinition;
if (!$a_parent_node_id) {
$a_parent_node_id = $_GET["ref_id"];
}
// add new object to custom parent container
if ((int) $_REQUEST["crtptrefid"]) {
$a_parent_node_id = (int) $_REQUEST["crtptrefid"];
}
$a_obj->createReference();
$a_obj->putInTree($a_parent_node_id);
$a_obj->setPermissions($a_parent_node_id);
$this->obj_id = $a_obj->getId();
$this->ref_id = $a_obj->getRefId();
// BEGIN ChangeEvent: Record save object.
require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
ilChangeEvent::_recordWriteEvent($this->obj_id, $ilUser->getId(), 'create');
// END ChangeEvent: Record save object.
// rbac log
include_once "Services/AccessControl/classes/class.ilRbacLog.php";
$rbac_log_roles = $rbacreview->getParentRoleIds($this->ref_id, false);
$rbac_log = ilRbacLog::gatherFaPa($this->ref_id, array_keys($rbac_log_roles), true);
ilRbacLog::add(ilRbacLog::CREATE_OBJECT, $this->ref_id, $rbac_log);
// use forced callback after object creation
if ($_REQUEST["crtcb"]) {
$callback_type = ilObject::_lookupType((int) $_REQUEST["crtcb"], true);
$class_name = "ilObj" . $objDefinition->getClassName($callback_type) . "GUI";
$location = $objDefinition->getLocation($callback_type);
include_once $location . "/class." . $class_name . ".php";
if (in_array(strtolower($class_name), array("ilobjitemgroupgui"))) {
$callback_obj = new $class_name((int) $_REQUEST["crtcb"]);
} else {
// #10368
$callback_obj = new $class_name(null, (int) $_REQUEST["crtcb"], true, false);
}
$callback_obj->afterSaveCallback($a_obj);
}
}
示例14: createNull
/**
* Creates a dav null object as a child of this object.
* null objects are used for locking names.
*
* @param string the name of the null object.
* @return ilObjectDAV returns the created object, or null if creation failed.
*/
function createNull($name)
{
global $tree;
// create and insert Folder in tree
require_once './Services/Object/classes/class.ilObject.php';
$newObj = new ilObject(0);
$newObj->setType('null');
$newObj->setTitle($name);
$newObj->create();
$newObj->createReference();
$newObj->setPermissions($this->getRefId());
$newObj->putInTree($this->getRefId());
require_once 'class.ilObjNullDAV.php';
$objDAV = new ilObjNullDAV($newObj->getRefId(), $newObj);
return $objDAV;
}
示例15: afterSave
/**
* save object
* @access public
*/
function afterSave(ilObject $a_new_object)
{
$tpl = $this->getDidacticTemplateVar("svytpl");
if ($tpl) {
$a_new_object->applySettingsTemplate($tpl);
}
$a_new_object->set360Mode((bool) $this->getDidacticTemplateVar("svy360"));
if ($a_new_object->get360Mode()) {
// this should rather be ilObjSurvey::ANONYMIZE_ON - see ilObjSurvey::getUserDataFromActiveId()
$a_new_object->setAnonymize(ilObjSurvey::ANONYMIZE_CODE_ALL);
$a_new_object->setEvaluationAccess(ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS);
}
$a_new_object->saveToDB();
// always send a message
ilUtil::sendSuccess($this->lng->txt("object_added"), true);
ilUtil::redirect("ilias.php?baseClass=ilObjSurveyGUI&ref_id=" . $a_new_object->getRefId() . "&cmd=properties");
}