ILIAS  release_8 Revision v8.24
ilObjectOwnershipManagementGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilObjectOwnershipManagementGUI:

Public Member Functions

 __construct (int $user_id=null, bool $read_only=false)
 
 executeCommand ()
 
 listObjects ()
 
 applyFilter ()
 
 resetFilter ()
 
 delete ()
 
 move ()
 
 export ()
 
 changeOwner ()
 
 isReadOnly ()
 

Data Fields

const P_OWNID = 'ownid'
 

Protected Member Functions

 redirectParentCmd (int $ref_id, string $cmd)
 
 redirectCmd (int $ref_id, string $class, string $cmd=null)
 
 checkReadOnly ()
 

Protected Attributes

ilObjUser $user
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilToolbarGUI $toolbar
 
ilLanguage $lng
 
ilObjectDefinition $obj_definition
 
ilTree $tree
 
int $user_id
 
int $own_id = 0
 
bool $read_only
 

Private Attributes

ilObjectRequestRetriever $retriever
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilObjectOwnershipManagementGUI

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

@ilCtrl_Calls ilObjectOwnershipManagementGUI:

Definition at line 28 of file class.ilObjectOwnershipManagementGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjectOwnershipManagementGUI::__construct ( int  $user_id = null,
bool  $read_only = false 
)

Definition at line 43 of file class.ilObjectOwnershipManagementGUI.php.

44 {
45 global $DIC;
46
47 $this->user = $DIC->user();
48 $this->ctrl = $DIC->ctrl();
49 $this->tpl = $DIC["tpl"];
50 $this->toolbar = $DIC->toolbar();
51 $this->lng = $DIC->language();
52 $this->obj_definition = $DIC["objDefinition"];
53 $this->tree = $DIC->repositoryTree();
54 $this->retriever = new ilObjectRequestRetriever($DIC->http()->wrapper(), $DIC->refinery());
55
56 $this->user_id = $this->user->getId();
57 if (!is_null($user_id)) {
58 $this->user_id = $user_id;
59 }
60 $this->read_only = $read_only;
61 $this->own_id = $this->retriever->getMaybeInt(self::P_OWNID, 0);
62 }
Base class for all sub item list gui's.
global $DIC
Definition: feed.php:28

References $DIC, $read_only, $user_id, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ applyFilter()

ilObjectOwnershipManagementGUI::applyFilter ( )

Definition at line 125 of file class.ilObjectOwnershipManagementGUI.php.

125 : void
126 {
127 $tbl = new ilObjectOwnershipManagementTableGUI($this, "listObjects", $this->user_id);
128 $tbl->resetOffset();
129 $tbl->writeFilterToSession();
130 $this->listObjects();
131 }

References listObjects().

+ Here is the call graph for this function:

◆ changeOwner()

ilObjectOwnershipManagementGUI::changeOwner ( )

Definition at line 212 of file class.ilObjectOwnershipManagementGUI.php.

212 : void
213 {
214 $this->checkReadOnly();
215
216 $this->redirectCmd(
217 $this->own_id,
218 ilPermissionGUI::class,
219 "owner"
220 );
221 }
redirectCmd(int $ref_id, string $class, string $cmd=null)

References checkReadOnly(), and redirectCmd().

+ Here is the call graph for this function:

◆ checkReadOnly()

ilObjectOwnershipManagementGUI::checkReadOnly ( )
protected

Definition at line 228 of file class.ilObjectOwnershipManagementGUI.php.

228 : void
229 {
230 if ($this->read_only) {
231 throw new ilObjectException(
232 'Cannot perform actions when in read only mode'
233 );
234 }
235 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Referenced by changeOwner(), delete(), export(), and move().

+ Here is the caller graph for this function:

◆ delete()

ilObjectOwnershipManagementGUI::delete ( )

Definition at line 182 of file class.ilObjectOwnershipManagementGUI.php.

182 : void
183 {
184 $this->checkReadOnly();
185
186 $this->redirectParentCmd(
187 $this->own_id,
188 "delete"
189 );
190 }

References checkReadOnly(), and redirectParentCmd().

+ Here is the call graph for this function:

◆ executeCommand()

ilObjectOwnershipManagementGUI::executeCommand ( )

Definition at line 64 of file class.ilObjectOwnershipManagementGUI.php.

64 : void
65 {
66 $this->ctrl->getNextClass($this);
67 $cmd = $this->ctrl->getCmd();
68
69 if (!$cmd) {
70 $cmd = "listObjects";
71 }
72 $this->$cmd();
73 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ export()

ilObjectOwnershipManagementGUI::export ( )

Definition at line 202 of file class.ilObjectOwnershipManagementGUI.php.

202 : void
203 {
204 $this->checkReadOnly();
205
206 $this->redirectCmd(
207 $this->own_id,
208 ilExportGUI::class
209 );
210 }

References checkReadOnly(), and redirectCmd().

+ Here is the call graph for this function:

◆ isReadOnly()

ilObjectOwnershipManagementGUI::isReadOnly ( )

Definition at line 223 of file class.ilObjectOwnershipManagementGUI.php.

223 : bool
224 {
225 return $this->read_only;
226 }

References $read_only.

◆ listObjects()

ilObjectOwnershipManagementGUI::listObjects ( )

Definition at line 75 of file class.ilObjectOwnershipManagementGUI.php.

75 : void
76 {
77 $sel_type = '';
78
79 $objects = ilObject::getAllOwnedRepositoryObjects($this->user_id);
80
81 if (sizeof($objects)) {
82 $this->toolbar->setFormAction($this->ctrl->getFormAction($this, "listObjects"));
83
84 $sel = new ilSelectInputGUI($this->lng->txt("type"), "type");
85 $this->toolbar->addStickyItem($sel, true);
86
88 $button->setCaption("ok");
89 $button->setCommand("listObjects");
90 $this->toolbar->addStickyItem($button);
91
92 $options = [];
93 foreach (array_keys($objects) as $type) {
94 if (!$this->obj_definition->isPlugin($type)) {
95 $options[$type] = $this->lng->txt("obj_" . $type);
96 } else {
97 $options[$type] = ilObjectPlugin::lookupTxtById($type, "obj_" . $type);
98 }
99 }
100 asort($options);
101 $sel->setOptions($options);
102
103 $sel_type = $this->retriever->getMaybeString('type', '');
104 if ($sel_type !== '') {
105 $sel->setValue($sel_type);
106 } else {
107 $sel_type = array_keys($options);
108 $sel_type = array_shift($sel_type);
109 }
110 $this->ctrl->setParameter($this, "type", $sel_type);
111 }
112
113 if ($sel_type === '') {
114 return;
115 }
116
117 if (is_array($objects[$sel_type]) && sizeof($objects[$sel_type])) {
118 ilObject::fixMissingTitles($sel_type, $objects[$sel_type]);
119 }
120
121 $tbl = new ilObjectOwnershipManagementTableGUI($this, "listObjects", $this->user_id, $objects[$sel_type]);
122 $this->tpl->setContent($tbl->getHTML());
123 }
static lookupTxtById(string $plugin_id, string $lang_var)
static getAllOwnedRepositoryObjects(int $user_id)
static fixMissingTitles($type, array &$obj_title_map)
Try to fix missing object titles.
This class represents a selection list property in a property form.
$type

References $type, ILIAS\Repository\ctrl(), ilObject\fixMissingTitles(), ilObject\getAllOwnedRepositoryObjects(), ilSubmitButton\getInstance(), ILIAS\Repository\lng(), ilObjectPlugin\lookupTxtById(), and ILIAS\Repository\toolbar().

Referenced by applyFilter(), and resetFilter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ move()

ilObjectOwnershipManagementGUI::move ( )

Definition at line 192 of file class.ilObjectOwnershipManagementGUI.php.

192 : void
193 {
194 $this->checkReadOnly();
195
196 $this->redirectParentCmd(
197 $this->own_id,
198 "cut"
199 );
200 }

References checkReadOnly(), and redirectParentCmd().

+ Here is the call graph for this function:

◆ redirectCmd()

ilObjectOwnershipManagementGUI::redirectCmd ( int  $ref_id,
string  $class,
string  $cmd = null 
)
protected

Definition at line 150 of file class.ilObjectOwnershipManagementGUI.php.

150 : void
151 {
152 $node = $this->tree->getNodeData($ref_id);
153 $gui_class = "ilObj" . $this->obj_definition->getClassName($node["type"]) . "GUI";
154 $path = ["ilRepositoryGUI", $gui_class, $class];
155
156 if ($class == "ilExportGUI") {
157 try {
158 $this->ctrl->getLinkTargetByClass($path);
159 } catch (Exception $e) {
160 switch ($node["type"]) {
161 case "glo":
162 $export_cmd = "exportList";
163 $path = ["ilRepositoryGUI", "ilGlossaryEditorGUI", $gui_class];
164 break;
165
166 default:
167 $export_cmd = "export";
168 $path = ["ilRepositoryGUI", $gui_class];
169 break;
170 }
171 $this->ctrl->setParameterByClass($gui_class, "ref_id", $ref_id);
172 $this->ctrl->setParameterByClass($gui_class, "cmd", $export_cmd);
173 $this->ctrl->redirectByClass($path);
174 }
175 }
176
177 $this->ctrl->setParameterByClass($class, "ref_id", $ref_id);
178 $this->ctrl->setParameterByClass($class, "cmd", $cmd);
179 $this->ctrl->redirectByClass($path);
180 }
$ref_id
Definition: ltiauth.php:67
$path
Definition: ltiservices.php:32

References Vendor\Package\$e, $path, $ref_id, and ILIAS\Repository\ctrl().

Referenced by changeOwner(), and export().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirectParentCmd()

ilObjectOwnershipManagementGUI::redirectParentCmd ( int  $ref_id,
string  $cmd 
)
protected

Definition at line 141 of file class.ilObjectOwnershipManagementGUI.php.

141 : void
142 {
143 $parent = $this->tree->getParentId($ref_id);
144 $this->ctrl->setParameterByClass("ilRepositoryGUI", "ref_id", $parent);
145 $this->ctrl->setParameterByClass("ilRepositoryGUI", "item_ref_id", $ref_id);
146 $this->ctrl->setParameterByClass("ilRepositoryGUI", "cmd", $cmd);
147 $this->ctrl->redirectByClass("ilRepositoryGUI");
148 }

References $ref_id, and ILIAS\Repository\ctrl().

Referenced by delete(), and move().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetFilter()

ilObjectOwnershipManagementGUI::resetFilter ( )

Definition at line 133 of file class.ilObjectOwnershipManagementGUI.php.

133 : void
134 {
135 $tbl = new ilObjectOwnershipManagementTableGUI($this, "listObjects", $this->user_id);
136 $tbl->resetOffset();
137 $tbl->resetFilter();
138 $this->listObjects();
139 }

References listObjects().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilObjectOwnershipManagementGUI::$ctrl
protected

Definition at line 32 of file class.ilObjectOwnershipManagementGUI.php.

◆ $lng

ilLanguage ilObjectOwnershipManagementGUI::$lng
protected

Definition at line 35 of file class.ilObjectOwnershipManagementGUI.php.

◆ $obj_definition

ilObjectDefinition ilObjectOwnershipManagementGUI::$obj_definition
protected

Definition at line 36 of file class.ilObjectOwnershipManagementGUI.php.

◆ $own_id

int ilObjectOwnershipManagementGUI::$own_id = 0
protected

Definition at line 39 of file class.ilObjectOwnershipManagementGUI.php.

◆ $read_only

bool ilObjectOwnershipManagementGUI::$read_only
protected

Definition at line 40 of file class.ilObjectOwnershipManagementGUI.php.

Referenced by __construct(), and isReadOnly().

◆ $retriever

ilObjectRequestRetriever ilObjectOwnershipManagementGUI::$retriever
private

Definition at line 41 of file class.ilObjectOwnershipManagementGUI.php.

◆ $toolbar

ilToolbarGUI ilObjectOwnershipManagementGUI::$toolbar
protected

Definition at line 34 of file class.ilObjectOwnershipManagementGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilObjectOwnershipManagementGUI::$tpl
protected

Definition at line 33 of file class.ilObjectOwnershipManagementGUI.php.

◆ $tree

ilTree ilObjectOwnershipManagementGUI::$tree
protected

Definition at line 37 of file class.ilObjectOwnershipManagementGUI.php.

◆ $user

ilObjUser ilObjectOwnershipManagementGUI::$user
protected

Definition at line 31 of file class.ilObjectOwnershipManagementGUI.php.

◆ $user_id

int ilObjectOwnershipManagementGUI::$user_id
protected

Definition at line 38 of file class.ilObjectOwnershipManagementGUI.php.

Referenced by __construct().

◆ P_OWNID

const ilObjectOwnershipManagementGUI::P_OWNID = 'ownid'

Definition at line 30 of file class.ilObjectOwnershipManagementGUI.php.


The documentation for this class was generated from the following file: