ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCourseRegistrationGUI Class Reference

GUI class for course registrations. More...

+ Inheritance diagram for ilCourseRegistrationGUI:
+ Collaboration diagram for ilCourseRegistrationGUI:

Public Member Functions

 __construct ($a_container, $a_parent_gui)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
- Public Member Functions inherited from ilRegistrationGUI
 __construct ($a_container)
 Constructor. More...
 
 getContainer ()
 Parent object. More...
 
 getRefId ()
 Get ref. More...
 
 cancel ()
 cancel subscription More...
 
 show (ilPropertyFormGUI $form=null)
 show registration form More...
 
 join ()
 join More...
 

Protected Member Functions

 getFormTitle ()
 get form title More...
 
 fillInformations ()
 fill informations More...
 
 fillRegistrationPeriod ()
 show informations about the registration period More...
 
 fillMaxMembers ()
 fill max members More...
 
 fillRegistrationType ()
 fill registration type More...
 
 addCommandButtons ()
 Add group specific command buttons. More...
 
 validate ()
 Validate subscription request. More...
 
 add ()
 add user More...
 
 initParticipants ()
 Init course participants. More...
 
 initWaitingList ()
 
 isWaitingListActive ()
 
- Protected Member Functions inherited from ilRegistrationGUI
 isRegistrationPossible ()
 check if registration is possible More...
 
 enableRegistration ($a_status)
 set registration disabled More...
 
 initParticipants ()
 Init participants object (course or group participants) More...
 
 initWaitingList ()
 Init waiting list (course or group waiting list) More...
 
 isWaitingListActive ()
 Check if the waiting list is active Maximum of members exceeded or any user on the waiting list. More...
 
 getWaitingList ()
 Get waiting list object. More...
 
 leaveWaitingList ()
 
 getFormTitle ()
 Get title for property form. More...
 
 fillInformations ()
 fill informations More...
 
 fillRegistrationPeriod ()
 show informations about the registration period More...
 
 fillMaxMembers ()
 show informations about the maximum number of user. More...
 
 fillRegistrationType ()
 show informations about registration procedure More...
 
 fillMembershipLimitation ()
 Show membership limitations. More...
 
 fillAgreement ()
 Show user agreement. More...
 
 showCustomFields ()
 Show course defined fields. More...
 
 validateAgreement ()
 Check Agreement. More...
 
 validateCustomFields ()
 Check required course fields. More...
 
 setAccepted ($a_status)
 Set Agreement accepted. More...
 
 validate ()
 validate join request More...
 
 initForm ()
 init registration form More...
 
 addCommandButtons ()
 Add command buttons. More...
 
 updateSubscriptionRequest ()
 Update subscription message. More...
 
 cancelSubscriptionRequest ()
 

Private Attributes

 $parent_gui = null
 

Additional Inherited Members

- Protected Attributes inherited from ilRegistrationGUI
 $privacy = null
 
 $container = null
 
 $ref_id
 
 $obj_id
 
 $participants
 
 $waiting_list = null
 
 $form
 
 $registration_possible = true
 
 $join_error = ''
 
 $tpl
 
 $lng
 
 $ctrl
 

Detailed Description

GUI class for course registrations.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

ilCourseRegistrationGUI:

Definition at line 16 of file class.ilCourseRegistrationGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilCourseRegistrationGUI::__construct (   $a_container,
  $a_parent_gui 
)

Constructor.

public

Parameters
objectcourse object

Definition at line 26 of file class.ilCourseRegistrationGUI.php.

27  {
28  parent::__construct($a_container);
29 
30  $this->parent_gui = $a_parent_gui;
31  }

Member Function Documentation

◆ add()

ilCourseRegistrationGUI::add ( )
protected

add user

protected

Parameters

Definition at line 442 of file class.ilCourseRegistrationGUI.php.

References $_POST, $_SESSION, $DIC, $GLOBALS, $ilCtrl, $ilUser, $info, $success, $tree, ilRegistrationGUI\$waiting_list, ilCourseWaitingList\addToList(), ilForumNotification\checkForumsExistsInsert(), ilParticipants\getDefaultMemberRole(), IL_CRS_MEMBER, IL_CRS_SUBSCRIPTION_CONFIRMATION, ilUtil\redirect(), ilUtil\sendFailure(), ilRegistrationGUI\setAccepted(), ilRegistrationGUI\show(), and ilUtil\stripSlashes().

443  {
444  global $DIC;
445 
446  $ilUser = $DIC['ilUser'];
447  $tree = $DIC['tree'];
448  $ilCtrl = $DIC['ilCtrl'];
449 
450  // TODO: language vars
451 
452  // set aggreement accepted
453  $this->setAccepted(true);
454 
455  include_once('./Modules/Course/classes/class.ilCourseWaitingList.php');
456  $free = max(0, $this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
457  $waiting_list = new ilCourseWaitingList($this->container->getId());
458  if ($this->container->isSubscriptionMembershipLimited() and $this->container->enabledWaitingList() and (!$free or $waiting_list->getCountUsers())) {
459  $waiting_list->addToList($ilUser->getId());
460  $info = sprintf(
461  $this->lng->txt('crs_added_to_list'),
462  $waiting_list->getPosition($ilUser->getId())
463  );
464  ilUtil::sendSuccess($info, true);
465 
466  $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST, $ilUser->getId());
467  $this->participants->sendNotification($this->participants->NOTIFY_WAITING_LIST, $ilUser->getId());
468  $ilCtrl->setParameterByClass(
469  "ilrepositorygui",
470  "ref_id",
471  $tree->getParentId($this->container->getRefId())
472  );
473  $ilCtrl->redirectByClass("ilrepositorygui", "");
474  }
475 
476  switch ($this->container->getSubscriptionType()) {
478  $this->participants->addSubscriber($ilUser->getId());
479  $this->participants->updateSubscriptionTime($ilUser->getId(), time());
480  $this->participants->updateSubject($ilUser->getId(), ilUtil::stripSlashes($_POST['subject']));
481  $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST, $ilUser->getId());
482 
483  ilUtil::sendSuccess($this->lng->txt("application_completed"), true);
484  $ilCtrl->setParameterByClass(
485  "ilrepositorygui",
486  "ref_id",
487  $tree->getParentId($this->container->getRefId())
488  );
489  $ilCtrl->redirectByClass("ilrepositorygui", "");
490  break;
491 
492  default:
493 
494  if ($this->container->isSubscriptionMembershipLimited() && $this->container->getSubscriptionMaxMembers()) {
495  $success = $GLOBALS['DIC']['rbacadmin']->assignUserLimited(
496  ilParticipants::getDefaultMemberRole($this->container->getRefId()),
497  $ilUser->getId(),
498  $this->container->getSubscriptionMaxMembers(),
499  array(ilParticipants::getDefaultMemberRole($this->container->getRefId()))
500  );
501  if (!$success) {
502  ilUtil::sendFailure($this->lng->txt('crs_subscription_failed_limit'));
503  $this->show();
504  return false;
505  }
506  }
507 
508  $this->participants->add($ilUser->getId(), IL_CRS_MEMBER);
509  $this->participants->sendNotification($this->participants->NOTIFY_ADMINS, $ilUser->getId());
510  $this->participants->sendNotification($this->participants->NOTIFY_REGISTERED, $ilUser->getId());
511 
512  include_once './Modules/Forum/classes/class.ilForumNotification.php';
513  ilForumNotification::checkForumsExistsInsert($this->container->getRefId(), $ilUser->getId());
514 
515  if ($this->container->getType() == "crs") {
516  $this->container->checkLPStatusSync($ilUser->getId());
517  }
518 
519  if (!$_SESSION["pending_goto"]) {
520  ilUtil::sendSuccess($this->lng->txt("crs_subscription_successful"), true);
521  $this->ctrl->returnToParent($this);
522  } else {
523  $tgt = $_SESSION["pending_goto"];
524  unset($_SESSION["pending_goto"]);
525  ilUtil::redirect($tgt);
526  }
527  break;
528  }
529  }
show(ilPropertyFormGUI $form=null)
show registration form
$_SESSION["AccountId"]
global $DIC
Definition: saml.php:7
static getDefaultMemberRole($a_ref_id)
const IL_CRS_SUBSCRIPTION_CONFIRMATION
addToList($a_usr_id)
Add to waiting list and raise event.
global $ilCtrl
Definition: ilias.php:18
const IL_CRS_MEMBER
setAccepted($a_status)
Set Agreement accepted.
$success
Definition: Utf8Test.php:86
$ilUser
Definition: imgupload.php:18
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static checkForumsExistsInsert($ref_id, $user_id=0)
$info
Definition: index.php:5
static redirect($a_script)
$_POST["username"]
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

◆ addCommandButtons()

ilCourseRegistrationGUI::addCommandButtons ( )
protected

Add group specific command buttons.

Returns

Definition at line 359 of file class.ilCourseRegistrationGUI.php.

References $DIC, $ilUser, IL_CRS_SUBSCRIPTION_CONFIRMATION, and ilRegistrationGUI\isRegistrationPossible().

360  {
361  global $DIC;
362 
363  $ilUser = $DIC['ilUser'];
364 
365  parent::addCommandButtons();
366 
367 
368  switch ($this->container->getSubscriptionType()) {
370  if ($this->participants->isSubscriber($ilUser->getId())) {
371  $this->form->clearCommandButtons();
372  $this->form->addCommandButton('updateSubscriptionRequest', $this->lng->txt('crs_update_subscr_request'));
373  $this->form->addCommandButton('cancelSubscriptionRequest', $this->lng->txt('crs_cancel_subscr_request'));
374  } elseif ($this->isRegistrationPossible()) {
375  $this->form->clearCommandButtons();
376  $this->form->addCommandButton('join', $this->lng->txt('crs_join_request'));
377  $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
378  }
379  break;
380  }
381  if (!$this->isRegistrationPossible()) {
382  return false;
383  }
384 
385  return true;
386  }
global $DIC
Definition: saml.php:7
const IL_CRS_SUBSCRIPTION_CONFIRMATION
isRegistrationPossible()
check if registration is possible
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ executeCommand()

ilCourseRegistrationGUI::executeCommand ( )

Execute command.

public

Definition at line 38 of file class.ilCourseRegistrationGUI.php.

References $DIC, $GLOBALS, $ilUser, ilRegistrationGUI\getRefId(), and ilRegistrationGUI\getWaitingList().

39  {
40  global $DIC;
41 
42  $ilTabs = $DIC['ilTabs'];
43  $ilUser = $DIC['ilUser'];
44 
45  if ($this->getWaitingList()->isOnList($ilUser->getId())) {
46  $ilTabs->activateTab('leave');
47  }
48 
49  if (!$GLOBALS['DIC']['ilAccess']->checkAccess('join', '', $this->getRefId())) {
50  $this->ctrl->setReturn($this->parent_gui, 'infoScreen');
51  $this->ctrl->returnToParent($this);
52  return false;
53  }
54 
55  $next_class = $this->ctrl->getNextClass($this);
56  switch ($next_class) {
57  default:
58  $cmd = $this->ctrl->getCmd("show");
59  $this->$cmd();
60  break;
61  }
62  return true;
63  }
global $DIC
Definition: saml.php:7
getWaitingList()
Get waiting list object.
$ilUser
Definition: imgupload.php:18
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

◆ fillInformations()

ilCourseRegistrationGUI::fillInformations ( )
protected

fill informations

protected

Parameters

Definition at line 90 of file class.ilCourseRegistrationGUI.php.

References ilUtil\makeClickable().

91  {
92  if ($this->container->getImportantInformation()) {
93  $imp = new ilNonEditableValueGUI($this->lng->txt('crs_important_info'), "", true);
94  $value = nl2br(ilUtil::makeClickable($this->container->getImportantInformation(), true));
95  $imp->setValue($value);
96  $this->form->addItem($imp);
97  }
98 
99  if ($this->container->getSyllabus()) {
100  $syl = new ilNonEditableValueGUI($this->lng->txt('crs_syllabus'), "", true);
101  $value = nl2br(ilUtil::makeClickable($this->container->getSyllabus(), true));
102  $syl->setValue($value);
103  $this->form->addItem($syl);
104  }
105  }
static makeClickable($a_text, $detectGotoLinks=false)
makeClickable In Texten enthaltene URLs und Mail-Adressen klickbar machen
This class represents a non editable value in a property form.
+ Here is the call graph for this function:

◆ fillMaxMembers()

ilCourseRegistrationGUI::fillMaxMembers ( )
protected

fill max members

protected

Parameters

Definition at line 174 of file class.ilCourseRegistrationGUI.php.

References $DIC, $ilUser, ilRegistrationGUI\$tpl, ilRegistrationGUI\$waiting_list, ilRegistrationGUI\enableRegistration(), ilRegistrationGUI\getContainer(), ilRegistrationGUI\getWaitingList(), ilObjCourseAccess\lookupRegistrationInfo(), ilUtil\sendFailure(), and ilCustomInputGUI\setHtml().

175  {
176  global $DIC;
177 
178  $ilUser = $DIC['ilUser'];
179 
180  if (!$this->container->isSubscriptionMembershipLimited()) {
181  return true;
182  }
183  $tpl = new ilTemplate('tpl.max_members_form.html', true, true, 'Services/Membership');
184 
185  if ($this->container->getSubscriptionMinMembers()) {
186  $tpl->setVariable('TXT_MIN', $this->lng->txt('mem_min_users') . ':');
187  $tpl->setVariable('NUM_MIN', $this->container->getSubscriptionMinMembers());
188  }
189 
190  if ($this->container->getSubscriptionMaxMembers()) {
191  $tpl->setVariable('TXT_MAX', $this->lng->txt('mem_max_users'));
192  $tpl->setVariable('NUM_MAX', $this->container->getSubscriptionMaxMembers());
193 
194  $tpl->setVariable('TXT_FREE', $this->lng->txt('mem_free_places') . ":");
195  include_once './Modules/Course/classes/class.ilObjCourseAccess.php';
196  $reg_info = ilObjCourseAccess::lookupRegistrationInfo($this->getContainer()->getId());
197  $free = $reg_info['reg_info_free_places'];
198 
199  if ($free) {
200  $tpl->setVariable('NUM_FREE', $free);
201  } else {
202  $tpl->setVariable('WARN_FREE', $free);
203  }
204 
205  include_once('./Modules/Course/classes/class.ilCourseWaitingList.php');
206  $waiting_list = new ilCourseWaitingList($this->container->getId());
207  if (
208  $this->container->isSubscriptionMembershipLimited() and
209  $this->container->enabledWaitingList() and
210  (!$free or $waiting_list->getCountUsers())) {
211  if ($waiting_list->isOnList($ilUser->getId())) {
212  $tpl->setVariable('TXT_WAIT', $this->lng->txt('mem_waiting_list_position'));
213  $tpl->setVariable('NUM_WAIT', $waiting_list->getPosition($ilUser->getId()));
214  } else {
215  $tpl->setVariable('TXT_WAIT', $this->lng->txt('mem_waiting_list'));
216  if ($free and $waiting_list->getCountUsers()) {
217  $tpl->setVariable('WARN_WAIT', $waiting_list->getCountUsers());
218  } else {
219  $tpl->setVariable('NUM_WAIT', $waiting_list->getCountUsers());
220  }
221  }
222  }
223 
224  $alert = '';
225  if (
226  !$free and
227  !$this->container->enabledWaitingList()) {
228  // Disable registration
229  $this->enableRegistration(false);
230  ilUtil::sendFailure($this->lng->txt('mem_alert_no_places'));
231  #$alert = $this->lng->txt('mem_alert_no_places');
232  } elseif (
233  $this->container->enabledWaitingList() and
234  $this->container->isSubscriptionMembershipLimited() and
235  $waiting_list->isOnList($ilUser->getId())
236  ) {
237  // Disable registration
238  $this->enableRegistration(false);
239  } elseif (
240  !$free and
241  $this->container->enabledWaitingList() and
242  $this->container->isSubscriptionMembershipLimited()) {
243  ilUtil::sendFailure($this->lng->txt('crs_warn_no_max_set_on_waiting_list'));
244  #$alert = $this->lng->txt('crs_warn_no_max_set_on_waiting_list');
245  } elseif (
246  $free and
247  $this->container->enabledWaitingList() and
248  $this->container->isSubscriptionMembershipLimited() and
249  $this->getWaitingList()->getCountUsers()) {
250  ilUtil::sendFailure($this->lng->txt('crs_warn_wl_set_on_waiting_list'));
251  #$alert = $this->lng->txt('crs_warn_wl_set_on_waiting_list');
252  }
253  }
254 
255  $max = new ilCustomInputGUI($this->lng->txt('mem_participants'));
256  $max->setHtml($tpl->get());
257  if (strlen($alert)) {
258  $max->setAlert($alert);
259  }
260  $this->form->addItem($max);
261  return true;
262  }
setHtml($a_html)
Set Html.
global $DIC
Definition: saml.php:7
getWaitingList()
Get waiting list object.
enableRegistration($a_status)
set registration disabled
special template class to simplify handling of ITX/PEAR
static lookupRegistrationInfo($a_obj_id)
Lookup registration info ilDB $ilDB ilObjUser $ilUser ilLanguage $lng.
$ilUser
Definition: imgupload.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
This class represents a custom property in a property form.
getContainer()
Parent object.
+ Here is the call graph for this function:

◆ fillRegistrationPeriod()

ilCourseRegistrationGUI::fillRegistrationPeriod ( )
protected

show informations about the registration period

protected

Definition at line 112 of file class.ilCourseRegistrationGUI.php.

References $end, $start, ilRegistrationGUI\$tpl, $warning, ilDateTime\_after(), ilDateTime\_before(), ilRegistrationGUI\enableRegistration(), ilDatePresentation\formatDate(), IL_CAL_UNIX, IL_CRS_SUBSCRIPTION_DEACTIVATED, ilUtil\sendFailure(), ilCustomInputGUI\setHtml(), and ilNonEditableValueGUI\setValue().

113  {
114  include_once('./Services/Calendar/classes/class.ilDateTime.php');
115  $now = new ilDateTime(time(), IL_CAL_UNIX, 'UTC');
116 
117  if ($this->container->getSubscriptionUnlimitedStatus()) {
118  $reg = new ilNonEditableValueGUI($this->lng->txt('mem_reg_period'));
119  $reg->setValue($this->lng->txt('mem_unlimited'));
120  $this->form->addItem($reg);
121  return true;
122  } elseif ($this->container->getSubscriptionLimitationType() == IL_CRS_SUBSCRIPTION_DEACTIVATED) {
123  return true;
124  }
125 
126  $start = new ilDateTime($this->container->getSubscriptionStart(), IL_CAL_UNIX, 'UTC');
127  $end = new ilDateTime($this->container->getSubscriptionEnd(), IL_CAL_UNIX, 'UTC');
128 
129  if (ilDateTime::_before($now, $start)) {
130  $tpl = new ilTemplate('tpl.registration_period_form.html', true, true, 'Services/Membership');
131  $tpl->setVariable('TXT_FIRST', $this->lng->txt('mem_start'));
132  $tpl->setVariable('FIRST', ilDatePresentation::formatDate($start));
133 
134  $tpl->setVariable('TXT_END', $this->lng->txt('mem_end'));
135  $tpl->setVariable('END', ilDatePresentation::formatDate($end));
136 
137  $warning = $this->lng->txt('mem_reg_not_started');
138  } elseif (ilDateTime::_after($now, $end)) {
139  $tpl = new ilTemplate('tpl.registration_period_form.html', true, true, 'Services/Membership');
140  $tpl->setVariable('TXT_FIRST', $this->lng->txt('mem_start'));
141  $tpl->setVariable('FIRST', ilDatePresentation::formatDate($start));
142 
143  $tpl->setVariable('TXT_END', $this->lng->txt('mem_end'));
144  $tpl->setVariable('END', ilDatePresentation::formatDate($end));
145 
146 
147  $warning = $this->lng->txt('mem_reg_expired');
148  } else {
149  $tpl = new ilTemplate('tpl.registration_period_form.html', true, true, 'Services/Membership');
150  $tpl->setVariable('TXT_FIRST', $this->lng->txt('mem_end'));
151  $tpl->setVariable('FIRST', ilDatePresentation::formatDate($end));
152  }
153 
154  $reg = new ilCustomInputGUI($this->lng->txt('mem_reg_period'));
155  $reg->setHtml($tpl->get());
156  if (strlen($warning)) {
157  // Disable registration
158  $this->enableRegistration(false);
160  #$reg->setAlert($warning);
161  }
162  $this->form->addItem($reg);
163  return true;
164  }
setHtml($a_html)
Set Html.
static _after(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
static _before(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
$start
Definition: bench.php:8
enableRegistration($a_status)
set registration disabled
$warning
Definition: X509warning.php:13
special template class to simplify handling of ITX/PEAR
Date and time handling
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
This class represents a custom property in a property form.
This class represents a non editable value in a property form.
const IL_CRS_SUBSCRIPTION_DEACTIVATED
+ Here is the call graph for this function:

◆ fillRegistrationType()

ilCourseRegistrationGUI::fillRegistrationType ( )
protected

fill registration type

protected

Returns

Definition at line 270 of file class.ilCourseRegistrationGUI.php.

References $_POST, $DIC, $ilUser, $pass, $txt, ilRegistrationGUI\enableRegistration(), IL_CRS_SUBSCRIPTION_CONFIRMATION, IL_CRS_SUBSCRIPTION_DEACTIVATED, IL_CRS_SUBSCRIPTION_DIRECT, IL_CRS_SUBSCRIPTION_PASSWORD, isWaitingListActive(), ilUtil\sendFailure(), ilFormPropertyGUI\setAlert(), and ilTextAreaInputGUI\setValue().

271  {
272  global $DIC;
273 
274  $ilUser = $DIC['ilUser'];
275 
276  if ($this->container->getSubscriptionLimitationType() == IL_CRS_SUBSCRIPTION_DEACTIVATED) {
277  $reg = new ilCustomInputGUI($this->lng->txt('mem_reg_type'));
278  #$reg->setHtml($this->lng->txt('crs_info_reg_deactivated'));
279  $reg->setAlert($this->lng->txt('crs_info_reg_deactivated'));
280  #ilUtil::sendFailure($this->lng->txt('crs_info_reg_deactivated'));
281  #$reg = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
282  #$reg->setValue($this->lng->txt('crs_info_reg_deactivated'));
283  #$reg->setAlert($this->lng->txt('grp_reg_deactivated_alert'));
284  $this->form->addItem($reg);
285 
286  // Disable registration
287  $this->enableRegistration(false);
288  return true;
289  }
290 
291  switch ($this->container->getSubscriptionType()) {
293 
294  // no "request" info if waiting list is active
295  if ($this->isWaitingListActive()) {
296  return true;
297  }
298 
299  $txt = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
300  $txt->setValue($this->lng->txt('crs_info_reg_direct'));
301 
302  $this->form->addItem($txt);
303  break;
304 
306  $txt = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
307  $txt->setValue($this->lng->txt('crs_subscription_options_password'));
308 
309 
310  $pass = new ilTextInputGUI($this->lng->txt('passwd'), 'grp_passw');
311  $pass->setInputType('password');
312  $pass->setSize(12);
313  $pass->setMaxLength(32);
314  #$pass->setRequired(true);
315  $pass->setInfo($this->lng->txt('crs_info_reg_password'));
316 
317  $txt->addSubItem($pass);
318  $this->form->addItem($txt);
319  break;
320 
322 
323  // no "request" info if waiting list is active
324  if ($this->isWaitingListActive()) {
325  return true;
326  }
327 
328  $txt = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
329  $txt->setValue($this->lng->txt('crs_subscription_options_confirmation'));
330 
331  $sub = new ilTextAreaInputGUI($this->lng->txt('crs_reg_subject'), 'subject');
332  $sub->setValue($_POST['subject']);
333  $sub->setInfo($this->lng->txt('crs_info_reg_confirmation'));
334  $sub->setCols(40);
335  $sub->setRows(5);
336  if ($this->participants->isSubscriber($ilUser->getId())) {
337  $sub_data = $this->participants->getSubscriberData($ilUser->getId());
338  $sub->setValue($sub_data['subject']);
339  $sub->setInfo('');
340  ilUtil::sendFailure($this->lng->txt('crs_reg_user_already_subscribed'));
341  $this->enableRegistration(false);
342  }
343  $txt->addSubItem($sub);
344  $this->form->addItem($txt);
345  break;
346 
347 
348  default:
349  return true;
350  }
351 
352  return true;
353  }
global $DIC
Definition: saml.php:7
setValue($a_value)
Set Value.
const IL_CRS_SUBSCRIPTION_CONFIRMATION
setAlert($a_alert)
Set Alert Text.
const IL_CRS_SUBSCRIPTION_PASSWORD
enableRegistration($a_status)
set registration disabled
This class represents a text property in a property form.
$ilUser
Definition: imgupload.php:18
$txt
Definition: error.php:11
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
This class represents a custom property in a property form.
This class represents a non editable value in a property form.
This class represents a text area property in a property form.
const IL_CRS_SUBSCRIPTION_DIRECT
$_POST["username"]
const IL_CRS_SUBSCRIPTION_DEACTIVATED
+ Here is the call graph for this function:

◆ getFormTitle()

ilCourseRegistrationGUI::getFormTitle ( )
protected

get form title

protected

Returns
string title

Definition at line 71 of file class.ilCourseRegistrationGUI.php.

References $DIC, $ilUser, and ilRegistrationGUI\getWaitingList().

72  {
73  global $DIC;
74 
75  $ilUser = $DIC['ilUser'];
76 
77  if ($this->getWaitingList()->isOnList($ilUser->getId())) {
78  return $this->lng->txt('member_status');
79  }
80  return $this->lng->txt('crs_registration');
81  }
global $DIC
Definition: saml.php:7
getWaitingList()
Get waiting list object.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ initParticipants()

ilCourseRegistrationGUI::initParticipants ( )
protected

Init course participants.

protected

Definition at line 539 of file class.ilCourseRegistrationGUI.php.

References ilCourseParticipants\_getInstanceByObjId().

540  {
541  include_once('./Modules/Course/classes/class.ilCourseParticipants.php');
542  $this->participants = ilCourseParticipants::_getInstanceByObjId($this->obj_id);
543  }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
+ Here is the call graph for this function:

◆ initWaitingList()

ilCourseRegistrationGUI::initWaitingList ( )
protected
See also
ilRegistrationGUI::initWaitingList() protected

Definition at line 550 of file class.ilCourseRegistrationGUI.php.

551  {
552  include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
553  $this->waiting_list = new ilCourseWaitingList($this->container->getId());
554  }

◆ isWaitingListActive()

ilCourseRegistrationGUI::isWaitingListActive ( )
protected
See also
ilRegistrationGUI::isWaitingListActive()

Definition at line 559 of file class.ilCourseRegistrationGUI.php.

References $DIC, $ilUser, and ilRegistrationGUI\getWaitingList().

Referenced by fillRegistrationType().

560  {
561  global $DIC;
562 
563  $ilUser = $DIC['ilUser'];
564  static $active = null;
565 
566  if ($active !== null) {
567  return $active;
568  }
569  if (!$this->container->enabledWaitingList() or !$this->container->isSubscriptionMembershipLimited()) {
570  return $active = false;
571  }
572  if (!$this->container->getSubscriptionMaxMembers()) {
573  return $active = false;
574  }
575 
576  $free = max(0, $this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
577  return $active = (!$free or $this->getWaitingList()->getCountUsers());
578  }
global $DIC
Definition: saml.php:7
getWaitingList()
Get waiting list object.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ validate()

ilCourseRegistrationGUI::validate ( )
protected

Validate subscription request.

protected

Parameters

Definition at line 395 of file class.ilCourseRegistrationGUI.php.

References $_POST, $DIC, $ilUser, $pass, IL_CRS_SUBSCRIPTION_PASSWORD, ilRegistrationGUI\isRegistrationPossible(), ilRegistrationGUI\setAccepted(), ilUtil\stripSlashes(), ilRegistrationGUI\validateAgreement(), and ilRegistrationGUI\validateCustomFields().

396  {
397  global $DIC;
398 
399  $ilUser = $DIC['ilUser'];
400 
401  if ($ilUser->getId() == ANONYMOUS_USER_ID) {
402  $this->join_error = $this->lng->txt('permission_denied');
403  return false;
404  }
405 
406  // Set aggrement to not accepted
407  $this->setAccepted(false);
408 
409  if (!$this->isRegistrationPossible()) {
410  $this->join_error = $this->lng->txt('mem_error_preconditions');
411  return false;
412  }
413  if ($this->container->getSubscriptionType() == IL_CRS_SUBSCRIPTION_PASSWORD) {
414  if (!strlen($pass = ilUtil::stripSlashes($_POST['grp_passw']))) {
415  $this->join_error = $this->lng->txt('crs_password_required');
416  return false;
417  }
418  if (strcmp($pass, $this->container->getSubscriptionPassword()) !== 0) {
419  $this->join_error = $this->lng->txt('crs_password_not_valid');
420  return false;
421  }
422  }
423  if (!$this->validateCustomFields()) {
424  $this->join_error = $this->lng->txt('fill_out_all_required_fields');
425  return false;
426  }
427  if (!$this->validateAgreement()) {
428  $this->join_error = $this->lng->txt('crs_agreement_required');
429  return false;
430  }
431 
432  return true;
433  }
global $DIC
Definition: saml.php:7
validateAgreement()
Check Agreement.
setAccepted($a_status)
Set Agreement accepted.
const IL_CRS_SUBSCRIPTION_PASSWORD
isRegistrationPossible()
check if registration is possible
$ilUser
Definition: imgupload.php:18
validateCustomFields()
Check required course fields.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
+ Here is the call graph for this function:

Field Documentation

◆ $parent_gui

ilCourseRegistrationGUI::$parent_gui = null
private

Definition at line 18 of file class.ilCourseRegistrationGUI.php.


The documentation for this class was generated from the following file: