59 bool $a_user_image =
false,
60 bool $a_profile_link =
false,
61 string $a_profile_back_link =
"",
62 bool $a_force_first_lastname =
false,
63 bool $a_omit_login =
false,
64 bool $a_sortable =
true,
65 bool $a_return_data_array =
false,
66 $a_ctrl_path =
"ilpublicuserprofilegui"
71 $ilCtrl =
$DIC[
'ilCtrl'];
74 if (!is_array($a_ctrl_path)) {
75 $a_ctrl_path = array($a_ctrl_path);
78 if (!($return_as_array = is_array($a_user_id))) {
79 $a_user_id = array($a_user_id);
88 b.value public_profile,
94 (a.usr_id = b.usr_id AND
98 (a.usr_id = c.usr_id AND
100 WHERE ' .
$ilDB->in(
'a.usr_id', $a_user_id,
false,
'integer');
102 $userrow =
$ilDB->queryF($sql, array(
'text',
'text'), array(
'public_profile',
'public_title'));
107 while ($row =
$ilDB->fetchObject($userrow)) {
110 "id" => (
int) $row->usr_id,
117 $has_public_profile = in_array($row->public_profile, array(
"y",
"g"));
118 if ($a_force_first_lastname || $has_public_profile) {
120 if ($row->public_title ==
"y" && $row->title) {
121 $title = $row->title .
" ";
123 $d[
"title"] = $title;
125 $pres = $row->lastname;
126 if (strlen($row->firstname)) {
127 $pres .= (
', ' . $row->firstname .
' ');
131 if (strlen($row->firstname)) {
132 $pres .= $row->firstname .
' ';
134 $pres .= ($row->lastname .
' ');
136 $d[
"firstname"] = $row->firstname;
137 $d[
"lastname"] = $row->lastname;
139 $d[
"login"] = $row->login;
140 $d[
"public_profile"] = $has_public_profile;
143 if (!$a_omit_login) {
144 $pres .=
"[" . $row->login .
"]";
147 if ($a_profile_link && $has_public_profile) {
148 $ilCtrl->setParameterByClass(end($a_ctrl_path),
"user_id", $row->usr_id);
149 if ($a_profile_back_link !=
"") {
150 $ilCtrl->setParameterByClass(
153 rawurlencode($a_profile_back_link)
156 $link = $ilCtrl->getLinkTargetByClass($a_ctrl_path,
"getHTML");
157 $pres =
'<a href="' . $link .
'">' . $pres .
'</a>';
163 $pres =
'<img class="ilUserXXSmall" src="' .
$img .
'" alt="' .
$lng->txt(
"icon") .
164 " " .
$lng->txt(
"user_picture") .
'" /> ' . $pres;
168 $names[$row->usr_id] = $pres;
172 foreach ($a_user_id as
$id) {
173 if (!isset($names[
$id]) || !$names[
$id]) {
174 $names[
$id] =
$lng->txt(
'usr_name_undisclosed');
178 if ($a_return_data_array) {
179 if ($return_as_array) {
182 return current(
$data);
185 return $return_as_array ? $names : $names[$a_user_id[0]];
195 "SELECT value FROM usr_pref " .
196 " WHERE usr_id = " .
$ilDB->quote($a_user_id,
"integer") .
197 " and keyword = " .
$ilDB->quote(
"public_profile",
"text")
199 $rec =
$ilDB->fetchAssoc($set);
201 return in_array($rec[
"value"] ??
"", array(
"y",
"g"));
212 if ($public_profile !=
'y' and $public_profile !=
'g') {
216 $GLOBALS[
'DIC'][
'ilCtrl']->setParameterByClass(
'ilpublicuserprofilegui',
'user', $a_usr_id);
217 return $GLOBALS[
'DIC'][
'ilCtrl']->getLinkTargetByClass(
'ilpublicuserprofilegui',
'getHTML');
247 if ($a_force_all || !
$ilSetting->get(
"disable_personal_workspace")) {
251 if ($a_force_all ||
$settings->isEnabled()) {
258 foreach ($all as $idx =>
$lang) {
270 int $a_ref_id =
null,
271 array $a_cal_view = []
276 $tree =
$DIC[
'tree'];
278 if ($a_value == self::START_REPOSITORY_OBJ) {
279 $a_ref_id = (
int) $a_ref_id;
281 !$tree->isDeleted($a_ref_id)) {
282 $ilSetting->set(
"usr_starting_point", $a_value);
283 $ilSetting->set(
"usr_starting_point_ref_id", $a_ref_id);
287 $valid = array_keys(self::getPossibleStartingPoints());
288 if (in_array($a_value,
$valid)) {
289 $ilSetting->set(
"usr_starting_point", $a_value);
290 if ($a_value == self::START_PD_CALENDAR) {
291 foreach ($a_cal_view as
$key => $value) {
310 $valid = array_keys(self::getPossibleStartingPoints());
311 $current =
$ilSetting->get(
"usr_starting_point");
312 if ($current == self::START_REPOSITORY_OBJ) {
314 } elseif (!$current || !in_array($current,
$valid)) {
315 $current = self::START_PD_OVERVIEW;
318 if (
$ilSetting->get(
'disable_my_offers') == 0 &&
319 $ilSetting->get(
'disable_my_memberships') == 0 &&
320 $ilSetting->get(
'personal_items_default_view') == 1) {
321 $current = self::START_PD_SUBSCRIPTION;
324 self::setStartingPoint($current);
328 $current = self::START_REPOSITORY;
333 public static function getStartingPointAsUrl(): string
339 $tree =
$DIC[
'tree'];
342 $rbacreview =
$DIC[
'rbacreview'];
343 $rbacsystem =
$DIC[
'rbacsystem'];
351 if (self::hasPersonalStartingPoint() &&
$ilUser->getPref(
'usr_starting_point') !=
null) {
352 $current = self::getPersonalStartingPoint();
353 if ($current == self::START_REPOSITORY_OBJ) {
354 $ref_id = self::getPersonalStartingObject();
360 $roles_ids = array_keys($roles);
362 foreach ($roles_ids as $role_id) {
363 if ($rbacreview->isAssigned(
$ilUser->getId(), $role_id)) {
364 $gr[$roles[$role_id][
'position']] = array(
365 "point" => $roles[$role_id][
'starting_point'],
366 "object" => $roles[$role_id][
'starting_object'],
367 "cal_view" => $roles[$role_id][
'calendar_view'],
368 "cal_period" => $roles[$role_id][
'calendar_period']
374 $role_point = array_pop($gr);
375 $current = $role_point[
'point'];
376 $ref_id = $role_point[
'object'];
377 $cal_view = $role_point[
'cal_view'];
378 $cal_period = $role_point[
'cal_period'];
383 $current = self::getStartingPoint();
385 $cal_view = self::getCalendarView();
386 $cal_period = self::getCalendarPeriod();
387 if ($current == self::START_REPOSITORY_OBJ) {
388 $ref_id = self::getStartingObject();
393 $calendar_string =
"";
394 if (!empty($cal_view) && !empty($cal_period)) {
395 $calendar_string =
"&cal_view=" . $cal_view .
"&cal_agenda_per=" . $cal_period;
398 if ($current === self::START_REPOSITORY_OBJ
401 || !$rbacsystem->checkAccessOfUser(
408 $log->debug(sprintf(
'Permission to Starting Point Denied. Starting Point Type: %s.', $current));
409 $current = self::START_REPOSITORY;
412 if ($current === self::START_REPOSITORY
413 && !$rbacsystem->checkAccessOfUser(
418 || $current === self::START_PD_CALENDAR
421 $log->debug(sprintf(
'Permission to Starting Point Denied. Starting Point Type: %s.', $current));
422 $current = self::START_PD_OVERVIEW;
425 if (
$ilSetting->get(
'disable_my_offers') == 0 &&
426 $ilSetting->get(
'disable_my_memberships') == 0 &&
427 $ilSetting->get(
'personal_items_default_view') == 1) {
428 $log->debug(sprintf(
'Permission to Starting Point Denied. Starting Point Type: %s.', $current));
429 $current = self::START_PD_SUBSCRIPTION;
434 case self::START_REPOSITORY:
438 case self::START_REPOSITORY_OBJ:
445 $current = self::START_PD_OVERVIEW;
451 self::START_PD_OVERVIEW =>
'ilias.php?baseClass=ilDashboardGUI&cmd=jumpToSelectedItems',
452 self::START_PD_SUBSCRIPTION =>
'ilias.php?baseClass=ilMembershipOverviewGUI',
453 self::START_PD_WORKSPACE =>
'ilias.php?baseClass=ilDashboardGUI&cmd=jumpToWorkspace',
454 self::START_PD_CALENDAR =>
'ilias.php?baseClass=ilDashboardGUI&cmd=jumpToCalendar' . $calendar_string,
457 return $map[$current];
470 return $ilSetting->get(
"usr_starting_point_ref_id");
482 return (
int)
$ilSetting->get(
"user_calendar_view");
494 return (
int)
$ilSetting->get(
"user_cal_period");
506 $ilSetting->set(
"usr_starting_point_personal", (
string) $a_value);
518 return (
bool)
$ilSetting->get(
"usr_starting_point_personal");
530 return (
bool)
$ilUser->getPref(
"usr_starting_point");
542 $valid = array_keys(self::getPossibleStartingPoints());
543 $current =
$ilUser->getPref(
"usr_starting_point");
544 if ($current == self::START_REPOSITORY_OBJ) {
546 } elseif (!$current || !in_array($current,
$valid)) {
547 return self::getStartingPoint();
562 $tree =
$DIC[
'tree'];
565 $ilUser->setPref(
"usr_starting_point",
null);
566 $ilUser->setPref(
"usr_starting_point_ref_id",
null);
570 if ($a_value == self::START_REPOSITORY_OBJ) {
571 $a_ref_id = (
int) $a_ref_id;
573 !$tree->isDeleted($a_ref_id)) {
574 $ilUser->setPref(
"usr_starting_point", $a_value);
575 $ilUser->setPref(
"usr_starting_point_ref_id", $a_ref_id);
579 $valid = array_keys(self::getPossibleStartingPoints());
580 if (in_array($a_value,
$valid)) {
581 $ilUser->setPref(
"usr_starting_point", $a_value);
598 $ref_id = self::getStartingObject();
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const CMD_JUMP_TO_MY_STAFF
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
Get static link.
static _getPersonalPicturePath(int $a_usr_id, string $a_size="small", bool $a_force_pic=false, bool $a_prevent_no_photo_image=false, bool $html_export=false)
static _lookupPref(int $a_usr_id, string $a_keyword)
static _lookupObjId(int $ref_id)
static getRolesWithStartingPoint()
get array with all roles which have starting point defined.
static getCalendarPeriod()
Get time frame of calendar view.
static getPossibleStartingPoints(bool $a_force_all=false)
Get all valid starting points.
static getPersonalStartingObject()
Get ref id of personal starting object.
static getCalendarView()
Get specific view of calendar starting point.
static hasPersonalStartPointPref()
Did user set any personal starting point (yet)?
static hasPersonalStartingPoint()
Can starting point be personalized?
static hasPublicProfile(int $a_user_id)
static getProfileLink(int $a_usr_id)
Get link to personal profile Return empty string in case of not public profile.
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link="", bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static getPersonalStartingPoint()
Get current personal starting point.
static togglePersonalStartingPoint(bool $a_value)
Toggle personal starting point setting.
static getStartingPoint()
Get current starting point setting.
static getStartingObject()
Get ref id of starting object.
const START_REPOSITORY_OBJ
static setStartingPoint(int $a_value, int $a_ref_id=null, array $a_cal_view=[])
Set starting point setting.
const START_PD_SUBSCRIPTION
static setPersonalStartingPoint(int $a_value, int $a_ref_id=null)
Set personal starting point setting.
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d