3 declare(strict_types=1);
69 $this->local_roles = array();
75 self::ROLE_LS_ADMIN .
'_' . $this->object->getRefId(),
76 "LSO admin learning sequence obj_no." . $this->
object->getId(),
78 $this->
object->getRefId()
82 self::ROLE_LS_MEMBER .
'_' . $this->object->getRefId(),
83 "LSO member of learning sequence obj_no." . $this->
object->getId(),
85 $this->
object->getRefId()
94 if (count($this->local_roles) == 0) {
95 $role_ids = $this->rbacreview->getRolesOfRoleFolder(
96 $this->object->getRefId()
99 foreach ($role_ids as $role_id) {
100 if ($this->rbacreview->isAssignable(
102 $this->object->getRefId()
110 $role_name = $role->getTitle();
113 $this->local_roles[$role_name] = (int) $role->getId();
124 return $local_ls_roles[self::ROLE_LS_MEMBER .
"_" . $this->
object->getRefId()];
130 return $local_ls_roles[self::ROLE_LS_ADMIN .
"_" . $this->
object->getRefId()];
135 return $this->
join($user_id, $role);
138 public function join(
int $user_id, $roles) : bool
140 if (is_array($roles)) {
141 foreach ($roles as $role) {
142 $this->rbacadmin->assignUser($role, $user_id,
false);
145 $this->rbacadmin->assignUser($roles, $user_id,
false);
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);
185 public function leave(
int $user_id) : bool
187 $roles = $this->participants::getMemberRoles($this->object->getRefId());
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 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->
object->getRefId();
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->object->getLSParticipants()->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);
static _lookupLogin($a_user_id)
lookup login
__construct(ilObjLearningSequence $object, ilLearningSequenceParticipants $participants, ilCtrl $ctrl, ilRbacAdmin $rbacadmin, ilRbacReview $rbacreview, ilDBInterface $database, ilObjUser $user)
static _lookupName($a_user_id)
lookup user name
dropDesktopItem($a_item_id, $a_type)
drop an item from user's personal desktop
This class provides processing control methods.
Class ilObjLearningSequence.
getLocalLearningSequenceRoles(bool $translate=false)
const LP_STATUS_NOT_ATTEMPTED
static _lookupFailedForObject($a_obj_id, $a_user_ids=null)
Get failed users for object.
getLearningSequenceMemberData(array $user_ids, int $active=1)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static _readUsersProfileData($a_user_ids)
STATIC METHOD get user data of selected users.
const LP_STATUS_IN_PROGRESS
getDefaultLearningSequenceRoles(string $lso_id)
static createDefaultRole($a_title, $a_description, $a_tpl_name, $a_ref_id)
static _enabledUserRelatedData()
check wether user related tracking is enabled or not
static _enabledLearningProgress()
check wether learing progress is enabled or not
static _lookupProgressByObjId($a_obj_id)
lookup progress for a specific object
readMemberData(array $user_ids, array $selected_columns=null)
getLearningSequenceMemberIds()
static getAvailablePortfolioLinksForUserIds(array $a_owner_ids, $a_back_url=null)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _getTranslation($a_role_title)
static _lookupInProgressForObject($a_obj_id, $a_user_ids=null)
Get in progress users for object.
addLSMember(int $user_id, int $role)
isPortfolio(array $columns=null)
static quoteArray($a_array)
Quotes all members of an array for usage in DB query statement.
join(int $user_id, $roles)
getLearningSequenceAdminIds()
static _getInstance()
Get instance of ilPrivacySettings.
Class ilRbacAdmin Core functions for role based access control.
static _lookupCompletedForObject($a_obj_id, $a_user_ids=null)
Get completed users for object.
const LP_STATUS_COMPLETED
static getInstance($a_obj_id)
getRoleObject(int $obj_id)
class ilRbacReview Contains Review functions of core Rbac.