ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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

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.

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

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  }
global $DIC
Definition: feed.php:28
Base class for all sub item list gui's.
+ Here is the call graph for this function:

Member Function Documentation

◆ applyFilter()

ilObjectOwnershipManagementGUI::applyFilter ( )

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

References listObjects().

125  : void
126  {
127  $tbl = new ilObjectOwnershipManagementTableGUI($this, "listObjects", $this->user_id);
128  $tbl->resetOffset();
129  $tbl->writeFilterToSession();
130  $this->listObjects();
131  }
+ Here is the call graph for this function:

◆ changeOwner()

ilObjectOwnershipManagementGUI::changeOwner ( )

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

References checkReadOnly(), and redirectCmd().

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)
+ Here is the call graph for this function:

◆ checkReadOnly()

ilObjectOwnershipManagementGUI::checkReadOnly ( )
protected

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

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

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...
+ Here is the caller graph for this function:

◆ delete()

ilObjectOwnershipManagementGUI::delete ( )

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

References checkReadOnly(), and redirectParentCmd().

182  : void
183  {
184  $this->checkReadOnly();
185 
186  $this->redirectParentCmd(
187  $this->own_id,
188  "delete"
189  );
190  }
+ Here is the call graph for this function:

◆ executeCommand()

ilObjectOwnershipManagementGUI::executeCommand ( )

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

References ILIAS\Repository\ctrl().

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  }
+ Here is the call graph for this function:

◆ export()

ilObjectOwnershipManagementGUI::export ( )

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

References checkReadOnly(), and redirectCmd().

202  : void
203  {
204  $this->checkReadOnly();
205 
206  $this->redirectCmd(
207  $this->own_id,
208  ilExportGUI::class
209  );
210  }
redirectCmd(int $ref_id, string $class, string $cmd=null)
+ Here is the call graph for this function:

◆ isReadOnly()

ilObjectOwnershipManagementGUI::isReadOnly ( )

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

References $read_only.

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

◆ listObjects()

ilObjectOwnershipManagementGUI::listObjects ( )

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

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().

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 
87  $button = ilSubmitButton::getInstance();
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  }
$type
static getAllOwnedRepositoryObjects(int $user_id)
static lookupTxtById(string $plugin_id, string $lang_var)
static fixMissingTitles($type, array &$obj_title_map)
Try to fix missing object titles.
+ 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.

References checkReadOnly(), and redirectParentCmd().

192  : void
193  {
194  $this->checkReadOnly();
195 
196  $this->redirectParentCmd(
197  $this->own_id,
198  "cut"
199  );
200  }
+ 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.

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

Referenced by changeOwner(), and export().

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  }
$path
Definition: ltiservices.php:32
$ref_id
Definition: ltiauth.php:67
+ 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.

References ILIAS\Repository\ctrl().

Referenced by delete(), and move().

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  }
$ref_id
Definition: ltiauth.php:67
+ 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.

References listObjects().

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