ILIAS  release_4-4 Revision
ilNewsItemGen Class Reference

A news item can be created by different sources. More...

+ Inheritance diagram for ilNewsItemGen:
+ Collaboration diagram for ilNewsItemGen:

Public Member Functions

 __construct ($a_id=0)
 Constructor. More...
 
 setId ($a_id)
 Set Id. More...
 
 getId ()
 Get Id. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setContent ($a_content)
 Set Content. More...
 
 getContent ()
 Get Content. More...
 
 setContextObjId ($a_context_obj_id)
 Set ContextObjId. More...
 
 getContextObjId ()
 Get ContextObjId. More...
 
 setContextObjType ($a_context_obj_type)
 Set ContextObjType. More...
 
 getContextObjType ()
 Get ContextObjType. More...
 
 setContextSubObjId ($a_context_sub_obj_id)
 Set ContextSubObjId. More...
 
 getContextSubObjId ()
 Get ContextSubObjId. More...
 
 setContextSubObjType ($a_context_sub_obj_type)
 Set ContextSubObjType. More...
 
 getContextSubObjType ()
 Get ContextSubObjType. More...
 
 setContentType ($a_content_type="text")
 Set ContentType. More...
 
 getContentType ()
 Get ContentType. More...
 
 setCreationDate ($a_creation_date)
 Set CreationDate. More...
 
 getCreationDate ()
 Get CreationDate. More...
 
 setUpdateDate ($a_update_date)
 Set UpdateDate. More...
 
 getUpdateDate ()
 Get UpdateDate. More...
 
 setUserId ($a_user_id)
 Set UserId. More...
 
 getUserId ()
 Get UserId. More...
 
 setVisibility ($a_visibility="users")
 Set Visibility. More...
 
 getVisibility ()
 Get Visibility. More...
 
 setContentLong ($a_content_long)
 Set ContentLong. More...
 
 getContentLong ()
 Get ContentLong. More...
 
 setPriority ($a_priority=1)
 Set Priority. More...
 
 getPriority ()
 Get Priority. More...
 
 setContentIsLangVar ($a_content_is_lang_var=0)
 Set ContentIsLangVar. More...
 
 getContentIsLangVar ()
 Get ContentIsLangVar. More...
 
 setMobId ($a_mob_id)
 Set MobId. More...
 
 getMobId ()
 Get MobId. More...
 
 setPlaytime ($a_playtime)
 Set Playtime. More...
 
 getPlaytime ()
 Get Playtime. More...
 
 create ()
 Create new item. More...
 
 delete ()
 Delete item from database. More...
 
 queryNewsForContext ()
 Query NewsForContext. More...
 
 queryNewsForVisibility ()
 Query NewsForVisibility. More...
 

Protected Attributes

 $id
 
 $title
 
 $content
 
 $context_obj_id
 
 $context_obj_type
 
 $context_sub_obj_id
 
 $context_sub_obj_type
 
 $content_type = "text"
 
 $creation_date
 
 $update_date
 
 $user_id
 
 $visibility = "users"
 
 $content_long
 
 $priority = 1
 
 $content_is_lang_var = 0
 
 $mob_id
 
 $playtime
 

Detailed Description

A news item can be created by different sources.

E.g. when a new forum posting is created, or when a change in a learning module is announced.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilNewsItemGen::__construct (   $a_id = 0)

Constructor.

Parameters
int$a_id

Definition at line 64 of file class.ilNewsItemGen.php.

References setId().

65  {
66  if ($a_id > 0)
67  {
68  $this->setId($a_id);
69  $this->read();
70  }
71 
72  }
setId($a_id)
Set Id.
+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilNewsItemGen::create ( )

Create new item.

Definition at line 418 of file class.ilNewsItemGen.php.

419  {
420  global $ilDB;
421 
422  }

◆ delete()

ilNewsItemGen::delete ( )

Delete item from database.

Definition at line 430 of file class.ilNewsItemGen.php.

References $query, and getId().

431  {
432  global $ilDB;
433 
434  $query = "DELETE FROM il_news_item".
435  " WHERE id = ".$ilDB->quote($this->getId(), "integer");
436 
437  $ilDB->manipulate($query);
438 
439  }
+ Here is the call graph for this function:

◆ getContent()

ilNewsItemGen::getContent ( )

Get Content.

Returns
string Content of news.

Definition at line 129 of file class.ilNewsItemGen.php.

References $content.

Referenced by ilNewsItem\create(), and ilNewsItem\update().

130  {
131  return $this->content;
132  }
+ Here is the caller graph for this function:

◆ getContentIsLangVar()

ilNewsItemGen::getContentIsLangVar ( )

Get ContentIsLangVar.

Returns
boolean

Definition at line 369 of file class.ilNewsItemGen.php.

References $content_is_lang_var.

Referenced by ilNewsItem\create(), and ilNewsItem\update().

370  {
372  }
+ Here is the caller graph for this function:

◆ getContentLong()

ilNewsItemGen::getContentLong ( )

Get ContentLong.

Returns
string Long content of news

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

References $content_long.

Referenced by ilNewsItem\create(), and ilNewsItem\update().

330  {
331  return $this->content_long;
332  }
+ Here is the caller graph for this function:

◆ getContentType()

ilNewsItemGen::getContentType ( )

Get ContentType.

Returns
string Content type.

Definition at line 229 of file class.ilNewsItemGen.php.

References $content_type.

Referenced by ilNewsItem\create(), and ilNewsItem\update().

230  {
231  return $this->content_type;
232  }
+ Here is the caller graph for this function:

◆ getContextObjId()

ilNewsItemGen::getContextObjId ( )

Get ContextObjId.

Returns
int

Definition at line 149 of file class.ilNewsItemGen.php.

References $context_obj_id.

Referenced by ilNewsItem\create(), queryNewsForContext(), ilNewsItem\queryNewsForContext(), queryNewsForVisibility(), and ilNewsItem\update().

150  {
151  return $this->context_obj_id;
152  }
+ Here is the caller graph for this function:

◆ getContextObjType()

ilNewsItemGen::getContextObjType ( )

Get ContextObjType.

Returns
int

Definition at line 169 of file class.ilNewsItemGen.php.

References $context_obj_type.

Referenced by ilNewsItem\create(), queryNewsForContext(), ilNewsItem\queryNewsForContext(), queryNewsForVisibility(), and ilNewsItem\update().

170  {
172  }
+ Here is the caller graph for this function:

◆ getContextSubObjId()

ilNewsItemGen::getContextSubObjId ( )

Get ContextSubObjId.

Returns
int

Definition at line 189 of file class.ilNewsItemGen.php.

References $context_sub_obj_id.

Referenced by ilNewsItem\create(), queryNewsForContext(), ilNewsItem\queryNewsForContext(), queryNewsForVisibility(), and ilNewsItem\update().

190  {
192  }
+ Here is the caller graph for this function:

◆ getContextSubObjType()

ilNewsItemGen::getContextSubObjType ( )

Get ContextSubObjType.

Returns
int

Definition at line 209 of file class.ilNewsItemGen.php.

References $context_sub_obj_type.

Referenced by ilNewsItem\create(), queryNewsForContext(), ilNewsItem\queryNewsForContext(), queryNewsForVisibility(), and ilNewsItem\update().

210  {
212  }
+ Here is the caller graph for this function:

◆ getCreationDate()

ilNewsItemGen::getCreationDate ( )

Get CreationDate.

Returns
string Date of creation.

Definition at line 249 of file class.ilNewsItemGen.php.

References $creation_date.

250  {
251  return $this->creation_date;
252  }

◆ getId()

ilNewsItemGen::getId ( )

Get Id.

Returns
int

Definition at line 89 of file class.ilNewsItemGen.php.

References $id.

Referenced by ilNewsItem\create(), delete(), ilNewsItem\increaseDownloadCounter(), ilNewsItem\increasePlayCounter(), ilNewsItem\read(), and ilNewsItem\update().

90  {
91  return $this->id;
92  }
+ Here is the caller graph for this function:

◆ getMobId()

ilNewsItemGen::getMobId ( )

Get MobId.

Returns
int Media Object ID (if news includes attachement)

Definition at line 389 of file class.ilNewsItemGen.php.

References $mob_id.

Referenced by ilNewsItem\create(), ilNewsItem\delete(), ilNewsItem\deliverMobFile(), and ilNewsItem\update().

390  {
391  return $this->mob_id;
392  }
+ Here is the caller graph for this function:

◆ getPlaytime()

ilNewsItemGen::getPlaytime ( )

Get Playtime.

Returns
string Play Time, hh:mm:ss (of attached media file)

Definition at line 409 of file class.ilNewsItemGen.php.

References $playtime.

Referenced by ilNewsItem\create(), and ilNewsItem\update().

410  {
411  return $this->playtime;
412  }
+ Here is the caller graph for this function:

◆ getPriority()

ilNewsItemGen::getPriority ( )

Get Priority.

Returns
int News Priority

Definition at line 349 of file class.ilNewsItemGen.php.

References $priority.

Referenced by ilNewsItem\create(), and ilNewsItem\update().

350  {
351  return $this->priority;
352  }
+ Here is the caller graph for this function:

◆ getTitle()

ilNewsItemGen::getTitle ( )

Get Title.

Returns
string Title of news item.

Definition at line 109 of file class.ilNewsItemGen.php.

References $title.

Referenced by ilNewsItem\create(), and ilNewsItem\update().

110  {
111  return $this->title;
112  }
+ Here is the caller graph for this function:

◆ getUpdateDate()

ilNewsItemGen::getUpdateDate ( )

Get UpdateDate.

Returns
string Date of last update.

Definition at line 269 of file class.ilNewsItemGen.php.

References $update_date.

270  {
271  return $this->update_date;
272  }

◆ getUserId()

ilNewsItemGen::getUserId ( )

Get UserId.

Returns
int User Id of last update.

Definition at line 289 of file class.ilNewsItemGen.php.

References $user_id.

Referenced by ilNewsItem\create(), and ilNewsItem\update().

290  {
291  return $this->user_id;
292  }
+ Here is the caller graph for this function:

◆ getVisibility()

ilNewsItemGen::getVisibility ( )

Get Visibility.

Returns
string Access level of news.

Definition at line 309 of file class.ilNewsItemGen.php.

References $visibility.

Referenced by ilNewsItem\create(), queryNewsForVisibility(), and ilNewsItem\update().

310  {
311  return $this->visibility;
312  }
+ Here is the caller graph for this function:

◆ queryNewsForContext()

ilNewsItemGen::queryNewsForContext ( )

Query NewsForContext.

Definition at line 445 of file class.ilNewsItemGen.php.

References $query, $result, getContextObjId(), getContextObjType(), getContextSubObjId(), and getContextSubObjType().

Referenced by ilNewsItem\queryNewsForContext().

446  {
447  global $ilDB;
448 
449  $query = "SELECT id, title, content, context_obj_id, context_obj_type, context_sub_obj_id, context_sub_obj_type, content_type, creation_date, update_date, user_id, visibility, content_long, priority, content_is_lang_var, mob_id, playtime ".
450  "FROM il_news_item ".
451  "WHERE ".
452  "context_obj_id = ".$ilDB->quote($this->getContextObjId(), "integer").
453  " AND context_obj_type = ".$ilDB->quote($this->getContextObjType(), "text").
454  " AND context_sub_obj_id = ".$ilDB->quote($this->getContextSubObjId(), "integer").
455  " AND ".$ilDB->equals("context_sub_obj_type", $this->getContextSubObjType(), "text", true).
456  " ORDER BY creation_date DESC ".
457  "";
458  $set = $ilDB->query($query);
459  $result = array();
460  while($rec = $ilDB->fetchAssoc($set))
461  {
462  $result[] = $rec;
463  }
464 
465  return $result;
466 
467  }
getContextSubObjType()
Get ContextSubObjType.
$result
getContextSubObjId()
Get ContextSubObjId.
getContextObjId()
Get ContextObjId.
getContextObjType()
Get ContextObjType.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ queryNewsForVisibility()

ilNewsItemGen::queryNewsForVisibility ( )

Query NewsForVisibility.

Definition at line 473 of file class.ilNewsItemGen.php.

References $query, $result, getContextObjId(), getContextObjType(), getContextSubObjId(), getContextSubObjType(), and getVisibility().

474  {
475  global $ilDB;
476 
477  $query = "SELECT id, title, content, context_obj_id, context_obj_type, context_sub_obj_id, context_sub_obj_type, content_type, creation_date, update_date, user_id, visibility, content_long, priority, content_is_lang_var, mob_id, playtime ".
478  "FROM il_news_item ".
479  "WHERE ".
480  "context_obj_id = ".$ilDB->quote($this->getContextObjId(), "integer").
481  " AND context_obj_type = ".$ilDB->quote($this->getContextObjType(), "text").
482  " AND context_sub_obj_id = ".$ilDB->quote($this->getContextSubObjId(), "integer").
483  " AND ".$ilDB->equals("context_sub_obj_type", $this->getContextSubObjType(), "text", true).
484  " AND visibility = ".$ilDB->quote($this->getVisibility(), "text").
485  " ORDER BY creation_date DESC ".
486  "";
487 
488  $set = $ilDB->query($query);
489  $result = array();
490  while($rec = $ilDB->fetchAssoc($set))
491  {
492  $result[] = $rec;
493  }
494 
495  return $result;
496 
497  }
getContextSubObjType()
Get ContextSubObjType.
$result
getContextSubObjId()
Get ContextSubObjId.
getContextObjId()
Get ContextObjId.
getContextObjType()
Get ContextObjType.
getVisibility()
Get Visibility.
+ Here is the call graph for this function:

◆ setContent()

ilNewsItemGen::setContent (   $a_content)

Set Content.

Parameters
string$a_contentContent of news.

Definition at line 119 of file class.ilNewsItemGen.php.

Referenced by ilNewsItem\read().

120  {
121  $this->content = $a_content;
122  }
+ Here is the caller graph for this function:

◆ setContentIsLangVar()

ilNewsItemGen::setContentIsLangVar (   $a_content_is_lang_var = 0)

Set ContentIsLangVar.

Parameters
boolean$a_content_is_lang_var

Definition at line 359 of file class.ilNewsItemGen.php.

Referenced by ilNewsItem\read().

360  {
361  $this->content_is_lang_var = $a_content_is_lang_var;
362  }
+ Here is the caller graph for this function:

◆ setContentLong()

ilNewsItemGen::setContentLong (   $a_content_long)

Set ContentLong.

Parameters
string$a_content_longLong content of news

Definition at line 319 of file class.ilNewsItemGen.php.

Referenced by ilNewsItem\read().

320  {
321  $this->content_long = $a_content_long;
322  }
+ Here is the caller graph for this function:

◆ setContentType()

ilNewsItemGen::setContentType (   $a_content_type = "text")

Set ContentType.

Parameters
string$a_content_typeContent type.

Definition at line 219 of file class.ilNewsItemGen.php.

Referenced by ilNewsItem\read().

220  {
221  $this->content_type = $a_content_type;
222  }
+ Here is the caller graph for this function:

◆ setContextObjId()

ilNewsItemGen::setContextObjId (   $a_context_obj_id)

Set ContextObjId.

Parameters
int$a_context_obj_id

Definition at line 139 of file class.ilNewsItemGen.php.

Referenced by ilNewsItem\read(), and ilNewsItem\setContext().

140  {
141  $this->context_obj_id = $a_context_obj_id;
142  }
+ Here is the caller graph for this function:

◆ setContextObjType()

ilNewsItemGen::setContextObjType (   $a_context_obj_type)

Set ContextObjType.

Parameters
int$a_context_obj_type

Definition at line 159 of file class.ilNewsItemGen.php.

Referenced by ilNewsItem\read(), and ilNewsItem\setContext().

160  {
161  $this->context_obj_type = $a_context_obj_type;
162  }
+ Here is the caller graph for this function:

◆ setContextSubObjId()

ilNewsItemGen::setContextSubObjId (   $a_context_sub_obj_id)

Set ContextSubObjId.

Parameters
int$a_context_sub_obj_id

Definition at line 179 of file class.ilNewsItemGen.php.

Referenced by ilNewsItem\read(), and ilNewsItem\setContext().

180  {
181  $this->context_sub_obj_id = $a_context_sub_obj_id;
182  }
+ Here is the caller graph for this function:

◆ setContextSubObjType()

ilNewsItemGen::setContextSubObjType (   $a_context_sub_obj_type)

Set ContextSubObjType.

Parameters
int$a_context_sub_obj_type

Definition at line 199 of file class.ilNewsItemGen.php.

Referenced by ilNewsItem\read(), and ilNewsItem\setContext().

200  {
201  $this->context_sub_obj_type = $a_context_sub_obj_type;
202  }
+ Here is the caller graph for this function:

◆ setCreationDate()

ilNewsItemGen::setCreationDate (   $a_creation_date)

Set CreationDate.

Parameters
string$a_creation_dateDate of creation.

Definition at line 239 of file class.ilNewsItemGen.php.

Referenced by ilNewsItem\read().

240  {
241  $this->creation_date = $a_creation_date;
242  }
+ Here is the caller graph for this function:

◆ setId()

ilNewsItemGen::setId (   $a_id)

Set Id.

Parameters
int$a_id

Definition at line 79 of file class.ilNewsItemGen.php.

Referenced by __construct(), and ilNewsItem\create().

80  {
81  $this->id = $a_id;
82  }
+ Here is the caller graph for this function:

◆ setMobId()

ilNewsItemGen::setMobId (   $a_mob_id)

Set MobId.

Parameters
int$a_mob_idMedia Object ID (if news includes attachement)

Definition at line 379 of file class.ilNewsItemGen.php.

Referenced by ilNewsItem\read().

380  {
381  $this->mob_id = $a_mob_id;
382  }
+ Here is the caller graph for this function:

◆ setPlaytime()

ilNewsItemGen::setPlaytime (   $a_playtime)

Set Playtime.

Parameters
string$a_playtimePlay Time, hh:mm:ss (of attached media file)

Definition at line 399 of file class.ilNewsItemGen.php.

Referenced by ilNewsItem\read().

400  {
401  $this->playtime = $a_playtime;
402  }
+ Here is the caller graph for this function:

◆ setPriority()

ilNewsItemGen::setPriority (   $a_priority = 1)

Set Priority.

Parameters
int$a_priorityNews Priority

Definition at line 339 of file class.ilNewsItemGen.php.

Referenced by ilNewsItem\read().

340  {
341  $this->priority = $a_priority;
342  }
+ Here is the caller graph for this function:

◆ setTitle()

ilNewsItemGen::setTitle (   $a_title)

Set Title.

Parameters
string$a_titleTitle of news item.

Definition at line 99 of file class.ilNewsItemGen.php.

Referenced by ilNewsItem\read().

100  {
101  $this->title = $a_title;
102  }
+ Here is the caller graph for this function:

◆ setUpdateDate()

ilNewsItemGen::setUpdateDate (   $a_update_date)

Set UpdateDate.

Parameters
string$a_update_dateDate of last update.

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

Referenced by ilNewsItem\read().

260  {
261  $this->update_date = $a_update_date;
262  }
+ Here is the caller graph for this function:

◆ setUserId()

ilNewsItemGen::setUserId (   $a_user_id)

Set UserId.

Parameters
int$a_user_idUser Id of last update.

Definition at line 279 of file class.ilNewsItemGen.php.

Referenced by ilNewsItem\read().

280  {
281  $this->user_id = $a_user_id;
282  }
+ Here is the caller graph for this function:

◆ setVisibility()

ilNewsItemGen::setVisibility (   $a_visibility = "users")

Set Visibility.

Parameters
string$a_visibilityAccess level of news.

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

Referenced by ilNewsItem\read().

300  {
301  $this->visibility = $a_visibility;
302  }
+ Here is the caller graph for this function:

Field Documentation

◆ $content

ilNewsItemGen::$content
protected

Definition at line 43 of file class.ilNewsItemGen.php.

Referenced by getContent().

◆ $content_is_lang_var

ilNewsItemGen::$content_is_lang_var = 0
protected

Definition at line 55 of file class.ilNewsItemGen.php.

Referenced by getContentIsLangVar().

◆ $content_long

ilNewsItemGen::$content_long
protected

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

Referenced by getContentLong().

◆ $content_type

ilNewsItemGen::$content_type = "text"
protected

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

Referenced by getContentType().

◆ $context_obj_id

ilNewsItemGen::$context_obj_id
protected

Definition at line 44 of file class.ilNewsItemGen.php.

Referenced by getContextObjId().

◆ $context_obj_type

ilNewsItemGen::$context_obj_type
protected

Definition at line 45 of file class.ilNewsItemGen.php.

Referenced by getContextObjType().

◆ $context_sub_obj_id

ilNewsItemGen::$context_sub_obj_id
protected

Definition at line 46 of file class.ilNewsItemGen.php.

Referenced by getContextSubObjId().

◆ $context_sub_obj_type

ilNewsItemGen::$context_sub_obj_type
protected

Definition at line 47 of file class.ilNewsItemGen.php.

Referenced by getContextSubObjType().

◆ $creation_date

ilNewsItemGen::$creation_date
protected

Definition at line 49 of file class.ilNewsItemGen.php.

Referenced by getCreationDate().

◆ $id

ilNewsItemGen::$id
protected

◆ $mob_id

ilNewsItemGen::$mob_id
protected

Definition at line 56 of file class.ilNewsItemGen.php.

Referenced by getMobId().

◆ $playtime

ilNewsItemGen::$playtime
protected

Definition at line 57 of file class.ilNewsItemGen.php.

Referenced by getPlaytime().

◆ $priority

ilNewsItemGen::$priority = 1
protected

Definition at line 54 of file class.ilNewsItemGen.php.

Referenced by getPriority().

◆ $title

ilNewsItemGen::$title
protected

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

Referenced by getTitle().

◆ $update_date

ilNewsItemGen::$update_date
protected

Definition at line 50 of file class.ilNewsItemGen.php.

Referenced by getUpdateDate().

◆ $user_id

ilNewsItemGen::$user_id
protected

Definition at line 51 of file class.ilNewsItemGen.php.

Referenced by getUserId(), and ilNewsItem\queryNewsForMultipleContexts().

◆ $visibility

ilNewsItemGen::$visibility = "users"
protected

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