19 declare(strict_types=1);
85 public function __construct(
int $id = 0,
int $id_type = self::REPOSITORY_NODE_ID,
int $parent_node_id = 0)
89 $this->obj_definition = $DIC[
"objDefinition"];
90 $this->tpl = $DIC[
"tpl"];
91 $this->
ctrl = $DIC[
"ilCtrl"];
92 $this->
lng = $DIC[
"lng"];
93 $this->tabs_gui = $DIC[
"ilTabs"];
94 $this->object_service = $DIC->object();
96 $this->error = $DIC[
'ilErr'];
97 $this->
locator = $DIC[
"ilLocator"];
98 $this->
user = $DIC->user();
99 $this->
access = $DIC->access();
100 $this->
toolbar = $DIC->toolbar();
101 $this->post_wrapper = $DIC->http()->wrapper()->post();
102 $this->request_wrapper = $DIC->http()->wrapper()->query();
105 $this->rbac_admin = $DIC->rbac()->admin();
106 $this->rbac_system = $DIC->rbac()->system();
107 $this->rbac_review = $DIC->rbac()->review();
109 $tree = $DIC[
"tree"];
111 $this->requested_ref_id = 0;
112 if ($this->request_wrapper->has(
"ref_id")) {
113 $this->requested_ref_id = $this->request_wrapper->retrieve(
"ref_id", $this->
refinery->kindlyTo()->int());
116 $this->parent_id = $parent_node_id;
117 $this->type = $this->
getType();
119 $this->notes_service = $DIC->notes();
121 $this->requested_new_type =
'';
122 if ($this->request_wrapper->has(
"new_type")) {
123 $this->requested_new_type = $this->request_wrapper->retrieve(
125 $this->
refinery->kindlyTo()->string()
127 } elseif ($this->post_wrapper->has(
"new_type")) {
128 $this->requested_new_type = $this->post_wrapper->retrieve(
130 $this->
refinery->kindlyTo()->string()
135 switch ($this->id_type) {
136 case self::REPOSITORY_NODE_ID:
137 $this->node_id =
$id;
141 $this->call_by_reference =
true;
145 case self::REPOSITORY_OBJECT_ID:
146 $this->object_id =
$id;
152 case self::WORKSPACE_NODE_ID:
153 $ilUser = $DIC[
"ilUser"];
154 $this->node_id =
$id;
161 case self::WORKSPACE_OBJECT_ID:
162 $ilUser = $DIC[
"ilUser"];
163 $this->object_id =
$id;
169 case self::PORTFOLIO_OBJECT_ID:
170 $this->object_id =
$id;
175 case self::OBJECT_ID:
176 $this->object_id =
$id;
186 if (!$this->object_id) {
187 $this->creation_mode =
true;
189 if ($this->node_id) {
191 if (!$this->parent_id && $this->tree) {
192 $this->parent_id = $this->tree->getParentId($this->node_id);
195 $this->ref_id = $this->node_id ?? 0;
201 if (is_object($this->
object)) {
202 $this->
ctrl->setContextObject($this->
object->getId(), $this->
object->getType());
220 $next_class = $this->
ctrl->getNextClass($this);
221 $cmd = $this->
ctrl->getCmd();
225 switch ($next_class) {
226 case "ilworkspaceaccessgui":
227 if ($this->node_id) {
228 $this->tabs_gui->activateTab(
"id_permissions");
230 $this->
ctrl->forwardCommand($wspacc);
257 if ($this->object_id != 0) {
258 switch ($this->id_type) {
259 case self::OBJECT_ID:
260 case self::REPOSITORY_OBJECT_ID:
261 case self::WORKSPACE_OBJECT_ID:
262 case self::PORTFOLIO_OBJECT_ID:
266 case self::REPOSITORY_NODE_ID:
270 case self::WORKSPACE_NODE_ID:
291 if ($this->omit_locator) {
295 switch ($this->id_type) {
296 case self::REPOSITORY_NODE_ID:
301 if ($this->admin_mode == self::ADMIN_MODE_NONE &&
302 strtolower($this->
ctrl->getCmdClass()) ==
"ilobjrolegui") {
303 $this->
ctrl->setParameterByClass(
306 $this->request_wrapper->has(
"rolf_ref_id")
307 ? $this->request_wrapper->retrieve(
"rolf_ref_id", $this->
refinery->kindlyTo()->string())
310 $this->
ctrl->setParameterByClass(
313 $this->request_wrapper->retrieve(
"obj_id", $this->refinery->kindlyTo()->string())
316 $this->
lng->txt(
"role"),
317 $this->
ctrl->getLinkTargetByClass([
"ilpermissiongui",
318 "ilobjrolegui"],
"perm")
323 if ($this->object_id) {
326 $this->tpl->setLocator();
330 case self::WORKSPACE_NODE_ID:
339 public function delete():
void 341 switch ($this->id_type) {
342 case self::REPOSITORY_NODE_ID:
343 case self::REPOSITORY_OBJECT_ID:
344 parent::deleteObject();
347 case self::WORKSPACE_NODE_ID:
348 case self::WORKSPACE_OBJECT_ID:
349 $this->deleteConfirmation();
352 case self::OBJECT_ID:
353 case self::PORTFOLIO_OBJECT_ID:
364 switch ($this->id_type) {
365 case self::REPOSITORY_NODE_ID:
366 case self::REPOSITORY_OBJECT_ID:
367 parent::confirmedDeleteObject();
370 case self::WORKSPACE_NODE_ID:
371 case self::WORKSPACE_OBJECT_ID:
375 case self::OBJECT_ID:
376 case self::PORTFOLIO_OBJECT_ID:
388 if (!$this->post_wrapper->has(
"id")) {
389 $this->tpl->setOnScreenMessage(
"failure", $this->
lng->txt(
"no_checkbox"),
true);
390 $this->
ctrl->redirect($this,
"");
394 $ids = $this->post_wrapper->retrieve(
399 if (count($ids) == 0) {
400 $this->tpl->setOnScreenMessage(
"failure", $this->
lng->txt(
"no_checkbox"),
true);
401 $this->
ctrl->redirect($this,
"");
407 foreach ($ids as $node_id) {
408 $del_nodes[
$node_id] = $this->tree->getNodeData($node_id);
411 foreach ($del_nodes as $node_id => $node) {
412 $this->tree->deleteReference($node_id);
413 if ($this->tree->isInTree($node_id)) {
414 $this->tree->deleteTree($node);
425 $this->tpl->setOnScreenMessage(
"success", $this->
lng->txt(
"msg_removed"),
true);
426 $this->
ctrl->redirect($this,
"");
431 return parent::getHTML();
439 return parent::withReferences();
443 parent::setCreationMode($mode);
447 return parent::getCreationMode();
451 return parent::prepareOutput($show_sub_objects);
455 parent::setTitleAndDescription();
459 parent::omitLocator($omit);
467 parent::setTargetFrame($cmd, $target_frame);
471 return parent::isVisible($ref_id, $type);
475 return parent::getCenterColumnHTML();
479 return parent::getRightColumnHTML();
483 parent::setColumnSettings($column_gui);
491 parent::checkPermission($perm, $cmd, $type,
$ref_id);
495 parent::showPossibleSubObjects();
500 parent::redirectToRefId($ref_id, $cmd);
507 parent::addAdminLocatorItems($do_not_add_object);
515 switch ($this->id_type) {
516 case self::REPOSITORY_NODE_ID:
517 case self::REPOSITORY_OBJECT_ID:
518 parent::viewObject();
521 case self::WORKSPACE_NODE_ID:
522 case self::WORKSPACE_OBJECT_ID:
526 case self::OBJECT_ID:
527 case self::PORTFOLIO_OBJECT_ID:
540 switch ($this->id_type) {
541 case self::REPOSITORY_NODE_ID:
542 case self::REPOSITORY_OBJECT_ID:
544 $this->tabs_gui->addTab(
546 $this->
lng->txt(
"perm_settings"),
547 $this->
ctrl->getLinkTargetByClass([get_class($this),
"ilpermissiongui"],
"perm")
552 case self::WORKSPACE_NODE_ID:
553 case self::WORKSPACE_OBJECT_ID:
557 in_array($this->type, [
"file",
"blog"]) &&
560 $this->tabs_gui->addTab(
562 $this->
lng->txt(
"wsp_permissions"),
563 $this->
ctrl->getLinkTargetByClass([get_class($this),
"ilworkspaceaccessgui"],
"share")
578 die(
"ilObject2GUI::getReturnLocation() is deprecated.");
582 die(
"ilObject2GUI::setReturnLocation() is deprecated.");
586 die(
"ilObject2GUI::showActions() is deprecated.");
590 die(
"ilObject2GUI::getTabs() is deprecated.");
603 abstract public function getType(): string;
610 parent::createObject();
614 parent::saveObject();
618 parent::editObject();
622 parent::updateObject();
626 parent::cancelObject();
636 $forms = parent::initCreationForms($new_type);
639 if ($this->id_type == self::WORKSPACE_NODE_ID) {
640 unset($forms[self::CFORM_CLONE]);
648 parent::importFileObject($this->parent_id);
656 $this->object_id = $obj->
getId();
658 if (!$parent_node_id) {
663 if ($this->retriever->has(
'crtptrefid')) {
664 $parent_node_id = $this->retriever->getMaybeInt(
'crtptrefid') ?? 0;
667 switch ($this->id_type) {
668 case self::REPOSITORY_NODE_ID:
669 case self::REPOSITORY_OBJECT_ID:
670 if (!$this->node_id) {
678 $rbac_log_roles = $this->rbac_review->getParentRoleIds($this->node_id,
false);
682 $this->
ctrl->setParameter($this,
"ref_id", $this->node_id);
685 case self::WORKSPACE_NODE_ID:
686 case self::WORKSPACE_OBJECT_ID:
687 if (!$this->node_id) {
688 $this->node_id = $this->tree->insertObject($parent_node_id, $this->object_id);
692 $this->
ctrl->setParameter($this,
"wsp_id", $this->node_id);
695 case self::OBJECT_ID:
696 case self::PORTFOLIO_OBJECT_ID:
706 self::handleAfterSaveCallback($obj, $this->retriever->getMaybeInt(
'crtcb'));
715 $objDefinition = $DIC[
"objDefinition"];
717 $callback_ref_id = (
int) $callback_ref_id;
718 if ($callback_ref_id) {
720 $class_name =
"ilObj" . $objDefinition->getClassName($callback_type) .
"GUI";
721 if (strtolower($class_name) ==
"ilobjitemgroupgui") {
722 $callback_obj =
new $class_name($callback_ref_id);
724 $callback_obj =
new $class_name(null, $callback_ref_id,
true,
false);
726 $callback_obj->afterSaveCallback($obj);
736 if ($perm ==
"create") {
741 return $this->
getAccessHandler()->checkAccess($perm .
"_" . $type, $cmd, $node_id);
753 if ($this->obj_id && $this->
object->getOwner() == $this->
user->getId()) {
764 if ($this->id_type == self::WORKSPACE_NODE_ID) {
765 if (!$this->creation_mode && $this->object_id) {
774 $dispatcher->setSubObject($sub_type, $sub_id);
777 $this->
ctrl->getLinkTarget($this,
"redrawHeaderAction",
"",
true),
779 $this->
ctrl->getLinkTargetByClass([
"ilcommonactiondispatchergui",
"iltagginggui"],
"")
782 $lg = $dispatcher->initHeaderAction();
784 if (is_object($lg)) {
787 $lg->setContainerObject($this);
792 $lg->enableNotes(
true);
800 return parent::initHeaderAction($sub_type, $sub_id);
808 parent::redrawHeaderActionObject();
getReturnLocation(string $cmd, string $location="")
Deprecated functions.
checkPermission(string $perm, string $cmd="", string $type="", int $ref_id=null)
delete()
delete object or referenced object (in the case of a referenced object, object data is only deleted i...
ilRbacReview $rbac_review
static gatherFaPa(int $a_ref_id, array $a_role_ids, bool $a_add_action=false)
initCreationForms(string $new_type)
Init creation forms.
executeCommand()
execute command
view()
view object content (repository/workspace switch)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
New implementation of ilObjectGUI.
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
static prepareJsLinks(string $redraw_url, string $notes_url, string $tags_url, ilGlobalTemplateInterface $tpl=null)
Insert js/ajax links into template.
confirmedDelete()
Delete objects (repository/workspace switch)
ilObjectRequestRetriever $retriever
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
prepareOutput(bool $show_sub_objects=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
RequestWrapper $request_wrapper
putObjectInTree(ilObject $obj, int $parent_node_id=null)
Add object to tree at given position.
setPermissions(int $parent_ref_id)
Manages favourites, currently the interface for other components, needs discussion.
const REPOSITORY_OBJECT_ID
ilFavouritesManager $favourites
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilObjectDefinition $obj_definition
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
omitLocator(bool $omit=true)
createReference()
creates reference for object
parses the objects.xml it handles the xml-description of all ilias objects
static add(int $a_action, int $a_ref_id, array $a_diff, bool $a_source_ref_id=false)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
getTargetFrame(string $cmd, string $target_frame="")
getType()
Functions that must be overwritten.
Column user interface class.
setCreationMode(bool $mode=true)
Class ilObjectGUI Basic methods of all Output classes.
Interface RequestWrapper.
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
__construct(int $id=0, int $id_type=self::REPOSITORY_NODE_ID, int $parent_node_id=0)
const PORTFOLIO_OBJECT_ID
ilGlobalTemplateInterface $tpl
static _lookupObjectId(int $ref_id)
static _recordWriteEvent(int $obj_id, int $usr_id, string $action, ?int $parent_obj_id=null)
Records a write event.
ArrayBasedRequestWrapper $post_wrapper
withReferences()
Final/Private declaration of unchanged parent methods.
Base class for all sub item list gui's.
const WORKSPACE_OBJECT_ID
redrawHeaderAction()
Updating icons after ajax call.
setTabs()
create tabs (repository/workspace switch)
setColumnSettings(ilColumnGUI $column_gui)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
putInTree(int $parent_ref_id)
maybe this method should be in tree object!?
lookupObjectId(int $a_node_id)
Get object id for node id.
Error Handling & global info handling.
redirectToRefId(int $ref_id, string $cmd="")
static handleAfterSaveCallback(ilObject $obj, ?int $callback_ref_id)
After creation callback.
Access handler for portfolio NOTE: This file needs to stay in the classes directory, WAC will be confused otherwise.
deleteConfirmedObjects()
Delete objects (workspace specific) This should probably be moved elsewhere as done with RepUtil...
isVisible(int $ref_id, string $type)
afterConstructor()
Do anything that should be done after constructor in here.
Class ilRbacAdmin Core functions for role based access control.
assignObject()
create object instance as internal property (repository/workspace switch)
setTargetFrame(string $cmd, string $target_frame)
static _lookupType(int $id, bool $reference=false)
addAdminLocatorItems(bool $do_not_add_object=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initHeaderAction(?string $sub_type=null, ?int $sub_id=null)
Add header action menu.
ilRbacSystem $rbac_system
addLocatorItems()
Functions to be overwritten.
setReturnLocation(string $cmd, string $location)