ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilMembershipRegistrationSettingsGUI.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
28 {
29  private ilObject $object;
31  protected ilLanguage $lng;
32  private array $options = [];
33 
34  public function __construct(ilObjectGUI $gui_object, ilObject $object, array $a_options)
35  {
36  global $DIC;
37 
38  $this->lng = $DIC->language();
39  $this->gui_object = $gui_object;
40  $this->object = $object;
41  $this->options = $a_options;
42  }
43 
47  abstract public function setFormValues(ilPropertyFormGUI $form): void;
48 
49  public function getCurrentObject(): ilObject
50  {
51  return $this->object;
52  }
53 
54  public function getCurrentGUI(): ilObjectGUI
55  {
56  return $this->gui_object;
57  }
58 
59  public function getOptions(): array
60  {
61  return $this->options;
62  }
63 
64  final public function addMembershipFormElements(ilPropertyFormGUI $form, string $a_parent_post = ''): void
65  {
66  // Registration type
67  $reg_type = new ilRadioGroupInputGUI($this->txt('reg_type'), 'registration_type');
68  //$reg_type->setValue($this->object->getRegistrationType());
69 
71  $opt_dir = new ilRadioOption(
72  $this->txt('reg_direct'),
74  );
75  $opt_dir->setInfo($this->txt('reg_direct_info'));
76  $reg_type->addOption($opt_dir);
77 
78  // cannot participate
79  $cannot_participate = new ilCheckboxInputGUI(
80  $this->txt('reg_cannot_participate'),
81  'show_cannot_participate_direct'
82  );
83  $cannot_participate->setInfo($this->txt('reg_cannot_participate_info'));
84  $cannot_participate->setValue("1");
85  $opt_dir->addSubItem($cannot_participate);
86  }
88  $opt_pass = new ilRadioOption(
89  $this->txt('reg_pass'),
91  );
92  $pass = new ilTextInputGUI($GLOBALS['DIC']['lng']->txt("password"), 'password');
93  $pass->setInfo($this->txt('reg_password_info'));
94  #$pass->setValue($this->object->getPassword());
95  $pass->setSize(10);
96  $pass->setMaxLength(32);
97  $opt_pass->addSubItem($pass);
98  $reg_type->addOption($opt_pass);
99  }
100 
102  $opt_req = new ilRadioOption(
103  $this->txt('reg_request'),
105  $this->txt('reg_request_info')
106  );
107  $reg_type->addOption($opt_req);
108 
109  // cannot participate
110  $cannot_participate = new ilCheckboxInputGUI(
111  $this->txt('reg_cannot_participate'),
112  'show_cannot_participate_request'
113  );
114  $cannot_participate->setInfo($this->txt('reg_cannot_participate_info'));
115  $cannot_participate->setValue("1");
116  $opt_req->addSubItem($cannot_participate);
117  }
119  $opt_tutor = new ilRadioOption(
120  $this->txt('reg_tutor'),
122  $this->txt('reg_tutor_info')
123  );
124  $reg_type->addOption($opt_tutor);
125  }
127  $opt_deact = new ilRadioOption(
128  $this->txt('reg_disabled'),
130  $this->txt('reg_disabled_info')
131  );
132  $reg_type->addOption($opt_deact);
133  }
134 
135  // Add to form
136  $form->addItem($reg_type);
137 
139  // max member
140  $lim = new ilCheckboxInputGUI($this->txt('reg_max_members_short'), 'registration_membership_limited');
141  $lim->setValue("1");
142 
143  $max = new ilTextInputGUI($this->txt('reg_max_members'), 'registration_max_members');
144  #$max->setValue($this->object->getMaxMembers() ? $this->object->getMaxMembers() : '');
145  //$max->setTitle($this->lng->txt('members'));
146  $max->setSize(3);
147  $max->setMaxLength(4);
148  $max->setInfo($this->txt('reg_max_members_info'));
149  $lim->addSubItem($max);
150 
151  $wait = new ilRadioGroupInputGUI($this->txt('reg_waiting_list'), 'waiting_list');
152 
153  $option = new ilRadioOption($this->txt('reg_waiting_list_none'), "0");
154  $wait->addOption($option);
155 
156  $option = new ilRadioOption($this->txt('reg_waiting_list_no_autofill'), "1");
157  $option->setInfo($this->txt('reg_waiting_list_no_autofill_info'));
158  $wait->addOption($option);
159 
160  $option = new ilRadioOption($this->txt('reg_waiting_list_autofill'), "2");
161  $option->setInfo($this->txt('reg_waiting_list_autofill_info'));
162  $wait->addOption($option);
163 
164  $lim->addSubItem($wait);
165 
166  $form->addItem($lim);
167  }
168 
169  $notificationCheckbox = new ilCheckboxInputGUI(
170  $this->txt('registration_notification'),
171  'registration_notification'
172  );
173  $notificationCheckbox->setInfo($this->txt('registration_notification_info'));
174 
175  $notificationOption = new ilRadioGroupInputGUI($this->txt('notification_option'), 'notification_option');
176  $notificationOption->setRequired(true);
177 
178  $inheritOption = new ilRadioOption(
181  );
182  $inheritOption->setInfo($this->txt('notification_option_inherit_info'));
183  $notificationOption->addOption($inheritOption);
184 
185  $manualOption = new ilRadioOption(
188  );
189  $manualOption->setInfo($this->txt('notification_option_manual_info'));
190  $notificationOption->addOption($manualOption);
191 
192  $notificationCheckbox->addSubItem($notificationOption);
193  $form->addItem($notificationCheckbox);
194 
195  $this->setFormValues($form);
196  }
197 
201  protected function txt(string $a_lang_key): string
202  {
203  $prefix = $this->getCurrentObject()->getType();
204  return $this->lng->txt($prefix . '_' . $a_lang_key);
205  }
206 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilObjectGUI $gui_object, ilObject $object, array $a_options)
This class represents a checkbox property in a property form.
addMembershipFormElements(ilPropertyFormGUI $form, string $a_parent_post='')
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property in a property form.
Class ilObjectGUI Basic methods of all Output classes.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
txt(string $a_lang_key)
Translate type specific.
setFormValues(ilPropertyFormGUI $form)
Set form values.