/** * Get item properties * * @return array array of property arrays: * "alert" (boolean) => display as an alert property (usually in red) * "property" (string) => property name * "value" (string) => property value */ function getProperties() { global $lng, $rbacsystem, $ilUser; // BEGIN WebDAV get parent properties $props = parent::getProperties(); // END WebDAV get parent properties include_once './Modules/Course/classes/class.ilObjCourseAccess.php'; $info = ilObjGroupAccess::lookupRegistrationInfo($this->obj_id); //var_dump($info); if ($info['reg_info_list_prop']) { $props[] = array('alert' => false, 'newline' => true, 'property' => $info['reg_info_list_prop']['property'], 'value' => $info['reg_info_list_prop']['value']); } if ($info['reg_info_list_prop_limit']) { $props[] = array('alert' => false, 'newline' => false, 'property' => $info['reg_info_list_prop_limit']['property'], 'propertyNameVisible' => strlen($info['reg_info_list_prop_limit']['property']) ? true : false, 'value' => $info['reg_info_list_prop_limit']['value']); } // waiting list include_once './Modules/Group/classes/class.ilGroupWaitingList.php'; if (ilGroupWaitingList::_isOnList($ilUser->getId(), $this->obj_id)) { $props[] = array("alert" => true, "property" => $lng->txt('member_status'), "value" => $lng->txt('on_waiting_list')); } return $props; }
/** * check whether goto script will succeed */ function _checkGoto($a_target) { global $ilAccess, $ilUser; $t_arr = explode("_", $a_target); // registration codes if (substr($t_arr[2], 0, 5) == 'rcode' and $ilUser->getId() != ANONYMOUS_USER_ID) { self::$using_code = true; return true; } if ($t_arr[0] != "grp" || (int) $t_arr[1] <= 0) { return false; } if ($ilAccess->checkAccess("read", "", $t_arr[1]) || $ilAccess->checkAccess("visible", "", $t_arr[1])) { return true; } return false; }
/** * @see ilMembershipRegistrationCodes::register() * @param int user_id * @param int role * @param bool force registration and do not check registration constraints. */ public function register($a_user_id, $a_role = IL_GRP_MEMBER, $a_force_registration = false) { include_once './Services/Membership/exceptions/class.ilMembershipRegistrationException.php'; include_once "./Modules/Group/classes/class.ilGroupParticipants.php"; $part = ilGroupParticipants::_getInstanceByObjId($this->getId()); if ($part->isAssigned($a_user_id)) { return true; } if (!$a_force_registration) { // Availability include_once './Modules/Group/classes/class.ilObjGroupAccess.php'; if (!ilObjGroupAccess::_registrationEnabled($this->getId())) { $this->lng->loadLanguageModule('crs'); throw new ilMembershipRegistrationException('456', $this->getRefId()); } // Max members if (!$this->isRegistrationUnlimited()) { $free = max(0, $this->getMaxMembers() - $part->getCountMembers()); include_once './Modules/Group/classes/class.ilGroupWaitingList.php'; $waiting_list = new ilGroupWaitingList($this->getId()); if ($this->isWaitingListEnabled() and (!$free or $waiting_list->getCountUsers())) { throw new ilMembershipRegistrationException('123', $this->getRefId()); } } } $part->add($a_user_id, $a_role); $part->sendNotification($part->TYPE_NOTIFICATION_REGISTRATION, $a_user_id); return true; }
/** * @see ilMembershipRegistrationCodes::register() * @param int user_id * @param int role * @param bool force registration and do not check registration constraints. */ public function register($a_user_id, $a_role = IL_GRP_MEMBER, $a_force_registration = false) { include_once './Services/Membership/exceptions/class.ilMembershipRegistrationException.php'; include_once "./Modules/Group/classes/class.ilGroupParticipants.php"; $part = ilGroupParticipants::_getInstanceByObjId($this->getId()); if ($part->isAssigned($a_user_id)) { return true; } if (!$a_force_registration) { // Availability if (!$this->isRegistrationEnabled()) { include_once './Modules/Group/classes/class.ilObjGroupAccess.php'; if (!ilObjGroupAccess::_usingRegistrationCode()) { throw new ilMembershipRegistrationException('Cant registrate to group ' . $this->getId() . ', group subscription is deactivated.', '456'); } } // Time Limitation if (!$this->isRegistrationUnlimited()) { $start = $this->getRegistrationStart(); $end = $this->getRegistrationEnd(); $time = new ilDateTime(time(), IL_CAL_UNIX); if (!(ilDateTime::_after($time, $start) and ilDateTime::_before($time, $end))) { throw new ilMembershipRegistrationException('Cant registrate to group ' . $this->getId() . ', group is out of registration time.', '789'); } } // Max members if ($this->isMembershipLimited()) { $free = max(0, $this->getMaxMembers() - $part->getCountMembers()); include_once './Modules/Group/classes/class.ilGroupWaitingList.php'; $waiting_list = new ilGroupWaitingList($this->getId()); if ($this->isWaitingListEnabled() and (!$free or $waiting_list->getCountUsers())) { $this->lng->loadLanguageModule("grp"); $waiting_list->addToList($a_user_id); $info = sprintf($this->lng->txt('grp_added_to_list'), $this->getTitle(), $waiting_list->getPosition($a_user_id)); include_once './Modules/Group/classes/class.ilGroupParticipants.php'; include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php'; $participants = ilGroupParticipants::_getInstanceByObjId($this->getId()); $participants->sendNotification(ilGroupMembershipMailNotification::TYPE_WAITING_LIST_MEMBER, $a_user_id); throw new ilMembershipRegistrationException($info, '124'); } if (!$free or $waiting_list->getCountUsers()) { throw new ilMembershipRegistrationException('Cant registrate to group ' . $this->getId() . ', membership is limited.', '123'); } } } $part->add($a_user_id, $a_role); $part->sendNotification($part->TYPE_NOTIFICATION_REGISTRATION, $a_user_id); return true; }