19 declare(strict_types=1);
34 protected InternalDataService
$data,
36 protected InternalGUIService $gui,
37 protected int $obj_id,
39 protected bool $creation_mode,
40 protected object $parent_gui,
41 protected object $parent_obj
47 $ctrl = $this->gui->ctrl();
48 $next_class = $ctrl->getNextClass($this);
49 $cmd = $ctrl->getCmd(
"edit");
51 switch ($next_class) {
52 case strtolower(\ilDidacticTemplateGUI::class):
53 $ctrl->setReturn($this,
'edit');
54 $did = new \ilDidacticTemplateGUI(
58 $ctrl->forwardCommand($did);
62 if (in_array($cmd, [
"edit",
"save"])) {
68 protected function edit(): void
70 $mt = $this->gui->ui()->mainTemplate();
71 $form = $this->getEditForm();
72 $mt->setContent($form->render());
75 protected function getEditForm(): FormAdapterGUI
77 $lng = $this->domain->lng();
78 $settings = $this->domain->glossarySettings()->getByObjId($this->obj_id);
80 $glo_obj = $this->parent_obj;
82 $glo_mode_disabled =
false;
83 $glo_mode_disabled_info =
"";
84 if (!empty($glo_obj->getGlossariesForCollection()) && $glo_obj->isVirtual()) {
85 $glo_mode_disabled =
true;
86 $glo_mode_disabled_info =
$lng->txt(
"glo_change_to_standard_unavailable_info");
88 $glo_mode_disabled =
true;
89 $glo_mode_disabled_info =
$lng->txt(
"glo_change_to_collection_unavailable_info");
93 ->form(self::class,
"save")
94 ->section(
"general",
$lng->txt(
"cont_glo_properties"))
100 $form = $form->addDidacticTemplates(
106 $form = $form->radio(
108 $lng->txt(
"glo_content_assembly"),
109 $glo_mode_disabled_info,
110 $settings->getVirtualMode()
115 $lng->txt(
"glo_mode_normal"),
116 $lng->txt(
"glo_mode_normal_info")
119 $lng->txt(
"glo_collection"),
120 $lng->txt(
"glo_collection_info")
122 ->section(
"avail",
$lng->txt(
'rep_activation_availability'))
125 ->section(
"presentation",
$lng->txt(
'cont_presentation'))
129 $lng->txt(
"glo_presentation_mode"),
131 $settings->getPresentationMode()
135 $lng->txt(
"glo_table_form"),
136 $lng->txt(
"glo_table_form_info")
140 $lng->txt(
"glo_text_snippet_length"),
141 $lng->txt(
"characters") .
" - " .
$lng->txt(
"glo_text_snippet_length_info"),
142 $settings->getSnippetLength(),
148 $lng->txt(
"glo_full_definitions"),
149 $lng->txt(
"glo_full_definitions_info")
154 $lng->txt(
"glo_flashcard_training"),
155 $lng->txt(
"glo_flashcard_training_info"),
156 $settings->getActiveFlashcards()
160 $lng->txt(
"glo_mode"),
162 $settings->getFlashcardsMode()
164 ->radioOption(
"term",
$lng->txt(
"glo_term_vs_def"),
$lng->txt(
"glo_term_vs_def_info"))
165 ->radioOption(
"def",
$lng->txt(
"glo_def_vs_term"),
$lng->txt(
"glo_def_vs_term_info"));
167 $form = $form->addAdditionalFeatures(
178 protected function save():
void 180 $mt = $this->gui->ui()->mainTemplate();
181 $form = $this->getEditForm();
182 $ctrl = $this->gui->ctrl();
183 $lng = $this->domain->lng();
185 $old_settings = $this->domain->glossarySettings()->getByObjId($this->obj_id);
187 if ($form->isValid()) {
188 $form->saveStdTitleAndDescription(
200 $form->saveStdAvailability(
203 $form->saveAdditionalFeatures(
212 $online_prop = $form->getData(
"is_online");
214 $settings = $this->data->settings(
216 $online_prop->getIsOnline(),
217 $form->getData(
"glo_mode"),
218 $old_settings->getActiveGlossaryMenu(),
219 $form->getData(
"pres_mode"),
220 $old_settings->getShowTaxonomy(),
221 (
int) $form->getData(
"snippet_length") ?: 200,
222 (bool) $form->getData(
"flash_active"),
223 $form->getData(
"flash_mode")
226 $this->domain->glossarySettings()->update($settings);
229 $form->redirectToDidacticConfirmationIfChanged(
235 $mt->setOnScreenMessage(
"success",
$lng->txt(
"msg_obj_modified"),
true);
236 $ctrl->redirectByClass(self::class,
"edit");
238 $mt = $this->gui->ui()->mainTemplate();
239 $mt->setContent($form->render());
static getTermsOfGlossary(int $a_glo_id)
__construct(protected InternalDataService $data, protected InternalDomainService $domain, protected InternalGUIService $gui, protected int $obj_id, protected int $ref_id, protected bool $creation_mode, protected object $parent_gui, protected object $parent_obj)