ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ilTermDefinitionBulkCreationGUI Class Reference
+ Collaboration diagram for ilTermDefinitionBulkCreationGUI:

Public Member Functions

 __construct (InternalDomainService $domain, InternalGUIService $gui, ilObjGlossary $glossary)
 
 executeCommand ()
 
 modifyToolbar (ilToolbarGUI $toolbar)
 

Protected Member Functions

 showCreationForm ()
 
 getCreationForm ()
 
 showConfirmationScreen ()
 
 renderConfirmation (string $data, string $language)
 
 createTermDefinitionPairs ()
 

Protected Attributes

InternalDomainService $domain
 
InternalGUIService $gui
 
ilObjGlossary $glossary
 
ILIAS Glossary Term TermManager $term_manager
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTermDefinitionBulkCreationGUI::__construct ( InternalDomainService  $domain,
InternalGUIService  $gui,
ilObjGlossary  $glossary 
)

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

References $domain, $glossary, $gui, $lng, and ILIAS\Glossary\InternalDomainService\term().

38  {
39  $this->glossary = $glossary;
40  $this->domain = $domain;
41  $this->gui = $gui;
42  $lng = $domain->lng();
43  $lng->loadLanguageModule("glo");
44  $this->term_manager = $domain
45  ->term($glossary);
46  }
global $lng
Definition: privfeed.php:31
term(\ilObjGlossary $glossary, int $user_id=0)
+ Here is the call graph for this function:

Member Function Documentation

◆ createTermDefinitionPairs()

ilTermDefinitionBulkCreationGUI::createTermDefinitionPairs ( )
protected

Definition at line 186 of file class.ilTermDefinitionBulkCreationGUI.php.

References $data, and $lng.

186  : void
187  {
188  $main_tpl = $this->gui->mainTemplate();
189  $ctrl = $this->gui->ctrl();
190  $lng = $this->domain->lng();
191  $request = $this->gui->editing()->request();
192 
193  $data = $request->getBulkCreationData();
194  $language = $request->getTermLanguage();
195  $this->term_manager->createTermDefinitionPairsFromBulkInputString($data, $language);
196  $main_tpl->setOnScreenMessage("success", $lng->txt("msg_obj_modified"), true);
197  $ctrl->returnToParent($this);
198  }
global $lng
Definition: privfeed.php:31

◆ executeCommand()

ilTermDefinitionBulkCreationGUI::executeCommand ( )

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

48  : void
49  {
50  $ctrl = $this->gui->ctrl();
51 
52  $next_class = $ctrl->getNextClass($this);
53  $cmd = $ctrl->getCmd("showCreationForm");
54 
55  switch ($next_class) {
56  default:
57  if (in_array($cmd, [
58  "showCreationForm",
59  "showConfirmationScreen",
60  "createTermDefinitionPairs"
61  ])) {
62  $this->$cmd();
63  }
64  }
65  }

◆ getCreationForm()

ilTermDefinitionBulkCreationGUI::getCreationForm ( )
protected

Definition at line 96 of file class.ilTermDefinitionBulkCreationGUI.php.

References $lng.

Referenced by showConfirmationScreen(), and showCreationForm().

96  : \ILIAS\Repository\Form\FormAdapterGUI
97  {
98  $lng = $this->domain->lng();
99  $user = $this->domain->user();
100  $form = $this
101  ->gui
102  ->form(self::class, "showConfirmationScreen", $lng->txt("glo_save_and_continue"))
103  ->asyncModal()
104  //->section("creation", $lng->txt("glo_bulk_data"))
105  ->textarea(
106  "bulk_data",
107  $lng->txt("glo_term_definition_pairs"),
108  $lng->txt("glo_term_definition_pairs_info"),
109  )
110  ->required();
111 
112  $session_lang = $this->term_manager->getSessionLang();
113  if ($session_lang != "") {
114  $s_lang = $session_lang;
115  } else {
116  $s_lang = $user->getLanguage();
117  }
118  $form->select(
119  "term_language",
120  $lng->txt("language"),
121  $this->domain->metadata()->getLOMLanguagesForSelectInputs(),
122  "",
123  $s_lang
124  )
125  ->required();
126 
127  return $form;
128  }
global $lng
Definition: privfeed.php:31
+ Here is the caller graph for this function:

◆ modifyToolbar()

ilTermDefinitionBulkCreationGUI::modifyToolbar ( ilToolbarGUI  $toolbar)

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

References $c, $components, $lng, and ilToolbarGUI\addComponent().

67  : void
68  {
69  $lng = $this->domain->lng();
70  $ctrl = $this->gui->ctrl();
71  $components = $this
72  ->gui
73  ->modal($lng->txt("glo_bulk_creation"))
74  ->getAsyncTriggerButtonComponents(
75  $lng->txt("glo_bulk_creation"),
76  $ctrl->getLinkTarget($this, "showCreationForm", "", true),
77  false
78  );
79  foreach ($components as $type => $c) {
80  if ($type === "signal") {
81  continue;
82  }
83  $toolbar->addComponent($c);
84  }
85  }
addComponent(\ILIAS\UI\Component\Component $a_comp)
$c
Definition: deliver.php:25
$components
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ renderConfirmation()

ilTermDefinitionBulkCreationGUI::renderConfirmation ( string  $data,
string  $language 
)
protected

Definition at line 149 of file class.ilTermDefinitionBulkCreationGUI.php.

References Vendor\Package\$f, $id, $lng, $r, ILIAS\Repository\event(), and ILIAS\UI\Implementation\Component\withAdditionalOnLoadCode().

Referenced by showConfirmationScreen().

149  : string
150  {
151  $lng = $this->domain->lng();
152  $ctrl = $this->gui->ctrl();
153  $f = $this->gui->ui()->factory();
154  $r = $this->gui->ui()->renderer();
155  $html_util = $this->gui->html();
156 
157  $conf_tpl = new ilTemplate("tpl.bulk_creation_confirmation.html", true, true, "components/ILIAS/Glossary");
158 
159  $button = $f->button()->standard(
160  $lng->txt("glo_create_term_definition_pairs"),
161  "#"
162  )->withAdditionalOnLoadCode(static function (string $id) {
163  return <<<EOT
164  const glo_bulk_button = document.getElementById("$id");
165  glo_bulk_button.addEventListener("click", (event) => {
166  glo_bulk_button.closest(".c-modal").querySelector(".modal-body").querySelector("form").submit();
167  });
168 EOT;
169  });
170 
171  $mbox = $f->messageBox()->info(
172  $lng->txt("glo_bulk_confirmation")
173  )->withButtons([$button]);
174 
175  $ctrl->setParameter($this, "term_language", $language);
176  $table = $this->domain->table()->getTermDefinitionBulkCreationTable($data, $this->glossary)->getComponent();
177 
178  $conf_tpl->setVariable("HIDDEN_VALUE", $html_util->escape($data));
179  $conf_tpl->setVariable("ACTION", $ctrl->getFormAction($this, "createTermDefinitionPairs"));
180  $conf_tpl->setVariable("MBOX", $r->render($mbox));
181  $conf_tpl->setVariable("TABLE", $r->render($table));
182 
183  return $conf_tpl->get();
184  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
global $lng
Definition: privfeed.php:31
$r
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showConfirmationScreen()

ilTermDefinitionBulkCreationGUI::showConfirmationScreen ( )
protected

Definition at line 130 of file class.ilTermDefinitionBulkCreationGUI.php.

References $lng, ILIAS\Repository\form(), getCreationForm(), ILIAS\UI\examples\MainControls\Slate\Legacy\legacy(), and renderConfirmation().

130  : void
131  {
132  $form = $this->getCreationForm();
133  $lng = $this->domain->lng();
134  if (!$form->isValid()) {
135  $this->gui->modal($lng->txt("glo_bulk_creation"))
136  ->form($form)
137  ->send();
138  }
139 
140  $language = $form->getData("term_language");
141  $this->gui->modal($lng->txt("glo_bulk_creation"))
142  ->legacy($this->renderConfirmation(
143  $form->getData("bulk_data"),
144  $language
145  ))
146  ->send();
147  }
legacy()
expected output: > ILIAS shows the rendered Component.
Definition: legacy.php:29
form( $class_path, string $cmd, string $submit_caption="")
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ showCreationForm()

ilTermDefinitionBulkCreationGUI::showCreationForm ( )
protected

Definition at line 87 of file class.ilTermDefinitionBulkCreationGUI.php.

References $lng, ILIAS\Repository\form(), getCreationForm(), and send().

87  : void
88  {
89  $lng = $this->domain->lng();
90  $this->gui
91  ->modal($lng->txt("glo_bulk_creation"))
92  ->form($this->getCreationForm())
93  ->send();
94  }
form( $class_path, string $cmd, string $submit_caption="")
global $lng
Definition: privfeed.php:31
catch(ilCmiXapiException $e) send($response)
Definition: xapitoken.php:100
+ Here is the call graph for this function:

Field Documentation

◆ $domain

InternalDomainService ilTermDefinitionBulkCreationGUI::$domain
protected

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

Referenced by __construct().

◆ $glossary

ilObjGlossary ilTermDefinitionBulkCreationGUI::$glossary
protected

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

Referenced by __construct().

◆ $gui

InternalGUIService ilTermDefinitionBulkCreationGUI::$gui
protected

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

Referenced by __construct().

◆ $term_manager

ILIAS Glossary Term TermManager ilTermDefinitionBulkCreationGUI::$term_manager
protected

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


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