/** * Show delete confirmation */ public function delete() { global $tpl, $ilSetting, $ilErr; $this->ctrl->setReturnByClass(get_class($this->getContainer()), ''); $to_delete = array(); if ((int) $_GET['item_ref_id']) { $to_delete = array((int) $_GET['item_ref_id']); } if (isset($_POST['id']) and is_array($_POST['id'])) { $to_delete = $_POST['id']; } if (!$to_delete) { $ilErr->raiseError($this->lng->txt('no_checkbox'), $ilErr->MESSAGE); } include_once './Services/Utilities/classes/class.ilConfirmationGUI.php'; $confirm = new ilConfirmationGUI(); $confirm->setFormAction($this->ctrl->getFormActionByClass(get_class($this->getContainer()), 'cancel')); $confirm->setHeaderText(''); $confirm->setCancel($this->lng->txt('cancel'), 'cancelDelete'); $confirm->setConfirm($this->lng->txt('delete'), 'performDelete'); foreach ($to_delete as $delete) { $obj_id = ilObject::_lookupObjId($delete); $type = ilObject::_lookupType($obj_id); $confirm->addItem('id[]', $delete, call_user_func(array(ilObjectFactory::getClassByType($type), '_lookupTitle'), $obj_id), ilUtil::getTypeIconPath($type, $obj_id)); } $msg = $this->lng->txt("info_delete_sure"); if (!$ilSetting->get('enable_trash')) { $msg .= "<br/>" . $this->lng->txt("info_delete_warning_no_trash"); } ilUtil::sendQuestion($msg); $tpl->setContent($confirm->getHTML()); }
/** * Constructor * @access public * @param string $a_target scriptname * @param string $a_session_variable session_variable * @param ilWorkspaceTree $a_tree workspace tree * @param ilWorkspaceAccessHandler $a_access_handler workspace access handler */ public function __construct($a_type, $a_target, $a_session_variable, ilWorkspaceTree $a_tree, ilWorkspaceAccessHandler $a_access_handler) { global $ilCtrl; $this->ctrl = $ilCtrl; $this->type = $a_type; $this->access = $a_access_handler; parent::__construct($a_target); // #11173 if (!$a_tree->readRootId()) { // create (workspace) root folder $root = ilObjectFactory::getClassByType("wsrt"); $root = new $root(null); $root->create(); $root_id = $a_tree->createReference($root->getId()); $a_tree->addTree($a_tree->getTreeId(), $root_id); $a_tree->setRootId($root_id); } $this->tree = $a_tree; $this->root_id = $this->tree->readRootId(); $this->order_column = 'title'; $this->setSessionExpandVariable($a_session_variable); // reset filter $this->filter = array(); $this->addFilter('wsrt'); $this->addFilter('wfld'); $this->addFormItemForType('wsrt'); $this->addFormItemForType('wfld'); $this->setFiltered(true); $this->setFilterMode(IL_FM_POSITIVE); }
/** * Show delete confirmation table */ function showDeleteConfirmation($a_ids, $a_supress_message = false) { global $lng, $ilSetting, $ilCtrl, $tpl, $objDefinition; if (!is_array($a_ids) || count($a_ids) == 0) { ilUtil::sendFailure($lng->txt("no_checkbox"), true); return false; } // Remove duplicate entries $a_ids = array_unique((array) $a_ids); include_once "./Services/Utilities/classes/class.ilConfirmationGUI.php"; $cgui = new ilConfirmationGUI(); if (!$a_supress_message) { $msg = $lng->txt("info_delete_sure"); if (!$ilSetting->get('enable_trash')) { $msg .= "<br/>" . $lng->txt("info_delete_warning_no_trash"); } $cgui->setHeaderText($msg); } $cgui->setFormAction($ilCtrl->getFormAction($this->parent_gui)); $cgui->setCancel($lng->txt("cancel"), "cancelDelete"); $cgui->setConfirm($lng->txt("confirm"), "confirmedDelete"); $form_name = "cgui_" . md5(uniqid()); $cgui->setFormName($form_name); $deps = array(); foreach ($a_ids as $ref_id) { $obj_id = ilObject::_lookupObjId($ref_id); $type = ilObject::_lookupType($obj_id); $title = call_user_func(array(ilObjectFactory::getClassByType($type), '_lookupTitle'), $obj_id); $alt = $objDefinition->isPlugin($type) ? $lng->txt("icon") . " " . ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type) : $lng->txt("icon") . " " . $lng->txt("obj_" . $type); $title .= $this->handleMultiReferences($obj_id, $ref_id, $form_name); $cgui->addItem("id[]", $ref_id, $title, ilObject::_getIcon($obj_id, "small", $type), $alt); ilObject::collectDeletionDependencies($deps, $ref_id, $obj_id, $type); } $deps_html = ""; if (is_array($deps) && count($deps) > 0) { include_once "./Services/Repository/classes/class.ilRepDependenciesTableGUI.php"; $tab = new ilRepDependenciesTableGUI($deps); $deps_html = "<br/><br/>" . $tab->getHTML(); } $tpl->setContent($cgui->getHTML() . $deps_html); return true; }
/** * Init personal tree */ protected function initTree() { global $ilUser; $user_id = $ilUser->getId(); include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php"; $this->tree = new ilWorkspaceTree($user_id); if (!$this->tree->readRootId()) { // create (workspace) root folder $root = ilObjectFactory::getClassByType("wsrt"); $root = new $root(null); $root->create(); $root_id = $this->tree->createReference($root->getId()); $this->tree->addTree($user_id, $root_id); $this->tree->setRootId($root_id); } }
/** * Display delete confirmation form (workspace specific) * * This should probably be moved elsewhere as done with RepUtil */ protected function deleteConfirmation() { global $lng, $tpl, $objDefinition; $node_id = (int) $_REQUEST["item_ref_id"]; if (!$node_id) { ilUtil::sendFailure($lng->txt("no_checkbox"), true); $this->ctrl->redirect($this, ""); } // on cancel or fail we return to parent node $parent_node = $this->tree->getParentId($node_id); $this->ctrl->setParameter($this, "wsp_id", $parent_node); include_once "./Services/Utilities/classes/class.ilConfirmationGUI.php"; $cgui = new ilConfirmationGUI(); $cgui->setHeaderText($lng->txt("info_delete_sure") . "<br/>" . $lng->txt("info_delete_warning_no_trash")); $cgui->setFormAction($this->ctrl->getFormAction($this)); $cgui->setCancel($lng->txt("cancel"), "cancelDelete"); $cgui->setConfirm($lng->txt("confirm"), "confirmedDelete"); $a_ids = array($node_id); foreach ($a_ids as $node_id) { $children = $this->tree->getSubTree($this->tree->getNodeData($node_id)); foreach ($children as $child) { $node_id = $child["wsp_id"]; $obj_id = $this->tree->lookupObjectId($node_id); $type = ilObject::_lookupType($obj_id); $title = call_user_func(array(ilObjectFactory::getClassByType($type), '_lookupTitle'), $obj_id); // if anything fails, abort the whole process if (!$this->checkPermissionBool("delete", "", "", $node_id)) { ilUtil::sendFailure($lng->txt("msg_no_perm_delete") . " " . $title, true); $this->ctrl->redirect($this); } $cgui->addItem("id[]", $node_id, $title, ilObject::_getIcon($obj_id, "small", $type), $lng->txt("icon") . " " . $lng->txt("obj_" . $type)); } } $tpl->setContent($cgui->getHTML()); }
/** * Confirmation for trash * * @param array $a_ids ref_ids */ public function confirmRemoveFromSystemObject($a_ids) { global $ilCtrl, $lng, $objDefinition, $tpl; include_once "./Services/Utilities/classes/class.ilConfirmationGUI.php"; if (!is_array($a_ids)) { $a_ids = array($a_ids); } $cgui = new ilConfirmationGUI(); $cgui->setFormAction($ilCtrl->getFormAction($this->parent_gui)); $cgui->setCancel($lng->txt("cancel"), "trash"); $cgui->setConfirm($lng->txt("confirm"), "removeFromSystem"); $cgui->setFormName("trash_confirmation"); $cgui->setHeaderText($lng->txt("info_delete_sure")); foreach ($a_ids as $id) { $obj_id = ilObject::_lookupObjId($id); $type = ilObject::_lookupType($obj_id); $title = call_user_func(array(ilObjectFactory::getClassByType($type), '_lookupTitle'), $obj_id); $alt = $objDefinition->isPlugin($type) ? $lng->txt("icon") . " " . ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type) : $lng->txt("icon") . " " . $lng->txt("obj_" . $type); $cgui->addItem("trash_id[]", $id, $title, ilObject::_getIcon($obj_id, "small", $type), $alt); } $tpl->setContent($cgui->getHTML()); }
/** * Create personal workspace tree for user * * @param int $a_user_id */ public function createTreeForUser($a_user_id) { $root = ilObjectFactory::getClassByType("wsrt"); $root = new $root(null); $root->create(); $root_id = $this->createReference($root->getId()); $this->addTree($a_user_id, $root_id); $this->setRootId($root_id); }