ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilRepositoryGUI Class Reference

Class ilRepositoryGUI. More...

+ Inheritance diagram for ilRepositoryGUI:
+ Collaboration diagram for ilRepositoryGUI:

Public Member Functions

 executeCommand ()
 
 show ()
 
 showRepTree ()
 

Data Fields

ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilRbacSystem $rbacsystem
 
int $cur_ref_id
 
string $cmd
 
string $mode = ""
 
ilCtrl $ctrl
 

Protected Member Functions

 redirectToRoot ()
 

Protected Attributes

ilObjectDefinition $objDefinition
 
ilLogger $log
 
ilObjUser $user
 
ilSetting $settings
 
ilHelpGUI $help
 
ilErrorHandling $error
 
ilAccessHandler $access
 
ContextServices $tool_context
 
StandardGUIRequest $request
 
bool $creation_mode
 
ilObjectGUI $gui_obj
 

Private Attributes

ILIAS HTTP Services $http
 

Detailed Description

Member Function Documentation

◆ executeCommand()

ilRepositoryGUI::executeCommand ( )

Definition at line 123 of file class.ilRepositoryGUI.php.

References $cmd, $error, $help, $ilErr, $lng, $rbacsystem, ilObject\_lookupType(), ilRbacSystem\checkAccess(), ILIAS\Repository\ctrl(), ilPublicSectionSettings\getInstance(), ilLoggerFactory\getLogger(), ILIAS\FileDelivery\http(), ilHelpGUI\ID_PART_SCREEN, null, ilObject2GUI\REPOSITORY_NODE_ID, show(), ilLanguage\txt(), and ILIAS\Repository\user().

123  : void
124  {
126  $lng = $this->lng;
127  $ilHelp = $this->help;
129 
130  if (
131  ($this->user->isAnonymous() || !($this->user->getId() >= 1)) &&
132  !ilPublicSectionSettings::getInstance()->isEnabledForDomain(
133  $this->http->request()->getServerParams()['SERVER_NAME']
134  )
135  ) {
136  $this->ctrl->redirectToURL('./login.php?cmd=force_login');
137  }
138 
139  $this->tool_context->claim()->repository();
140 
141  // check creation mode
142  // determined by "new_type" parameter
143  $new_type = $this->request->getNewType();
144 
145  if ($new_type !== "" && $new_type !== "sty") {
146  $this->creation_mode = true;
147  $ilHelp->setScreenIdComponent($new_type);
148  $ilHelp->setDefaultScreenId(ilHelpGUI::ID_PART_SCREEN, "create");
149  $this->ctrl->saveParameter($this, ["crtcb"]);
150  }
151 
152  $cmd = $this->ctrl->getCmd();
153 
154  // determine next class
155  if ($this->creation_mode) {
156  $obj_type = $new_type;
157  $class_name = $this->objDefinition->getClassName($obj_type);
158  if (strtolower($class_name) !== "user") {
159  $next_class = strtolower("ilObj" . $class_name . "GUI");
160  } else {
161  $next_class = $this->ctrl->getNextClass();
162  }
163  // Only set the fixed cmdClass if the next class is different to
164  // the GUI class of the new object.
165  // An example:
166  // Copy Category uses this call structure:
167  // RespositoryGUI -> CategoryGUI -> ilObjectCopyGUI
168  // Without this fix, the cmdClass ilObjectCopyGUI would never be reached
169 
170  ilLoggerFactory::getLogger('obj')->debug($this->ctrl->getNextClass() . ' <-> ' . $class_name);
171 
172  if ($this->ctrl->getNextClass() !== strtolower('ilObj' . $class_name . 'GUI')) {
173  $this->ctrl->setParameterByClass($next_class, "new_type", $new_type);
174  $this->ctrl->redirectByClass($next_class, $this->ctrl->getCmd());
175  }
176  } elseif ((($next_class = $this->ctrl->getNextClass($this)) == "")
177  || ($next_class === "ilrepositorygui" && $this->ctrl->getCmd() === "return")) {
178  // get GUI of current object
179  $obj_type = ilObject::_lookupType($this->cur_ref_id, true);
180  $class_name = $this->objDefinition->getClassName($obj_type);
181  $next_class = strtolower("ilObj" . $class_name . "GUI");
182 
183  if ($this->ctrl->getCmd() === "return") {
184  $this->ctrl->redirectByClass($next_class, "");
185  }
186 
187  if ($this->ctrl->getCmd() !== "showRepTree") {
188  $this->ctrl->redirectByClass($next_class, $this->ctrl->getCmd());
189  }
190  }
191 
192  // commands that are always handled by repository gui
193  // to do: move to container
194  if ($cmd === "showRepTree") {
195  $next_class = "";
196  }
197 
198  switch ($next_class) {
199  // forward asynchronous file uploads to the upload handler.
200  // possible via dropzones in list guis or global template
201  // sections like title.
202  case strtolower(ilObjFileUploadHandlerGUI::class):
203  $this->ctrl->forwardCommand(new ilObjFileUploadHandlerGUI());
204  break;
205 
206  default:
207  // forward all other classes to gui commands
208  if ($next_class !== null && $next_class !== "" && $next_class !== "ilrepositorygui") {
209  $class_path = $this->ctrl->lookupClassPath($next_class);
210  // get gui class instance
211  //require_once($class_path);
212  $class_name = $this->ctrl->getClassForClasspath($class_path);
213  if (!$this->creation_mode) {
214  if (is_subclass_of($class_name, "ilObject2GUI")) {
215  $this->gui_obj = new $class_name($this->cur_ref_id, ilObject2GUI::REPOSITORY_NODE_ID);
216  } else {
217  $this->gui_obj = new $class_name("", $this->cur_ref_id, true, false);
218  }
219  } elseif (is_subclass_of($class_name, "ilObject2GUI")) {
220  $this->gui_obj = new $class_name(0, ilObject2GUI::REPOSITORY_NODE_ID, $this->cur_ref_id);
221  } else {
222  $this->gui_obj = new $class_name("", 0, true, false);
223  }
224  $this->gui_obj->setCreationMode($this->creation_mode);
225  $this->ctrl->setReturn($this, "return");
226 
227  $this->show();
228  } else { //
229  $cmd = (string) $this->ctrl->getCmd("");
230 
231  // check read access for category
232  if ($cmd !== "showRepTree" && $this->cur_ref_id > 0 && !$rbacsystem->checkAccess("read", $this->cur_ref_id)) {
233  $ilErr->raiseError($lng->txt("permission_denied"), $ilErr->MESSAGE);
234  $this->tpl->printToStdout();
235  } else {
236  $this->cmd = $cmd;
237  $this->$cmd();
238  }
239  }
240  break;
241  }
242  }
static getLogger(string $a_component_id)
Get component logger.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
$ilErr
Definition: raiseError.php:33
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
static http()
Fetches the global http state from ILIAS.
ilErrorHandling $error
static _lookupType(int $id, bool $reference=false)
const ID_PART_SCREEN
+ Here is the call graph for this function:

◆ redirectToRoot()

ilRepositoryGUI::redirectToRoot ( )
protected

Definition at line 111 of file class.ilRepositoryGUI.php.

References $ctrl, ilCtrl\redirectByClass(), and ilCtrl\setParameterByClass().

111  : void
112  {
113  $ctrl = $this->ctrl;
115  self::class,
116  "ref_id",
117  $this->tree->getRootId()
118  );
119 
120  $ctrl->redirectByClass(self::class, "");
121  }
setParameterByClass(string $a_class, string $a_parameter, $a_value)
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
+ Here is the call graph for this function:

◆ show()

ilRepositoryGUI::show ( )

Definition at line 244 of file class.ilRepositoryGUI.php.

References ILIAS\Repository\ctrl().

Referenced by executeCommand().

244  : void
245  {
246  // normal command processing
247  $this->ctrl->forwardCommand($this->gui_obj);
248  $this->tpl->setVariable("OBJECTS", $this->gui_obj->getHTML());
249  $this->tpl->printToStdout();
250  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showRepTree()

ilRepositoryGUI::showRepTree ( )

Definition at line 252 of file class.ilRepositoryGUI.php.

252  : void
253  {
254  $exp = new ilRepositoryExplorerGUI($this, "showRepTree");
255  // root node should be skipped, see #26787
256  $exp->setSkipRootNode(true);
257  $exp->handleCommand();
258  }
Repository explorer GUI class.

Field Documentation

◆ $access

ilAccessHandler ilRepositoryGUI::$access
protected

Definition at line 54 of file class.ilRepositoryGUI.php.

◆ $cmd

string ilRepositoryGUI::$cmd

Definition at line 61 of file class.ilRepositoryGUI.php.

Referenced by executeCommand().

◆ $creation_mode

bool ilRepositoryGUI::$creation_mode
protected

Definition at line 66 of file class.ilRepositoryGUI.php.

◆ $ctrl

ilCtrl ilRepositoryGUI::$ctrl

Definition at line 63 of file class.ilRepositoryGUI.php.

Referenced by redirectToRoot().

◆ $cur_ref_id

int ilRepositoryGUI::$cur_ref_id

Definition at line 60 of file class.ilRepositoryGUI.php.

◆ $error

ilErrorHandling ilRepositoryGUI::$error
protected

Definition at line 53 of file class.ilRepositoryGUI.php.

Referenced by executeCommand().

◆ $gui_obj

ilObjectGUI ilRepositoryGUI::$gui_obj
protected

Definition at line 67 of file class.ilRepositoryGUI.php.

◆ $help

ilHelpGUI ilRepositoryGUI::$help
protected

Definition at line 52 of file class.ilRepositoryGUI.php.

Referenced by executeCommand().

◆ $http

ILIAS HTTP Services ilRepositoryGUI::$http
private

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

◆ $lng

ilLanguage ilRepositoryGUI::$lng

Definition at line 56 of file class.ilRepositoryGUI.php.

Referenced by executeCommand().

◆ $log

ilLogger ilRepositoryGUI::$log
protected

Definition at line 49 of file class.ilRepositoryGUI.php.

◆ $mode

string ilRepositoryGUI::$mode = ""

Definition at line 62 of file class.ilRepositoryGUI.php.

◆ $objDefinition

ilObjectDefinition ilRepositoryGUI::$objDefinition
protected

Definition at line 48 of file class.ilRepositoryGUI.php.

◆ $rbacsystem

ilRbacSystem ilRepositoryGUI::$rbacsystem

Definition at line 59 of file class.ilRepositoryGUI.php.

Referenced by executeCommand().

◆ $request

StandardGUIRequest ilRepositoryGUI::$request
protected

Definition at line 65 of file class.ilRepositoryGUI.php.

◆ $settings

ilSetting ilRepositoryGUI::$settings
protected

Definition at line 51 of file class.ilRepositoryGUI.php.

◆ $tool_context

ContextServices ilRepositoryGUI::$tool_context
protected

Definition at line 55 of file class.ilRepositoryGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilRepositoryGUI::$tpl

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

◆ $tree

ilTree ilRepositoryGUI::$tree

Definition at line 58 of file class.ilRepositoryGUI.php.

◆ $user

ilObjUser ilRepositoryGUI::$user
protected

Definition at line 50 of file class.ilRepositoryGUI.php.


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