本文整理汇总了PHP中ilObject::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObject::getId方法的具体用法?PHP ilObject::getId怎么用?PHP ilObject::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObject
的用法示例。
在下文中一共展示了ilObject::getId方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: createPreview
/**
* Creates the preview for the object with the specified id.
*
* @param ilObject $a_obj The object to create the preview for.
* @param bool $a_force true, to force the creation of the preview; false, to create the preview only if needed.
* @return bool true, if the preview was created; otherwise, false.
*/
public static function createPreview($a_obj, $a_force = false)
{
$preview = new ilPreview($a_obj->getId(), $a_obj->getType());
return $preview->create($a_obj, $a_force);
}
示例3: afterSave
protected function afterSave(ilObject $a_new_object)
{
include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
$sort = new ilContainerSortingSettings($a_new_object->getId());
$sort->setSortMode(ilContainer::SORT_INHERIT);
$sort->update();
// 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(), "");
}
示例4: 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"]);
}
示例5: __appendObjectProperties
/**
* Append object properties
* @param ilObject $obj
*/
public function __appendObjectProperties(ilObject $obj)
{
switch ($obj->getType()) {
case 'file':
include_once './Modules/File/classes/class.ilObjFileAccess.php';
$size = ilObjFileAccess::_lookupFileSize($obj->getId());
$extension = ilObjFileAccess::_lookupSuffix($obj->getId());
$this->xmlStartTag('Properties');
$this->xmlElement("Property", array('name' => 'fileSize'), (int) $size);
$this->xmlElement("Property", array('name' => 'fileExtension'), (string) $extension);
// begin-patch fm
$this->xmlElement('Property', array('name' => 'fileVersion'), (string) ilObjFileAccess::_lookupVersion($obj->getId()));
// end-patch fm
$this->xmlEndTag('Properties');
break;
}
}
示例6: getId
final function getId()
{
return parent::getId();
}
示例7: afterSave
protected function afterSave(ilObject $a_new_object)
{
// Save link
$this->link->setLinkResourceId($a_new_object->getId());
$link_id = $this->link->add();
$this->link->updateValid(true);
ilUtil::sendSuccess($this->lng->txt('webr_link_added'));
// personal workspace
if ($this->id_type == self::WORKSPACE_NODE_ID) {
$this->ctrl->redirect($this, "editLinks");
} else {
ilUtil::redirect("ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=" . $a_new_object->getRefId() . "&cmd=switchViewMode&switch_mode=2");
}
}
示例8: afterSave
protected function afterSave(ilObject $a_new_object)
{
// create 1st page / blog
include_once "Modules/Portfolio/classes/class.ilPortfolioPage.php";
$page = $this->getPageInstance(null, $a_new_object->getId());
if ($_POST["ptype"] == "page") {
$page->setType(ilPortfolioPage::TYPE_PAGE);
$page->setTitle($_POST["fpage"]);
// use template as basis
$layout_id = $_POST["tmpl"];
if ($layout_id) {
include_once "./Services/Style/classes/class.ilPageLayout.php";
$layout_obj = new ilPageLayout($layout_id);
$page->setXMLContent($layout_obj->getXMLContent());
}
} else {
$page->setType(ilPortfolioPage::TYPE_BLOG);
$page->setTitle($_POST["blog"]);
}
$page->create();
ilUtil::sendSuccess($this->lng->txt("prtf_portfolio_created"), true);
$this->ctrl->setParameter($this, "prt_id", $a_new_object->getId());
$this->ctrl->redirect($this, "view");
}
示例9: afterSave
/**
* After saving,
*
* @param
* @return
*/
protected function afterSave(ilObject $a_new_object)
{
global $ilCtrl, $lng;
if ($this->getAssignedObject() > 0) {
ilObjTaxonomy::saveUsage($a_new_object->getId(), $this->getAssignedObject());
$ilCtrl->setParameter($this, "tax_id", $a_new_object->getId());
ilUtil::sendSuccess($lng->txt("tax_added"), true);
$ilCtrl->redirect($this, "editSettings");
}
}
示例10: 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(), "");
}
示例11: afterSave
/**
* After saving,
*
* @param
* @return
*/
protected function afterSave(ilObject $a_new_object)
{
global $ilCtrl;
if ($this->getAssignedObject() > 0) {
ilObjTaxonomy::saveUsage($a_new_object->getId(), $this->getAssignedObject());
$ilCtrl->redirect($this, "editAOTaxonomySettings");
}
}
示例12: 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)));
}
示例13: afterSave
function afterSave(ilObject $a_new_object, $a_feed_block)
{
// saveObject() parameters are sent as array
$a_feed_block = $a_feed_block[0];
$a_feed_block->setContextObjId($a_new_object->getId());
$a_feed_block->setContextObjType("feed");
}
示例14: 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);
}