ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilUserStartingPointRepository Class Reference
+ Collaboration diagram for ilUserStartingPointRepository:

Public Member Functions

 __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)
 
 getStartingPointById (?int $id)
 
 getStartingPoints ()
 
 getDefaultStartingPointID ()
 
 getUserStartingPointID ()
 
 onRoleDeleted (ilObjRole $role)
 
 getGlobalRolesWithoutStartingPoint ()
 
 save (ilUserStartingPoint $starting_point)
 
 update (ilUserStartingPoint $starting_point)
 update starting point More...
 
 delete (int $starting_point_id)
 
 getMaxPosition ()
 
 reArrangePositions (array $a_items)
 
 saveOrder (array $a_items)
 
 getPossibleStartingPoints (bool $force_all=false)
 
 getSystemDefaultStartingPointType ()
 
 getValidAndAccessibleStartingPointAsUrl ()
 
 getSystemDefaultStartingObject ()
 
 getSystemDefaultCalendarView ()
 Get specific view of calendar starting point. More...
 
 getSystemDefaultCalendarPeriod ()
 Get time frame of calendar view. More...
 
 togglePersonalStartingPointActivation (bool $value)
 Toggle personal starting point setting. More...
 
 isPersonalStartingPointEnabled ()
 
 isCurrentUserPersonalStartingPointEnabled ()
 Did user set any personal starting point (yet)? More...
 
 getCurrentUserPersonalStartingPoint ()
 Get current personal starting point. More...
 
 setCurrentUserPersonalStartingPoint (int $starting_point_type, ?int $ref_id=null)
 Set personal starting point setting. More...
 
 getCurrentUserPersonalStartingObject ()
 Get ref id of personal starting object. More...
 

Data Fields

const START_PD_CALENDAR = 10
 
const START_REPOSITORY_OBJ = 16
 

Private Member Functions

 getRolesWithStartingPoint ()
 
 getFallbackStartingPointType ()
 
 setSystemDefaultStartingPoint (ilUserStartingPoint $starting_point)
 
 getApplicableStartingPointTypeInfo ()
 
 getFirstRoleWithStartingPointForUserId (int $user_id)
 
 getLinkUrlByStartingPointTypeInfo (array $starting_point)
 

Private Attributes

const START_PD_OVERVIEW = 1
 
const START_PD_SUBSCRIPTION = 2
 
const START_PD_NOTES = 4
 
const START_PD_NEWS = 5
 
const START_PD_WORKSPACE = 6
 
const START_PD_PORTFOLIO = 7
 
const START_PD_SKILLS = 8
 
const START_PD_LP = 9
 
const START_PD_MAIL = 11
 
const START_PD_CONTACTS = 12
 
const START_PD_PROFILE = 13
 
const START_PD_SETTINGS = 14
 
const START_REPOSITORY = 15
 
const START_PD_MYSTAFF = 17
 
const ORDER_POSITION_MIN = 0
 
const ORDER_POSITION_MAX = 9999
 
const USER_STARTING_POINT_ID = -1
 
const DEFAULT_STARTING_POINT_ID = 0
 
const URL_LINKS_BY_TYPE
 
bool $current_user_has_access_to_my_staff
 

Detailed Description

Definition at line 25 of file class.ilUserStartingPointRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ilUserStartingPointRepository::__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 
)

Definition at line 60 of file class.ilUserStartingPointRepository.php.

References $DIC.

68  {
69  global $DIC;
70  $this->current_user_has_access_to_my_staff = (new ilMyStaffCachedAccessDecorator(
71  $DIC,
72  ilMyStaffAccess::getInstance()
73  ))->hasCurrentUserAccessToMyStaff();
74  }
global $DIC
Definition: shib_login.php:22

Member Function Documentation

◆ delete()

ilUserStartingPointRepository::delete ( int  $starting_point_id)

Definition at line 289 of file class.ilUserStartingPointRepository.php.

289  : void
290  {
291  $query = 'DELETE FROM usr_starting_point WHERE id = ' . $this->db->quote($starting_point_id, 'integer');
292  $this->db->manipulate($query);
293  }

◆ getApplicableStartingPointTypeInfo()

ilUserStartingPointRepository::getApplicableStartingPointTypeInfo ( )
private

Definition at line 446 of file class.ilUserStartingPointRepository.php.

References getCurrentUserPersonalStartingObject(), getCurrentUserPersonalStartingPoint(), getFirstRoleWithStartingPointForUserId(), getSystemDefaultCalendarPeriod(), getSystemDefaultCalendarView(), getSystemDefaultStartingObject(), getSystemDefaultStartingPointType(), isPersonalStartingPointEnabled(), and ILIAS\Repository\user().

Referenced by getValidAndAccessibleStartingPointAsUrl().

446  : array
447  {
448  if ($this->isPersonalStartingPointEnabled()
449  && $this->getCurrentUserPersonalStartingPoint() !== 0) {
450  return [
451  'type' => $this->getCurrentUserPersonalStartingPoint(),
452  'object' => $this->getCurrentUserPersonalStartingObject()
453  ];
454  }
455 
456  $role = $this->getFirstRoleWithStartingPointForUserId($this->user->getId());
457  if ($role !== []) {
458  return [
459  'type' => $role['starting_point'],
460  'object' => $role['starting_object'],
461  'cal_view' => $role['calendar_view'],
462  'cal_period' => $role['calendar_period']
463  ];
464  }
465 
466  return [
467  'type' => $this->getSystemDefaultStartingPointType(),
468  'object' => $this->getSystemDefaultStartingObject(),
469  'cal_view' => $this->getSystemDefaultCalendarView(),
470  'cal_period' => $this->getSystemDefaultCalendarPeriod()
471  ];
472  }
getSystemDefaultCalendarView()
Get specific view of calendar starting point.
getCurrentUserPersonalStartingObject()
Get ref id of personal starting object.
getSystemDefaultCalendarPeriod()
Get time frame of calendar view.
getCurrentUserPersonalStartingPoint()
Get current personal starting point.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCurrentUserPersonalStartingObject()

ilUserStartingPointRepository::getCurrentUserPersonalStartingObject ( )

Get ref id of personal starting object.

Definition at line 597 of file class.ilUserStartingPointRepository.php.

References null, and ILIAS\Repository\user().

Referenced by getApplicableStartingPointTypeInfo().

597  : ?int
598  {
599  $personal_starting_object = $this->user->getPref('usr_starting_point_ref_id');
600  if ($personal_starting_object !== null) {
601  return (int) $personal_starting_object;
602  }
603 
604  return null;
605  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCurrentUserPersonalStartingPoint()

ilUserStartingPointRepository::getCurrentUserPersonalStartingPoint ( )

Get current personal starting point.

Definition at line 553 of file class.ilUserStartingPointRepository.php.

References $valid, getPossibleStartingPoints(), null, and ILIAS\Repository\user().

Referenced by getApplicableStartingPointTypeInfo().

553  : int
554  {
555  $valid = array_keys($this->getPossibleStartingPoints());
556  $current = $this->user->getPref('usr_starting_point');
557  if ($current !== null
558  && in_array((int) $current, $valid)) {
559  return (int) $current;
560  }
561 
562  return 0;
563  }
$valid
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDefaultStartingPointID()

ilUserStartingPointRepository::getDefaultStartingPointID ( )

Definition at line 133 of file class.ilUserStartingPointRepository.php.

Referenced by save(), and update().

133  : int
134  {
135  return self::DEFAULT_STARTING_POINT_ID;
136  }
+ Here is the caller graph for this function:

◆ getFallbackStartingPointType()

ilUserStartingPointRepository::getFallbackStartingPointType ( )
private

Definition at line 375 of file class.ilUserStartingPointRepository.php.

References ILIAS\Repository\settings().

Referenced by getSystemDefaultStartingPointType(), and getValidAndAccessibleStartingPointAsUrl().

375  : int
376  {
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;
381  }
382 
383  return self::START_PD_OVERVIEW;
384  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFirstRoleWithStartingPointForUserId()

ilUserStartingPointRepository::getFirstRoleWithStartingPointForUserId ( int  $user_id)
private

Definition at line 474 of file class.ilUserStartingPointRepository.php.

References getRolesWithStartingPoint().

Referenced by getApplicableStartingPointTypeInfo().

474  : array
475  {
476  $roles = $this->getRolesWithStartingPoint();
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];
481  }
482  }
483  return [];
484  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGlobalRolesWithoutStartingPoint()

ilUserStartingPointRepository::getGlobalRolesWithoutStartingPoint ( )

Definition at line 181 of file class.ilUserStartingPointRepository.php.

References ANONYMOUS_ROLE_ID, and getRolesWithStartingPoint().

181  : array
182  {
183  $global_roles = $this->rbac_review->getGlobalRoles();
184  $roles_with_starting_point = $this->getRolesWithStartingPoint();
185 
186  $ids_roles_with_sp = [];
187  foreach ($roles_with_starting_point as $role) {
188  $ids_roles_with_sp[] = $role['role_id'];
189  }
190 
191  $ids_roles_without_sp = array_diff($global_roles, $ids_roles_with_sp);
192 
193  $roles = [];
194  foreach ($ids_roles_without_sp as $roleid) {
195  if ($roleid === ANONYMOUS_ROLE_ID) {
196  continue;
197  }
198  $role_obj = new ilObjRole($roleid);
199  $roles[] = [
200  'id' => $role_obj->getId(),
201  'title' => $role_obj->getTitle(),
202  ];
203  }
204 
205  return $roles;
206  }
Class ilObjRole.
const ANONYMOUS_ROLE_ID
Definition: constants.php:28
+ Here is the call graph for this function:

◆ getLinkUrlByStartingPointTypeInfo()

ilUserStartingPointRepository::getLinkUrlByStartingPointTypeInfo ( array  $starting_point)
private

Definition at line 486 of file class.ilUserStartingPointRepository.php.

References $url, and ilLink\_getStaticLink().

Referenced by getValidAndAccessibleStartingPointAsUrl().

486  : string
487  {
488  $type = $starting_point['type'];
489  if ($type === self::START_REPOSITORY
490  || $type === self::START_REPOSITORY_OBJ) {
491  return ilLink::_getStaticLink($starting_point['object'], '', true);
492  }
493 
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;
501  }
502  $url .= $calendar_string;
503  }
504 
505  return $url;
506  }
$url
Definition: shib_logout.php:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMaxPosition()

ilUserStartingPointRepository::getMaxPosition ( )

Definition at line 295 of file class.ilUserStartingPointRepository.php.

References ILIAS\Repository\int().

Referenced by save().

295  : int
296  {
297  //get max order number
298  $result = $this->db->query('SELECT max(position) as max_order FROM usr_starting_point');
299 
300  $order_val = 0;
301  while ($row = $this->db->fetchAssoc($result)) {
302  $order_val = (int) $row['max_order'];
303  }
304  return $order_val;
305  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPossibleStartingPoints()

ilUserStartingPointRepository::getPossibleStartingPoints ( bool  $force_all = false)

Definition at line 335 of file class.ilUserStartingPointRepository.php.

References ilCalendarSettings\_getInstance(), and ILIAS\Repository\settings().

Referenced by getCurrentUserPersonalStartingPoint(), getSystemDefaultStartingPointType(), setCurrentUserPersonalStartingPoint(), and setSystemDefaultStartingPoint().

335  : array //checked
336  {
337  $all = [];
338 
339  $all[self::START_PD_OVERVIEW] = 'mm_dashboard';
340  $all[self::START_PD_SUBSCRIPTION] = 'my_courses_groups';
341 
342  if ($this->current_user_has_access_to_my_staff) {
343  $all[self::START_PD_MYSTAFF] = 'my_staff';
344  }
345 
346  if ($force_all || !$this->settings->get('disable_personal_workspace')) {
347  $all[self::START_PD_WORKSPACE] = 'mm_personal_and_shared_r';
348  }
349  $calendar_settings = ilCalendarSettings::_getInstance();
350  if ($force_all || $calendar_settings->isEnabled()) {
351  $all[self::START_PD_CALENDAR] = 'calendar';
352  }
353 
354  $all[self::START_REPOSITORY] = 'obj_root';
355  $all[self::START_REPOSITORY_OBJ] = 'adm_user_starting_point_object';
356 
357  return $all;
358  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRolesWithStartingPoint()

ilUserStartingPointRepository::getRolesWithStartingPoint ( )
private
Returns
array<int, array{"id": int, "starting_point": int, "starting_object": int, "calendar_view": int, "calendar_period": int, "position": int, "role_id": int}>

Definition at line 158 of file class.ilUserStartingPointRepository.php.

References $res, and ILIAS\Repository\int().

Referenced by getFirstRoleWithStartingPointForUserId(), getGlobalRolesWithoutStartingPoint(), and onRoleDeleted().

158  : array
159  {
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%']);
162 
163  $roles = [];
164  while ($sp = $this->db->fetchAssoc($res)) {
165  $options = unserialize($sp['rule_options']);
166 
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'],
175 
176  ];
177  }
178  return $roles;
179  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStartingPointById()

ilUserStartingPointRepository::getStartingPointById ( ?int  $id)

Definition at line 76 of file class.ilUserStartingPointRepository.php.

References $res, getSystemDefaultCalendarPeriod(), getSystemDefaultCalendarView(), getSystemDefaultStartingObject(), getSystemDefaultStartingPointType(), and null.

77  {
78  if ($id === null) {
79  return new ilUserStartingPoint($id);
80  }
81 
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);
85 
86  if ($starting_point_array === null) {
87  $default_starting_point = new ilUserStartingPoint(self::DEFAULT_STARTING_POINT_ID);
88  $default_starting_point->setStartingPointType($this->getSystemDefaultStartingPointType());
89  $default_starting_point->setStartingObject($this->getSystemDefaultStartingObject());
90  $default_starting_point->setCalendarView($this->getSystemDefaultCalendarView());
91  $default_starting_point->setCalendarPeriod($this->getSystemDefaultCalendarPeriod());
92  return $default_starting_point;
93  }
94 
95  return new ilUserStartingPoint(
96  $id,
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']
104  );
105  }
$res
Definition: ltiservices.php:66
getSystemDefaultCalendarView()
Get specific view of calendar starting point.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getSystemDefaultCalendarPeriod()
Get time frame of calendar view.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ getStartingPoints()

ilUserStartingPointRepository::getStartingPoints ( )
Returns
array<ilUserStartingPoint>

Definition at line 110 of file class.ilUserStartingPointRepository.php.

References $res.

110  : array
111  {
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)) {
116  $starting_point = new ilUserStartingPoint(
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']
125  );
126 
127  $starting_points[] = $starting_point;
128  }
129 
130  return $starting_points;
131  }
$res
Definition: ltiservices.php:66

◆ getSystemDefaultCalendarPeriod()

ilUserStartingPointRepository::getSystemDefaultCalendarPeriod ( )

Get time frame of calendar view.

Definition at line 524 of file class.ilUserStartingPointRepository.php.

References ILIAS\Repository\settings().

Referenced by getApplicableStartingPointTypeInfo(), and getStartingPointById().

524  : int
525  {
526  return (int) $this->settings->get('user_cal_period');
527  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSystemDefaultCalendarView()

ilUserStartingPointRepository::getSystemDefaultCalendarView ( )

Get specific view of calendar starting point.

Definition at line 516 of file class.ilUserStartingPointRepository.php.

References ILIAS\Repository\settings().

Referenced by getApplicableStartingPointTypeInfo(), and getStartingPointById().

516  : int
517  {
518  return (int) $this->settings->get('user_calendar_view');
519  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSystemDefaultStartingObject()

ilUserStartingPointRepository::getSystemDefaultStartingObject ( )

Definition at line 508 of file class.ilUserStartingPointRepository.php.

References ILIAS\Repository\settings().

Referenced by getApplicableStartingPointTypeInfo(), and getStartingPointById().

508  : int
509  {
510  return (int) $this->settings->get('usr_starting_point_ref_id');
511  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSystemDefaultStartingPointType()

ilUserStartingPointRepository::getSystemDefaultStartingPointType ( )

Definition at line 360 of file class.ilUserStartingPointRepository.php.

References $valid, ANONYMOUS_USER_ID, getFallbackStartingPointType(), getPossibleStartingPoints(), ILIAS\Repository\int(), setSystemDefaultStartingPoint(), ILIAS\Repository\settings(), and ILIAS\Repository\user().

Referenced by getApplicableStartingPointTypeInfo(), and getStartingPointById().

360  : int
361  {
362  $valid = array_keys($this->getPossibleStartingPoints());
363  $current = (int) $this->settings->get('usr_starting_point');
364  if (!$current || !in_array($current, $valid)) {
366  $this->setSystemDefaultStartingPoint($current);
367  }
368  if ($this->user->getId() === ANONYMOUS_USER_ID
369  || !$this->user->getId()) {
370  $current = self::START_REPOSITORY;
371  }
372  return $current;
373  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
$valid
setSystemDefaultStartingPoint(ilUserStartingPoint $starting_point)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUserStartingPointID()

ilUserStartingPointRepository::getUserStartingPointID ( )

Definition at line 138 of file class.ilUserStartingPointRepository.php.

138  : int
139  {
140  return self::USER_STARTING_POINT_ID;
141  }

◆ getValidAndAccessibleStartingPointAsUrl()

ilUserStartingPointRepository::getValidAndAccessibleStartingPointAsUrl ( )

Definition at line 406 of file class.ilUserStartingPointRepository.php.

References ilObject\_exists(), ilCalendarSettings\_getInstance(), getApplicableStartingPointTypeInfo(), getFallbackStartingPointType(), getLinkUrlByStartingPointTypeInfo(), null, and ILIAS\Repository\user().

Referenced by ilUserUtil\getProfileLink().

406  : string
407  {
408  $starting_point = $this->getApplicableStartingPointTypeInfo();
409 
410  if ($starting_point['type'] === self::START_REPOSITORY_OBJ
411  && (
412  $starting_point['object'] === null
413  || !ilObject::_exists($starting_point['object'], true)
414  || $this->tree->isDeleted($starting_point['object'])
415  || !$this->rbac_system->checkAccessOfUser(
416  $this->user->getId(),
417  'read',
418  $starting_point['object']
419  )
420  )
421  ) {
422  $this->log->user()->debug(sprintf('Permission to Starting Point Denied. Starting Point Type: %s.', $starting_point['type']));
423  $starting_point['type'] = self::START_REPOSITORY;
424  }
425 
426  if ($starting_point['type'] === self::START_REPOSITORY
427  && !$this->rbac_system->checkAccessOfUser(
428  $this->user->getId(),
429  'read',
430  $this->tree->getRootId()
431  )
432  || $starting_point['type'] === self::START_PD_CALENDAR
433  && !ilCalendarSettings::_getInstance()->isEnabled()
434  ) {
435  $this->log->user()->debug(sprintf('Permission to Starting Point Denied. Starting Point Type: %s.', $starting_point['type']));
436  $starting_point['type'] = $this->getFallbackStartingPointType();
437  }
438 
439  if ($starting_point['type'] === self::START_REPOSITORY) {
440  $starting_point['object'] = $this->tree->getRootId();
441  }
442 
443  return $this->getLinkUrlByStartingPointTypeInfo($starting_point);
444  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isCurrentUserPersonalStartingPointEnabled()

ilUserStartingPointRepository::isCurrentUserPersonalStartingPointEnabled ( )

Did user set any personal starting point (yet)?

Definition at line 545 of file class.ilUserStartingPointRepository.php.

References ILIAS\Repository\user().

545  : bool
546  {
547  return (bool) $this->user->getPref('usr_starting_point');
548  }
+ Here is the call graph for this function:

◆ isPersonalStartingPointEnabled()

ilUserStartingPointRepository::isPersonalStartingPointEnabled ( )

Definition at line 537 of file class.ilUserStartingPointRepository.php.

References ILIAS\Repository\settings().

Referenced by getApplicableStartingPointTypeInfo().

537  : bool //checked
538  {
539  return $this->settings->get('usr_starting_point_personal') === '1' ? true : false;
540  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onRoleDeleted()

ilUserStartingPointRepository::onRoleDeleted ( ilObjRole  $role)

Definition at line 143 of file class.ilUserStartingPointRepository.php.

References $data, ilObject\getId(), ilObjectFactory\getInstanceByObjId(), getRolesWithStartingPoint(), and null.

143  : void
144  {
145  foreach ($this->getRolesWithStartingPoint() as $role_id => $data) {
146  if ($role_id === $role->getId()
147  || ($maybe_deleted_role = ilObjectFactory::getInstanceByObjId($role_id, false)) === null
148  || !($maybe_deleted_role instanceof ilObjRole)
149  ) {
150  $this->delete($data['id']);
151  }
152  }
153  }
Class ilObjRole.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
+ Here is the call graph for this function:

◆ reArrangePositions()

ilUserStartingPointRepository::reArrangePositions ( array  $a_items)

Definition at line 307 of file class.ilUserStartingPointRepository.php.

307  : array
308  {
309  $ord_const = 0;
310  $rearranged = [];
311  foreach ($a_items as $v) {
312  $v['starting_position'] = $ord_const;
313  $rearranged[$ord_const] = $v;
314  $ord_const += 10;
315  }
316  return $rearranged;
317  }

◆ save()

ilUserStartingPointRepository::save ( ilUserStartingPoint  $starting_point)

Definition at line 208 of file class.ilUserStartingPointRepository.php.

References ilUserStartingPoint\getCalendarPeriod(), ilUserStartingPoint\getCalendarView(), getDefaultStartingPointID(), ilUserStartingPoint\getId(), getMaxPosition(), ilUserStartingPoint\getRuleOptions(), ilUserStartingPoint\getRuleType(), ilUserStartingPoint\getStartingObject(), ilUserStartingPoint\getStartingPointType(), setSystemDefaultStartingPoint(), ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

208  : void
209  {
210  if ($starting_point->getId() === $this->getDefaultStartingPointID()) {
211  $this->setSystemDefaultStartingPoint($starting_point);
212  return;
213  }
214  //get position
215  $max_position = $this->getMaxPosition();
216  $position = $max_position + 10;
217 
218  $next_id = $this->db->nextId('usr_starting_point');
219  $values = [
220  $next_id,
221  $starting_point->getStartingPointType(),
222  $starting_point->getStartingObject(),
223  $position,
224  $starting_point->getRuleType(),
225  $starting_point->getRuleOptions(),
226  $starting_point->getCalendarView(),
227  $starting_point->getCalendarPeriod()
228  ];
229 
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)',
232  [
241  ],
242  $values
243  );
244  }
setSystemDefaultStartingPoint(ilUserStartingPoint $starting_point)
getCalendarView()
Gets calendar view.
+ Here is the call graph for this function:

◆ saveOrder()

ilUserStartingPointRepository::saveOrder ( array  $a_items)

Definition at line 319 of file class.ilUserStartingPointRepository.php.

References $id.

319  : void
320  {
321  asort($a_items);
322  $nr = 10;
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')
329  );
330  $nr += 10;
331  }
332  }
333  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ setCurrentUserPersonalStartingPoint()

ilUserStartingPointRepository::setCurrentUserPersonalStartingPoint ( int  $starting_point_type,
?int  $ref_id = null 
)

Set personal starting point setting.

Definition at line 568 of file class.ilUserStartingPointRepository.php.

References $ref_id, $valid, ilObject\_lookupObjId(), getPossibleStartingPoints(), null, and ILIAS\Repository\user().

571  : bool {
572  if ($starting_point_type === 0) {
573  $this->user->setPref('usr_starting_point', null);
574  $this->user->setPref('usr_starting_point_ref_id', null);
575  return false;
576  }
577 
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);
583  return true;
584  }
585  }
586  $valid = array_keys($this->getPossibleStartingPoints());
587  if (in_array($starting_point_type, $valid)) {
588  $this->user->setPref('usr_starting_point', (string) $starting_point_type);
589  return true;
590  }
591  return false;
592  }
$valid
static _lookupObjId(int $ref_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:

◆ setSystemDefaultStartingPoint()

ilUserStartingPointRepository::setSystemDefaultStartingPoint ( ilUserStartingPoint  $starting_point)
private

Definition at line 386 of file class.ilUserStartingPointRepository.php.

References ilUserStartingPoint\getCalendarPeriod(), ilUserStartingPoint\getCalendarView(), getPossibleStartingPoints(), ilUserStartingPoint\getStartingObject(), ilUserStartingPoint\getStartingPointType(), and ILIAS\Repository\settings().

Referenced by getSystemDefaultStartingPointType(), save(), and update().

388  : void {
389  $starting_point_type = $starting_point->getStartingPointType();
390 
391  $valid_starting_points = array_keys($this->getPossibleStartingPoints());
392  if (in_array($starting_point_type, $valid_starting_points)) {
393  $this->settings->set('usr_starting_point', (string) $starting_point_type);
394  }
395 
396  if ($starting_point->getStartingPointType() === self::START_REPOSITORY_OBJ) {
397  $this->settings->set('usr_starting_point_ref_id', (string) $starting_point->getStartingObject());
398  }
399 
400  if ($starting_point->getStartingPointType() === self::START_PD_CALENDAR) {
401  $this->settings->set('user_calendar_view', (string) $starting_point->getCalendarView());
402  $this->settings->set('user_calendar_period', (string) $starting_point->getCalendarPeriod());
403  }
404  }
getCalendarView()
Gets calendar view.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ togglePersonalStartingPointActivation()

ilUserStartingPointRepository::togglePersonalStartingPointActivation ( bool  $value)

Toggle personal starting point setting.

Definition at line 532 of file class.ilUserStartingPointRepository.php.

References ILIAS\Repository\settings().

532  : void
533  {
534  $this->settings->set('usr_starting_point_personal', $value ? '1' : '0');
535  }
+ Here is the call graph for this function:

◆ update()

ilUserStartingPointRepository::update ( ilUserStartingPoint  $starting_point)

update starting point

Definition at line 249 of file class.ilUserStartingPointRepository.php.

References ilUserStartingPoint\getCalendarPeriod(), ilUserStartingPoint\getCalendarView(), getDefaultStartingPointID(), ilUserStartingPoint\getId(), ilUserStartingPoint\getPosition(), ilUserStartingPoint\getRuleOptions(), ilUserStartingPoint\getRuleType(), ilUserStartingPoint\getStartingObject(), ilUserStartingPoint\getStartingPointType(), setSystemDefaultStartingPoint(), ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

249  : void
250  {
251  if ($starting_point->getId() === $this->getDefaultStartingPointID()) {
252  $this->setSystemDefaultStartingPoint($starting_point);
253  return;
254  }
255 
256  $this->db->manipulateF(
257  'UPDATE usr_starting_point
258  SET starting_point = %s,
259  starting_object = %s,
260  position = %s,
261  rule_type = %s,
262  rule_options = %s,
263  calendar_view = %s,
264  calendar_period = %s
265  WHERE id = %s',
266  [
275  ],
276  [
277  $starting_point->getStartingPointType(),
278  $starting_point->getStartingObject(),
279  $starting_point->getPosition(),
280  $starting_point->getRuleType(),
281  $starting_point->getRuleOptions(),
282  $starting_point->getCalendarView(),
283  $starting_point->getCalendarPeriod(),
284  $starting_point->getId()
285  ]
286  );
287  }
setSystemDefaultStartingPoint(ilUserStartingPoint $starting_point)
getCalendarView()
Gets calendar view.
+ Here is the call graph for this function:

Field Documentation

◆ $current_user_has_access_to_my_staff

bool ilUserStartingPointRepository::$current_user_has_access_to_my_staff
private

Definition at line 58 of file class.ilUserStartingPointRepository.php.

◆ DEFAULT_STARTING_POINT_ID

const ilUserStartingPointRepository::DEFAULT_STARTING_POINT_ID = 0
private

Definition at line 48 of file class.ilUserStartingPointRepository.php.

◆ ORDER_POSITION_MAX

const ilUserStartingPointRepository::ORDER_POSITION_MAX = 9999
private

Definition at line 45 of file class.ilUserStartingPointRepository.php.

◆ ORDER_POSITION_MIN

const ilUserStartingPointRepository::ORDER_POSITION_MIN = 0
private

Definition at line 44 of file class.ilUserStartingPointRepository.php.

◆ START_PD_CALENDAR

const ilUserStartingPointRepository::START_PD_CALENDAR = 10

◆ START_PD_CONTACTS

const ilUserStartingPointRepository::START_PD_CONTACTS = 12
private

Definition at line 37 of file class.ilUserStartingPointRepository.php.

◆ START_PD_LP

const ilUserStartingPointRepository::START_PD_LP = 9
private

Definition at line 34 of file class.ilUserStartingPointRepository.php.

◆ START_PD_MAIL

const ilUserStartingPointRepository::START_PD_MAIL = 11
private

Definition at line 36 of file class.ilUserStartingPointRepository.php.

◆ START_PD_MYSTAFF

const ilUserStartingPointRepository::START_PD_MYSTAFF = 17
private

Definition at line 42 of file class.ilUserStartingPointRepository.php.

◆ START_PD_NEWS

const ilUserStartingPointRepository::START_PD_NEWS = 5
private

Definition at line 30 of file class.ilUserStartingPointRepository.php.

◆ START_PD_NOTES

const ilUserStartingPointRepository::START_PD_NOTES = 4
private

Definition at line 29 of file class.ilUserStartingPointRepository.php.

◆ START_PD_OVERVIEW

const ilUserStartingPointRepository::START_PD_OVERVIEW = 1
private

Definition at line 27 of file class.ilUserStartingPointRepository.php.

◆ START_PD_PORTFOLIO

const ilUserStartingPointRepository::START_PD_PORTFOLIO = 7
private

Definition at line 32 of file class.ilUserStartingPointRepository.php.

◆ START_PD_PROFILE

const ilUserStartingPointRepository::START_PD_PROFILE = 13
private

Definition at line 38 of file class.ilUserStartingPointRepository.php.

◆ START_PD_SETTINGS

const ilUserStartingPointRepository::START_PD_SETTINGS = 14
private

Definition at line 39 of file class.ilUserStartingPointRepository.php.

◆ START_PD_SKILLS

const ilUserStartingPointRepository::START_PD_SKILLS = 8
private

Definition at line 33 of file class.ilUserStartingPointRepository.php.

◆ START_PD_SUBSCRIPTION

const ilUserStartingPointRepository::START_PD_SUBSCRIPTION = 2
private

Definition at line 28 of file class.ilUserStartingPointRepository.php.

◆ START_PD_WORKSPACE

const ilUserStartingPointRepository::START_PD_WORKSPACE = 6
private

Definition at line 31 of file class.ilUserStartingPointRepository.php.

◆ START_REPOSITORY

const ilUserStartingPointRepository::START_REPOSITORY = 15
private

Definition at line 40 of file class.ilUserStartingPointRepository.php.

◆ START_REPOSITORY_OBJ

◆ URL_LINKS_BY_TYPE

const ilUserStartingPointRepository::URL_LINKS_BY_TYPE
private
Initial value:
= [
self::START_PD_OVERVIEW => 'ilias.php?baseClass=ilDashboardGUI&cmd=jumpToSelectedItems'

Definition at line 50 of file class.ilUserStartingPointRepository.php.

◆ USER_STARTING_POINT_ID

const ilUserStartingPointRepository::USER_STARTING_POINT_ID = -1
private

Definition at line 47 of file class.ilUserStartingPointRepository.php.


The documentation for this class was generated from the following file: