19 declare(strict_types=1);
    51         self::START_PD_OVERVIEW => 
'ilias.php?baseClass=ilDashboardGUI&cmd=jumpToSelectedItems',
    52         self::START_PD_SUBSCRIPTION => 
'ilias.php?baseClass=ilMembershipOverviewGUI',
    53         self::START_PD_WORKSPACE => 
'ilias.php?baseClass=ilDashboardGUI&cmd=jumpToWorkspace',
    54         self::START_PD_CALENDAR => 
'ilias.php?baseClass=ilDashboardGUI&cmd=jumpToCalendar',
    64         private readonly 
ilTree $tree,
    72             ilMyStaffAccess::getInstance()
    73         ))->hasCurrentUserAccessToMyStaff();
    82         $query = 
'SELECT * FROM usr_starting_point WHERE id = ' . $this->db->quote($id, 
'integer');
    83         $res = $this->db->query($query);
    84         $starting_point_array = $this->db->fetchAssoc(
$res);
    86         if ($starting_point_array === null) {
    92             return $default_starting_point;
    97             $starting_point_array[
'starting_point'],
    98             $starting_point_array[
'starting_object'],
    99             $starting_point_array[
'position'],
   100             $starting_point_array[
'rule_type'],
   101             $starting_point_array[
'rule_options'],
   102             $starting_point_array[
'calendar_view'],
   103             $starting_point_array[
'calendar_period']
   112         $query = 
'SELECT * FROM usr_starting_point';
   113         $res = $this->db->query($query);
   114         $starting_points = [];
   115         while ($starting_point_array = $this->db->fetchAssoc(
$res)) {
   117                 $starting_point_array[
'id'],
   118                 $starting_point_array[
'starting_point'],
   119                 $starting_point_array[
'starting_object'],
   120                 $starting_point_array[
'position'],
   121                 $starting_point_array[
'rule_type'],
   122                 $starting_point_array[
'rule_options'],
   123                 $starting_point_array[
'calendar_view'],
   124                 $starting_point_array[
'calendar_period']
   127             $starting_points[] = $starting_point;
   130         return $starting_points;
   135         return self::DEFAULT_STARTING_POINT_ID;
   140         return self::USER_STARTING_POINT_ID;
   146             if ($role_id === $role->
getId()
   148                 || !($maybe_deleted_role instanceof 
ilObjRole)
   150                 $this->
delete(
$data[
'id']);
   160         $query = 
'SELECT * FROM usr_starting_point WHERE rule_options LIKE %s ORDER BY position ASC';
   161         $res = $this->db->queryF($query, [
'text'], [
'%role_id%']);
   164         while ($sp = $this->db->fetchAssoc(
$res)) {
   165             $options = unserialize($sp[
'rule_options']);
   167             $roles[(
int) $options[
'role_id']] = [
   168                 'id' => (
int) $sp[
'id'],
   169                 'starting_point' => (
int) $sp[
'starting_point'],
   170                 'starting_object' => (
int) $sp[
'starting_object'],
   171                 'calendar_view' => (
int) $sp[
'calendar_view'],
   172                 'calendar_period' => (
int) $sp[
'calendar_period'],
   173                 'position' => (
int) $sp[
'position'],
   174                 'role_id' => (
int) $options[
'role_id'],
   183         $global_roles = $this->rbac_review->getGlobalRoles();
   186         $ids_roles_with_sp = [];
   187         foreach ($roles_with_starting_point as $role) {
   188             $ids_roles_with_sp[] = $role[
'role_id'];
   191         $ids_roles_without_sp = array_diff($global_roles, $ids_roles_with_sp);
   194         foreach ($ids_roles_without_sp as $roleid) {
   200                 'id' => $role_obj->getId(),
   201                 'title' => $role_obj->getTitle(),
   216         $position = $max_position + 10;
   218         $next_id = $this->db->nextId(
'usr_starting_point');
   230         $this->db->manipulateF(
   231             'INSERT INTO usr_starting_point (id, starting_point, starting_object, position, rule_type, rule_options, calendar_view, calendar_period) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)',
   256         $this->db->manipulateF(
   257             'UPDATE usr_starting_point   258                         SET starting_point = %s,   259                                 starting_object = %s,   284                 $starting_point->
getId()
   289     public function delete(
int $starting_point_id): 
void   291         $query = 
'DELETE FROM usr_starting_point WHERE id = ' . $this->db->quote($starting_point_id, 
'integer');
   292         $this->db->manipulate($query);
   298         $result = $this->db->query(
'SELECT max(position) as max_order FROM usr_starting_point');
   301         while ($row = $this->db->fetchAssoc($result)) {
   302             $order_val = (
int) $row[
'max_order'];
   311         foreach ($a_items as $v) {
   312             $v[
'starting_position'] = $ord_const;
   313             $rearranged[$ord_const] = $v;
   323         foreach ($a_items as 
$id => $position) {
   324             if ($position > self::ORDER_POSITION_MIN && $position < self::ORDER_POSITION_MAX) {
   325                 $this->db->manipulate(
   326                     'UPDATE usr_starting_point SET' .
   327                     ' position = ' . $this->db->quote($nr, 
'integer') .
   328                     ' WHERE id = ' . $this->db->quote(
$id, 
'integer')
   339         $all[self::START_PD_OVERVIEW] = 
'mm_dashboard';
   340         $all[self::START_PD_SUBSCRIPTION] = 
'my_courses_groups';
   342         if ($this->current_user_has_access_to_my_staff) {
   343             $all[self::START_PD_MYSTAFF] = 
'my_staff';
   346         if ($force_all || !$this->
settings->get(
'disable_personal_workspace')) {
   347             $all[self::START_PD_WORKSPACE] = 
'mm_personal_and_shared_r';
   350         if ($force_all || $calendar_settings->isEnabled()) {
   351             $all[self::START_PD_CALENDAR] = 
'calendar';
   354         $all[self::START_REPOSITORY] = 
'obj_root';
   355         $all[self::START_REPOSITORY_OBJ] = 
'adm_user_starting_point_object';
   363         $current = (
int) $this->
settings->get(
'usr_starting_point');
   364         if (!$current || !in_array($current, 
$valid)) {
   369             || !$this->
user->getId()) {
   370             $current = self::START_REPOSITORY;
   377         if ($this->
settings->get(
'disable_my_offers') === 
'0' &&
   378             $this->
settings->get(
'disable_my_memberships') === 
'0' &&
   379             $this->
settings->get(
'personal_items_default_view') === 
'1') {
   380             return self::START_PD_SUBSCRIPTION;
   383         return self::START_PD_OVERVIEW;
   392         if (in_array($starting_point_type, $valid_starting_points)) {
   393             $this->
settings->set(
'usr_starting_point', (
string) $starting_point_type);
   410         if ($starting_point[
'type'] === self::START_REPOSITORY_OBJ
   412                 $starting_point[
'object'] === null
   414                 || $this->tree->isDeleted($starting_point[
'object'])
   415                 || !$this->rbac_system->checkAccessOfUser(
   416                     $this->
user->getId(),
   418                     $starting_point[
'object']
   422             $this->log->root()->debug(sprintf(
'Permission to Starting Point Denied. Starting Point Type: %s.', $starting_point[
'type']));
   423             $starting_point[
'type'] = self::START_REPOSITORY;
   426         if ($starting_point[
'type'] === self::START_REPOSITORY
   427                 && !$this->rbac_system->checkAccessOfUser(
   428                     $this->user->getId(),
   430                     $this->tree->getRootId()
   432             || $starting_point[
'type'] === self::START_PD_CALENDAR
   435             $this->log->root()->debug(sprintf(
'Permission to Starting Point Denied. Starting Point Type: %s.', $starting_point[
'type']));
   439         if ($starting_point[
'type'] === self::START_REPOSITORY) {
   440             $starting_point[
'object'] = $this->tree->getRootId();
   459                 'type' => $role[
'starting_point'],
   460                 'object' => $role[
'starting_object'],
   461                 'cal_view' => $role[
'calendar_view'],
   462                 'cal_period' => $role[
'calendar_period']
   477         $role_ids = array_keys($roles);
   478         foreach ($role_ids as $role_id) {
   479             if ($this->rbac_review->isAssigned($user_id, $role_id)) {
   480                 return $roles[$role_id];
   488         $type = $starting_point[
'type'];
   489         if ($type === self::START_REPOSITORY
   490             || $type === self::START_REPOSITORY_OBJ) {
   494         $url = self::URL_LINKS_BY_TYPE[$type];
   495         if ($type == self::START_PD_CALENDAR) {
   496             $cal_view = $starting_point[
'cal_view'] ?? 
'';
   497             $cal_period = $starting_point[
'cal_period'] ?? 
'';
   498             $calendar_string = 
'';
   499             if (!empty($cal_view) && !empty($cal_period)) {
   500                 $calendar_string = 
'&cal_view=' . $cal_view . 
'&cal_agenda_per=' . $cal_period;
   502             $url .= $calendar_string;
   510         return (
int) $this->
settings->get(
'usr_starting_point_ref_id');
   518         return (
int) $this->
settings->get(
'user_calendar_view');
   526         return (
int) $this->
settings->get(
'user_cal_period');
   534         $this->
settings->set(
'usr_starting_point_personal', $value ? 
'1' : 
'0');
   539         return $this->
settings->get(
'usr_starting_point_personal') === 
'1' ? true : 
false;
   547         return (
bool) $this->
user->getPref(
'usr_starting_point');
   556         $current = $this->
user->getPref(
'usr_starting_point');
   557         if ($current !== null
   558             && in_array((
int) $current, 
$valid)) {
   559             return (
int) $current;
   569         int $starting_point_type,
   572         if ($starting_point_type === 0) {
   573             $this->
user->setPref(
'usr_starting_point', null);
   574             $this->
user->setPref(
'usr_starting_point_ref_id', null);
   578         if ($starting_point_type === self::START_REPOSITORY_OBJ) {
   580                 !$this->tree->isDeleted(
$ref_id)) {
   581                 $this->
user->setPref(
'usr_starting_point', (
string) $starting_point_type);
   582                 $this->
user->setPref(
'usr_starting_point_ref_id', (
string) 
$ref_id);
   587         if (in_array($starting_point_type, 
$valid)) {
   588             $this->
user->setPref(
'usr_starting_point', (
string) $starting_point_type);
   599         $personal_starting_object = $this->
user->getPref(
'usr_starting_point_ref_id');
   600         if ($personal_starting_object !== null) {
   601             return (
int) $personal_starting_object;
 const USER_STARTING_POINT_ID
 
reArrangePositions(array $a_items)
 
getSystemDefaultStartingObject()
 
getValidAndAccessibleStartingPointAsUrl()
 
getDefaultStartingPointID()
 
getSystemDefaultCalendarView()
Get specific view of calendar starting point. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
getFirstRoleWithStartingPointForUserId(int $user_id)
 
saveOrder(array $a_items)
 
Provides fluid interface to LoggingServices. 
 
getLinkUrlByStartingPointTypeInfo(array $starting_point)
 
__construct(private readonly ilObjUser $user, private readonly ilDBInterface $db, private readonly LoggingServices $log, private readonly ilTree $tree, private readonly ilRbacReview $rbac_review, private readonly ilRbacSystem $rbac_system, private readonly ilSetting $settings)
 
onRoleDeleted(ilObjRole $role)
 
const CMD_JUMP_TO_MY_STAFF
 
getSystemDefaultStartingPointType()
 
getPossibleStartingPoints(bool $force_all=false)
 
isCurrentUserPersonalStartingPointEnabled()
Did user set any personal starting point (yet)? 
 
static _lookupObjId(int $ref_id)
 
getApplicableStartingPointTypeInfo()
 
update(ilUserStartingPoint $starting_point)
update starting point 
 
getFallbackStartingPointType()
 
togglePersonalStartingPointActivation(bool $value)
Toggle personal starting point setting. 
 
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data 
 
getCurrentUserPersonalStartingObject()
Get ref id of personal starting object. 
 
const START_REPOSITORY_OBJ
 
isPersonalStartingPointEnabled()
 
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
 
getStartingPointById(?int $id)
 
save(ilUserStartingPoint $starting_point)
 
getSystemDefaultCalendarPeriod()
Get time frame of calendar view. 
 
const DEFAULT_STARTING_POINT_ID
 
getCurrentUserPersonalStartingPoint()
Get current personal starting point. 
 
bool $current_user_has_access_to_my_staff
 
setSystemDefaultStartingPoint(ilUserStartingPoint $starting_point)
 
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id 
 
getRolesWithStartingPoint()
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
setCurrentUserPersonalStartingPoint(int $starting_point_type, int $ref_id=null)
Set personal starting point setting. 
 
getCalendarView()
Gets calendar view. 
 
getGlobalRolesWithoutStartingPoint()
 
const START_PD_SUBSCRIPTION