46 $a_user_image =
false,
47 $a_profile_link =
false,
48 $a_profile_back_link =
"",
49 $a_force_first_lastname =
false,
50 $a_omit_login =
false,
52 $a_return_data_array =
false,
53 $a_ctrl_path =
"ilpublicuserprofilegui"
61 if (!is_array($a_ctrl_path)) {
62 $a_ctrl_path = array($a_ctrl_path);
65 if (!($return_as_array = is_array($a_user_id))) {
66 $a_user_id = array($a_user_id);
75 b.value public_profile,
81 (a.usr_id = b.usr_id AND
85 (a.usr_id = c.usr_id AND
87 WHERE ' .
$ilDB->in(
'a.usr_id', $a_user_id,
false,
'integer');
89 $userrow =
$ilDB->queryF($sql, array(
'text',
'text'), array(
'public_profile',
'public_title'));
94 while ($row =
$ilDB->fetchObject($userrow)) {
96 $d = array(
"id" => (
int) $row->usr_id,
"title" =>
"",
"lastname" =>
"",
"firstname" =>
"",
"img" =>
"",
"link" =>
"",
97 "public_profile" =>
"");
98 $has_public_profile = in_array($row->public_profile, array(
"y",
"g"));
99 if ($a_force_first_lastname || $has_public_profile) {
101 if ($row->public_title ==
"y" && $row->title) {
102 $title = $row->title .
" ";
104 $d[
"title"] = $title;
106 $pres = $row->lastname;
107 if (strlen($row->firstname)) {
108 $pres .= (
', ' . $row->firstname .
' ');
112 if (strlen($row->firstname)) {
113 $pres .= $row->firstname .
' ';
115 $pres .= ($row->lastname .
' ');
117 $d[
"firstname"] = $row->firstname;
118 $d[
"lastname"] = $row->lastname;
120 $d[
"login"] = $row->login;
121 $d[
"public_profile"] = $has_public_profile;
124 if (!$a_omit_login) {
125 $pres .=
"[" . $row->login .
"]";
128 if ($a_profile_link && $has_public_profile) {
129 $ilCtrl->setParameterByClass(end($a_ctrl_path),
"user_id", $row->usr_id);
130 if ($a_profile_back_link !=
"") {
134 rawurlencode($a_profile_back_link)
137 $link =
$ilCtrl->getLinkTargetByClass($a_ctrl_path,
"getHTML");
138 $pres =
'<a href="' . $link .
'">' . $pres .
'</a>';
144 $pres =
'<img class="ilUserXXSmall" src="' .
$img .
'" alt="' .
$lng->txt(
"icon") .
145 " " .
$lng->txt(
"user_picture") .
'" /> ' . $pres;
149 $names[$row->usr_id] = $pres;
153 foreach ($a_user_id as $id) {
155 $names[$id] =
$lng->txt(
'usr_name_undisclosed');
159 if ($a_return_data_array) {
160 if ($return_as_array) {
163 return current(
$data);
166 return $return_as_array ? $names : $names[$a_user_id[0]];
182 "SELECT value FROM usr_pref " .
183 " WHERE usr_id = " .
$ilDB->quote($a_user_id,
"integer") .
184 " and keyword = " .
$ilDB->quote(
"public_profile",
"text")
186 $rec =
$ilDB->fetchAssoc($set);
188 return in_array($rec[
"value"], array(
"y",
"g"));
201 if ($public_profile !=
'y' and $public_profile !=
'g') {
205 $GLOBALS[
'DIC'][
'ilCtrl']->setParameterByClass(
'ilpublicuserprofilegui',
'user', $a_usr_id);
206 return $GLOBALS[
'DIC'][
'ilCtrl']->getLinkTargetByClass(
'ilpublicuserprofilegui',
'getHTML');
232 if ($a_force_all || (
$ilSetting->get(
'disable_my_offers') == 0 &&
233 $ilSetting->get(
'disable_my_memberships') == 0)) {
237 if (ilMyStaffAccess::getInstance()->hasCurrentUserAccessToMyStaff()) {
241 if ($a_force_all || !
$ilSetting->get(
"disable_personal_workspace")) {
245 include_once(
'./Services/Calendar/classes/class.ilCalendarSettings.php');
247 if ($a_force_all || $settings->isEnabled()) {
253 foreach ($all as $idx =>
$lang) {
272 $tree =
$DIC[
'tree'];
274 if ($a_value == self::START_REPOSITORY_OBJ) {
275 $a_ref_id = (int) $a_ref_id;
277 !$tree->isDeleted($a_ref_id)) {
278 $ilSetting->set(
"usr_starting_point", $a_value);
279 $ilSetting->set(
"usr_starting_point_ref_id", $a_ref_id);
283 $valid = array_keys(self::getPossibleStartingPoints());
284 if (in_array($a_value,
$valid)) {
285 $ilSetting->set(
"usr_starting_point", $a_value);
303 $valid = array_keys(self::getPossibleStartingPoints());
304 $current =
$ilSetting->get(
"usr_starting_point");
305 if ($current == self::START_REPOSITORY_OBJ) {
307 } elseif (!$current || !in_array($current,
$valid)) {
311 if (
$ilSetting->get(
'disable_my_offers') == 0 &&
312 $ilSetting->get(
'disable_my_memberships') == 0 &&
313 $ilSetting->get(
'personal_items_default_view') == 1) {
319 if (
$ilUser->getId() == ANONYMOUS_USER_ID ||
335 $tree =
$DIC[
'tree'];
337 $rbacreview =
$DIC[
'rbacreview'];
344 if (self::hasPersonalStartingPoint() &&
$ilUser->getPref(
'usr_starting_point') !=
null) {
346 if ($current == self::START_REPOSITORY_OBJ) {
350 include_once
'./Services/AccessControl/classes/class.ilStartingPoint.php';
356 $roles_ids = array_keys($roles);
359 foreach ($rbacreview->getGlobalRoles() as $role_id) {
360 if ($rbacreview->isAssigned(
$ilUser->getId(), $role_id)) {
361 if (in_array($role_id, $roles_ids)) {
362 $gr[$roles[$role_id][
'position']] = array(
363 "point" => $roles[$role_id][
'starting_point'],
364 "object" => $roles[$role_id][
'starting_object']
371 $role_point = array_pop($gr);
372 $current = $role_point[
'point'];
373 $ref_id = $role_point[
'object'];
380 if ($current == self::START_REPOSITORY_OBJ) {
388 $ref_id = $tree->readRootId();
394 !$tree->isDeleted($ref_id)) {
395 include_once(
'./Services/Link/classes/class.ilLink.php');
405 self::START_PD_OVERVIEW =>
'ilias.php?baseClass=ilDashboardGUI&cmd=jumpToSelectedItems',
406 self::START_PD_SUBSCRIPTION =>
'ilias.php?baseClass=ilMembershipOverviewGUI',
407 self::START_PD_WORKSPACE =>
'ilias.php?baseClass=ilDashboardGUI&cmd=jumpToWorkspace',
408 self::START_PD_CALENDAR =>
'ilias.php?baseClass=ilDashboardGUI&cmd=jumpToCalendar',
411 return $map[$current];
426 return $ilSetting->get(
"usr_starting_point_ref_id");
440 $ilSetting->set(
"usr_starting_point_personal", (
bool) $a_value);
454 return $ilSetting->get(
"usr_starting_point_personal");
468 return (
bool)
$ilUser->getPref(
"usr_starting_point");
482 $valid = array_keys(self::getPossibleStartingPoints());
483 $current =
$ilUser->getPref(
"usr_starting_point");
484 if ($current == self::START_REPOSITORY_OBJ) {
486 } elseif (!$current || !in_array($current,
$valid)) {
504 $tree =
$DIC[
'tree'];
507 $ilUser->setPref(
"usr_starting_point",
null);
508 $ilUser->setPref(
"usr_starting_point_ref_id",
null);
512 if ($a_value == self::START_REPOSITORY_OBJ) {
513 $a_ref_id = (int) $a_ref_id;
515 !$tree->isDeleted($a_ref_id)) {
516 $ilUser->setPref(
"usr_starting_point", $a_value);
517 $ilUser->setPref(
"usr_starting_point_ref_id", $a_ref_id);
521 $valid = array_keys(self::getPossibleStartingPoints());
522 if (in_array($a_value,
$valid)) {
523 $ilUser->setPref(
"usr_starting_point", $a_value);
540 $ref_id =
$ilUser->getPref(
"usr_starting_point_ref_id");
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
An exception for terminatinating execution or to throw for unit testing.
static _getInstance()
get singleton instance
const CMD_JUMP_TO_MY_STAFF
static _getStaticLink( $a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
static _getPersonalPicturePath( $a_usr_id, $a_size="small", $a_force_pic=false, $a_prevent_no_photo_image=false)
Get path to personal picture.
static _lookupPref($a_usr_id, $a_keyword)
static _lookupObjId($a_id)
static getRolesWithStartingPoint()
get array with all roles which have starting point defined.
static getPersonalStartingObject()
Get ref id of personal starting object.
static getPossibleStartingPoints($a_force_all=false)
Get all valid starting points.
static hasPersonalStartPointPref()
Did user set any personal starting point (yet)?
static hasPersonalStartingPoint()
Can starting point be personalized?
static hasPublicProfile($a_user_id)
Has public profile.
static togglePersonalStartingPoint($a_value)
Toggle personal starting point setting.
static getPersonalStartingPoint()
Get current personal starting point.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static getStartingPoint()
Get current starting point setting.
static getProfileLink($a_usr_id)
Get link to personal profile Return empty string in case of not public profile.
static setPersonalStartingPoint($a_value, $a_ref_id=null)
Set personal starting point setting.
static getStartingPointAsUrl()
Get current starting point setting as URL.
static getStartingObject()
Get ref id of starting object.
const START_REPOSITORY_OBJ
const START_PD_SUBSCRIPTION
static setStartingPoint($a_value, $a_ref_id=null)
Set starting point setting.
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d