ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilMMItemTranslationTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
10 {
12 
13 // private ilCtrl $ctrl;
14 // private ilLanguage $lng;
15 
21  public function __construct(ilMMItemTranslationGUI $a_parent_obj, ilMMItemFacadeInterface $item_facade)
22  {
23  $table_id = self::class;
24  $this->item_facade = $item_facade;
25  $this->setId($table_id);
26  $this->setPrefix($table_id);
27  $this->setFormName($table_id);
28  parent::__construct($a_parent_obj);
29  $this->ctrl->saveParameter($a_parent_obj, $this->getNavParameter());
30  $this->setRowTemplate("tpl.translation_row.html", "Services/MainMenu");
31  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
32  $this->setExternalSorting(true);
33  $this->setDefaultOrderField("id");
34  $this->setDefaultOrderDirection("asc");
35  $this->setExternalSegmentation(true);
36  $this->setEnableHeader(true);
37  $this->initColumns();
38  $this->initCommands();
39  $this->lng->loadLanguageModule("meta");
40 
41  $this->addCommandButton(
43  $this->lng
44  ->txt("save")
45  );
46  $this->addMultiCommand(
48  $this->lng
49  ->txt("delete")
50  );
51 
52  $this->parseData();
53  }
54 
55  protected function initColumns(): void
56  {
57  $this->addColumn($this->lng->txt('mm_translation_select'), '', '15px', true);
58  $this->addColumn($this->lng->txt('mm_translation_lang'));
59  $this->addColumn($this->lng->txt('mm_translation_trans'));
60  }
61 
62  protected function initCommands(): void
63  {
65  ->txt("delete"));
66  }
67 
68  protected function parseData(): void
69  {
70  $this->setData(ilMMItemTranslationStorage::where(['identification' => $this->item_facade->getId()])->getArray());
71  }
72 
76  protected function fillRow(array $a_set): void
77  {
81  $translation = ilMMItemTranslationStorage::find($a_set['id']);
82 
83  $this->tpl->setVariable('ID', $translation->getId());
84  $this->tpl->setVariable('LANGUAGE', $this->lng->txt("meta_l_" . $translation->getLanguageKey()));
85  $this->tpl->setVariable('TEXT', $translation->getTranslation());
86  }
87 }
setData(array $a_data)
setFormAction(string $a_form_action, bool $a_multipart=false)
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
__construct(ilMMItemTranslationGUI $a_parent_obj, ilMMItemFacadeInterface $item_facade)
ilMMItemTranslationTableGUI constructor.
setFormName(string $a_name="")
static where($where, $operator=null)
setId(string $a_val)
setExternalSorting(bool $a_val)
fillRow(array $a_set)
Standard Version of Fill Row.
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
Class ilMMItemTranslationGUI.
Class ilMMItemTranslationTableGUI.
__construct(Container $dic, ilPlugin $plugin)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
addMultiCommand(string $a_cmd, string $a_text)
Interface ilMMItemFacadeInterface.
setEnableHeader(bool $a_enableheader)
setExternalSegmentation(bool $a_val)
setPrefix(string $a_prefix)