ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilUserUtil Class Reference

Class ilUserUtil. More...

+ Collaboration diagram for ilUserUtil:

Static Public Member Functions

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)
 Default behaviour is:
static getProfileLink ($a_usr_id)
 Get link to personal profile Return empty string in case of not public profile.
static getPossibleStartingPoints ($a_force_all=false)
 Get all valid starting points.
static setStartingPoint ($a_value, $a_ref_id=null)
 Set starting point setting.
static getStartingPoint ()
 Get current starting point setting.
static getStartingPointAsUrl ()
 Get current starting point setting as URL.
static getStartingObject ()
 Get ref id of starting object.
static togglePersonalStartingPoint ($a_value)
 Toggle personal starting point setting.
static hasPersonalStartingPoint ()
 Can starting point be personalized?
static hasPersonalStartPointPref ()
 Did user set any personal starting point (yet)?
static getPersonalStartingPoint ()
 Get current personal starting point.
static setPersonalStartingPoint ($a_value, $a_ref_id=null)
 Set personal starting point setting.
static getPersonalStartingObject ()
 Get ref id of personal starting object.

Data Fields

const START_PD_OVERVIEW = 1
const START_PD_SUBSCRIPTION = 2
const START_PD_BOOKMARKS = 3
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_CALENDAR = 10
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_REPOSITORY_OBJ = 16

Detailed Description

Class ilUserUtil.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id:
class.ilUserUtil.php 61321 2015-11-10 11:30:12Z gitmgr

Definition at line 12 of file class.ilUserUtil.php.

Member Function Documentation

static ilUserUtil::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 
)
static

Default behaviour is:

  • lastname, firstname if public profile enabled
  • [loginname] (always) modifications by jposselt at databay . de : if $a_user_id is an array of user ids the method returns an array of "id" => "NamePresentation" pairs.

...

Parameters
booleansortable should be used in table presentions. output is "Doe, John" title is ommited

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

References $ilCtrl, $ilDB, $img, $lng, $row, and ilObjUser\_getPersonalPicturePath().

Referenced by ilSurveyAppraiseesTableGUI\__construct(), ilSystemNotification\compose(), ilSurveyParticipantsGUI\confirmAdminAppraiseesCloseObject(), ilObjExerciseGUI\confirmDeassignMembersObject(), ilSurveyParticipantsGUI\confirmDeleteAppraiseesObject(), ilSurveyParticipantsGUI\confirmDeleteRatersObject(), ilConsultationHoursGUI\confirmRejectBooking(), ilCourseParticipantsGroupsGUI\confirmRemove(), ilObjBlogGUI\confirmRemoveContributor(), ilObjExerciseGUI\confirmRemoveTeamMemberObject(), ilObjExerciseGUI\createTeamObject(), ilPageObjectGUI\edit(), ilSharedResourceGUI\executeCommand(), ilObjExerciseGUI\executeCommand(), ilUserForTagTableGUI\fillRow(), ilPageHistoryTableGUI\fillRow(), ilHistoryTableGUI\fillRow(), ilWikiRecentChangesTableGUI\fillRow(), ilExcDeliveredFilesTableGUI\fillRow(), ilExAssignmentListTextTableGUI\fillRow(), ilWikiPagesTableGUI\fillRow(), ilUsersOnlineBlockGUI\fillRow(), ilWorkspaceShareTableGUI\fillRow(), ilContributorTableGUI\getItems(), ilExAssignmentTeamTableGUI\getItems(), ilExAssignmentPeerReviewTableGUI\getItems(), ilNoteGUI\getNoteListHTML(), ilWikiPagesTableGUI\getPages(), ilDataCollectionRecord\getStandardFieldHTML(), ilWorkspaceAccessTableGUI\importData(), ilObjSurveyGUI\infoScreen(), ilObjFileGUI\infoScreenForward(), ilLearningProgressBaseGUI\initEditUserForm(), ilSurveyExecutionGUI\outSurveyPage(), ilExAssignmentListTextTableGUI\parse(), ilConsultationHourBookingTableGUI\parse(), ilCronManagerTableGUI\parseJobToData(), ilBlogPostingGUI\postOutputProcessing(), ilWikiPageGUI\preview(), ilObjBlogGUI\renderList(), ilObjBlogGUI\renderNavigationByAuthors(), ilPublicUserProfileGUI\renderTitle(), ilLMMailNotification\send(), ilObjDataCollection\sendNotification(), ilWikiUtil\sendNotification(), ilObjSurvey\sendNotificationMail(), ilObjExerciseGUI\showAssignmentTextObject(), ilPageObjectGUI\showPage(), ilExAssignmentPeerReviewOverviewTableGUI\translateUserIds(), and ilPageObject\update().

{
global $lng, $ilCtrl, $ilDB;
if (!($return_as_array = is_array($a_user_id)))
$a_user_id = array($a_user_id);
$sql = 'SELECT
a.usr_id,
firstname,
lastname,
title,
login,
b.value public_profile,
c.value public_title
FROM
usr_data a
LEFT JOIN
usr_pref b ON
(a.usr_id = b.usr_id AND
b.keyword = %s)
LEFT JOIN
usr_pref c ON
(a.usr_id = c.usr_id AND
c.keyword = %s)
WHERE ' . $ilDB->in('a.usr_id', $a_user_id, false, 'integer');
$userrow = $ilDB->queryF($sql, array('text', 'text'), array('public_profile', 'public_title'));
$names = array();
while ($row = $ilDB->fetchObject($userrow))
{
if ($a_force_first_lastname ||
$has_public_profile = in_array($row->public_profile, array("y", "g")))
{
$title = "";
if($row->public_title == "y" && $row->title)
{
$title = $row->title . " ";
}
if($a_sortable)
{
$pres = $row->lastname;
if(strlen($row->firstname))
{
$pres .= (', '.$row->firstname.' ');
}
}
else
{
$pres = $title;
if(strlen($row->firstname))
{
$pres .= $row->firstname.' ';
}
$pres .= ($row->lastname.' ');
}
}
if(!$a_omit_login)
{
$pres.= "[".$row->login."]";
}
if ($a_profile_link && $has_public_profile)
{
$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user_id", $row->usr_id);
if ($a_profile_back_link != "")
{
$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "back_url",
rawurlencode($a_profile_back_link));
}
$pres = '<a href="'.$ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML").'">'.$pres.'</a>';
}
if ($a_user_image)
{
$pres = '<img border="0" src="'.$img.'" alt="'.$lng->txt("icon").
" ".$lng->txt("user_picture").'" /> '.$pres;
}
$names[$row->usr_id] = $pres;
}
foreach($a_user_id as $id)
{
if (!$names[$id])
$names[$id] = "unknown";
}
return $return_as_array ? $names : $names[$a_user_id[0]];
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilUserUtil::getPersonalStartingObject ( )
static

Get ref id of personal starting object.

Returns
int

Definition at line 448 of file class.ilUserUtil.php.

References $ilUser, $ref_id, and getStartingObject().

Referenced by getStartingPointAsUrl(), and ilPersonalSettingsGUI\initGeneralSettingsForm().

{
global $ilUser;
$ref_id = $ilUser->getPref("usr_starting_point_ref_id");
if(!$ref_id)
{
}
return $ref_id;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilUserUtil::getPersonalStartingPoint ( )
static

Get current personal starting point.

Returns
int

Definition at line 388 of file class.ilUserUtil.php.

References $ilUser, $valid, and getStartingPoint().

Referenced by getStartingPointAsUrl(), and ilPersonalSettingsGUI\initGeneralSettingsForm().

{
global $ilUser;
$valid = array_keys(self::getPossibleStartingPoints());
$current = $ilUser->getPref("usr_starting_point");
if($current == self::START_REPOSITORY_OBJ)
{
return $current;
}
else if(!$current || !in_array($current, $valid))
{
}
return $current;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilUserUtil::getPossibleStartingPoints (   $a_force_all = false)
static

Get all valid starting points.

Returns
array

Definition at line 168 of file class.ilUserUtil.php.

References $ilSetting, $lang, $lng, ilCalendarSettings\_getInstance(), START_PD_CALENDAR, START_PD_OVERVIEW, START_PD_SUBSCRIPTION, START_PD_WORKSPACE, and START_REPOSITORY.

Referenced by ilPersonalSettingsGUI\initGeneralSettingsForm().

{
global $ilSetting, $lng;
// for all conditions: see ilMainMenuGUI
$all = array();
$all[self::START_PD_OVERVIEW] = 'overview';
if($a_force_all || ($ilSetting->get('disable_my_offers') == 0 &&
$ilSetting->get('disable_my_memberships') == 0))
{
$all[self::START_PD_SUBSCRIPTION] = 'my_courses_groups';
}
if($a_force_all || !$ilSetting->get("disable_personal_workspace"))
{
$all[self::START_PD_WORKSPACE] = 'personal_workspace';
}
include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
if($a_force_all || $settings->isEnabled())
{
$all[self::START_PD_CALENDAR] = 'calendar';
}
$all[self::START_REPOSITORY] = 'repository';
foreach($all as $idx => $lang)
{
$all[$idx] = $lng->txt($lang);
}
return $all;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilUserUtil::getProfileLink (   $a_usr_id)
static

Get link to personal profile Return empty string in case of not public profile.

Parameters
type$a_usr_id
Returns
string

Definition at line 146 of file class.ilUserUtil.php.

References $GLOBALS, and ilObjUser\_lookupPref().

Referenced by ilRepositoryUserResultTableGUI\fillRow().

{
$public_profile = ilObjUser::_lookupPref($a_usr_id,'public_profile');
if($public_profile != 'y' and $public_profile != 'g')
{
return '';
}
$GLOBALS['ilCtrl']->setParameterByClass('ilpublicuserprofilegui','user',$a_usr_id);
return $GLOBALS['ilCtrl']->getLinkTargetByClass('ilpublicuserprofilegui','getHTML');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilUserUtil::getStartingObject ( )
static

Get ref id of starting object.

Returns
int

Definition at line 340 of file class.ilUserUtil.php.

References $ilSetting.

Referenced by getPersonalStartingObject(), and getStartingPointAsUrl().

{
global $ilSetting;
return $ilSetting->get("usr_starting_point_ref_id");
}

+ Here is the caller graph for this function:

static ilUserUtil::getStartingPoint ( )
static

Get current starting point setting.

Returns
int

Definition at line 242 of file class.ilUserUtil.php.

References $ilSetting, $ilUser, $valid, setStartingPoint(), START_PD_OVERVIEW, START_PD_SUBSCRIPTION, and START_REPOSITORY.

Referenced by getPersonalStartingPoint(), and getStartingPointAsUrl().

{
$valid = array_keys(self::getPossibleStartingPoints());
$current = $ilSetting->get("usr_starting_point");
if($current == self::START_REPOSITORY_OBJ)
{
return $current;
}
else if(!$current || !in_array($current, $valid))
{
// #10715 - if 1 is disabled overview will display the current default
if($ilSetting->get('disable_my_offers') == 0 &&
$ilSetting->get('disable_my_memberships') == 0 &&
$ilSetting->get('personal_items_default_view') == 1)
{
}
}
if($ilUser->getId() == ANONYMOUS_USER_ID)
{
}
return $current;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilUserUtil::getStartingPointAsUrl ( )
static

Get current starting point setting as URL.

Returns
string

self::START_PD_LP => 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToLP',

Definition at line 278 of file class.ilUserUtil.php.

References $ilUser, $ref_id, ilLink\_getStaticLink(), ilObject\_lookupObjId(), getPersonalStartingObject(), getPersonalStartingPoint(), getStartingObject(), getStartingPoint(), and START_PD_OVERVIEW.

Referenced by ilMainMenuGUI\getHeaderURL().

{
global $tree, $ilUser;
$ref_id = 1;
if(self::hasPersonalStartingPoint())
{
if($current == self::START_REPOSITORY_OBJ)
{
}
}
else
{
$current = self::getStartingPoint();
if($current == self::START_REPOSITORY_OBJ)
{
}
}
switch($current)
{
case self::START_REPOSITORY:
case self::START_REPOSITORY_OBJ:
if($ref_id &&
!$tree->isDeleted($ref_id))
{
include_once('./Services/Link/classes/class.ilLink.php');
}
// invalid starting object, overview is fallback
// fallthrough
default:
$map = array(
self::START_PD_OVERVIEW => 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSelectedItems',
self::START_PD_SUBSCRIPTION => 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToMemberships',
// self::START_PD_BOOKMARKS => 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToBookmarks',
// self::START_PD_NOTES => 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToNotes',
// self::START_PD_NEWS => 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToNews',
self::START_PD_WORKSPACE => 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToWorkspace',
// self::START_PD_PORTFOLIO => 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio',
// self::START_PD_SKILLS => 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSkills',
self::START_PD_CALENDAR => 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToCalendar',
// self::START_PD_MAIL => 'ilias.php?baseClass=ilMailGUI',
// self::START_PD_CONTACTS => 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToContacts',
// self::START_PD_PROFILE => 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToProfile',
// self::START_PD_SETTINGS => 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSettings'
);
return $map[$current];
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilUserUtil::hasPersonalStartingPoint ( )
static

Can starting point be personalized?

Returns
bool

Definition at line 364 of file class.ilUserUtil.php.

References $ilSetting.

Referenced by ilPersonalSettingsGUI\initGeneralSettingsForm(), and ilPersonalSettingsGUI\saveGeneralSettings().

{
global $ilSetting;
return $ilSetting->get("usr_starting_point_personal");
}

+ Here is the caller graph for this function:

static ilUserUtil::hasPersonalStartPointPref ( )
static

Did user set any personal starting point (yet)?

Returns
bool

Definition at line 376 of file class.ilUserUtil.php.

References $ilUser.

Referenced by ilPersonalSettingsGUI\initGeneralSettingsForm().

{
global $ilUser;
return (bool)$ilUser->getPref("usr_starting_point");
}

+ Here is the caller graph for this function:

static ilUserUtil::setPersonalStartingPoint (   $a_value,
  $a_ref_id = null 
)
static

Set personal starting point setting.

Parameters
int$a_value
int$a_ref_id
Returns
boolean

Definition at line 412 of file class.ilUserUtil.php.

References $ilUser, $valid, and ilObject\_lookupObjId().

Referenced by ilPersonalSettingsGUI\saveGeneralSettings().

{
global $ilUser, $tree;
if(!$a_value)
{
$ilUser->setPref("usr_starting_point", null);
$ilUser->setPref("usr_starting_point_ref_id", null);
return;
}
if($a_value == self::START_REPOSITORY_OBJ)
{
$a_ref_id = (int)$a_ref_id;
if(ilObject::_lookupObjId($a_ref_id) &&
!$tree->isDeleted($a_ref_id))
{
$ilUser->setPref("usr_starting_point", $a_value);
$ilUser->setPref("usr_starting_point_ref_id", $a_ref_id);
return true;
}
}
$valid = array_keys(self::getPossibleStartingPoints());
if(in_array($a_value, $valid))
{
$ilUser->setPref("usr_starting_point", $a_value);
return true;
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilUserUtil::setStartingPoint (   $a_value,
  $a_ref_id = null 
)
static

Set starting point setting.

Parameters
int$a_value
int$a_ref_id
Returns
boolean

Definition at line 213 of file class.ilUserUtil.php.

References $ilSetting, $valid, and ilObject\_lookupObjId().

Referenced by getStartingPoint(), and ilObjSystemFolderGUI\saveBasicSettingsObject().

{
global $ilSetting, $tree;
if($a_value == self::START_REPOSITORY_OBJ)
{
$a_ref_id = (int)$a_ref_id;
if(ilObject::_lookupObjId($a_ref_id) &&
!$tree->isDeleted($a_ref_id))
{
$ilSetting->set("usr_starting_point", $a_value);
$ilSetting->set("usr_starting_point_ref_id", $a_ref_id);
return true;
}
}
$valid = array_keys(self::getPossibleStartingPoints());
if(in_array($a_value, $valid))
{
$ilSetting->set("usr_starting_point", $a_value);
return true;
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilUserUtil::togglePersonalStartingPoint (   $a_value)
static

Toggle personal starting point setting.

Parameters
bool$a_value

Definition at line 352 of file class.ilUserUtil.php.

References $ilSetting.

Referenced by ilObjSystemFolderGUI\saveBasicSettingsObject().

{
global $ilSetting;
$ilSetting->set("usr_starting_point_personal", (bool)$a_value);
}

+ Here is the caller graph for this function:

Field Documentation

const ilUserUtil::START_PD_BOOKMARKS = 3

Definition at line 16 of file class.ilUserUtil.php.

const ilUserUtil::START_PD_CALENDAR = 10

Definition at line 23 of file class.ilUserUtil.php.

Referenced by getPossibleStartingPoints().

const ilUserUtil::START_PD_CONTACTS = 12

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

const ilUserUtil::START_PD_LP = 9

Definition at line 22 of file class.ilUserUtil.php.

const ilUserUtil::START_PD_MAIL = 11

Definition at line 24 of file class.ilUserUtil.php.

const ilUserUtil::START_PD_NEWS = 5

Definition at line 18 of file class.ilUserUtil.php.

const ilUserUtil::START_PD_NOTES = 4

Definition at line 17 of file class.ilUserUtil.php.

const ilUserUtil::START_PD_OVERVIEW = 1
const ilUserUtil::START_PD_PORTFOLIO = 7

Definition at line 20 of file class.ilUserUtil.php.

const ilUserUtil::START_PD_PROFILE = 13

Definition at line 26 of file class.ilUserUtil.php.

const ilUserUtil::START_PD_SETTINGS = 14

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

const ilUserUtil::START_PD_SKILLS = 8

Definition at line 21 of file class.ilUserUtil.php.

const ilUserUtil::START_PD_SUBSCRIPTION = 2

Definition at line 15 of file class.ilUserUtil.php.

Referenced by getPossibleStartingPoints(), and getStartingPoint().

const ilUserUtil::START_PD_WORKSPACE = 6

Definition at line 19 of file class.ilUserUtil.php.

Referenced by getPossibleStartingPoints().

const ilUserUtil::START_REPOSITORY = 15

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

Referenced by getPossibleStartingPoints(), and getStartingPoint().

const ilUserUtil::START_REPOSITORY_OBJ = 16

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

Referenced by ilPersonalSettingsGUI\initGeneralSettingsForm().


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