ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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 ()
 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 37 of file class.ilCourseRegistrationGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilCourseRegistrationGUI::__construct (   $a_container,
  $a_parent_gui 
)

Constructor.

public

Parameters
objectcourse object

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

48  {
49  parent::__construct($a_container);
50 
51  $this->parent_gui = $a_parent_gui;
52  }

Member Function Documentation

◆ add()

ilCourseRegistrationGUI::add ( )
protected

add user

protected

Parameters

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

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

489  {
490  global $ilUser,$tree, $ilCtrl;
491 
492  // TODO: language vars
493 
494  // set aggreement accepted
495  $this->setAccepted(true);
496 
497  include_once('./Modules/Course/classes/class.ilCourseWaitingList.php');
498  $free = max(0,$this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
499  $waiting_list = new ilCourseWaitingList($this->container->getId());
500  if($this->container->isSubscriptionMembershipLimited() and $this->container->enabledWaitingList() and (!$free or $waiting_list->getCountUsers()))
501  {
502  $waiting_list->addToList($ilUser->getId());
503  $info = sprintf($this->lng->txt('crs_added_to_list'),
504  $waiting_list->getPosition($ilUser->getId()));
505  ilUtil::sendSuccess($info,true);
506 
507  $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST,$ilUser->getId());
508  $this->participants->sendNotification($this->participants->NOTIFY_WAITING_LIST,$ilUser->getId());
509  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id",
510  $tree->getParentId($this->container->getRefId()));
511  $ilCtrl->redirectByClass("ilrepositorygui", "");
512  }
513 
514  switch($this->container->getSubscriptionType())
515  {
517  $this->participants->addSubscriber($ilUser->getId());
518  $this->participants->updateSubscriptionTime($ilUser->getId(),time());
519  $this->participants->updateSubject($ilUser->getId(),ilUtil::stripSlashes($_POST['subject']));
520  $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST,$ilUser->getId());
521 
522  ilUtil::sendSuccess($this->lng->txt("application_completed"),true);
523  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id",
524  $tree->getParentId($this->container->getRefId()));
525  $ilCtrl->redirectByClass("ilrepositorygui", "");
526  break;
527 
528  default:
529 
530  if($this->container->isSubscriptionMembershipLimited() && $this->container->getSubscriptionMaxMembers())
531  {
532  $success = $GLOBALS['rbacadmin']->assignUserLimited(
533  ilParticipants::getDefaultMemberRole($this->container->getRefId()),
534  $ilUser->getId(),
535  $this->container->getSubscriptionMaxMembers(),
536  array(ilParticipants::getDefaultMemberRole($this->container->getRefId()))
537  );
538  if(!$success)
539  {
540  ilUtil::sendFailure($this->lng->txt('crs_subscription_failed_limit'));
541  $this->show();
542  return FALSE;
543  }
544  }
545 
546  $this->participants->add($ilUser->getId(),IL_CRS_MEMBER);
547  $this->participants->sendNotification($this->participants->NOTIFY_ADMINS,$ilUser->getId());
548  $this->participants->sendNotification($this->participants->NOTIFY_REGISTERED,$ilUser->getId());
549 
550  include_once './Modules/Forum/classes/class.ilForumNotification.php';
551  ilForumNotification::checkForumsExistsInsert($this->container->getRefId(), $ilUser->getId());
552 
553  if($this->container->getType() == "crs")
554  {
555  $this->container->checkLPStatusSync($ilUser->getId());
556  }
557 
558  if(!$_SESSION["pending_goto"])
559  {
560  ilUtil::sendSuccess($this->lng->txt("crs_subscription_successful"),true);
561  $this->ctrl->returnToParent($this);
562  }
563  else
564  {
565  $tgt = $_SESSION["pending_goto"];
566  unset($_SESSION["pending_goto"]);
567  ilUtil::redirect($tgt);
568  }
569  break;
570  }
571  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
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:87
$GLOBALS['ct_recipient']
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.
show()
show registration form
global $ilUser
Definition: imgupload.php:15
static checkForumsExistsInsert($ref_id, $user_id=0)
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:

◆ addCommandButtons()

ilCourseRegistrationGUI::addCommandButtons ( )
protected

Add group specific command buttons.

Returns

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

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

398  {
399  global $ilUser;
400 
401  parent::addCommandButtons();
402 
403 
404  switch($this->container->getSubscriptionType())
405  {
407  if($this->participants->isSubscriber($ilUser->getId()))
408  {
409  $this->form->clearCommandButtons();
410  $this->form->addCommandButton('updateSubscriptionRequest', $this->lng->txt('crs_update_subscr_request'));
411  $this->form->addCommandButton('cancelSubscriptionRequest', $this->lng->txt('crs_cancel_subscr_request'));
412  }
413  elseif($this->isRegistrationPossible())
414  {
415  $this->form->clearCommandButtons();
416  $this->form->addCommandButton('join', $this->lng->txt('crs_join_request'));
417  $this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
418  }
419  break;
420  }
421  if(!$this->isRegistrationPossible())
422  {
423  return false;
424  }
425 
426  return true;
427  }
const IL_CRS_SUBSCRIPTION_CONFIRMATION
isRegistrationPossible()
check if registration is possible
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ executeCommand()

ilCourseRegistrationGUI::executeCommand ( )

Execute command.

public

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

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

60  {
61  global $ilTabs,$ilUser;
62 
63  if($this->getWaitingList()->isOnList($ilUser->getId()))
64  {
65  $ilTabs->activateTab('leave');
66  }
67 
68  if(!$GLOBALS['ilAccess']->checkAccess('join','',$this->getRefId()))
69  {
70  $this->ctrl->setReturn($this->parent_gui,'infoScreen');
71  $this->ctrl->returnToParent($this);
72  return FALSE;
73  }
74 
75  $next_class = $this->ctrl->getNextClass($this);
76  switch($next_class)
77  {
78  default:
79  $cmd = $this->ctrl->getCmd("show");
80  $this->$cmd();
81  break;
82  }
83  return true;
84  }
getWaitingList()
Get waiting list object.
$cmd
Definition: sahs_server.php:35
$GLOBALS['ct_recipient']
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ fillInformations()

ilCourseRegistrationGUI::fillInformations ( )
protected

fill informations

protected

Parameters

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

References ilUtil\makeClickable().

111  {
112  if($this->container->getImportantInformation())
113  {
114  $imp = new ilNonEditableValueGUI($this->lng->txt('crs_important_info'), "", true);
115  $value = nl2br(ilUtil::makeClickable($this->container->getImportantInformation(), true));
116  $imp->setValue($value);
117  $this->form->addItem($imp);
118  }
119 
120  if($this->container->getSyllabus())
121  {
122  $syl = new ilNonEditableValueGUI($this->lng->txt('crs_syllabus'), "", true);
123  $value = nl2br(ilUtil::makeClickable ($this->container->getSyllabus(), true));
124  $syl->setValue($value);
125  $this->form->addItem($syl);
126  }
127  }
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 205 of file class.ilCourseRegistrationGUI.php.

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

206  {
207  global $ilUser;
208 
209  if(!$this->container->isSubscriptionMembershipLimited())
210  {
211  return true;
212  }
213  $tpl = new ilTemplate('tpl.max_members_form.html',true,true,'Services/Membership');
214  $tpl->setVariable('TXT_MAX',$this->lng->txt('mem_max_users'));
215  $tpl->setVariable('NUM_MAX',$this->container->getSubscriptionMaxMembers());
216 
217  $tpl->setVariable('TXT_FREE',$this->lng->txt('mem_free_places').":");
218 
219  include_once './Modules/Course/classes/class.ilObjCourseAccess.php';
220  $reg_info = ilObjCourseAccess::lookupRegistrationInfo($this->getContainer()->getId());
221  $free = $reg_info['reg_info_free_places'];
222 
223  if($free)
224  {
225  $tpl->setVariable('NUM_FREE',$free);
226  }
227  else
228  {
229  $tpl->setVariable('WARN_FREE',$free);
230  }
231 
232  include_once('./Modules/Course/classes/class.ilCourseWaitingList.php');
233  $waiting_list = new ilCourseWaitingList($this->container->getId());
234  if(
235  $this->container->isSubscriptionMembershipLimited() and
236  $this->container->enabledWaitingList() and
237  (!$free or $waiting_list->getCountUsers()))
238  {
239  if($waiting_list->isOnList($ilUser->getId()))
240  {
241  $tpl->setVariable('TXT_WAIT',$this->lng->txt('mem_waiting_list_position'));
242  $tpl->setVariable('NUM_WAIT',$waiting_list->getPosition($ilUser->getId()));
243 
244  }
245  else
246  {
247  $tpl->setVariable('TXT_WAIT',$this->lng->txt('mem_waiting_list'));
248  if($free and $waiting_list->getCountUsers())
249  $tpl->setVariable('WARN_WAIT',$waiting_list->getCountUsers());
250  else
251  $tpl->setVariable('NUM_WAIT',$waiting_list->getCountUsers());
252  }
253  }
254 
255  $alert = '';
256  if(
257  !$free and
258  !$this->container->enabledWaitingList())
259  {
260  // Disable registration
261  $this->enableRegistration(false);
262  ilUtil::sendFailure($this->lng->txt('mem_alert_no_places'));
263  #$alert = $this->lng->txt('mem_alert_no_places');
264  }
265  elseif(
266  $this->container->enabledWaitingList() and
267  $this->container->isSubscriptionMembershipLimited() and
268  $waiting_list->isOnList($ilUser->getId())
269  )
270  {
271  // Disable registration
272  $this->enableRegistration(false);
273  }
274  elseif(
275  !$free and
276  $this->container->enabledWaitingList() and
277  $this->container->isSubscriptionMembershipLimited())
278 
279  {
280  ilUtil::sendFailure($this->lng->txt('crs_warn_no_max_set_on_waiting_list'));
281  #$alert = $this->lng->txt('crs_warn_no_max_set_on_waiting_list');
282  }
283  elseif(
284  $free and
285  $this->container->enabledWaitingList() and
286  $this->container->isSubscriptionMembershipLimited() and
287  $this->getWaitingList()->getCountUsers())
288  {
289  ilUtil::sendFailure($this->lng->txt('crs_warn_wl_set_on_waiting_list'));
290  #$alert = $this->lng->txt('crs_warn_wl_set_on_waiting_list');
291  }
292 
293  $max = new ilCustomInputGUI($this->lng->txt('mem_participants'));
294  $max->setHtml($tpl->get());
295  if(strlen($alert))
296  {
297  $max->setAlert($alert);
298  }
299  $this->form->addItem($max);
300  return true;
301  }
setHtml($a_html)
Set Html.
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.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
This class represents a custom property in a property form.
global $ilUser
Definition: imgupload.php:15
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 134 of file class.ilCourseRegistrationGUI.php.

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

135  {
136  include_once('./Services/Calendar/classes/class.ilDateTime.php');
137  $now = new ilDateTime(time(),IL_CAL_UNIX,'UTC');
138 
139  if($this->container->getSubscriptionUnlimitedStatus())
140  {
141  $reg = new ilNonEditableValueGUI($this->lng->txt('mem_reg_period'));
142  $reg->setValue($this->lng->txt('mem_unlimited'));
143  $this->form->addItem($reg);
144  return true;
145  }
146  elseif($this->container->getSubscriptionLimitationType() == IL_CRS_SUBSCRIPTION_DEACTIVATED)
147  {
148  return true;
149  }
150 
151  $start = new ilDateTime($this->container->getSubscriptionStart(),IL_CAL_UNIX,'UTC');
152  $end = new ilDateTime($this->container->getSubscriptionEnd(),IL_CAL_UNIX,'UTC');
153 
154  if(ilDateTime::_before($now,$start))
155  {
156  $tpl = new ilTemplate('tpl.registration_period_form.html',true,true,'Services/Membership');
157  $tpl->setVariable('TXT_FIRST',$this->lng->txt('mem_start'));
158  $tpl->setVariable('FIRST',ilDatePresentation::formatDate($start));
159 
160  $tpl->setVariable('TXT_END',$this->lng->txt('mem_end'));
161  $tpl->setVariable('END',ilDatePresentation::formatDate($end));
162 
163  $warning = $this->lng->txt('mem_reg_not_started');
164  }
165  elseif(ilDateTime::_after($now,$end))
166  {
167  $tpl = new ilTemplate('tpl.registration_period_form.html',true,true,'Services/Membership');
168  $tpl->setVariable('TXT_FIRST',$this->lng->txt('mem_start'));
169  $tpl->setVariable('FIRST',ilDatePresentation::formatDate($start));
170 
171  $tpl->setVariable('TXT_END',$this->lng->txt('mem_end'));
172  $tpl->setVariable('END',ilDatePresentation::formatDate($end));
173 
174 
175  $warning = $this->lng->txt('mem_reg_expired');
176  }
177  else
178  {
179  $tpl = new ilTemplate('tpl.registration_period_form.html',true,true,'Services/Membership');
180  $tpl->setVariable('TXT_FIRST',$this->lng->txt('mem_end'));
181  $tpl->setVariable('FIRST',ilDatePresentation::formatDate($end));
182  }
183 
184  $reg = new ilCustomInputGUI($this->lng->txt('mem_reg_period'));
185  $reg->setHtml($tpl->get());
186  if(strlen($warning))
187  {
188  // Disable registration
189  $this->enableRegistration(false);
190  ilUtil::sendFailure($warning);
191  #$reg->setAlert($warning);
192  }
193  $this->form->addItem($reg);
194  return true;
195  }
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
enableRegistration($a_status)
set registration disabled
special template class to simplify handling of ITX/PEAR
static formatDate(ilDateTime $date)
Format a date public.
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 309 of file class.ilCourseRegistrationGUI.php.

References $_POST, $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().

310  {
311  global $ilUser;
312 
313  if($this->container->getSubscriptionLimitationType() == IL_CRS_SUBSCRIPTION_DEACTIVATED)
314  {
315  $reg = new ilCustomInputGUI($this->lng->txt('mem_reg_type'));
316  #$reg->setHtml($this->lng->txt('crs_info_reg_deactivated'));
317  $reg->setAlert($this->lng->txt('crs_info_reg_deactivated'));
318  #ilUtil::sendFailure($this->lng->txt('crs_info_reg_deactivated'));
319  #$reg = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
320  #$reg->setValue($this->lng->txt('crs_info_reg_deactivated'));
321  #$reg->setAlert($this->lng->txt('grp_reg_deactivated_alert'));
322  $this->form->addItem($reg);
323 
324  // Disable registration
325  $this->enableRegistration(false);
326  return true;
327  }
328 
329  switch($this->container->getSubscriptionType())
330  {
332 
333  // no "request" info if waiting list is active
334  if($this->isWaitingListActive())
335  return true;
336 
337  $txt = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
338  $txt->setValue($this->lng->txt('crs_info_reg_direct'));
339 
340  $this->form->addItem($txt);
341  break;
342 
344  $txt = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
345  $txt->setValue($this->lng->txt('crs_subscription_options_password'));
346 
347 
348  $pass = new ilTextInputGUI($this->lng->txt('passwd'),'grp_passw');
349  $pass->setInputType('password');
350  $pass->setSize(12);
351  $pass->setMaxLength(32);
352  #$pass->setRequired(true);
353  $pass->setInfo($this->lng->txt('crs_info_reg_password'));
354 
355  $txt->addSubItem($pass);
356  $this->form->addItem($txt);
357  break;
358 
360 
361  // no "request" info if waiting list is active
362  if($this->isWaitingListActive())
363  return true;
364 
365  $txt = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
366  $txt->setValue($this->lng->txt('crs_subscription_options_confirmation'));
367 
368  $sub = new ilTextAreaInputGUI($this->lng->txt('crs_reg_subject'),'subject');
369  $sub->setValue($_POST['subject']);
370  $sub->setInfo($this->lng->txt('crs_info_reg_confirmation'));
371  $sub->setCols(40);
372  $sub->setRows(5);
373  if($this->participants->isSubscriber($ilUser->getId()))
374  {
375  $sub_data = $this->participants->getSubscriberData($ilUser->getId());
376  $sub->setValue($sub_data['subject']);
377  $sub->setInfo('');
378  ilUtil::sendFailure($this->lng->txt('crs_reg_user_already_subscribed'));
379  $this->enableRegistration(false);
380  }
381  $txt->addSubItem($sub);
382  $this->form->addItem($txt);
383  break;
384 
385 
386  default:
387  return true;
388  }
389 
390  return true;
391  }
$_POST['username']
Definition: cron.php:12
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.
$txt
Definition: error.php:10
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.
global $ilUser
Definition: imgupload.php:15
This class represents a text area property in a property form.
const IL_CRS_SUBSCRIPTION_DIRECT
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 92 of file class.ilCourseRegistrationGUI.php.

References $ilUser, and ilRegistrationGUI\getWaitingList().

93  {
94  global $ilUser;
95 
96  if($this->getWaitingList()->isOnList($ilUser->getId()))
97  {
98  return $this->lng->txt('member_status');
99  }
100  return $this->lng->txt('crs_registration');
101  }
getWaitingList()
Get waiting list object.
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ initParticipants()

ilCourseRegistrationGUI::initParticipants ( )
protected

Init course participants.

protected

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

References ilCourseParticipants\_getInstanceByObjId().

582  {
583  include_once('./Modules/Course/classes/class.ilCourseParticipants.php');
584  $this->participants = ilCourseParticipants::_getInstanceByObjId($this->obj_id);
585  }
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 592 of file class.ilCourseRegistrationGUI.php.

593  {
594  include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
595  $this->waiting_list = new ilCourseWaitingList($this->container->getId());
596  }

◆ isWaitingListActive()

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

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

References $ilUser, and ilRegistrationGUI\getWaitingList().

Referenced by fillRegistrationType().

602  {
603  global $ilUser;
604  static $active = null;
605 
606  if($active !== null)
607  {
608  return $active;
609  }
610  if(!$this->container->enabledWaitingList() or !$this->container->isSubscriptionMembershipLimited())
611  {
612  return $active = false;
613  }
614  if(!$this->container->getSubscriptionMaxMembers())
615  {
616  return $active = false;
617  }
618 
619  $free = max(0,$this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
620  return $active = (!$free or $this->getWaitingList()->getCountUsers());
621  }
getWaitingList()
Get waiting list object.
global $ilUser
Definition: imgupload.php:15
+ 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 436 of file class.ilCourseRegistrationGUI.php.

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

437  {
438  global $ilUser;
439 
440  if($ilUser->getId() == ANONYMOUS_USER_ID)
441  {
442  $this->join_error = $this->lng->txt('permission_denied');
443  return false;
444  }
445 
446  // Set aggrement to not accepted
447  $this->setAccepted(false);
448 
449  if(!$this->isRegistrationPossible())
450  {
451  $this->join_error = $this->lng->txt('mem_error_preconditions');
452  return false;
453  }
454  if($this->container->getSubscriptionType() == IL_CRS_SUBSCRIPTION_PASSWORD)
455  {
456  if(!strlen($pass = ilUtil::stripSlashes($_POST['grp_passw'])))
457  {
458  $this->join_error = $this->lng->txt('crs_password_required');
459  return false;
460  }
461  if(strcmp($pass,$this->container->getSubscriptionPassword()) !== 0)
462  {
463  $this->join_error = $this->lng->txt('crs_password_not_valid');
464  return false;
465  }
466  }
467  if(!$this->validateCustomFields())
468  {
469  $this->join_error = $this->lng->txt('fill_out_all_required_fields');
470  return false;
471  }
472  if(!$this->validateAgreement())
473  {
474  $this->join_error = $this->lng->txt('crs_agreement_required');
475  return false;
476  }
477 
478  return true;
479  }
$_POST['username']
Definition: cron.php:12
validateAgreement()
Check Agreement.
setAccepted($a_status)
Set Agreement accepted.
const IL_CRS_SUBSCRIPTION_PASSWORD
isRegistrationPossible()
check if registration is possible
validateCustomFields()
Check required course fields.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

Field Documentation

◆ $parent_gui

ilCourseRegistrationGUI::$parent_gui = null
private

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


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