ILIAS  trunk Revision v12.0_alpha-413-g215742c0453
ILIAS\News\Data\NewsItem Class Reference

News Item DTO for transfer of news items. More...

+ Collaboration diagram for ILIAS\News\Data\NewsItem:

Public Member Functions

 __construct (protected int $id, protected string $title, protected string $content, protected int $context_obj_id, protected string $context_obj_type, protected int $context_sub_obj_id, protected ?string $context_sub_obj_type, protected string $content_type, protected \DateTimeImmutable $creation_date, protected \DateTimeImmutable $update_date, protected int $user_id, protected int $update_user_id, protected string $visibility, protected string $content_long, protected int $priority, protected bool $content_is_lang_var, protected bool $content_text_is_lang_var, protected int $mob_id, protected string $playtime, protected int $mob_cnt_play, protected int $mob_cnt_download, protected bool $content_html, protected int $context_ref_id=0)
 
 getId ()
 
 isContentTextIsLangVar ()
 
 getTitle ()
 
 getContent ()
 
 getContextObjId ()
 
 getContextRefId ()
 
 getContextObjType ()
 
 getContextSubObjId ()
 
 getContextSubObjType ()
 
 getContentType ()
 
 getCreationDate ()
 
 getUpdateDate ()
 
 getUserId ()
 
 getUpdateUserId ()
 
 getVisibility ()
 
 getContentLong ()
 
 getPriority ()
 
 isContentIsLangVar ()
 
 getMobId ()
 
 getPlaytime ()
 
 getMobCntPlay ()
 
 getMobCntDownload ()
 
 isContentHtml ()
 
 withContextRefId (int $context_ref_id)
 
 withContent (string $content)
 
 withContentLong (string $content_long)
 
 toArray ()
 
 toLegacy ()
 

Detailed Description

News Item DTO for transfer of news items.

Definition at line 28 of file NewsItem.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\News\Data\NewsItem::__construct ( protected int  $id,
protected string  $title,
protected string  $content,
protected int  $context_obj_id,
protected string  $context_obj_type,
protected int  $context_sub_obj_id,
protected ?string  $context_sub_obj_type,
protected string  $content_type,
protected \DateTimeImmutable  $creation_date,
protected \DateTimeImmutable  $update_date,
protected int  $user_id,
protected int  $update_user_id,
protected string  $visibility,
protected string  $content_long,
protected int  $priority,
protected bool  $content_is_lang_var,
protected bool  $content_text_is_lang_var,
protected int  $mob_id,
protected string  $playtime,
protected int  $mob_cnt_play,
protected int  $mob_cnt_download,
protected bool  $content_html,
protected int  $context_ref_id = 0 
)

Definition at line 30 of file NewsItem.php.

54 {
55 }

Member Function Documentation

◆ getContent()

ILIAS\News\Data\NewsItem::getContent ( )

Definition at line 72 of file NewsItem.php.

72 : string
73 {
74 return $this->content;
75 }

◆ getContentLong()

ILIAS\News\Data\NewsItem::getContentLong ( )

Definition at line 132 of file NewsItem.php.

132 : string
133 {
134 return $this->content_long;
135 }

◆ getContentType()

ILIAS\News\Data\NewsItem::getContentType ( )

Definition at line 102 of file NewsItem.php.

102 : string
103 {
104 return $this->content_type;
105 }

◆ getContextObjId()

ILIAS\News\Data\NewsItem::getContextObjId ( )

Definition at line 77 of file NewsItem.php.

77 : int
78 {
79 return $this->context_obj_id;
80 }

Referenced by ILIAS\News\Data\NewsCollection\addNewsItem(), and ILIAS\News\Data\NewsCollection\getGroupingFor().

+ Here is the caller graph for this function:

◆ getContextObjType()

ILIAS\News\Data\NewsItem::getContextObjType ( )

Definition at line 87 of file NewsItem.php.

87 : string
88 {
89 return $this->context_obj_type;
90 }

Referenced by ILIAS\News\Data\NewsCollection\addNewsItem(), and ILIAS\News\Data\NewsCollection\getGroupingFor().

+ Here is the caller graph for this function:

◆ getContextRefId()

ILIAS\News\Data\NewsItem::getContextRefId ( )

Definition at line 82 of file NewsItem.php.

82 : int
83 {
84 return $this->context_ref_id;
85 }

Referenced by ILIAS\News\Data\NewsCollection\getGroupingFor().

+ Here is the caller graph for this function:

◆ getContextSubObjId()

ILIAS\News\Data\NewsItem::getContextSubObjId ( )

Definition at line 92 of file NewsItem.php.

92 : int
93 {
94 return $this->context_sub_obj_id;
95 }

◆ getContextSubObjType()

ILIAS\News\Data\NewsItem::getContextSubObjType ( )

Definition at line 97 of file NewsItem.php.

97 : ?string
98 {
99 return $this->context_sub_obj_type;
100 }

◆ getCreationDate()

ILIAS\News\Data\NewsItem::getCreationDate ( )

Definition at line 107 of file NewsItem.php.

107 : DateTimeImmutable
108 {
109 return $this->creation_date;
110 }

◆ getId()

ILIAS\News\Data\NewsItem::getId ( )

Definition at line 57 of file NewsItem.php.

57 : int
58 {
59 return $this->id;
60 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id.

Referenced by ILIAS\News\Data\NewsCollection\addNewsItem(), ILIAS\News\Data\NewsCollection\getGroupingFor(), ilNewsTimelineItemGUI\renderMedia(), and ilNewsTimelineItemGUI\renderMediaModal().

+ Here is the caller graph for this function:

◆ getMobCntDownload()

ILIAS\News\Data\NewsItem::getMobCntDownload ( )

Definition at line 162 of file NewsItem.php.

162 : int
163 {
164 return $this->mob_cnt_download;
165 }

◆ getMobCntPlay()

ILIAS\News\Data\NewsItem::getMobCntPlay ( )

Definition at line 157 of file NewsItem.php.

157 : int
158 {
159 return $this->mob_cnt_play;
160 }

◆ getMobId()

ILIAS\News\Data\NewsItem::getMobId ( )

Definition at line 147 of file NewsItem.php.

147 : int
148 {
149 return $this->mob_id;
150 }

Referenced by ilNewsTimelineItemGUI\getMediaPath().

+ Here is the caller graph for this function:

◆ getPlaytime()

ILIAS\News\Data\NewsItem::getPlaytime ( )

Definition at line 152 of file NewsItem.php.

152 : string
153 {
154 return $this->playtime;
155 }

◆ getPriority()

ILIAS\News\Data\NewsItem::getPriority ( )

Definition at line 137 of file NewsItem.php.

137 : int
138 {
139 return $this->priority;
140 }

◆ getTitle()

ILIAS\News\Data\NewsItem::getTitle ( )

Definition at line 67 of file NewsItem.php.

67 : string
68 {
69 return $this->title;
70 }

◆ getUpdateDate()

ILIAS\News\Data\NewsItem::getUpdateDate ( )

Definition at line 112 of file NewsItem.php.

112 : DateTimeImmutable
113 {
114 return $this->update_date;
115 }

◆ getUpdateUserId()

ILIAS\News\Data\NewsItem::getUpdateUserId ( )

Definition at line 122 of file NewsItem.php.

122 : int
123 {
124 return $this->update_user_id;
125 }

◆ getUserId()

ILIAS\News\Data\NewsItem::getUserId ( )

Definition at line 117 of file NewsItem.php.

117 : int
118 {
119 return $this->user_id;
120 }

References $user_id.

◆ getVisibility()

ILIAS\News\Data\NewsItem::getVisibility ( )

Definition at line 127 of file NewsItem.php.

127 : string
128 {
129 return $this->visibility;
130 }

◆ isContentHtml()

ILIAS\News\Data\NewsItem::isContentHtml ( )

Definition at line 167 of file NewsItem.php.

167 : bool
168 {
169 return $this->content_html;
170 }

◆ isContentIsLangVar()

ILIAS\News\Data\NewsItem::isContentIsLangVar ( )

Definition at line 142 of file NewsItem.php.

142 : bool
143 {
144 return $this->content_is_lang_var;
145 }

◆ isContentTextIsLangVar()

ILIAS\News\Data\NewsItem::isContentTextIsLangVar ( )

Definition at line 62 of file NewsItem.php.

62 : bool
63 {
64 return $this->content_text_is_lang_var;
65 }

◆ toArray()

ILIAS\News\Data\NewsItem::toArray ( )

Definition at line 195 of file NewsItem.php.

195 : array
196 {
197 return [
198 'id' => $this->id,
199 'title' => $this->title,
200 'content' => $this->content,
201 'context_obj_id' => $this->context_obj_id,
202 'context_obj_type' => $this->context_obj_type,
203 'context_sub_obj_id' => $this->context_sub_obj_id,
204 'context_sub_obj_type' => $this->context_sub_obj_type,
205 'content_type' => $this->content_type,
206 'creation_date' => $this->creation_date->format('Y-m-d H:i:s'),
207 'update_date' => $this->update_date->format('Y-m-d H:i:s'),
208 'user_id' => $this->user_id,
209 'update_user_id' => $this->update_user_id,
210 'visibility' => $this->visibility,
211 'content_long' => $this->content_long,
212 'priority' => $this->priority,
213 'content_is_lang_var' => $this->content_is_lang_var,
214 'content_text_is_lang_var' => $this->content_text_is_lang_var,
215 'mob_id' => $this->mob_id,
216 'playtime' => $this->playtime,
217 'mob_cnt_play' => $this->mob_cnt_play,
218 'mob_cnt_download' => $this->mob_cnt_download,
219 'content_html' => $this->content_html
220 ];
221 }

References $id, and $user_id.

◆ toLegacy()

ILIAS\News\Data\NewsItem::toLegacy ( )

Definition at line 223 of file NewsItem.php.

224 {
225 $item = new \ilNewsItem(0); //prevent database loading
226 $item->setId($this->id);
227 $item->setTitle($this->title);
228 $item->setContent($this->content);
229 $item->setContextObjId($this->context_obj_id);
230 $item->setContextObjType($this->context_obj_type);
231 $item->setContextSubObjId($this->context_sub_obj_id);
232 $item->setContextSubObjType($this->context_sub_obj_type);
233 $item->setContentType($this->content_type);
234 $item->setCreationDate($this->creation_date->format('Y-m-d H:i:s'));
235 $item->setUpdateDate($this->update_date->format('Y-m-d H:i:s'));
236 $item->setUserId($this->user_id);
237 $item->setUpdateUserId($this->update_user_id);
238 $item->setVisibility($this->visibility);
239 $item->setContentLong($this->content_long);
240 $item->setPriority($this->priority);
241 $item->setContentIsLangVar($this->content_is_lang_var);
242 $item->setContentTextIsLangVar($this->content_text_is_lang_var);
243 $item->setMobId($this->mob_id);
244 $item->setPlaytime($this->playtime);
245 $item->setMobPlayCounter($this->mob_cnt_play);
246 $item->setMobDownloadCounter($this->mob_cnt_download);
247 $item->setContentHtml($this->content_html);
248 return $item;
249 }
A news item can be created by different sources.

◆ withContent()

ILIAS\News\Data\NewsItem::withContent ( string  $content)

Definition at line 180 of file NewsItem.php.

180 : NewsItem
181 {
182 $clone = clone $this;
183 $clone->content = $content;
184 return $clone;
185 }

Referenced by ILIAS\News\Data\NewsCollection\getGroupingFor().

+ Here is the caller graph for this function:

◆ withContentLong()

ILIAS\News\Data\NewsItem::withContentLong ( string  $content_long)

Definition at line 187 of file NewsItem.php.

187 : NewsItem
188 {
189 $clone = clone $this;
190 $clone->content_long = $content_long;
191 return $clone;
192 }

◆ withContextRefId()

ILIAS\News\Data\NewsItem::withContextRefId ( int  $context_ref_id)

Definition at line 173 of file NewsItem.php.

173 : NewsItem
174 {
175 $clone = clone $this;
176 $clone->context_ref_id = $context_ref_id;
177 return $clone;
178 }

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