ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
4 include_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  public final 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  {
77  $opt_dir = new ilRadioOption($this->txt('reg_direct'), ilMembershipRegistrationSettings::TYPE_DIRECT);
78  $opt_dir->setInfo($this->txt('reg_direct_info'));
79  $reg_type->addOption($opt_dir);
80  }
82  {
83  $opt_pass = new ilRadioOption($this->txt('reg_pass'), ilMembershipRegistrationSettings::TYPE_PASSWORD);
84  $pass = new ilTextInputGUI($GLOBALS['lng']->txt("password"),'password');
85  $pass->setInfo($this->txt('reg_password_info'));
86  #$pass->setValue($this->object->getPassword());
87  $pass->setSize(10);
88  $pass->setMaxLength(32);
89  $opt_pass->addSubItem($pass);
90  $reg_type->addOption($opt_pass);
91  }
92 
94  {
95  $opt_req = new ilRadioOption($this->txt('reg_request'), ilMembershipRegistrationSettings::TYPE_REQUEST,$this->txt('reg_request_info'));
96  $reg_type->addOption($opt_req);
97  }
99  {
100  $opt_deact = new ilRadioOption($this->txt('reg_disabled'),ilMembershipRegistrationSettings::TYPE_NONE,$this->txt('reg_disabled_info'));
101  $reg_type->addOption($opt_deact);
102  }
103 
104  // Add to form
105  $form->addItem($reg_type);
106 
108  {
109  // max member
110  $lim = new ilCheckboxInputGUI($this->txt('reg_max_members_short'),'registration_membership_limited');
111  $lim->setValue(1);
112  #$lim->setOptionTitle($this->lng->txt('reg_grp_max_members'));
113  #$lim->setChecked($this->object->isMembershipLimited());
114 
115  /* JF, 2015-08-31 - only used in sessions which cannot support min members (yet)
116  $min = new ilTextInputGUI($this->txt('reg_min_members'),'registration_min_members');
117  $min->setSize(3);
118  $min->setMaxLength(4);
119  $min->setInfo($this->txt('reg_min_members_info'));
120  $lim->addSubItem($min);
121  */
122 
123  $max = new ilTextInputGUI($this->txt('reg_max_members'),'registration_max_members');
124  #$max->setValue($this->object->getMaxMembers() ? $this->object->getMaxMembers() : '');
125  //$max->setTitle($this->lng->txt('members'));
126  $max->setSize(3);
127  $max->setMaxLength(4);
128  $max->setInfo($this->txt('reg_max_members_info'));
129  $lim->addSubItem($max);
130 
131  /*
132  $wait = new ilCheckboxInputGUI($this->txt('reg_waiting_list'),'waiting_list');
133  $wait->setValue(1);
134  //$wait->setOptionTitle($this->lng->txt('grp_waiting_list'));
135  $wait->setInfo($this->txt('reg_waiting_list_info'));
136  #$wait->setChecked($this->object->isWaitingListEnabled() ? true : false);
137  $lim->addSubItem($wait);
138  */
139 
140  $wait = new ilRadioGroupInputGUI($this->txt('reg_waiting_list'), 'waiting_list');
141 
142  $option = new ilRadioOption($this->txt('reg_waiting_list_none'), 0);
143  $wait->addOption($option);
144 
145  $option = new ilRadioOption($this->txt('reg_waiting_list_no_autofill'), 1);
146  $option->setInfo($this->txt('reg_waiting_list_no_autofill_info'));
147  $wait->addOption($option);
148 
149  $option = new ilRadioOption($this->txt('reg_waiting_list_autofill'), 2);
150  $option->setInfo($this->txt('reg_waiting_list_autofill_info'));
151  $wait->addOption($option);
152 
153  $lim->addSubItem($wait);
154 
155  $form->addItem($lim);
156  }
157 
158  $this->setFormValues($form);
159  }
160 
164  protected function txt($a_lang_key)
165  {
166  $prefix = $this->getCurrentObject()->getType();
167  return $GLOBALS['lng']->txt($prefix.'_'.$a_lang_key);
168  }
169 }
170 ?>
This class represents an option in a radio group.
This class represents a property form user interface.
Class ilObject Basic functions for all objects.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
This class represents a checkbox property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
This class represents a property in a property form.
Class ilObjectGUI Basic methods of all Output classes.
This class represents a text property in a property form.
Create styles array
The data for the language used.
__construct(ilObjectGUI $gui_object, ilObject $object, $a_options)
Constructor.
addMembershipFormElements(ilPropertyFormGUI $form, $a_parent_post='')
Add membership form elements.
setFormValues(ilPropertyFormGUI $form)
Set form values.