ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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);#$this->lng->txt('grp_reg_direct_info'));
78  $reg_type->addOption($opt_dir);
79  }
81  {
82  $opt_pass = new ilRadioOption($this->txt('reg_pass'), ilMembershipRegistrationSettings::TYPE_PASSWORD);
83  $pass = new ilTextInputGUI($GLOBALS['lng']->txt("password"),'password');
84  $pass->setInfo($this->txt('reg_password_info'));
85  #$pass->setValue($this->object->getPassword());
86  $pass->setSize(10);
87  $pass->setMaxLength(32);
88  $opt_pass->addSubItem($pass);
89  $reg_type->addOption($opt_pass);
90  }
91 
93  {
94  $opt_req = new ilRadioOption($this->txt('reg_request'), ilMembershipRegistrationSettings::TYPE_REQUEST,$this->txt('reg_request_info'));
95  $reg_type->addOption($opt_req);
96  }
98  {
99  $opt_deact = new ilRadioOption($this->txt('reg_disabled'),ilMembershipRegistrationSettings::TYPE_NONE,$this->txt('reg_disabled_info'));
100  $reg_type->addOption($opt_deact);
101  }
102 
103  // Add to form
104  $form->addItem($reg_type);
105 
107  {
108  // max member
109  $lim = new ilCheckboxInputGUI($this->txt('reg_max_members_short'),'registration_membership_limited');
110  $lim->setValue(1);
111  #$lim->setOptionTitle($this->lng->txt('reg_grp_max_members'));
112  #$lim->setChecked($this->object->isMembershipLimited());
113 
114  $max = new ilTextInputGUI($this->txt('reg_max_members'),'registration_max_members');
115  #$max->setValue($this->object->getMaxMembers() ? $this->object->getMaxMembers() : '');
116  //$max->setTitle($this->lng->txt('members'));
117  $max->setSize(3);
118  $max->setMaxLength(4);
119  $max->setInfo($this->txt('reg_max_members_info'));
120  $lim->addSubItem($max);
121 
122  $wait = new ilCheckboxInputGUI($this->txt('reg_waiting_list'),'waiting_list');
123  $wait->setValue(1);
124  //$wait->setOptionTitle($this->lng->txt('grp_waiting_list'));
125  $wait->setInfo($this->txt('reg_waiting_list_info'));
126  #$wait->setChecked($this->object->isWaitingListEnabled() ? true : false);
127  $lim->addSubItem($wait);
128 
129  $form->addItem($lim);
130  }
131 
132  $this->setFormValues($form);
133  }
134 
138  protected function txt($a_lang_key)
139  {
140  $prefix = $this->getCurrentObject()->getType();
141  return $GLOBALS['lng']->txt($prefix.'_'.$a_lang_key);
142  }
143 }
144 ?>