ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilWorkspaceGSToolProvider.php
Go to the documentation of this file.
1 <?php
2 
22 
29 {
30  public const SHOW_WS_TREE = 'show_ws_tree';
31 
33  {
34  return $this->context_collection->main()->desktop();
35  }
36 
37  public function getToolsForContextStack(CalledContexts $called_contexts): array
38  {
39  $tools = [];
40  $additional_data = $called_contexts->current()->getAdditionalData();
41 
42  $title = $this->dic->language()->txt("objs_fold");
43 
44  $icon = $this->dic->ui()->factory()->symbol()->icon()->standard("fold", $title);
45 
46  if ($additional_data->is(self::SHOW_WS_TREE, true)) {
47  $iff = function ($id) {
48  return $this->identification_provider->contextAwareIdentifier($id);
49  };
50  $l = function (string $content) {
51  return $this->dic->ui()->factory()->legacy()->content($content);
52  };
53  $ref_id = $called_contexts->current()->getReferenceId()->toInt();
54  $tools[] = $this->factory->tool($iff("tree"))
55  ->withTitle($title)
56  ->withSymbol($icon)
57  ->withContentWrapper(function () use ($l) {
58  return $l($this->getTree());
59  });
60  }
61 
62  return $tools;
63  }
64 
65  private function getTree(): string
66  {
67  global $DIC;
68 
69  $user = $DIC->user();
70  $exp = new ilWorkspaceExplorerGUI($user->getId(), ["ilPersonalWorkspaceGUI", "ilObjWorkspaceFolderGUI"], "render", "ilObjWorkspaceFolderGUI", "", "wsp_id");
71  $exp->setTypeWhiteList(array("wsrt", "wfld"));
72  $exp->setSelectableTypes(array("wsrt", "wfld"));
73  $exp->setLinkToNodeClass(true);
74  $exp->setAjax(false);
75  $exp->setActivateHighlighting(true);
76 
77  return $exp->getHTML(true);
78  }
79 }
factory()
setTypeWhiteList(array $a_val)
Set type white list.
getToolsForContextStack(CalledContexts $called_contexts)
$ref_id
Definition: ltiauth.php:65
global $DIC
Definition: shib_login.php:22
Explorer for selecting a personal workspace item.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23