ILIAS  release_4-4 Revision
ilForumAuthorInformation Class Reference

ilForumAuthorInformation More...

+ Collaboration diagram for ilForumAuthorInformation:

Public Member Functions

 __construct ($authorEntity, $pseudonym, $importName, array $publicProfileLinkAttributes=array())
 
 getProfilePicture ()
 
 getAuthor ()
 
 getAuthorName ($without_short_name=false)
 
 getAuthorShortName ()
 
 getLinkedAuthorName ()
 
 getLinkedAuthorShortName ()
 
 isPseudonymUsed ()
 

Protected Member Functions

 initUserInstance ()
 
 doesAuthorAccountExists ()
 
 isAuthorAnonymous ()
 
 buildAuthorProfileLink ($with_profile_link=false)
 

Protected Attributes

 $authorEntity
 
 $pseudonym
 
 $importName
 
 $publicProfileLinkAttributes = array()
 
 $authorName
 
 $authorShortName
 
 $linked_public_name
 
 $linked_short_name
 
 $is_pseudonym = false
 
 $profilePicture
 
 $author
 
 $files = array()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilForumAuthorInformation::__construct (   $authorEntity,
  $pseudonym,
  $importName,
array  $publicProfileLinkAttributes = array() 
)
Parameters
ilObjUser | int$authorEntity
$pseudonym
$importName
array$publicProfileLinkAttributes

Definition at line 81 of file class.ilForumAuthorInformation.php.

References $authorEntity, $importName, $pseudonym, and $publicProfileLinkAttributes.

82  {
83  $this->authorEntity = $authorEntity;
84  $this->pseudonym = $pseudonym;
85  $this->importName = $importName;
86  $this->publicProfileLinkAttributes = $publicProfileLinkAttributes;
87 
88  $this->init();
89  }

Member Function Documentation

◆ buildAuthorProfileLink()

ilForumAuthorInformation::buildAuthorProfileLink (   $with_profile_link = false)
protected
Parameters
bool$with_profile_link

Definition at line 153 of file class.ilForumAuthorInformation.php.

References $authorName, $authorShortName, $lng, doesAuthorAccountExists(), getAuthor(), ilUtil\getImagePath(), initUserInstance(), and isAuthorAnonymous().

154  {
155  $link = '';
156 
157  if($with_profile_link && $this->publicProfileLinkAttributes)
158  {
159  $link = '<a';
160 
161  foreach($this->publicProfileLinkAttributes as $attr => $value)
162  {
163  $link .= ' ' . $attr . '="' . $value . '"';
164  }
165 
166  $link .= '>';
167  }
168 
169  $linked_login = $link . $this->authorShortName;
170  $link .= $this->authorName;
171 
172  if($with_profile_link && $this->publicProfileLinkAttributes)
173  {
174  $link .= '</a>';
175  $linked_login .= '</a>';
176  }
177 
178  $this->linked_public_name = $link;
179  $this->linked_short_name = $linked_login;
180  }
+ Here is the call graph for this function:

◆ doesAuthorAccountExists()

ilForumAuthorInformation::doesAuthorAccountExists ( )
protected
Returns
bool

Definition at line 124 of file class.ilForumAuthorInformation.php.

References getAuthor().

Referenced by buildAuthorProfileLink(), and isAuthorAnonymous().

125  {
126  return $this->getAuthor() instanceof ilObjUser && $this->getAuthor()->getId();
127  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAuthor()

ilForumAuthorInformation::getAuthor ( )
Returns
ilObjUser

Definition at line 267 of file class.ilForumAuthorInformation.php.

References $author.

Referenced by buildAuthorProfileLink(), doesAuthorAccountExists(), and isAuthorAnonymous().

+ Here is the caller graph for this function:

◆ getAuthorName()

ilForumAuthorInformation::getAuthorName (   $without_short_name = false)
Parameters
bool$without_short_name
Returns
string

Definition at line 276 of file class.ilForumAuthorInformation.php.

References $authorName, and getAuthorShortName().

277  {
278  if(!$without_short_name)
279  {
280  return $this->authorName;
281  }
282  else
283  {
284  return trim(preg_replace('/\('.$this->getAuthorShortName().'\)/', '', $this->authorName));
285  }
286  }
+ Here is the call graph for this function:

◆ getAuthorShortName()

ilForumAuthorInformation::getAuthorShortName ( )
Returns
string

Definition at line 291 of file class.ilForumAuthorInformation.php.

References $authorShortName.

Referenced by getAuthorName().

+ Here is the caller graph for this function:

◆ getLinkedAuthorName()

ilForumAuthorInformation::getLinkedAuthorName ( )
Returns
string

Definition at line 299 of file class.ilForumAuthorInformation.php.

References $linked_public_name.

◆ getLinkedAuthorShortName()

ilForumAuthorInformation::getLinkedAuthorShortName ( )
Returns
string

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

References $linked_short_name.

◆ getProfilePicture()

ilForumAuthorInformation::getProfilePicture ( )
Returns
string

Definition at line 259 of file class.ilForumAuthorInformation.php.

References $profilePicture.

◆ initUserInstance()

ilForumAuthorInformation::initUserInstance ( )
protected

Definition at line 94 of file class.ilForumAuthorInformation.php.

References $authorEntity, ilObjForumAccess\getCachedUserInstance(), ilObject\getId(), and ilForumAuthorInformationCache\getUserObjectById().

Referenced by buildAuthorProfileLink().

95  {
96  if($this->authorEntity instanceof ilObjUser && $this->authorEntity->getId())
97  {
98  $this->author = $this->authorEntity;
99  }
100  else if(is_numeric($this->authorEntity) && $this->authorEntity)
101  {
102  // Try to read user instance from preloaded cache array
103  $this->author = ilForumAuthorInformationCache::getUserObjectById($this->authorEntity);
104 
105  if(!$this->author)
106  {
107  // Get a user instance from forum module's cache method
108  $this->author = ilObjForumAccess::getCachedUserInstance($this->authorEntity);
109  }
110  }
111 
112  if(!$this->author)
113  {
114  $this->author = new ilObjUser();
115  $this->author->setId(0);
116  $this->author->setPref('public_profile', 'n');
117  $this->author->setGender('');
118  }
119  }
static getCachedUserInstance($usr_id)
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAuthorAnonymous()

ilForumAuthorInformation::isAuthorAnonymous ( )
protected
Returns
bool

Definition at line 132 of file class.ilForumAuthorInformation.php.

References $ilUser, doesAuthorAccountExists(), and getAuthor().

Referenced by buildAuthorProfileLink().

133  {
134  return $this->doesAuthorAccountExists() && $this->getAuthor()->getId() == ANONYMOUS_USER_ID;
135  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isPseudonymUsed()

ilForumAuthorInformation::isPseudonymUsed ( )
Returns
bool

Definition at line 316 of file class.ilForumAuthorInformation.php.

References $is_pseudonym.

Field Documentation

◆ $author

ilForumAuthorInformation::$author
protected

Definition at line 68 of file class.ilForumAuthorInformation.php.

Referenced by getAuthor().

◆ $authorEntity

ilForumAuthorInformation::$authorEntity
protected

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

Referenced by __construct(), and initUserInstance().

◆ $authorName

ilForumAuthorInformation::$authorName
protected

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

Referenced by buildAuthorProfileLink(), and getAuthorName().

◆ $authorShortName

ilForumAuthorInformation::$authorShortName
protected

◆ $files

ilForumAuthorInformation::$files = array()
protected

Definition at line 73 of file class.ilForumAuthorInformation.php.

◆ $importName

ilForumAuthorInformation::$importName
protected

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

Referenced by __construct().

◆ $is_pseudonym

ilForumAuthorInformation::$is_pseudonym = false
protected

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

Referenced by isPseudonymUsed().

◆ $linked_public_name

ilForumAuthorInformation::$linked_public_name
protected

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

Referenced by getLinkedAuthorName().

◆ $linked_short_name

ilForumAuthorInformation::$linked_short_name
protected

Definition at line 53 of file class.ilForumAuthorInformation.php.

Referenced by getLinkedAuthorShortName().

◆ $profilePicture

ilForumAuthorInformation::$profilePicture
protected

Definition at line 63 of file class.ilForumAuthorInformation.php.

Referenced by getProfilePicture().

◆ $pseudonym

ilForumAuthorInformation::$pseudonym
protected

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

Referenced by __construct().

◆ $publicProfileLinkAttributes

ilForumAuthorInformation::$publicProfileLinkAttributes = array()
protected

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

Referenced by __construct().


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