本文整理汇总了PHP中ilTree::getNodeData方法的典型用法代码示例。如果您正苦于以下问题:PHP ilTree::getNodeData方法的具体用法?PHP ilTree::getNodeData怎么用?PHP ilTree::getNodeData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilTree
的用法示例。
在下文中一共展示了ilTree::getNodeData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareHTML
/**
* Call this before using getHTML()
* @access public
* @return ilMailFolderTableGUI
* @final
*
*/
public final function prepareHTML()
{
global $ilUser;
$this->addColumn('', '', '1px', true);
$this->addColumn($this->lng->txt('personal_picture'), '', '10%');
if ($this->isDraftFolder() || $this->isSentFolder()) {
$this->addColumn($this->lng->txt('recipient'), 'rcp_to', '25%');
} else {
$this->addColumn($this->lng->txt('sender'), 'from', '25%');
}
$this->addColumn($this->lng->txt('subject'), 'm_subject', '40%');
$this->addColumn($this->lng->txt('date'), 'send_time', '20%');
// init folder data
$mtree = new ilTree($ilUser->getId());
$mtree->setTableNames('mail_tree', 'mail_obj_data');
$this->_folderNode = $mtree->getNodeData($this->_currentFolderId);
// command buttons
$this->initCommandButtons();
// mail actions
$this->initMultiCommands($this->_parentObject->mbox->getActions($this->_currentFolderId));
// fetch table data
$this->fetchTableData();
return $this;
}
示例2: executeDragDrop
/**
* Execute Drag Drop Action
*
* @param string $source_id Source element ID
* @param string $target_id Target element ID
* @param string $first_child Insert as first child of target
* @param string $movecopy Position ("move" | "copy")
*/
function executeDragDrop($source_id, $target_id, $first_child, $as_subitem = false, $movecopy = "move")
{
$lmtree = new ilTree($this->getId());
$lmtree->setTableNames('lm_tree', 'lm_data');
$lmtree->setTreeTablePK("lm_id");
//echo "-".$source_id."-".$target_id."-".$first_child."-".$as_subitem."-";
$source_obj = ilLMObjectFactory::getInstance($this, $source_id, true);
$source_obj->setLMId($this->getId());
if (!$first_child) {
$target_obj = ilLMObjectFactory::getInstance($this, $target_id, true);
$target_obj->setLMId($this->getId());
$target_parent = $lmtree->getParentId($target_id);
}
// handle pages
if ($source_obj->getType() == "pg") {
//echo "1";
if ($lmtree->isInTree($source_obj->getId())) {
$node_data = $lmtree->getNodeData($source_obj->getId());
// cut on move
if ($movecopy == "move") {
$parent_id = $lmtree->getParentId($source_obj->getId());
$lmtree->deleteTree($node_data);
// write history entry
require_once "./Services/History/classes/class.ilHistory.php";
ilHistory::_createEntry($source_obj->getId(), "cut", array(ilLMObject::_lookupTitle($parent_id), $parent_id), $this->getType() . ":pg");
ilHistory::_createEntry($parent_id, "cut_page", array(ilLMObject::_lookupTitle($source_obj->getId()), $source_obj->getId()), $this->getType() . ":st");
} else {
// copy page
$new_page =& $source_obj->copy();
$source_id = $new_page->getId();
$source_obj =& $new_page;
}
// paste page
if (!$lmtree->isInTree($source_obj->getId())) {
if ($first_child) {
$target_pos = IL_FIRST_NODE;
$parent = $target_id;
} else {
if ($as_subitem) {
$parent = $target_id;
$target_pos = IL_FIRST_NODE;
$pg_childs =& $lmtree->getChildsByType($parent, "pg");
if (count($pg_childs) != 0) {
$target_pos = $pg_childs[count($pg_childs) - 1]["obj_id"];
}
} else {
$target_pos = $target_id;
$parent = $target_parent;
}
}
// insert page into tree
$lmtree->insertNode($source_obj->getId(), $parent, $target_pos);
// write history entry
if ($movecopy == "move") {
// write history comments
include_once "./Services/History/classes/class.ilHistory.php";
ilHistory::_createEntry($source_obj->getId(), "paste", array(ilLMObject::_lookupTitle($parent), $parent), $this->getType() . ":pg");
ilHistory::_createEntry($parent, "paste_page", array(ilLMObject::_lookupTitle($source_obj->getId()), $source_obj->getId()), $this->getType() . ":st");
}
}
}
}
// handle chapters
if ($source_obj->getType() == "st") {
//echo "2";
$source_node = $lmtree->getNodeData($source_id);
$subnodes = $lmtree->getSubtree($source_node);
// check, if target is within subtree
foreach ($subnodes as $subnode) {
if ($subnode["obj_id"] == $target_id) {
return;
}
}
$target_pos = $target_id;
if ($first_child) {
$target_pos = IL_FIRST_NODE;
$target_parent = $target_id;
$pg_childs =& $lmtree->getChildsByType($target_parent, "pg");
if (count($pg_childs) != 0) {
$target_pos = $pg_childs[count($pg_childs) - 1]["obj_id"];
}
} else {
if ($as_subitem) {
$target_parent = $target_id;
$target_pos = IL_FIRST_NODE;
$childs =& $lmtree->getChilds($target_parent);
if (count($childs) != 0) {
$target_pos = $childs[count($childs) - 1]["obj_id"];
}
}
}
// insert into
//.........这里部分代码省略.........
示例3: getExportResources
function getExportResources()
{
$export_files = array();
require_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
include_once "./Modules/File/classes/class.ilObjFile.php";
$tree = new ilTree($this->slm_object->getId());
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
foreach ($tree->getSubTree($tree->getNodeData($this->node_object->getId()), true, 'page') as $page) {
$page_obj = new ilSCORM2004Page($page["obj_id"]);
$page_obj->buildDom();
$mob_ids = $page_obj->collectMediaObjects(false);
foreach ($mob_ids as $mob_id) {
if ($mob_id > 0 && ilObject::_exists($mob_id)) {
$path = ilObjMediaObject::_lookupStandardItemPath($mob_id, false, false);
$media_obj = new ilObjMediaObject($mob_id);
$export_files[$i]["date"] = $media_obj->getCreateDate();
$export_files[$i]["size"] = @filesize($path);
// could be remote, e.g. youtube video
$export_files[$i]["file"] = $media_obj->getTitle();
$export_files[$i]["type"] = $media_obj->getDescription();
$export_files[$i]["path"] = $path;
$this->ctrl->setParameter($this, "resource", rawurlencode(ilObjMediaObject::_lookupStandardItemPath($mob_id, false, false)));
$export_files[$i]["link"] = $this->ctrl->getLinkTarget($this, "downloadResource");
$i++;
}
}
include_once "./Services/COPage/classes/class.ilPCFileList.php";
$file_ids = ilPCFileList::collectFileItems($page_obj, $page_obj->getDomDoc());
foreach ($file_ids as $file_id) {
$file_obj = new ilObjFile($file_id, false);
$export_files[$i]["date"] = $file_obj->getCreateDate();
$export_files[$i]["size"] = $file_obj->getFileSize();
$export_files[$i]["file"] = $file_obj->getFileName();
$export_files[$i]["type"] = $file_obj->getFileType();
$export_files[$i]["file_id"] = $file_id;
$this->ctrl->setParameter($this, "file_id", $file_id);
$export_files[$i]["link"] = $this->ctrl->getLinkTarget($this, "downloadFile", "");
$i++;
}
unset($page_obj);
}
return $export_files;
}
示例4: showFolder
/**
* Shows current folder. Current Folder is determined by $_GET["mobj_id"]
*/
public function showFolder($a_show_confirmation = false)
{
/**
* @var $ilUser ilObjUser
* @var $ilToolbar ilToolbarGUI
*/
global $ilUser, $ilToolbar;
$this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail.html', 'Services/Mail');
$this->tpl->setTitle($this->lng->txt('mail'));
$sentFolderId = $this->mbox->getSentFolder();
$draftsFolderId = $this->mbox->getDraftsFolder();
$isTrashFolder = $_GET['mobj_id'] == $this->mbox->getTrashFolder();
$isSentFolder = $_GET['mobj_id'] == $sentFolderId;
$isDraftFolder = $_GET['mobj_id'] == $draftsFolderId;
if ($this->current_selected_cmd == 'deleteMails' && !$this->errorDelete && $this->current_selected_cmd != 'confirm' && $isTrashFolder) {
if (isset($_REQUEST['mail_id']) && !is_array($_REQUEST['mail_id'])) {
$_REQUEST['mail_id'] = array($_REQUEST['mail_id']);
}
$confirmation = new ilConfirmationGUI();
$confirmation->setHeaderText($this->lng->txt('mail_sure_delete'));
$this->ctrl->setParameter($this, 'mail_id', implode(',', (array) $_REQUEST['mail_id']));
$confirmation->setFormAction($this->ctrl->getFormAction($this, 'confirmDeleteMails'));
$confirmation->setConfirm($this->lng->txt('confirm'), 'confirmDeleteMails');
$confirmation->setCancel($this->lng->txt('cancel'), 'cancelDeleteMails');
$this->tpl->setVariable('CONFIRMATION', $confirmation->getHTML());
$a_show_confirmation = true;
}
$folders = $this->mbox->getSubFolders();
$mtree = new ilTree($ilUser->getId());
$mtree->setTableNames('mail_tree', 'mail_obj_data');
$check_uf = false;
$check_local = false;
if ('tree' == ilSession::get(ilMailGUI::VIEWMODE_SESSION_KEY)) {
$folder_d = $mtree->getNodeData($_GET['mobj_id']);
if ($folder_d['m_type'] == 'user_folder') {
$check_uf = true;
} else {
if ($folder_d['m_type'] == 'local') {
$check_local = true;
}
}
}
$mailtable = new ilMailFolderTableGUI($this, (int) $_GET['mobj_id'], 'showFolder');
$mailtable->isSentFolder($isSentFolder)->isDraftFolder($isDraftFolder)->isTrashFolder($isTrashFolder)->initFilter();
$mailtable->setSelectedItems($_POST['mail_id']);
try {
$mailtable->prepareHTML();
} catch (Exception $e) {
ilUtil::sendFailure($this->lng->txt($e->getMessage()) != '-' . $e->getMessage() . '-' ? $this->lng->txt($e->getMessage()) : $e->getMessage());
}
$table_html = $mailtable->getHtml();
$folder_options = array();
if ('tree' != ilSession::get(ilMailGUI::VIEWMODE_SESSION_KEY)) {
foreach ($folders as $folder) {
$folder_d = $mtree->getNodeData($folder['obj_id']);
if ($folder['obj_id'] == $_GET['mobj_id']) {
if ($folder['type'] == 'user_folder') {
$check_uf = true;
} else {
if ($folder['type'] == 'local') {
$check_local = true;
$check_uf = false;
}
}
}
if ($folder['type'] == 'user_folder') {
$pre = '';
for ($i = 2; $i < $folder_d['depth'] - 1; $i++) {
$pre .= ' ';
}
if ($folder_d['depth'] > 1) {
$pre .= '+';
}
$folder_options[$folder['obj_id']] = $pre . ' ' . $folder['title'];
} else {
$folder_options[$folder['obj_id']] = $this->lng->txt('mail_' . $folder['title']);
}
}
}
if ($a_show_confirmation == false && $this->askForConfirmation == false) {
if ('tree' != ilSession::get(ilMailGUI::VIEWMODE_SESSION_KEY)) {
$ilToolbar->addText($this->lng->txt('mail_change_to_folder'));
include_once './Services/Form/classes/class.ilSelectInputGUI.php';
$si = new ilSelectInputGUI("", "mobj_id");
$si->setOptions($folder_options);
$si->setValue($_GET['mobj_id']);
$ilToolbar->addInputItem($si);
$ilToolbar->addFormButton($this->lng->txt('change'), 'showFolder');
$ilToolbar->setFormAction($this->ctrl->getFormAction($this, 'showFolder'));
}
if ($check_local == true || $check_uf == true) {
$this->addSubfolderCommands($check_uf);
}
}
// END SHOW_FOLDER
if ($mailtable->isTrashFolder() && $mailtable->getNumerOfMails() > 0 && $this->askForConfirmation) {
$confirmation = new ilConfirmationGUI();
//.........这里部分代码省略.........
示例5: exportHTMLScoObjects
function exportHTMLScoObjects($a_inst, $a_target_dir, &$expLog, $a_one_file = "")
{
global $ilBench;
$tree = new ilTree($this->getId());
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
// copy all necessary files now
if ($a_one_file != "") {
$this->prepareHTMLExporter($a_target_dir);
// put header into file
$sco_tpl = new ilTemplate("tpl.sco.html", true, true, "Modules/Scorm2004");
include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php";
$sco_tpl = ilCOPageHTMLExport::getPreparedMainTemplate($sco_tpl);
$sco_tpl->setCurrentBlock("js_file");
$sco_tpl->setVariable("JS_FILE", "./js/pure.js");
$sco_tpl->parseCurrentBlock();
$sco_tpl->setCurrentBlock("js_file");
$sco_tpl->setVariable("JS_FILE", "./js/question_handling.js");
$sco_tpl->parseCurrentBlock();
$sco_tpl->setCurrentBlock("head");
$sco_tpl->parseCurrentBlock();
fputs($a_one_file, $sco_tpl->get("head"));
// toc
include_once "./Modules/Scorm2004/classes/class.ilContObjectManifestBuilder.php";
$manifestBuilder = new ilContObjectManifestBuilder($this);
$manifestBuilder->buildManifest('12');
$xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/module.xsl");
$xml = simplexml_load_string($manifestBuilder->writer->xmlDumpMem());
$args = array('/_xml' => $xml->organizations->organization->asXml(), '/_xsl' => $xsl);
$xh = xslt_create();
$params = array("one_page" => "y");
$output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params);
xslt_free($xh);
fputs($a_one_file, $output);
}
foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, 'sco') as $sco) {
include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php";
$sco_folder = $a_target_dir . "/" . $sco['obj_id'];
ilUtil::makeDir($sco_folder);
$node = new ilSCORM2004Sco($this, $sco['obj_id']);
if ($a_one_file == "") {
$node->exportHTML($a_inst, $sco_folder, $expLog, $a_one_file);
} else {
$node->exportHTMLPageObjects($a_inst, $a_target_dir, $expLog, 'full', "sco", $a_one_file, $sco_tpl);
}
if ($this->getAssignedGlossary() != 0) {
include_once "./Modules/Glossary/classes/class.ilObjGlossary.php";
$glos = new ilObjGlossary($this->getAssignedGlossary(), false);
//$glos->exportHTML($sco_folder."/glossary", $expLog);
}
}
// copy all necessary files now
if ($a_one_file != "") {
// put tail into file
fputs($a_one_file, $sco_tpl->get("tail"));
}
}
示例6: 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);
}
示例7: testAllOthers
/**
* get path ids (adjacenca and nested set)
* @group IL_Init
* @param
* @return
*/
public function testAllOthers()
{
$tree = new ilTree(ROOT_FOLDER_ID);
$d = $tree->getDepth(24);
$this->assertEquals($d, 4);
$node = $tree->getNodeData(24);
$this->assertEquals($node['title'], 'Public chat');
$bool = $tree->isInTree(24);
$this->assertEquals($bool, true);
$bool = $tree->isInTree(24242424);
$this->assertEquals($bool, false);
/* ref_id 14 => obj_id 98 does not exist
$node = $tree->getParentNodeData(24);
$this->assertEquals($node['title'],'Chat-Server');
*/
$bool = $tree->isGrandChild(9, 24);
$this->assertEquals($bool, 1);
/* see above
$node = $tree->getNodeDataByType('chac');
$this->assertEquals($node[0]['title'],'Chat-Server');
*/
$bool = $tree->isDeleted(24);
$this->assertEquals($bool, false);
$id = $tree->getParentId(24);
$this->assertEquals($id, 14);
$lft = $tree->getLeftValue(24);
$this->assertEquals($lft, 14);
$seq = $tree->getChildSequenceNumber($tree->getNodeData(24));
$this->assertEquals($seq, 1);
$tree->getNodePath(9, 1);
$max_depth = $tree->getMaximumDepth();
// Round trip
$tree = new ilTree(ROOT_FOLDER_ID);
$suc = $tree->fetchSuccessorNode(16);
// cals
$cals = $tree->fetchPredecessorNode($suc['child']);
$this->assertEquals($cals['child'], 16);
}
示例8: getChapterList
/**
* export (sub)structure objects of structure object (see ilias_co.dtd)
*
* @param object $a_xml_writer ilXmlWriter object that receives the
* xml data
*/
static function getChapterList($a_lm_id)
{
$tree = new ilTree($a_lm_id);
$tree->setTableNames('lm_tree', 'lm_data');
$tree->setTreeTablePK("lm_id");
$chapters = array();
$ndata = $tree->getNodeData($tree->readRootId());
$childs = $tree->getSubtree($ndata);
foreach ($childs as $child) {
if ($child["type"] == "st") {
$chapters[] = $child;
}
}
return $chapters;
}
示例9: mapCurrentPageId
function mapCurrentPageId($current_page_id)
{
$subtree = $this->lm_tree->getSubTree($this->lm_tree->getNodeData(1));
$node = $this->lm_tree->getNodeData($current_page_id);
$pos = array_search($node, $subtree);
$this->tr_obj =& $this->ilias->obj_factory->getInstanceByRefId($_SESSION["tr_id"]);
$lmtree = new ilTree($this->tr_obj->getId());
$lmtree->setTableNames('lm_tree', 'lm_data');
$lmtree->setTreeTablePK("lm_id");
$subtree = $lmtree->getSubTree($lmtree->getNodeData(1));
return $subtree[$pos]["child"];
}
示例10: cutPage
/**
* cut page
*/
function cutPage()
{
$this->cutItems();
return;
if (!isset($_POST["id"])) {
$this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
}
if (count($_POST["id"]) > 1) {
$this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"), $this->ilias->error_obj->MESSAGE);
}
if (count($_POST["id"]) == 1 && $_POST["id"][0] == IL_FIRST_NODE) {
$this->ilias->raiseError($this->lng->txt("cont_select_item"), $this->ilias->error_obj->MESSAGE);
}
// SAVE POST VALUES
ilEditClipboard::storeContentObject("pg", $_POST["id"][0]);
$tree = new ilTree($this->content_object->getId());
$tree->setTableNames('lm_tree', 'lm_data');
$tree->setTreeTablePK("lm_id");
// cut selected object
$cutted = 0;
foreach ($_POST["id"] as $id) {
if ($id == -1) {
continue;
}
$obj =& ilLMObjectFactory::getInstance($this->content_object, $id);
$obj->setLMId($this->content_object->getId());
$node_data = $tree->getNodeData($id);
//$obj->delete();
if ($tree->isInTree($id)) {
$parent_id = $tree->getParentId($id);
$tree->deleteTree($node_data);
// write history entry
require_once "./Services/History/classes/class.ilHistory.php";
ilHistory::_createEntry($id, "cut", array(ilLMObject::_lookupTitle($parent_id), $parent_id), $this->content_object->getType() . ":pg");
ilHistory::_createEntry($parent_id, "cut_page", array(ilLMObject::_lookupTitle($id), $id), $this->content_object->getType() . ":st");
}
$cutted++;
}
// tree check
$this->checkTree();
if ($cutted > 0) {
ilUtil::sendInfo($this->lng->txt("msg_cut_clipboard"), true);
}
$this->ctrl->redirect($this, "view");
}
示例11: getAllSubObjects
/**
* get all subobject (structure and page objects) of a lm
*
* @access protected
* @return
*/
protected function getAllSubObjects($a_ref_id)
{
$tree = new ilTree(ilObject::_lookupObjId($a_ref_id));
$tree->setTableNames('lm_tree', 'lm_data');
$tree->setTreeTablePK("lm_id");
foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId())) as $node) {
if ($node['type'] == 'st' or $node['type'] == 'pg') {
$depth = $node['depth'] - 1;
$child = $node['child'];
$chapter[$child]['depth'] = $depth;
$chapter[$child]['type'] = $node['type'];
}
}
return $chapter ? $chapter : array();
}
示例12: restoreObjects
/**
* Move objects from trash back to repository
*/
function restoreObjects($a_cur_ref_id, $a_ref_ids)
{
global $rbacsystem, $log, $ilAppEventHandler, $lng, $tree;
$cur_obj_id = ilObject::_lookupObjId($a_cur_ref_id);
foreach ($a_ref_ids as $id) {
$obj_data = ilObjectFactory::getInstanceByRefId($id);
if (!$rbacsystem->checkAccess('create', $a_cur_ref_id, $obj_data->getType())) {
$no_create[] = ilObject::_lookupTitle(ilObject::_lookupObjId($id));
}
}
if (count($no_create)) {
include_once "./Services/Repository/exceptions/class.ilRepositoryException.php";
throw new ilRepositoryException($lng->txt("msg_no_perm_paste") . " " . implode(',', $no_create));
}
$affected_ids = array();
foreach ($a_ref_ids as $id) {
$affected_ids[$id] = $id;
// INSERT AND SET PERMISSIONS
ilRepUtil::insertSavedNodes($id, $a_cur_ref_id, -(int) $id, $affected_ids);
// DELETE SAVED TREE
$saved_tree = new ilTree(-(int) $id);
$saved_tree->deleteTree($saved_tree->getNodeData($id));
include_once './Services/Object/classes/class.ilObjectFactory.php';
$factory = new ilObjectFactory();
$ref_obj = $factory->getInstanceByRefId($id, FALSE);
if ($ref_obj instanceof ilObject) {
$lroles = $GLOBALS['rbacreview']->getRolesOfRoleFolder($id, FALSE);
foreach ($lroles as $role_id) {
include_once './Services/AccessControl/classes/class.ilObjRole.php';
$role = new ilObjRole($role_id);
$role->setParent($id);
$role->delete();
}
$parent_ref = $GLOBALS['tree']->getParentId($id);
if ($parent_ref) {
$ref_obj->setPermissions($parent_ref);
}
}
// BEGIN ChangeEvent: Record undelete.
require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
global $ilUser;
ilChangeEvent::_recordWriteEvent(ilObject::_lookupObjId($id), $ilUser->getId(), 'undelete', ilObject::_lookupObjId($tree->getParentId($id)));
ilChangeEvent::_catchupWriteEvents($cur_obj_id, $ilUser->getId());
// END PATCH ChangeEvent: Record undelete.
}
// send events
foreach ($affected_ids as $id) {
// send global event
$ilAppEventHandler->raise("Services/Object", "undelete", array("obj_id" => ilObject::_lookupObjId($id), "ref_id" => $id));
}
}
示例13: confirmedMove
function confirmedMove()
{
global $ilUser;
$tgt = (int) $_REQUEST["bmfmv_id"];
$bm_ids = explode(";", $_REQUEST['bm_id_tgt']);
if (!$bm_ids || !$tgt) {
ilUtil::sendFailure($this->lng->txt("no_checkbox"));
return $this->view();
}
$tree = new ilTree($ilUser->getId());
$tree->setTableNames('bookmark_tree', 'bookmark_data');
$tgt_node = $tree->getNodeData($tgt);
// sanity check
foreach ($bm_ids as $node_id) {
if ($tree->isGrandChild($node_id, $tgt)) {
ilUtil::sendFailure($this->lng->txt("error"), true);
$this->ctrl->redirect($this, "view");
}
$node = $tree->getNodeData($node_id);
// already at correct position
if ($node["parent"] == $tgt) {
continue;
}
$tree->moveTree($node_id, $tgt);
}
ilUtil::sendSuccess($this->lng->txt("bookmark_moved_ok"), true);
$this->ctrl->setParameter($this, "bmf_id", $tgt);
$this->ctrl->redirect($this, "view");
}
示例14: removeDeletedNodes
/**
* remove already deleted objects within the objects in trash
* recursive function
*
* @access public
* @param integer ref_id of source object
* @param boolean
*/
function removeDeletedNodes($a_node_id, $a_checked, $a_delete_objects = true)
{
global $ilDB, $log, $ilias, $tree;
$query = "SELECT tree FROM tree WHERE parent = ? AND tree < 0 ";
$sta = $ilDB->prepare($query, array('integer', 'integer'));
$res = $ilDB->execute($sta, array($a_node_id, 0));
while ($row = $ilDB->fetchObject($res)) {
// only continue recursion if fetched node wasn't touched already!
if (!in_array($row->tree, $a_checked)) {
$deleted_tree = new ilTree($row->tree);
$a_checked[] = $row->tree;
$row->tree = $row->tree * -1;
$del_node_data = $deleted_tree->getNodeData($row->tree);
$del_subtree_nodes = $deleted_tree->getSubTree($del_node_data);
$this->removeDeletedNodes($row->tree, $a_checked);
if ($a_delete_objects) {
foreach ($del_subtree_nodes as $node) {
$node_obj =& $ilias->obj_factory->getInstanceByRefId($node["ref_id"]);
// write log entry
/*$this->writelog("removeDeletedNodes(), delete obj_id: ".$node_obj->getId().
", ref_id: ".$node_obj->getRefId().", type: ".$node_obj->getType().", ".
"title: ".$node_obj->getTitle());
*/
$node_obj->delete();
}
}
$tree->deleteTree($del_node_data);
// write log entry
//$this->writelog("removeDeletedNodes(), deleted tree, tree_id: ".$del_node_data["tree"].", child: ".$del_node_data["child"]);
}
}
return true;
}
示例15: exportXMLPageObjects
function exportXMLPageObjects($a_target_dir, &$a_xml_writer, $a_inst, &$expLog)
{
global $ilBench;
include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php";
include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
$tree = new ilTree($this->slm_id);
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
$pages = $tree->getSubTree($tree->getNodeData($this->getId()), true, 'page');
foreach ($pages as $page) {
$expLog->write(date("[y-m-d H:i:s] ") . "Page Object " . $page["obj_id"]);
// export xml to writer object
$page_obj = new ilSCORM2004Page($page["obj_id"]);
$page_obj->exportXML($a_xml_writer, "normal", $a_inst);
//collect media objects
$mob_ids = $page_obj->getMediaObjectIds();
foreach ($mob_ids as $mob_id) {
$this->mob_ids[$mob_id] = $mob_id;
}
// collect all file items
$file_ids = $page_obj->getFileItemIds();
foreach ($file_ids as $file_id) {
$this->file_ids[$file_id] = $file_id;
}
include_once "./Services/COPage/classes/class.ilPCQuestion.php";
$q_ids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]);
if (count($q_ids) > 0) {
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
foreach ($q_ids as $q_id) {
$q_obj =& assQuestion::_instanciateQuestion($q_id);
$qti_file = fopen($a_target_dir . "/qti_" . $q_id . ".xml", "w");
fwrite($qti_file, $q_obj->toXML());
fclose($qti_file);
}
}
unset($page_obj);
}
}