ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilFooterTranslationGUI Class Reference
+ Collaboration diagram for ilFooterTranslationGUI:

Public Member Functions

 __construct (private Container $dic, private Translator $translator, private ilObjFooterUIHandling $ui_handling, private TranslatableItem $translatable_item, private ?URI $back_target=null)
 
 executeCommand ()
 

Data Fields

const CMD_DEFAULT = 'index'
 
const CMD_LANGUAGE_SELECTION = 'selectLanguages'
 
const CMD_SAVE_LANGUAGE_SELECTION = 'saveLanguages'
 
const CMD_TRANSLATE_IN_MODAL = 'translateInAsyncModal'
 
const CMD_SAVE_TRANSLATIONS = 'saveTranslations'
 

Private Member Functions

 index ()
 
 selectLanguages ()
 
 translateInAsyncModal ()
 
 saveTranslations ()
 

Private Attributes

TranslationsRepository $repository
 
Factory $ui_factory
 
ilCtrlInterface $ctrl
 
ServerRequestInterface $request
 
TranslationWorkflowForm $workflow
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilFooterTranslationGUI::__construct ( private Container  $dic,
private Translator  $translator,
private ilObjFooterUIHandling  $ui_handling,
private TranslatableItem  $translatable_item,
private ?URI  $back_target = null 
)

Definition at line 70 of file class.ilFooterTranslationGUI.php.

References $repository, ILIAS\Repository\ctrl(), and ILIAS\UI\examples\Deck\repository().

76  {
77  $this->ui_factory = $this->dic->ui()->factory();
78  $this->ctrl = $this->dic->ctrl();
79  $this->request = $this->dic->http()->request();
80 
82  $this->dic->database()
83  );
84 
85  $this->workflow = new TranslationWorkflowForm(
86  $this->dic->learningObjectMetadata(),
87  $this->dic->ui(),
89  $this->translatable_item,
90  );
91  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
TranslationsRepository $repository
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilFooterTranslationGUI::executeCommand ( )

Definition at line 188 of file class.ilFooterTranslationGUI.php.

References ILIAS\Repository\ctrl().

188  : void
189  {
190  $this->ui_handling->requireReadable();
191 
192  $next_class = $this->ctrl->getNextClass($this) ?? '';
193  $cmd = $this->ctrl->getCmd(self::CMD_DEFAULT);
194 
195  switch ($cmd) {
196  case self::CMD_DEFAULT:
197  case self::CMD_LANGUAGE_SELECTION:
198  case self::CMD_SAVE_LANGUAGE_SELECTION:
199  case self::CMD_TRANSLATE_IN_MODAL:
200  case self::CMD_SAVE_TRANSLATIONS:
201  default:
202  $this->ui_handling->backToMainTab();
203  $this->ui_handling->requireWritable();
204  $this->$cmd();
205  break;
206  }
207  }
+ Here is the call graph for this function:

◆ index()

ilFooterTranslationGUI::index ( )
private

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

References null, and ILIAS\UI\examples\Deck\repository().

93  : void
94  {
95  // LISTING
96  $translations = $this->repository->get($this->translatable_item);
97  if ($translations->get() === []) {
98  $content = $this->ui_factory->messageBox()->info(
99  $this->translator->translate('no_translations')
100  );
101  } else {
102  $items = [];
103  foreach ($translations->get() as $t) {
104  $items[$this->translator->translate('meta_l_' . $t->getLanguageCode())] = $t->getTranslation();
105  }
106  $content = $this->ui_factory->listing()->descriptive(
107  $items
108  );
109  $content = $this->back_target === null ? $this->ui_factory->panel()->secondary()->legacy(
110  $this->translator->translate('translations'),
111  $this->ui_factory->legacy()->content(
112  $this->ui_handling->render($content)
113  )
114  ) : $content;
115  }
116 
117  $prompt = $this->ui_factory->prompt()->standard(
118  $this->ui_handling->getHereAsURI(self::CMD_LANGUAGE_SELECTION)
119  );
120 
121  // Edit Button
122  $edit_button = $this->ui_factory
123  ->button()
124  ->standard(
125  $this->translator->translate('edit_translations'),
126  '#'
127  )
128  ->withOnClick($prompt->getShowSignal());
129 
130  $this->dic->toolbar()->addComponent(
131  $edit_button
132  );
133 
134  if ($this->back_target === null) {
135  $this->ui_handling->out(
136  $prompt,
137  $content
138  );
139  return;
140  }
141 
142  $this->ui_handling->outAsyncAsModal(
143  'Translations',
144  (string) $this->back_target,
145  $edit_button,
146  $this->ui_factory->divider()->horizontal(),
147  $prompt,
148  $content
149  );
150  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ saveTranslations()

ilFooterTranslationGUI::saveTranslations ( )
private

Definition at line 171 of file class.ilFooterTranslationGUI.php.

References $data, ILIAS\Repository\ctrl(), and null.

171  : void
172  {
173  $form = $this->workflow->asTranslationModal(
174  $this->ui_handling->getHereAsURI(self::CMD_SAVE_TRANSLATIONS)
175  );
176  $form = $form->withRequest($this->request);
177  if (($data = $form->getData()) === null) {
178  $this->ui_handling->outAsync($form);
179  return;
180  }
181  $this->ctrl->redirectToURL(
182  (string) ($this->back_target ?? $this->ui_handling->getHereAsURI(self::CMD_DEFAULT))
183  );
184  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ selectLanguages()

ilFooterTranslationGUI::selectLanguages ( )
private

Definition at line 152 of file class.ilFooterTranslationGUI.php.

152  : void
153  {
154  $this->ui_handling->outAsync(
155  $this->workflow->asTranslationWorkflow(
156  $this->ui_handling->getHereAsURI(),
157  $this->back_target ?? $this->ui_handling->getHereAsURI(self::CMD_DEFAULT)
158  )
159  );
160  }

◆ translateInAsyncModal()

ilFooterTranslationGUI::translateInAsyncModal ( )
private

Definition at line 162 of file class.ilFooterTranslationGUI.php.

162  : void
163  {
164  $this->ui_handling->outAsync(
165  $this->workflow->asTranslationModal(
166  $this->ui_handling->getHereAsURI(self::CMD_SAVE_TRANSLATIONS)
167  )
168  );
169  }

Field Documentation

◆ $ctrl

ilCtrlInterface ilFooterTranslationGUI::$ctrl
private

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

◆ $repository

TranslationsRepository ilFooterTranslationGUI::$repository
private

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

Referenced by __construct().

◆ $request

ServerRequestInterface ilFooterTranslationGUI::$request
private

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

◆ $ui_factory

Factory ilFooterTranslationGUI::$ui_factory
private

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

◆ $workflow

TranslationWorkflowForm ilFooterTranslationGUI::$workflow
private

Definition at line 68 of file class.ilFooterTranslationGUI.php.

◆ CMD_DEFAULT

const ilFooterTranslationGUI::CMD_DEFAULT = 'index'

◆ CMD_LANGUAGE_SELECTION

const ilFooterTranslationGUI::CMD_LANGUAGE_SELECTION = 'selectLanguages'

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

◆ CMD_SAVE_LANGUAGE_SELECTION

const ilFooterTranslationGUI::CMD_SAVE_LANGUAGE_SELECTION = 'saveLanguages'

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

◆ CMD_SAVE_TRANSLATIONS

const ilFooterTranslationGUI::CMD_SAVE_TRANSLATIONS = 'saveTranslations'

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

◆ CMD_TRANSLATE_IN_MODAL

const ilFooterTranslationGUI::CMD_TRANSLATE_IN_MODAL = 'translateInAsyncModal'

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