/**
  * Add to waiting list and raise event
  * @param int $a_usr_id
  */
 public function addToList($a_usr_id)
 {
     global $ilAppEventHandler, $ilLog;
     if (!parent::addToList($a_usr_id)) {
         return FALSE;
     }
     $ilLog->write(__METHOD__ . ': Raise new event: Modules/Course addToList');
     $ilAppEventHandler->raise("Modules/Course", 'addToWaitingList', array('obj_id' => $this->obj_id, 'usr_id' => $a_usr_id));
     return TRUE;
 }
 /**
  * Waiting list tes
  * @param
  * @return
  */
 public function testMembership()
 {
     include_once './Services/Membership/classes/class.ilWaitingList.php';
     include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
     $wait = new ilCourseWaitingList(999999);
     $ret = $wait->addToList(111111);
     $this->assertEquals($ret, true);
     $wait->updateSubscriptionTime(111111, time());
     $wait->removeFromList(111111);
     $wait->addToList(111111);
     $ret = $wait->isOnList(111111);
     $this->assertEquals($ret, true);
     $wait->addToList(111111);
     ilWaitingList::_deleteAll(999999);
     $wait->addToList(111111);
     ilWaitingList::_deleteUser(111111);
 }
 /**
  * Add user to course
  *
  * @access public
  * @param int user id
  * @param int role IL_CRS_ADMIN || IL_CRS_TUTOR || IL_CRS_MEMBER
  * 
  */
 public function add($a_usr_id, $a_role)
 {
     global $rbacadmin, $ilLog, $ilAppEventHandler;
     if ($this->isAssigned($a_usr_id)) {
         return false;
     }
     switch ($a_role) {
         case IL_CRS_ADMIN:
             $this->admins[] = $a_usr_id;
             break;
         case IL_CRS_TUTOR:
             $this->tutors[] = $a_usr_id;
             break;
         case IL_CRS_MEMBER:
             $this->members[] = $a_usr_id;
             break;
         case IL_GRP_ADMIN:
             $this->admins[] = $a_usr_id;
             break;
         case IL_GRP_MEMBER:
             $this->members[] = $a_usr_id;
             break;
     }
     $this->participants[] = $a_usr_id;
     $rbacadmin->assignUser($this->role_data[$a_role], $a_usr_id);
     $this->addDesktopItem($a_usr_id);
     // Delete subscription request
     $this->deleteSubscriber($a_usr_id);
     include_once './Services/Membership/classes/class.ilWaitingList.php';
     ilWaitingList::deleteUserEntry($a_usr_id, $this->obj_id);
     if ($this->type == 'crs') {
         // Add event: used for ecs accounts
         $ilLog->write(__METHOD__ . ': Raise new event: Modules/Course addParticipant');
         $ilAppEventHandler->raise("Modules/Course", "addParticipant", array('obj_id' => $this->obj_id, 'usr_id' => $a_usr_id, 'role_id' => $a_role));
     }
     return true;
 }
 /**
  * Add user to course
  *
  * @access public
  * @param int user id
  * @param int role IL_CRS_ADMIN || IL_CRS_TUTOR || IL_CRS_MEMBER
  *
  * global ilRbacReview $rbacreview
  * 
  */
 public function add($a_usr_id, $a_role)
 {
     global $rbacadmin, $ilLog, $ilAppEventHandler, $rbacreview;
     if ($rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $this->roles)) {
         return false;
     }
     switch ($a_role) {
         case IL_CRS_ADMIN:
             $this->admins = true;
             break;
         case IL_CRS_TUTOR:
             $this->tutors = true;
             break;
         case IL_CRS_MEMBER:
             $this->members = true;
             break;
         case IL_GRP_ADMIN:
             $this->admins = true;
             break;
         case IL_GRP_MEMBER:
             $this->members = true;
             break;
     }
     $rbacadmin->assignUser($this->role_data[$a_role], $a_usr_id);
     $this->addDesktopItem($a_usr_id);
     // Delete subscription request
     $this->deleteSubscriber($a_usr_id);
     include_once './Services/Membership/classes/class.ilWaitingList.php';
     ilWaitingList::deleteUserEntry($a_usr_id, $this->obj_id);
     $ilLog->write(__METHOD__ . ': Raise new event: Modules/Course addParticipant');
     $ilAppEventHandler->raise($this->getComponent(), "addParticipant", array('obj_id' => $this->obj_id, 'usr_id' => $a_usr_id, 'role_id' => $a_role));
     return true;
 }