ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilMembershipRegistrationSettingsGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once './Services/Membership/classes/class.ilMembershipRegistrationSettings.php';
5
16{
17 private $object = null;
18 private $gui_object = null;
19 private $options = array();
20
26 public function __construct(ilObjectGUI $gui_object, ilObject $object, $a_options)
27 {
28 $this->gui_object = $gui_object;
29 $this->object = $object;
30 $this->options = $a_options;
31 }
32
36 abstract public function setFormValues(ilPropertyFormGUI $form);
37
42 public function getCurrentObject()
43 {
44 return $this->object;
45 }
46
51 public function getCurrentGUI()
52 {
53 return $this->gui_object;
54 }
55
60 public function getOptions()
61 {
62 return $this->options;
63 }
64
69 final public function addMembershipFormElements(ilPropertyFormGUI $form, $a_parent_post = '')
70 {
71 // Registration type
72 $reg_type = new ilRadioGroupInputGUI($this->txt('reg_type'), 'registration_type');
73 //$reg_type->setValue($this->object->getRegistrationType());
74
76 $opt_dir = new ilRadioOption($this->txt('reg_direct'), ilMembershipRegistrationSettings::TYPE_DIRECT);
77 $opt_dir->setInfo($this->txt('reg_direct_info'));
78 $reg_type->addOption($opt_dir);
79
80 // cannot participate
81 $cannot_participate = new ilCheckboxInputGUI(
82 $this->txt('reg_cannot_participate'),
83 'show_cannot_participate_direct'
84 );
85 $cannot_participate->setInfo($this->txt('reg_cannot_participate_info'));
86 $cannot_participate->setValue(1);
87 $opt_dir->addSubItem($cannot_participate);
88 }
90 $opt_pass = new ilRadioOption($this->txt('reg_pass'), ilMembershipRegistrationSettings::TYPE_PASSWORD);
91 $pass = new ilTextInputGUI($GLOBALS['DIC']['lng']->txt("password"), 'password');
92 $pass->setInfo($this->txt('reg_password_info'));
93 #$pass->setValue($this->object->getPassword());
94 $pass->setSize(10);
95 $pass->setMaxLength(32);
96 $opt_pass->addSubItem($pass);
97 $reg_type->addOption($opt_pass);
98 }
99
101 $opt_req = new ilRadioOption($this->txt('reg_request'), ilMembershipRegistrationSettings::TYPE_REQUEST, $this->txt('reg_request_info'));
102 $reg_type->addOption($opt_req);
103
104 // cannot participate
105 $cannot_participate = new ilCheckboxInputGUI(
106 $this->txt('reg_cannot_participate'),
107 'show_cannot_participate_request'
108 );
109 $cannot_participate->setInfo($this->txt('reg_cannot_participate_info'));
110 $cannot_participate->setValue(1);
111 $opt_req->addSubItem($cannot_participate);
112
113 }
115 $opt_tutor = new ilRadioOption(
116 $this->txt('reg_tutor'),
118 $this->txt('reg_tutor_info')
119 );
120 $reg_type->addOption($opt_tutor);
121 }
123 $opt_deact = new ilRadioOption($this->txt('reg_disabled'), ilMembershipRegistrationSettings::TYPE_NONE, $this->txt('reg_disabled_info'));
124 $reg_type->addOption($opt_deact);
125 }
126
127 // Add to form
128 $form->addItem($reg_type);
129
131 // max member
132 $lim = new ilCheckboxInputGUI($this->txt('reg_max_members_short'), 'registration_membership_limited');
133 $lim->setValue(1);
134 #$lim->setOptionTitle($this->lng->txt('reg_grp_max_members'));
135 #$lim->setChecked($this->object->isMembershipLimited());
136
137 /* JF, 2015-08-31 - only used in sessions which cannot support min members (yet)
138 $min = new ilTextInputGUI($this->txt('reg_min_members'),'registration_min_members');
139 $min->setSize(3);
140 $min->setMaxLength(4);
141 $min->setInfo($this->txt('reg_min_members_info'));
142 $lim->addSubItem($min);
143 */
144
145 $max = new ilTextInputGUI($this->txt('reg_max_members'), 'registration_max_members');
146 #$max->setValue($this->object->getMaxMembers() ? $this->object->getMaxMembers() : '');
147 //$max->setTitle($this->lng->txt('members'));
148 $max->setSize(3);
149 $max->setMaxLength(4);
150 $max->setInfo($this->txt('reg_max_members_info'));
151 $lim->addSubItem($max);
152
153 /*
154 $wait = new ilCheckboxInputGUI($this->txt('reg_waiting_list'),'waiting_list');
155 $wait->setValue(1);
156 //$wait->setOptionTitle($this->lng->txt('grp_waiting_list'));
157 $wait->setInfo($this->txt('reg_waiting_list_info'));
158 #$wait->setChecked($this->object->isWaitingListEnabled() ? true : false);
159 $lim->addSubItem($wait);
160 */
161
162 $wait = new ilRadioGroupInputGUI($this->txt('reg_waiting_list'), 'waiting_list');
163
164 $option = new ilRadioOption($this->txt('reg_waiting_list_none'), 0);
165 $wait->addOption($option);
166
167 $option = new ilRadioOption($this->txt('reg_waiting_list_no_autofill'), 1);
168 $option->setInfo($this->txt('reg_waiting_list_no_autofill_info'));
169 $wait->addOption($option);
170
171 $option = new ilRadioOption($this->txt('reg_waiting_list_autofill'), 2);
172 $option->setInfo($this->txt('reg_waiting_list_autofill_info'));
173 $wait->addOption($option);
174
175 $lim->addSubItem($wait);
176
177 $form->addItem($lim);
178 }
179
180 $notificationCheckbox = new ilCheckboxInputGUI($this->txt('registration_notification'), 'registration_notification');
181 $notificationCheckbox->setInfo($this->txt('registration_notification_info'));
182
183 $notificationOption = new ilRadioGroupInputGUI($this->txt('notification_option'), 'notification_option');
184 $notificationOption->setRequired(true);
185
187 $inheritOption->setInfo($this->txt('notification_option_inherit_info'));
188 $notificationOption->addOption($inheritOption);
189
191 $manualOption->setInfo($this->txt('notification_option_manual_info'));
192 $notificationOption->addOption($manualOption);
193
194 $notificationCheckbox->addSubItem($notificationOption);
195 $form->addItem($notificationCheckbox);
196
197 $this->setFormValues($form);
198 }
199
203 protected function txt($a_lang_key)
204 {
205 $prefix = $this->getCurrentObject()->getType();
206 return $GLOBALS['DIC']['lng']->txt($prefix . '_' . $a_lang_key);
207 }
208}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
An exception for terminatinating execution or to throw for unit testing.
This class represents a checkbox property in a property form.
addMembershipFormElements(ilPropertyFormGUI $form, $a_parent_post='')
Add membership form elements.
setFormValues(ilPropertyFormGUI $form)
Set form values.
__construct(ilObjectGUI $gui_object, ilObject $object, $a_options)
Constructor.
Class ilObjectGUI Basic methods of all Output classes.
Class ilObject Basic functions for all objects.
This class represents a property form user interface.
addItem($a_item)
Add Item (Property, SectionHeader).
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a text property in a property form.