19 declare(strict_types=1);
83 public function __construct(
int $id = 0,
int $id_type = self::REPOSITORY_NODE_ID,
int $parent_node_id = 0)
87 $this->obj_definition = $DIC[
"objDefinition"];
88 $this->tpl = $DIC[
"tpl"];
89 $this->
ctrl = $DIC[
"ilCtrl"];
90 $this->
lng = $DIC[
"lng"];
91 $this->tabs_gui = $DIC[
"ilTabs"];
92 $this->object_service = $DIC->object();
94 $this->error = $DIC[
'ilErr'];
95 $this->
locator = $DIC[
"ilLocator"];
96 $this->
user = $DIC->user();
97 $this->
access = $DIC->access();
98 $this->
toolbar = $DIC->toolbar();
99 $this->
http = $DIC[
'http'];
100 $this->request = $this->
http->request();
101 $this->post_wrapper = $this->
http->wrapper()->post();
102 $this->request_wrapper = $this->
http->wrapper()->query();
105 $this->rbac_admin = $DIC->rbac()->admin();
106 $this->rbac_system = $DIC->rbac()->system();
107 $this->rbac_review = $DIC->rbac()->review();
108 $this->ui_factory = $DIC[
'ui.factory'];
109 $this->ui_renderer = $DIC[
'ui.renderer'];
110 $this->
settings = $DIC[
'ilSetting'];
111 $this->temp_file_system = $DIC->filesystem()->temp();
113 $tree = $DIC[
"tree"];
115 $this->requested_ref_id = 0;
116 if ($this->request_wrapper->has(
"ref_id")) {
117 $this->requested_ref_id = $this->request_wrapper->retrieve(
"ref_id", $this->
refinery->kindlyTo()->int());
120 $this->parent_id = $parent_node_id;
121 $this->type = $this->
getType();
123 $this->notes_service = $DIC->notes();
125 $this->requested_new_type =
'';
126 if ($this->request_wrapper->has(
"new_type")) {
127 $this->requested_new_type = $this->request_wrapper->retrieve(
129 $this->
refinery->kindlyTo()->string()
131 } elseif ($this->post_wrapper->has(
"new_type")) {
132 $this->requested_new_type = $this->post_wrapper->retrieve(
134 $this->
refinery->kindlyTo()->string()
139 switch ($this->id_type) {
140 case self::REPOSITORY_NODE_ID:
141 $this->node_id =
$id;
145 $this->call_by_reference =
true;
149 case self::REPOSITORY_OBJECT_ID:
150 $this->object_id =
$id;
156 case self::WORKSPACE_NODE_ID:
157 $ilUser = $DIC[
"ilUser"];
158 $this->node_id =
$id;
165 case self::WORKSPACE_OBJECT_ID:
166 $ilUser = $DIC[
"ilUser"];
167 $this->object_id =
$id;
173 case self::PORTFOLIO_OBJECT_ID:
174 $this->object_id =
$id;
179 case self::OBJECT_ID:
180 $this->object_id =
$id;
190 if (!$this->object_id) {
191 $this->creation_mode =
true;
193 if ($this->node_id) {
195 if (!$this->parent_id && $this->tree) {
196 $this->parent_id = $this->tree->getParentId($this->node_id);
199 $this->ref_id = $this->node_id ?? 0;
205 if (is_object($this->
object)) {
206 $this->
ctrl->setContextObject($this->
object->getId(), $this->
object->getType());
224 $next_class = $this->
ctrl->getNextClass($this);
225 $cmd = $this->
ctrl->getCmd();
229 switch ($next_class) {
230 case "ilworkspaceaccessgui":
231 if ($this->node_id) {
232 $this->tabs_gui->activateTab(
"id_permissions");
234 $this->
ctrl->forwardCommand($wspacc);
261 if ($this->object_id != 0) {
262 switch ($this->id_type) {
263 case self::OBJECT_ID:
264 case self::REPOSITORY_OBJECT_ID:
265 case self::WORKSPACE_OBJECT_ID:
266 case self::PORTFOLIO_OBJECT_ID:
270 case self::REPOSITORY_NODE_ID:
274 case self::WORKSPACE_NODE_ID:
295 if ($this->omit_locator) {
299 switch ($this->id_type) {
300 case self::REPOSITORY_NODE_ID:
305 if ($this->admin_mode == self::ADMIN_MODE_NONE &&
306 strtolower($this->
ctrl->getCmdClass()) ==
"ilobjrolegui") {
307 $this->
ctrl->setParameterByClass(
310 $this->request_wrapper->has(
"rolf_ref_id")
311 ? $this->request_wrapper->retrieve(
"rolf_ref_id", $this->
refinery->kindlyTo()->string())
314 $this->
ctrl->setParameterByClass(
317 $this->request_wrapper->retrieve(
"obj_id", $this->refinery->kindlyTo()->string())
320 $this->
lng->txt(
"role"),
321 $this->
ctrl->getLinkTargetByClass([
"ilpermissiongui",
322 "ilobjrolegui"],
"perm")
327 if ($this->object_id) {
330 $this->tpl->setLocator();
334 case self::WORKSPACE_NODE_ID:
343 public function delete():
void 345 switch ($this->id_type) {
346 case self::REPOSITORY_NODE_ID:
347 case self::REPOSITORY_OBJECT_ID:
348 parent::deleteObject();
351 case self::WORKSPACE_NODE_ID:
352 case self::WORKSPACE_OBJECT_ID:
353 $this->deleteConfirmation();
356 case self::OBJECT_ID:
357 case self::PORTFOLIO_OBJECT_ID:
368 switch ($this->id_type) {
369 case self::REPOSITORY_NODE_ID:
370 case self::REPOSITORY_OBJECT_ID:
371 parent::confirmedDeleteObject();
374 case self::WORKSPACE_NODE_ID:
375 case self::WORKSPACE_OBJECT_ID:
379 case self::OBJECT_ID:
380 case self::PORTFOLIO_OBJECT_ID:
392 if (!$this->post_wrapper->has(
"id")) {
393 $this->tpl->setOnScreenMessage(
"failure", $this->
lng->txt(
"no_checkbox"),
true);
394 $this->
ctrl->redirect($this,
"");
398 $ids = $this->post_wrapper->retrieve(
403 if (count($ids) == 0) {
404 $this->tpl->setOnScreenMessage(
"failure", $this->
lng->txt(
"no_checkbox"),
true);
405 $this->
ctrl->redirect($this,
"");
411 foreach ($ids as $node_id) {
412 $del_nodes[
$node_id] = $this->tree->getNodeData($node_id);
415 foreach ($del_nodes as $node_id => $node) {
416 $this->tree->deleteReference($node_id);
417 if ($this->tree->isInTree($node_id)) {
418 $this->tree->deleteTree($node);
429 $this->tpl->setOnScreenMessage(
"success", $this->
lng->txt(
"msg_removed"),
true);
430 $this->
ctrl->redirect($this,
"");
435 return parent::getHTML();
443 return parent::withReferences();
447 parent::setCreationMode($mode);
451 return parent::getCreationMode();
455 return parent::prepareOutput($show_sub_objects);
459 parent::setTitleAndDescription();
463 parent::omitLocator($omit);
471 parent::setTargetFrame($cmd, $target_frame);
479 return parent::getCenterColumnHTML();
483 return parent::getRightColumnHTML();
487 parent::setColumnSettings($column_gui);
495 parent::checkPermission($perm, $cmd, $type,
$ref_id);
499 parent::showPossibleSubObjects();
504 parent::redirectToRefId($ref_id, $cmd);
511 parent::addAdminLocatorItems($do_not_add_object);
519 switch ($this->id_type) {
520 case self::REPOSITORY_NODE_ID:
521 case self::REPOSITORY_OBJECT_ID:
522 parent::viewObject();
525 case self::WORKSPACE_NODE_ID:
526 case self::WORKSPACE_OBJECT_ID:
530 case self::OBJECT_ID:
531 case self::PORTFOLIO_OBJECT_ID:
544 switch ($this->id_type) {
545 case self::REPOSITORY_NODE_ID:
546 case self::REPOSITORY_OBJECT_ID:
548 $this->tabs_gui->addTab(
550 $this->
lng->txt(
"perm_settings"),
551 $this->
ctrl->getLinkTargetByClass([get_class($this),
"ilpermissiongui"],
"perm")
556 case self::WORKSPACE_NODE_ID:
557 case self::WORKSPACE_OBJECT_ID:
561 in_array($this->type, [
"file",
"blog"]) &&
564 $this->tabs_gui->addTab(
566 $this->
lng->txt(
"wsp_permissions"),
567 $this->
ctrl->getLinkTargetByClass([get_class($this),
"ilworkspaceaccessgui"],
"share")
582 die(
"ilObject2GUI::getReturnLocation() is deprecated.");
586 die(
"ilObject2GUI::setReturnLocation() is deprecated.");
590 die(
"ilObject2GUI::showActions() is deprecated.");
594 die(
"ilObject2GUI::getTabs() is deprecated.");
607 abstract public function getType(): string;
614 parent::createObject();
618 parent::saveObject();
622 parent::editObject();
626 parent::updateObject();
630 parent::cancelObject();
638 $this->object_id = $obj->
getId();
640 if (!$parent_node_id) {
645 if ($this->retriever->has(
'crtptrefid')) {
646 $parent_node_id = $this->retriever->getMaybeInt(
'crtptrefid') ?? 0;
649 switch ($this->id_type) {
650 case self::REPOSITORY_NODE_ID:
651 case self::REPOSITORY_OBJECT_ID:
652 if (!$this->node_id) {
660 $rbac_log_roles = $this->rbac_review->getParentRoleIds($this->node_id,
false);
664 $this->
ctrl->setParameter($this,
"ref_id", $this->node_id);
667 case self::WORKSPACE_NODE_ID:
668 case self::WORKSPACE_OBJECT_ID:
669 if (!$this->node_id) {
670 $this->node_id = $this->tree->insertObject($parent_node_id, $this->object_id);
674 $this->
ctrl->setParameter($this,
"wsp_id", $this->node_id);
677 case self::OBJECT_ID:
678 case self::PORTFOLIO_OBJECT_ID:
688 self::handleAfterSaveCallback($obj, $this->retriever->getMaybeInt(
'crtcb'));
697 $objDefinition = $DIC[
"objDefinition"];
699 $callback_ref_id = (
int) $callback_ref_id;
700 if ($callback_ref_id) {
702 $class_name =
"ilObj" . $objDefinition->getClassName($callback_type) .
"GUI";
703 if (strtolower($class_name) ==
"ilobjitemgroupgui") {
704 $callback_obj =
new $class_name($callback_ref_id);
706 $callback_obj =
new $class_name(
null, $callback_ref_id,
true,
false);
708 $callback_obj->afterSaveCallback($obj);
718 if ($perm ==
"create") {
723 return $this->
getAccessHandler()->checkAccess($perm .
"_" . $type, $cmd, $node_id);
735 if ($this->obj_id && $this->
object->getOwner() == $this->
user->getId()) {
746 if ($this->id_type == self::WORKSPACE_NODE_ID) {
747 if (!$this->creation_mode && $this->object_id) {
756 $dispatcher->setSubObject($sub_type, $sub_id);
759 $this->
ctrl->getLinkTarget($this,
"redrawHeaderAction",
"",
true),
761 $this->
ctrl->getLinkTargetByClass([
"ilcommonactiondispatchergui",
"iltagginggui"],
"")
764 $lg = $dispatcher->initHeaderAction();
766 if (is_object($lg)) {
769 $lg->setContainerObject($this);
774 $lg->enableNotes(
true);
782 return parent::initHeaderAction($sub_type, $sub_id);
790 parent::redrawHeaderActionObject();
getReturnLocation(string $cmd, string $location="")
Deprecated functions.
delete()
delete object or referenced object (in the case of a referenced object, object data is only deleted i...
ilRbacReview $rbac_review
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.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
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)
setPermissions(int $parent_ref_id)
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...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
omitLocator(bool $omit=true)
createReference()
creates reference for object
static gatherFaPa(int $ref_id, array $role_ids, bool $add_action=false)
static http()
Fetches the global http state from ILIAS.
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.
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.
putObjectInTree(ilObject $obj, ?int $parent_node_id=null)
Add object to tree at given position.
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.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
setTabs()
create tabs (repository/workspace switch)
setColumnSettings(ilColumnGUI $column_gui)
static add(int $action, int $ref_id, array $diff, bool $source_ref_id=false)
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.
redirectToRefId(int $ref_id, string $cmd="")
static handleAfterSaveCallback(ilObject $obj, ?int $callback_ref_id)
After creation callback.
static prepareJsLinks(string $redraw_url, string $notes_url, string $tags_url, ?ilGlobalTemplateInterface $tpl=null)
Insert js/ajax links into template.
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)
Class ilCommonActionDispatcherGUI.
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)