ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilTaxonomyGSToolProvider.php
Go to the documentation of this file.
1 <?php
2 
6 
13 {
14  const SHOW_TAX_TREE = 'show_tax_tree';
15  const TAX_TREE_GUI_PATH = 'tax_tree_gui_path';
16  const TAX_ID = 'tax_id';
17  const TAX_TREE_CMD = 'tax_tree_cmd';
18  const TAX_TREE_PARENT_CMD = 'tax_tree_parent_cmd';
19 
20 
25  {
26  return $this->context_collection->main()->main();
27  }
28 
29 
33  public function getToolsForContextStack(CalledContexts $called_contexts) : array
34  {
35  global $DIC;
36 
37  $lng = $DIC->language();
38  $lng->loadLanguageModule("tax");
39 
40  $title = $lng->txt("tax_taxonomy");
41  $icon = $DIC->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("outlined/icon_tax.svg"), $title);
42 
43  $tools = [];
44  $additional_data = $called_contexts->current()->getAdditionalData();
45  if ($additional_data->is(self::SHOW_TAX_TREE, true)) {
46  $iff = function ($id) {
47  return $this->identification_provider->contextAwareIdentifier($id);
48  };
49  $l = function (string $content) {
50  return $this->dic->ui()->factory()->legacy($content);
51  };
52  $tools[] = $this->factory->tool($iff("tree"))
53  ->withTitle($title)
54  ->withSymbol($icon)
55  ->withContentWrapper(function () use ($additional_data, $l) {
56  return $l($this->getEditTree(
57  $additional_data->get(self::TAX_TREE_GUI_PATH),
58  $additional_data->get(self::TAX_ID),
59  $additional_data->get(self::TAX_TREE_CMD),
60  $additional_data->get(self::TAX_TREE_PARENT_CMD)
61  ));
62  });
63  }
64 
65  return $tools;
66  }
67 
68 
75  private function getEditTree($gui_path, $tax_id, $cmd, $parent_cmd) : string
76  {
77  $target_gui = $gui_path[count($gui_path) - 1];
78  $tax_exp = new ilTaxonomyExplorerGUI(
79  $gui_path,
80  $parent_cmd,
81  $tax_id,
82  $target_gui,
83  $cmd
84  );
85 
86  return $tax_exp->getHTML();
87  }
88 }
getToolsForContextStack(CalledContexts $called_contexts)
Taxonomy explorer GUI class.
getEditTree($gui_path, $tax_id, $cmd, $parent_cmd)
$lng
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $DIC
Definition: goto.php:24