本文整理汇总了PHP中ilUtil::removeItemFromDesktops方法的典型用法代码示例。如果您正苦于以下问题:PHP ilUtil::removeItemFromDesktops方法的具体用法?PHP ilUtil::removeItemFromDesktops怎么用?PHP ilUtil::removeItemFromDesktops使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilUtil
的用法示例。
在下文中一共展示了ilUtil::removeItemFromDesktops方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteObject
function deleteObject($sid, $reference_id)
{
$this->initAuth($sid);
$this->initIlias();
if (!$this->__checkSession($sid)) {
return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
}
if (!is_numeric($reference_id)) {
return $this->__raiseError('No reference id given.', 'Client');
}
global $tree, $rbacsystem, $rbacadmin;
if (!($del_obj =& ilObjectFactory::getInstanceByRefId($reference_id, false))) {
return $this->__raiseError('No valid reference id given.', 'Client');
}
if (!$rbacsystem->checkAccess('delete', $del_obj->getRefId())) {
return $this->__raiseError('No permission to delete object with id: ' . $del_obj->getRefId() . '!', 'Client');
}
// Delete tree
if ($tree->isDeleted($reference_id)) {
return $this->__raiseError('Node already deleted', 'Server');
}
if ($del_obj->getType() == 'rolf') {
return $this->__raiseError('Delete is not available for role folders.', 'Client');
}
$subnodes = $tree->getSubtree($tree->getNodeData($reference_id));
foreach ($subnodes as $subnode) {
$rbacadmin->revokePermission($subnode["child"]);
// remove item from all user desktops
$affected_users = ilUtil::removeItemFromDesktops($subnode["child"]);
}
if (!$tree->saveSubTree($reference_id)) {
return $this->__raiseError('Node already deleted', 'Client');
}
return true;
}
示例2: delete
/**
* delete object or referenced object
* (in the case of a referenced object, object data is only deleted
* if last reference is deleted)
* This function removes an object entirely from system!!
*
* @access public
* @return boolean true if object was removed completely; false if only a references was removed
*/
function delete()
{
global $rbacadmin, $log, $ilDB;
$remove = false;
// delete object_data entry
if (!$this->referenced || $this->countReferences() == 1) {
// check type match
$db_type = ilObject::_lookupType($this->getId());
if ($this->type != $db_type) {
$message = "ilObject::delete(): Type mismatch. Object with obj_id: " . $this->id . " " . "was instantiated by type '" . $this->type . "'. DB type is: " . $db_type;
// write log entry
$log->write($message);
// raise error
$this->ilias->raiseError("ilObject::delete(): Type mismatch. (" . $this->type . "/" . $this->id . ")", $this->ilias->error_obj->WARNING);
}
// delete entry in object_data
$q = "DELETE FROM object_data " . "WHERE obj_id = " . $ilDB->quote($this->getId(), "integer");
$ilDB->manipulate($q);
// delete long description
$query = "DELETE FROM object_description WHERE obj_id = " . $ilDB->quote($this->getId(), "integer");
$ilDB->manipulate($query);
// write log entry
$log->write("ilObject::delete(), deleted object, obj_id: " . $this->getId() . ", type: " . $this->getType() . ", title: " . $this->getTitle());
// remove news
include_once "./Services/News/classes/class.ilNewsItem.php";
$news_item = new ilNewsItem();
$news_item->deleteNewsOfContext($this->getId(), $this->getType());
include_once "./Services/Block/classes/class.ilBlockSetting.php";
ilBlockSetting::_deleteSettingsOfBlock($this->getId(), "news");
include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
ilDidacticTemplateObjSettings::deleteByObjId($this->getId());
/* remove notes (see infoscreen gui)
as they can be seen as personal data we are keeping them for now
include_once("Services/Notes/classes/class.ilNote.php");
foreach(array(IL_NOTE_PRIVATE, IL_NOTE_PUBLIC) as $note_type)
{
foreach(ilNote::_getNotesOfObject($this->id, 0, $this->type, $note_type) as $note)
{
$note->delete();
}
}
*/
// BEGIN WebDAV: Delete WebDAV properties
$query = "DELETE FROM dav_property " . "WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer');
$res = $ilDB->manipulate($query);
// END WebDAV: Delete WebDAV properties
include_once './Services/Tracking/classes/class.ilChangeEvent.php';
ilChangeEvent::_delete($this->getId());
include_once './Services/Tracking/classes/class.ilLPCollections.php';
ilLPCollections::_deleteAll($this->getId());
include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
ilECSImport::_deleteByObjId($this->getId());
$remove = true;
} else {
// write log entry
$log->write("ilObject::delete(), object not deleted, number of references: " . $this->countReferences() . ", obj_id: " . $this->getId() . ", type: " . $this->getType() . ", title: " . $this->getTitle());
}
// delete object_reference entry
if ($this->referenced) {
include_once "Services/Object/classes/class.ilObjectActivation.php";
ilObjectActivation::deleteAllEntries($this->getRefId());
// delete entry in object_reference
$query = "DELETE FROM object_reference " . "WHERE ref_id = " . $ilDB->quote($this->getRefId(), 'integer');
$res = $ilDB->manipulate($query);
// write log entry
$log->write("ilObject::delete(), reference deleted, ref_id: " . $this->getRefId() . ", obj_id: " . $this->getId() . ", type: " . $this->getType() . ", title: " . $this->getTitle());
// DELETE PERMISSION ENTRIES IN RBAC_PA
// DONE: method overwritten in ilObjRole & ilObjUser.
// this call only applies for objects in rbac (not usr,role,rolt)
// TODO: Do this for role templates too
$rbacadmin->revokePermission($this->getRefId(), 0, false);
include_once "Services/AccessControl/classes/class.ilRbacLog.php";
ilRbacLog::delete($this->getRefId());
// Remove applied didactic template setting
include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
ilDidacticTemplateObjSettings::deleteByRefId($this->getRefId());
// Remove desktop items
ilUtil::removeItemFromDesktops($this->getRefId());
}
// remove conditions
if ($this->referenced) {
$ch =& new ilConditionHandler();
$ch->delete($this->getRefId());
unset($ch);
}
return $remove;
}
示例3: deleteObjects
/**
* Delete objects. Move them to trash (if trash feature is enabled).
*
* @param integer current ref id
* @param array array of ref(!) ids to be deleted
*/
public static function deleteObjects($a_cur_ref_id, $a_ids)
{
global $ilAppEventHandler, $rbacsystem, $rbacadmin, $log, $ilUser, $tree, $lng, $ilSetting;
include_once './Services/Payment/classes/class.ilPaymentObject.php';
include_once "./Services/Repository/exceptions/class.ilRepositoryException.php";
// Remove duplicate ids from array
$a_ids = array_unique((array) $a_ids);
// FOR ALL SELECTED OBJECTS
foreach ($a_ids as $id) {
if ($tree->isDeleted($id)) {
$log->write(__METHOD__ . ': Object with ref_id: ' . $id . ' already deleted.');
throw new ilRepositoryException($lng->txt("msg_obj_already_deleted"));
}
// GET COMPLETE NODE_DATA OF ALL SUBTREE NODES
$node_data = $tree->getNodeData($id);
$subtree_nodes = $tree->getSubTree($node_data);
$all_node_data[] = $node_data;
$all_subtree_nodes[] = $subtree_nodes;
// CHECK DELETE PERMISSION OF ALL OBJECTS
foreach ($subtree_nodes as $node) {
if ($node['type'] == 'rolf') {
continue;
}
if (!$rbacsystem->checkAccess('delete', $node["child"])) {
$not_deletable[] = $node["child"];
$perform_delete = false;
} else {
if (ilPaymentObject::_isBuyable($node['child'])) {
$buyable[] = $node['child'];
$perform_delete = false;
}
}
}
}
// IF THERE IS ANY OBJECT WITH NO PERMISSION TO DELETE
if (count($not_deletable)) {
$not_deletable = implode(',', $not_deletable);
ilSession::clear("saved_post");
throw new ilRepositoryException($lng->txt("msg_no_perm_delete") . " " . $not_deletable . "<br/>" . $lng->txt("msg_cancel"));
}
if (count($buyable)) {
foreach ($buyable as $id) {
$tmp_object = ilObjectFactory::getInstanceByRefId($id);
$titles[] = $tmp_object->getTitle();
}
$title_str = implode(',', $titles);
throw new ilRepositoryException($lng->txt('msg_obj_not_deletable_sold') . ' ' . $title_str);
}
// DELETE THEM
if (!$all_node_data[0]["type"]) {
// alex: this branch looks suspicious to me... I deactivate it for
// now. Objects that aren't in the tree should overwrite this method.
throw new ilRepositoryException($lng->txt("ilRepUtil::deleteObjects: Type information missing."));
// OBJECTS ARE NO 'TREE OBJECTS'
if ($rbacsystem->checkAccess('delete', $a_cur_ref_id)) {
foreach ($a_ids as $id) {
$obj =& ilObjectFactory::getInstanceByObjId($id);
$obj->delete();
// write log entry
$log->write("ilObjectGUI::confirmedDeleteObject(), deleted obj_id " . $obj->getId() . ", type: " . $obj->getType() . ", title: " . $obj->getTitle());
}
} else {
throw new ilRepositoryException($lng->txt("no_perm_delete") . "<br/>" . $lng->txt("msg_cancel"));
}
} else {
// SAVE SUBTREE AND DELETE SUBTREE FROM TREE
$affected_ids = array();
foreach ($a_ids as $id) {
if ($tree->isDeleted($id)) {
$log->write(__METHOD__ . ': Object with ref_id: ' . $id . ' already deleted.');
throw new ilRepositoryException($lng->txt("msg_obj_already_deleted"));
}
// DELETE OLD PERMISSION ENTRIES
$subnodes = $tree->getSubtree($tree->getNodeData($id));
foreach ($subnodes as $subnode) {
$rbacadmin->revokePermission($subnode["child"]);
// remove item from all user desktops
$affected_users = ilUtil::removeItemFromDesktops($subnode["child"]);
$affected_ids[$subnode["child"]] = $subnode["child"];
// TODO: inform users by mail that object $id was deleted
//$mail->sendMail($id,$msg,$affected_users);
// should go to appevents at the end
}
// TODO: needs other handling
// This class shouldn't have to know anything about ECS
include_once './Services/WebServices/ECS/classes/class.ilECSObjectSettings.php';
ilECSObjectSettings::_handleDelete($subnodes);
if (!$tree->saveSubTree($id, true)) {
$log->write(__METHOD__ . ': Object with ref_id: ' . $id . ' already deleted.');
throw new ilRepositoryException($lng->txt("msg_obj_already_deleted"));
}
// write log entry
$log->write("ilObjectGUI::confirmedDeleteObject(), moved ref_id " . $id . " to trash");
// remove item from all user desktops
//.........这里部分代码省略.........
示例4: deleteCourse
function deleteCourse($sid, $course_id)
{
$this->initAuth($sid);
$this->initIlias();
if (!$this->__checkSession($sid)) {
return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
}
if (!is_numeric($course_id)) {
return $this->__raiseError('No valid course id given. Please choose an existing reference id of an ILIAS course', 'Client');
}
include_once "./Services/Utilities/classes/class.ilUtil.php";
global $rbacsystem;
if (($obj_type = ilObject::_lookupType(ilObject::_lookupObjId($course_id))) != 'crs') {
$course_id = end($ref_ids = ilObject::_getAllReferences($course_id));
if (ilObject::_lookupType(ilObject::_lookupObjId($course_id)) != 'crs') {
return $this->__raiseError('Invalid course id. Object with id "' . $course_id . '" is not of type "course"', 'Client');
}
}
if (!$rbacsystem->checkAccess('delete', $course_id)) {
return $this->__raiseError('Check access failed. No permission to delete course', 'Server');
}
global $tree, $rbacadmin, $log;
if ($tree->isDeleted($course_id)) {
return $this->__raiseError('Node already deleted', 'Server');
}
$subnodes = $tree->getSubtree($tree->getNodeData($course_id));
foreach ($subnodes as $subnode) {
$rbacadmin->revokePermission($subnode["child"]);
// remove item from all user desktops
$affected_users = ilUtil::removeItemFromDesktops($subnode["child"]);
}
if (!$tree->saveSubTree($course_id)) {
return $this->__raiseError('Node already deleted', 'Client');
}
// write log entry
$log->write("SOAP ilObjectGUI::confirmedDeleteObject(), moved ref_id " . $course_id . " to trash");
// remove item from all user desktops
$affected_users = ilUtil::removeItemFromDesktops($course_id);
return true;
}
示例5: remove
/**
* Removes the specified child from this object.
*
* @param ilObjectDAV the child to be removed.
*/
function remove($objDAV)
{
global $tree, $rbacadmin;
$subnodes = $tree->getSubTree($tree->getNodeData($objDAV->getRefId()));
foreach ($subnodes as $node) {
$rbacadmin->revokePermission($node["child"]);
$affectedUsers = ilUtil::removeItemFromDesktops($node["child"]);
}
$tree->saveSubTree($objDAV->getRefId());
$tree->deleteTree($tree->getNodeData($objDAV->getRefId()));
}