ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilObjectOwnershipManagementGUI Class Reference
+ Collaboration diagram for ilObjectOwnershipManagementGUI:

Public Member Functions

 __construct (protected InternalDomainService $domain, protected InternalGUIService $gui, ?int $user_id=null, bool $read_only=false)
 
 executeCommand ()
 
 listObjects ()
 
 delete (int $id)
 
 show (int $id)
 
 move (int $id)
 
 export (int $id)
 
 changeOwner (int $id)
 
 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

ilCtrl $ctrl
 
ilLanguage $lng
 
int $user_id
 
int $own_id = 0
 
bool $read_only
 

Private Member Functions

 getLabelForObjectType (string $type)
 

Private Attributes

ilObjectRequestRetriever $retriever
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilObjectOwnershipManagementGUI::__construct ( protected InternalDomainService  $domain,
protected InternalGUIService  $gui,
?int  $user_id = null,
bool  $read_only = false 
)

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

39 {
40 $this->ctrl = $this->gui->ctrl();
41 $this->lng = $this->domain->lng();
42 $this->retriever = new ilObjectRequestRetriever(
43 $this->gui->http()->wrapper(),
44 $this->domain->refinery()
45 );
46
47 $this->lng->loadLanguageModule('obj');
48
49 $this->user_id = $domain->user()->getId();
50 if (!is_null($user_id)) {
51 $this->user_id = $user_id;
52 }
53 $this->read_only = $read_only;
54 $this->own_id = $this->retriever->getMaybeInt(self::P_OWNID, 0);
55 }
Base class for all sub item list gui's.

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

+ Here is the call graph for this function:

Member Function Documentation

◆ changeOwner()

ilObjectOwnershipManagementGUI::changeOwner ( int  $id)

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

223 : void
224 {
225 $this->checkReadOnly();
226
227 $this->redirectCmd(
228 $id,
229 ilPermissionGUI::class,
230 'owner'
231 );
232 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
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 239 of file class.ilObjectOwnershipManagementGUI.php.

239 : void
240 {
241 if ($this->read_only) {
242 throw new ilObjectException(
243 'Cannot perform actions when in read only mode'
244 );
245 }
246 }
Base exception class for object service.

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

+ Here is the caller graph for this function:

◆ delete()

ilObjectOwnershipManagementGUI::delete ( int  $id)

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

187 : void
188 {
189 $this->checkReadOnly();
190
191 $this->redirectParentCmd(
192 $id,
193 'delete'
194 );
195 }

References $id, checkReadOnly(), and redirectParentCmd().

+ Here is the call graph for this function:

◆ executeCommand()

ilObjectOwnershipManagementGUI::executeCommand ( )

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

57 : void
58 {
59 $this->ctrl->getNextClass($this);
60 $cmd = $this->ctrl->getCmd();
61
62 if (!$cmd) {
63 $cmd = 'listObjects';
64 }
65 $this->$cmd();
66 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ export()

ilObjectOwnershipManagementGUI::export ( int  $id)

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

213 : void
214 {
215 $this->checkReadOnly();
216
217 $this->redirectCmd(
218 $id,
219 ilExportGUI::class
220 );
221 }

References checkReadOnly(), and redirectCmd().

+ Here is the call graph for this function:

◆ getLabelForObjectType()

ilObjectOwnershipManagementGUI::getLabelForObjectType ( string  $type)
private

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

131 : string
132 {
133 $obj_definition = $this->domain->objectDefinition();
134 if ($obj_definition->isPlugin($type)) {
136 ->txt('obj_' . $type);
137 }
138
139 return $this->lng->txt('objs_' . $type);
140 }
static getPluginObjectByType(string $type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin.

References ilObjectPlugin\getPluginObjectByType(), and ILIAS\Repository\lng().

Referenced by listObjects().

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

◆ isReadOnly()

ilObjectOwnershipManagementGUI::isReadOnly ( )

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

234 : bool
235 {
236 return $this->read_only;
237 }

References $read_only.

◆ listObjects()

ilObjectOwnershipManagementGUI::listObjects ( )

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

68 : void
69 {
70 $objects = ilObject::getAllOwnedRepositoryObjects($this->user_id);
71 $mt = $this->gui->mainTemplate();
72 $toolbar = $this->gui->toolbar();
73 $f = $this->gui->ui()->factory();
74
75 if ($objects === []) {
76 $table_builder = $this->gui->ownership()->ownershipManagementTableBuilder(
77 $this->user_id,
78 $this->lng->txt('user_owns_no_objects'),
79 [],
80 '',
81 $this,
82 'listObjects'
83 );
84 $mt->setContent($table_builder->getTable()->render());
85 return;
86 }
87
88 $object_types = array_keys($objects);
89
90 $options = [];
91 foreach ($object_types as $type) {
92 $this->ctrl->setParameterByClass(self::class, 'type', $type);
93 $target = $this->ctrl->getLinkTargetByClass(self::class, 'listObjects');
94 $label = $this->getLabelForObjectType($type);
95 $options[$type] = $f->button()->shy($label, $target);
96 }
97 asort($options);
98
99 $selected_type = $this->retriever->getMaybeString('type') ?? array_keys($options)[0];
100 unset($options[$selected_type]);
101
102 $dropdown = $f->dropdown()->standard($options)->withLabel(
103 $this->lng->txt('select_object_type')
104 );
105
106 $toolbar->addStickyItem($dropdown);
107
108 if (is_array($objects[$selected_type])
109 && $objects[$selected_type] !== []) {
110 ilObject::fixMissingTitles($selected_type, $objects[$selected_type]);
111 }
112
113 $table_builder = $this->gui->ownership()->ownershipManagementTableBuilder(
114 $this->user_id,
115 $this->getLabelForObjectType($selected_type),
116 $objects,
117 $selected_type,
118 $this,
119 'listObjects'
120 );
121
122 $this->ctrl->setParameterByClass(self::class, 'type', $selected_type);
123
124 if ($table_builder->getTable()->handleCommand()) {
125 return;
126 }
127
128 $mt->setContent($table_builder->getTable()->render());
129 }
static getAllOwnedRepositoryObjects(int $user_id)
static fixMissingTitles($type, array &$obj_title_map)
Try to fix missing object titles.

References Vendor\Package\$f, ILIAS\Repository\ctrl(), ilObject\fixMissingTitles(), ilObject\getAllOwnedRepositoryObjects(), getLabelForObjectType(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ move()

ilObjectOwnershipManagementGUI::move ( int  $id)

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

203 : void
204 {
205 $this->checkReadOnly();
206
207 $this->redirectParentCmd(
208 $id,
209 'cut'
210 );
211 }

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 152 of file class.ilObjectOwnershipManagementGUI.php.

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

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 142 of file class.ilObjectOwnershipManagementGUI.php.

142 : void
143 {
144 $tree = $this->domain->repositoryTree();
145 $parent = $tree->getParentId($ref_id);
146 $this->ctrl->setParameterByClass(ilRepositoryGUI::class, 'ref_id', $parent);
147 $this->ctrl->setParameterByClass(ilRepositoryGUI::class, 'item_ref_id', $ref_id);
148 $this->ctrl->setParameterByClass(ilRepositoryGUI::class, 'cmd', $cmd);
149 $this->ctrl->redirectByClass(ilRepositoryGUI::class);
150 }

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:

◆ show()

ilObjectOwnershipManagementGUI::show ( int  $id)

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

197 : void
198 {
199 $link = \ilLink::_getLink($id);
200 $this->ctrl->redirectToURL($link);
201 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilObjectOwnershipManagementGUI::$ctrl
protected

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

◆ $lng

ilLanguage ilObjectOwnershipManagementGUI::$lng
protected

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

◆ $own_id

int ilObjectOwnershipManagementGUI::$own_id = 0
protected

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

◆ $read_only

bool ilObjectOwnershipManagementGUI::$read_only
protected

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

Referenced by __construct(), and isReadOnly().

◆ $retriever

ilObjectRequestRetriever ilObjectOwnershipManagementGUI::$retriever
private

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

◆ $user_id

int ilObjectOwnershipManagementGUI::$user_id
protected

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

Referenced by __construct().

◆ P_OWNID

const ilObjectOwnershipManagementGUI::P_OWNID = 'ownid'

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


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