ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 31 of file class.ilTermDefinitionBulkCreationGUI.php.

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

35  {
36  $this->glossary = $glossary;
37  $this->domain = $domain;
38  $this->gui = $gui;
39  $lng = $domain->lng();
40  $lng->loadLanguageModule("glo");
41  $this->term_manager = $domain
42  ->term($glossary);
43  }
$lng
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 181 of file class.ilTermDefinitionBulkCreationGUI.php.

References $data, and $lng.

181  : void
182  {
183  $main_tpl = $this->gui->mainTemplate();
184  $ctrl = $this->gui->ctrl();
185  $lng = $this->domain->lng();
186  $request = $this->gui->editing()->request();
187 
188  $data = $request->getBulkCreationData();
189  $language = $request->getTermLanguage();
190  $this->term_manager->createTermDefinitionPairsFromBulkInputString($data, $language);
191  $main_tpl->setOnScreenMessage("success", $lng->txt("msg_obj_modified"), true);
192  $ctrl->returnToParent($this);
193  }
$lng

◆ executeCommand()

ilTermDefinitionBulkCreationGUI::executeCommand ( )

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

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

◆ getCreationForm()

ilTermDefinitionBulkCreationGUI::getCreationForm ( )
protected

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

References $lng, and ilMDLanguageItem\_getLanguages().

Referenced by showConfirmationScreen(), and showCreationForm().

94  {
95  $lng = $this->domain->lng();
96  $user = $this->domain->user();
97  $form = $this
98  ->gui
99  ->form(self::class, "showConfirmationScreen")
100  ->asyncModal()
101  //->section("creation", $lng->txt("glo_bulk_data"))
102  ->textarea(
103  "bulk_data",
104  $lng->txt("glo_term_definition_pairs"),
105  $lng->txt("glo_term_definition_pairs_info"),
106  )
107  ->required();
108 
109  $session_lang = $this->term_manager->getSessionLang();
110  if ($session_lang != "") {
111  $s_lang = $session_lang;
112  } else {
113  $s_lang = $user->getLanguage();
114  }
115  $form->select(
116  "term_language",
117  $lng->txt("language"),
119  "",
120  $s_lang
121  )
122  ->required();
123 
124  return $form;
125  }
$lng
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modifyToolbar()

ilTermDefinitionBulkCreationGUI::modifyToolbar ( ilToolbarGUI  $toolbar)

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

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

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

◆ renderConfirmation()

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

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

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

Referenced by showConfirmationScreen().

146  : string
147  {
148  $lng = $this->domain->lng();
149  $ctrl = $this->gui->ctrl();
150 
151  $f = $this->gui->ui()->factory();
152  $r = $this->gui->ui()->renderer();
153  $button = $f->button()->standard(
154  $lng->txt("glo_create_term_definition_pairs"),
155  "#"
156  )->withAdditionalOnLoadCode(static function (string $id) {
157  return <<<EOT
158  const glo_bulk_button = document.getElementById("$id");
159  glo_bulk_button.addEventListener("click", (event) => {
160  glo_bulk_button.closest(".modal").querySelector("form").submit();
161  });
162 EOT;
163  });
164 
165  $mbox = $f->messageBox()->confirmation(
166  $lng->txt("glo_bulk_confirmation")
167  )->withButtons([$button]);
168 
169  $ctrl->setParameter($this, "term_language", $language);
171  $this,
172  "renderConfirmation",
173  $data,
174  $this->glossary
175  );
176 
177  return $r->render($mbox) .
178  $table->getHTML();
179  }
$lng
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$r
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showConfirmationScreen()

ilTermDefinitionBulkCreationGUI::showConfirmationScreen ( )
protected

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

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

127  : void
128  {
129  $form = $this->getCreationForm();
130  $lng = $this->domain->lng();
131  if (!$form->isValid()) {
132  $this->gui->modal($lng->txt("glo_bulk_creation"))
133  ->form($form)
134  ->send();
135  }
136 
137  $language = $form->getData("term_language");
138  $this->gui->modal($lng->txt("glo_bulk_creation"))
139  ->legacy($this->renderConfirmation(
140  $form->getData("bulk_data"),
141  $language
142  ))
143  ->send();
144  }
$lng
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:

◆ showCreationForm()

ilTermDefinitionBulkCreationGUI::showCreationForm ( )
protected

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

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

84  : void
85  {
86  $lng = $this->domain->lng();
87  $this->gui
88  ->modal($lng->txt("glo_bulk_creation"))
89  ->form($this->getCreationForm())
90  ->send();
91  }
$lng
form( $class_path, string $cmd, string $submit_caption="")
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 26 of file class.ilTermDefinitionBulkCreationGUI.php.

Referenced by __construct().

◆ $glossary

ilObjGlossary ilTermDefinitionBulkCreationGUI::$glossary
protected

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

Referenced by __construct().

◆ $gui

InternalGUIService ilTermDefinitionBulkCreationGUI::$gui
protected

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

Referenced by __construct().

◆ $term_manager

ILIAS Glossary Term TermManager ilTermDefinitionBulkCreationGUI::$term_manager
protected

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


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