ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilMMItemTranslationGUI Class Reference

Class ilMMItemTranslationGUI. More...

+ Collaboration diagram for ilMMItemTranslationGUI:

Public Member Functions

 __construct (ilMMItemFacadeInterface $item_facade, ilMMItemRepository $repository)
 ilMMItemTranslationGUI constructor. More...
 
 executeCommand ()
 

Data Fields

const P_TRANSLATIONS = 'translations'
 
const P_DELETE = 'delete'
 
const CMD_ADD_LANGUAGE = "addLanguages"
 
const CMD_SAVE_LANGUAGES = "saveLanguages"
 
const CMD_SAVE_TRANSLATIONS = "saveTranslations"
 
const CMD_DELETE_TRANSLATIONS = "deleteTranslations"
 
const CMD_DEFAULT = 'index'
 
const IDENTIFIER = 'identifier'
 

Protected Member Functions

 index ()
 
 initToolbar ()
 
 deleteTranslations ()
 
 addLanguages ()
 
 saveLanguages ()
 
 getLanguagesForm ()
 
 cancel ()
 

Private Attributes

 $repository
 
 $item_facade
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMMItemTranslationGUI::__construct ( ilMMItemFacadeInterface  $item_facade,
ilMMItemRepository  $repository 
)

ilMMItemTranslationGUI constructor.

Parameters
ilMMItemFacadeInterface$item_facade

Definition at line 36 of file class.ilMMItemTranslationGUI.php.

37 {
38 $this->item_facade = $item_facade;
39 $this->repository = $repository;
40 $this->lng()->loadLanguageModule("mme");
41 }
repository()
Definition: repository.php:5

References $item_facade, $repository, and repository().

+ Here is the call graph for this function:

Member Function Documentation

◆ addLanguages()

ilMMItemTranslationGUI::addLanguages ( )
protected

Definition at line 103 of file class.ilMMItemTranslationGUI.php.

104 {
105 $form = $this->getLanguagesForm();
106
107 $this->tpl()->setContent($form->getHTML());
108 }

References getLanguagesForm().

+ Here is the call graph for this function:

◆ cancel()

ilMMItemTranslationGUI::cancel ( )
protected

Definition at line 157 of file class.ilMMItemTranslationGUI.php.

158 {
159 $this->ctrl()->redirect($this, self::CMD_DEFAULT);
160 }

Referenced by deleteTranslations(), and saveLanguages().

+ Here is the caller graph for this function:

◆ deleteTranslations()

ilMMItemTranslationGUI::deleteTranslations ( )
protected

Definition at line 91 of file class.ilMMItemTranslationGUI.php.

92 {
93 $to_delete = (array) $this->http()->request()->getParsedBody()[self::P_DELETE];
94 foreach ($to_delete as $id) {
96 }
97 $this->repository->updateItem($this->item_facade);
98 ilUtil::sendInfo($this->lng()->txt('msg_translations_deleted'), true);
99 $this->cancel();
100 }
static find($primary_key, array $add_constructor_args=array())
@inheritDoc
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static http()
Fetches the global http state from ILIAS.

References cancel(), CachedActiveRecord\find(), ILIAS\FileDelivery\http(), P_DELETE, repository(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ executeCommand()

ilMMItemTranslationGUI::executeCommand ( )

Definition at line 44 of file class.ilMMItemTranslationGUI.php.

45 {
46 $this->ctrl()->saveParameter($this, self::IDENTIFIER);
47 switch ($this->ctrl()->getNextClass()) {
48 default:
49 $cmd = $this->ctrl()->getCmd(self::CMD_DEFAULT);
50 $this->{$cmd}();
51 }
52 }

◆ getLanguagesForm()

ilMMItemTranslationGUI::getLanguagesForm ( )
protected
Returns
ilPropertyFormGUI
Exceptions
ilFormException

Definition at line 136 of file class.ilMMItemTranslationGUI.php.

137 {
138 $form = new ilPropertyFormGUI();
139 $form->setFormAction($this->ctrl()->getFormAction($this));
140
141 // additional languages
143 $options = array("" => $this->lng()->txt("please_select")) + $options;
144 $si = new ilSelectInputGUI($this->lng()->txt("additional_langs"), "additional_langs");
145 $si->setOptions($options);
146 $si->setMulti(true);
147 $form->addItem($si);
148
149 $form->setTitle($this->lng()->txt("add_languages"));
150 $form->addCommandButton(self::CMD_SAVE_LANGUAGES, $this->lng()->txt("save"));
151 $form->addCommandButton(self::CMD_DEFAULT, $this->lng()->txt("cancel"));
152
153 return $form;
154 }
This class represents a property form user interface.
This class represents a selection list property in a property form.

References $si, and ilMDLanguageItem\_getLanguages().

Referenced by addLanguages(), and saveLanguages().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index()

ilMMItemTranslationGUI::index ( )
protected

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

56 {
57 $this->initToolbar();
58
59 $table = new ilMMItemTranslationTableGUI($this, $this->item_facade);
60 $this->tpl()->setContent($table->getHTML());
61 }
Class ilMMItemTranslationTableGUI.

References initToolbar().

+ Here is the call graph for this function:

◆ initToolbar()

ilMMItemTranslationGUI::initToolbar ( )
protected

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

65 {
66 $this->toolbar()->addButton(
67 $this->lng()->txt("add_languages"),
68 $this->ctrl()
69 ->getLinkTarget($this, self::CMD_ADD_LANGUAGE)
70 );
71 }

Referenced by index().

+ Here is the caller graph for this function:

◆ saveLanguages()

ilMMItemTranslationGUI::saveLanguages ( )
protected

Definition at line 111 of file class.ilMMItemTranslationGUI.php.

112 {
113 $form = $this->getLanguagesForm();
114 if ($form->checkInput()) {
115 $ad = $form->getInput("additional_langs");
116 if (is_array($ad)) {
117 foreach ($ad as $language_key) {
118 ilMMItemTranslationStorage::storeTranslation($this->item_facade->identification(), $language_key, "");
119 }
120 }
121 $this->repository->updateItem($this->item_facade);
122 ilUtil::sendInfo($this->lng()->txt("msg_languages_added"), true);
123 $this->cancel();
124 }
125
126 ilUtil::sendFailure($this->lng()->txt('err_check_input'));
127 $form->setValuesByPost();
128 $this->tpl()->setContent($form->getHTML());
129 }
static storeTranslation(IdentificationInterface $identification, string $language_key, string $translation)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References cancel(), getLanguagesForm(), repository(), ilUtil\sendFailure(), ilUtil\sendInfo(), and ilMMItemTranslationStorage\storeTranslation().

+ Here is the call graph for this function:

Field Documentation

◆ $item_facade

ilMMItemTranslationGUI::$item_facade
private

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

Referenced by __construct().

◆ $repository

ilMMItemTranslationGUI::$repository
private

Definition at line 24 of file class.ilMMItemTranslationGUI.php.

Referenced by __construct().

◆ CMD_ADD_LANGUAGE

const ilMMItemTranslationGUI::CMD_ADD_LANGUAGE = "addLanguages"

Definition at line 15 of file class.ilMMItemTranslationGUI.php.

◆ CMD_DEFAULT

const ilMMItemTranslationGUI::CMD_DEFAULT = 'index'

Definition at line 19 of file class.ilMMItemTranslationGUI.php.

Referenced by ilMMTopItemTableGUI\fillRow().

◆ CMD_DELETE_TRANSLATIONS

const ilMMItemTranslationGUI::CMD_DELETE_TRANSLATIONS = "deleteTranslations"

Definition at line 18 of file class.ilMMItemTranslationGUI.php.

◆ CMD_SAVE_LANGUAGES

const ilMMItemTranslationGUI::CMD_SAVE_LANGUAGES = "saveLanguages"

Definition at line 16 of file class.ilMMItemTranslationGUI.php.

◆ CMD_SAVE_TRANSLATIONS

const ilMMItemTranslationGUI::CMD_SAVE_TRANSLATIONS = "saveTranslations"

◆ IDENTIFIER

const ilMMItemTranslationGUI::IDENTIFIER = 'identifier'

Definition at line 20 of file class.ilMMItemTranslationGUI.php.

Referenced by ilMMTopItemTableGUI\fillRow().

◆ P_DELETE

const ilMMItemTranslationGUI::P_DELETE = 'delete'

Definition at line 14 of file class.ilMMItemTranslationGUI.php.

Referenced by deleteTranslations().

◆ P_TRANSLATIONS

const ilMMItemTranslationGUI::P_TRANSLATIONS = 'translations'

Definition at line 13 of file class.ilMMItemTranslationGUI.php.


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