ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilForumAuthorInformation Class Reference

ilForumAuthorInformation More...

+ Collaboration diagram for ilForumAuthorInformation:

Public Member Functions

 __construct ($author_id, $display_id, $alias, $import_name, array $public_profile_link_attributes=array())
 
 getProfilePicture ()
 
 getAuthor ()
 
 getAuthorName ($without_short_name=false)
 
 getAuthorShortName ()
 
 getLinkedAuthorName ()
 
 getLinkedAuthorShortName ()
 
 hasSuffix ()
 
 getSuffix ()
 

Protected Member Functions

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

Protected Attributes

 $display_id
 
 $alias
 
 $import_name
 
 $public_profile_link_attributes = array()
 
 $author_name
 
 $author_short_name
 
 $linked_public_name
 
 $linked_short_name
 
 $suffix = ''
 
 $profilePicture
 
 $author
 
 $files = array()
 
 $author_id
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilForumAuthorInformation::__construct (   $author_id,
  $display_id,
  $alias,
  $import_name,
array  $public_profile_link_attributes = array() 
)
Parameters
int$author_id
int$display_id
string$alias
string$import_name
array$public_profile_link_attributes

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

88 {
89 $this->author_id = $author_id;
90 $this->display_id = $display_id;
91 $this->alias = $alias;
92 $this->import_name = $import_name;
93 $this->public_profile_link_attributes = $public_profile_link_attributes;
94
95 $this->init();
96 }

References $alias, $author_id, $display_id, $import_name, and $public_profile_link_attributes.

Member Function Documentation

◆ buildAuthorProfileLink()

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

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

156 {
157 $link = '';
158
159 if($with_profile_link && $this->public_profile_link_attributes)
160 {
161 $link = '<a';
162
163 foreach($this->public_profile_link_attributes as $attr => $value)
164 {
165 $link .= ' ' . $attr . '="' . $value . '"';
166 }
167
168 $link .= '>';
169 }
170
171 $linked_login = $link . $this->author_short_name;
172 $link .= $this->author_name;
173
174 if($with_profile_link && $this->public_profile_link_attributes)
175 {
176 $link .= '</a>';
177 $linked_login .= '</a>';
178 }
179
180 $this->linked_public_name = $link;
181 $this->linked_short_name = $linked_login;
182 }

References $author_name, and $author_short_name.

◆ doesAuthorAccountExists()

ilForumAuthorInformation::doesAuthorAccountExists ( )
protected
Returns
bool

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

127 {
128 return $this->getAuthor() instanceof ilObjUser && $this->getAuthor()->getId();
129 }

References getAuthor().

Referenced by isAuthorAnonymous().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAuthor()

ilForumAuthorInformation::getAuthor ( )
Returns
ilObjUser

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

References $author.

Referenced by 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 290 of file class.ilForumAuthorInformation.php.

291 {
292 if(!$without_short_name)
293 {
294 return $this->author_name;
295 }
296 else
297 {
298 return trim(preg_replace('/\‍(' . $this->getAuthorShortName() . '\‍)/', '', $this->author_name));
299 }
300 }

References $author_name, and getAuthorShortName().

+ Here is the call graph for this function:

◆ getAuthorShortName()

ilForumAuthorInformation::getAuthorShortName ( )
Returns
string

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

306 {
308 }

References $author_short_name.

Referenced by getAuthorName().

+ Here is the caller graph for this function:

◆ getLinkedAuthorName()

ilForumAuthorInformation::getLinkedAuthorName ( )
Returns
string

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

References $linked_public_name.

◆ getLinkedAuthorShortName()

ilForumAuthorInformation::getLinkedAuthorShortName ( )
Returns
string

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

References $linked_short_name.

◆ getProfilePicture()

ilForumAuthorInformation::getProfilePicture ( )
Returns
string

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

References $profilePicture.

◆ getSuffix()

ilForumAuthorInformation::getSuffix ( )
Returns
string

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

References $suffix.

◆ hasSuffix()

ilForumAuthorInformation::hasSuffix ( )
Returns
bool

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

330 {
331 return strlen($this->suffix);
332 }

◆ initUserInstance()

ilForumAuthorInformation::initUserInstance ( )
protected

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

102 {
103 if(is_numeric($this->display_id) && $this->display_id > 0)
104 {
105 // Try to read user instance from preloaded cache array
106 $this->author = ilForumAuthorInformationCache::getUserObjectById($this->display_id);
107 if(!$this->author)
108 {
109 // Get a user instance from forum module's cache method
110 $this->author = ilObjForumAccess::getCachedUserInstance($this->display_id);
111 }
112 }
113
114 if(!$this->author)
115 {
116 $this->author = new ilObjUser();
117 $this->author->setId(0);
118 $this->author->setPref('public_profile', 'n');
119 $this->author->setGender('');
120 }
121 }
static getCachedUserInstance($usr_id)

References ilObjForumAccess\getCachedUserInstance(), and ilForumAuthorInformationCache\getUserObjectById().

+ Here is the call graph for this function:

◆ isAuthorAnonymous()

ilForumAuthorInformation::isAuthorAnonymous ( )
protected
Returns
bool

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

135 {
136 return $this->doesAuthorAccountExists() && $this->getAuthor()->getId() == ANONYMOUS_USER_ID;
137 }

References doesAuthorAccountExists(), and getAuthor().

+ Here is the call graph for this function:

Field Documentation

◆ $alias

ilForumAuthorInformation::$alias
protected

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

Referenced by __construct().

◆ $author

ilForumAuthorInformation::$author
protected

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

Referenced by getAuthor().

◆ $author_id

ilForumAuthorInformation::$author_id
protected

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

Referenced by __construct().

◆ $author_name

ilForumAuthorInformation::$author_name
protected

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

Referenced by buildAuthorProfileLink(), and getAuthorName().

◆ $author_short_name

ilForumAuthorInformation::$author_short_name
protected

◆ $display_id

ilForumAuthorInformation::$display_id
protected

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

Referenced by __construct().

◆ $files

ilForumAuthorInformation::$files = array()
protected

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

◆ $import_name

ilForumAuthorInformation::$import_name
protected

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

Referenced by __construct().

◆ $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().

◆ $public_profile_link_attributes

ilForumAuthorInformation::$public_profile_link_attributes = array()
protected

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

Referenced by __construct().

◆ $suffix

ilForumAuthorInformation::$suffix = ''
protected

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

Referenced by getSuffix().


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