3declare(strict_types=1);
 
   64        $this->ref_id = $ls_ref_id;
 
   65        $this->obj_id = $ls_obj_id;
 
   73        $this->local_roles = array();
 
   79            self::ROLE_LS_ADMIN . 
'_' . $this->ref_id,
 
   80            "LSO admin learning sequence obj_no." . $this->obj_id,
 
   86            self::ROLE_LS_MEMBER . 
'_' . $this->ref_id,
 
   87            "LSO member of learning sequence obj_no." . $this->obj_id,
 
   98        if (count($this->local_roles) == 0) {
 
   99            $role_ids = $this->rbacreview->getRolesOfRoleFolder(
 
  103            foreach ($role_ids as $role_id) {
 
  104                if ($this->rbacreview->isAssignable(
 
  114                        $role_name = $role->getTitle();
 
  117                    $this->local_roles[$role_name] = (int) $role->getId();
 
  128        return $local_ls_roles[self::ROLE_LS_MEMBER . 
"_" . $this->ref_id];
 
  134        return $local_ls_roles[self::ROLE_LS_ADMIN . 
"_" . $this->ref_id];
 
  139        return $this->
join($user_id, $role);
 
  142    public function join(
int $user_id, 
int $role = 
null) : bool
 
  144        if (is_null($role)) {
 
  147        $this->rbacadmin->assignUser($role, $user_id);
 
  155        if (count($member_ids) <= 1 || !in_array($this->
user->getId(), $member_ids)) {
 
  158            if (!$this->isAdmin($this->
user->getId())) {
 
  174        foreach ($roles as $role) {
 
  175            foreach ($this->rbacreview->assignedUsers($role) as $member_id) {
 
  176                array_push($users, $member_id);
 
  180        $users = array_unique($users);
 
  185    public function leave(
int $user_id) : bool
 
  187        $roles = $this->participants::getMemberRoles($this->ref_id);
 
  189        if (!is_array($roles)) {
 
  190            return $this->rbacadmin->deassignUser($roles, $user_id);
 
  193        foreach ($roles as $role) {
 
  194            $this->rbacadmin->deassignUser($role, $user_id);
 
  203        $additional_where = 
"";
 
  205        if (is_numeric($active) && $active > -1) {
 
  206            $additional_where = 
"AND active = '$active'" . PHP_EOL;
 
  210             "SELECT login, firstname, lastname, title, usr_id, last_login" . PHP_EOL
 
  211            . 
"FROM usr_data " . PHP_EOL
 
  213            . $additional_where . PHP_EOL
 
  214            . 
"ORDER BY lastname, firstname" . PHP_EOL
 
  221                "id" => $row->usr_id,
 
  222                "login" => $row->login,
 
  223                "firstname" => $row->firstname,
 
  224                "lastname" => $row->lastname,
 
  225                "last_login" => $row->last_login
 
  237        foreach ($this->rbacreview->assignedUsers($this->getDefaultAdminRole()) as $admin_id) {
 
  238            array_push($users, $admin_id);
 
  246        if (strlen($lso_id) == 0) {
 
  247            $lso_id = $this->ref_id;
 
  250        $roles = $this->rbacreview->getRolesOfRoleFolder($lso_id);
 
  252        $default_roles = array();
 
  253        foreach ($roles as $role) {
 
  256            $member = self::ROLE_LS_MEMBER . 
"_" . $lso_id;
 
  257            $admin = self::ROLE_LS_ADMIN . 
"_" . $lso_id;
 
  259            if (strcmp(
$object->getTitle(), $member) == 0) {
 
  260                $default_roles[
"lso_member_role"] = 
$object->getId();
 
  263            if (strcmp(
$object->getTitle(), $admin) == 0) {
 
  264                $default_roles[
"lso_admin_role"] = 
$object->getId();
 
  268        return $default_roles;
 
  276    public function readMemberData(array $user_ids, array $selected_columns = 
null) : array
 
  278        $portfolio_enabled = $this->
isPortfolio($selected_columns);
 
  282        if ($tracking_enabled) {
 
  284            $tracking_enabled = $olp->isActive();
 
  291        if ($privacy->enabledLearningSequenceAccessTimes()) {
 
  295        if ($portfolio_enabled) {
 
  298                $this->ctrl->getLinkTargetByClass(
"ilLearningSequenceMembershipGUI", 
"members")
 
  304        foreach ($user_ids as $usr_id) {
 
  311            $data[
'usr_id'] = $usr_id;
 
  313            $data[
'notification'] = 0;
 
  314            if ($this->participants->isNotificationEnabled($usr_id)) {
 
  315                $data[
'notification'] = 1;
 
  318            foreach ($profile_data[$usr_id] as $field => $value) {
 
  319                $data[$field] = $value;
 
  322            if ($tracking_enabled) {
 
  323                if (in_array($usr_id, $completed)) {
 
  325                } elseif (in_array($usr_id, $in_progress)) {
 
  327                } elseif (in_array($usr_id, 
$failed)) {
 
  334            if ($privacy->enabledLearningSequenceAccessTimes()) {
 
  335                if (isset($progress[$usr_id][
'ts']) and $progress[$usr_id][
'ts']) {
 
  341                    $data[
'access_time'] = $this->lng->txt(
'no_date');
 
  342                    $data[
'access_time_unix'] = 0;
 
  346            if ($portfolio_enabled) {
 
  347                $data[
'prtf'] = $portfolios[$usr_id];
 
  350            $members[$usr_id] = 
$data;
 
  369        return in_array(self::TYPE_PORTFOLIO, 
$columns);
 
  374        return $this->participants->isMember($usr_id);
 
  382        return ($tracking_active && $user_completion);
 
An exception for terminatinating execution or to throw for unit testing.
This class provides processing control methods.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
static _lookupCompletedForObject($a_obj_id, $a_user_ids=null)
Get completed users for object.
static _lookupFailedForObject($a_obj_id, $a_user_ids=null)
Get failed users for object.
static _lookupInProgressForObject($a_obj_id, $a_user_ids=null)
Get in progress users for object.
const LP_STATUS_COMPLETED
static _hasUserCompleted($a_obj_id, $a_user_id)
Lookup user object completion.
const LP_STATUS_NOT_ATTEMPTED
const LP_STATUS_IN_PROGRESS
static _lookupProgressByObjId($a_obj_id)
lookup progress for a specific object
__construct(int $ls_ref_id, int $ls_obj_id, ilLearningSequenceParticipants $participants, ilCtrl $ctrl, ilRbacAdmin $rbacadmin, ilRbacReview $rbacreview, ilDBInterface $database, ilObjUser $user)
getLearningSequenceAdminIds()
addLSMember(int $user_id, int $role)
getLearningSequenceMemberData(array $user_ids, int $active=1)
readMemberData(array $user_ids, array $selected_columns=null)
getDefaultLearningSequenceRoles(string $lso_id)
isPortfolio(array $columns=null)
isCompletedByUser(int $usr_id)
join(int $user_id, int $role=null)
getRoleObject(int $obj_id)
getLearningSequenceMemberIds()
getLocalLearningSequenceRoles(bool $translate=false)
static getAvailablePortfolioLinksForUserIds(array $a_owner_ids, $a_back_url=null)
static _getTranslation($a_role_title)
static createDefaultRole($a_title, $a_description, $a_tpl_name, $a_ref_id)
static _enabledLearningProgress()
check wether learing progress is enabled or not
static _enabledUserRelatedData()
check wether user related tracking is enabled or not
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
static _readUsersProfileData($a_user_ids)
STATIC METHOD get user data of selected users.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static getInstance($a_obj_id)
static _getInstance()
Get instance of ilPrivacySettings.
Class ilRbacAdmin Core functions for role based access control.
class ilRbacReview Contains Review functions of core Rbac.
static quoteArray($a_array)
Quotes all members of an array for usage in DB query statement.