ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilNewsService Class Reference

News service. More...

+ Collaboration diagram for ilNewsService:

Public Member Functions

 __construct (ilLanguage $lng, ilSetting $settings, ilObjUser $user, ilNewsObjectAdapterInterface $obj_adapter=null)
 Constructor. More...
 
 data ()
 
 item (ilNewsContext $context)
 Get a new news item for a context. More...
 
 contextForRefId (int $ref_id, int $subid=0, string $subtype="")
 Get context object for news. More...
 

Protected Attributes

 $_deps
 

Detailed Description

News service.

Author
killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 11 of file class.ilNewsService.php.

Constructor & Destructor Documentation

◆ __construct()

ilNewsService::__construct ( ilLanguage  $lng,
ilSetting  $settings,
ilObjUser  $user,
ilNewsObjectAdapterInterface  $obj_adapter = null 
)

Constructor.

Parameters
ilLanguage$lng

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

23 {
24 if (is_null($obj_adapter)) {
25 $obj_adapter = new ilNewsObjectAdapter();
26 }
27 $this->_deps = new ilNewsServiceDependencies($lng, $settings, $user, $obj_adapter);
28 }
Wraps ilObject dependencies.
$user
Definition: migrateto20.php:57
$lng

References $lng, and $user.

Member Function Documentation

◆ contextForRefId()

ilNewsService::contextForRefId ( int  $ref_id,
int  $subid = 0,
string  $subtype = "" 
)

Get context object for news.

Parameters
int$ref_id
string$subtype
int$subid
Returns
ilNewsContext

Definition at line 61 of file class.ilNewsService.php.

62 {
63 $obj_id = $this->_deps->obj()->getObjIdForRefId($ref_id);
64 $obj_type = $this->_deps->obj()->getTypeForObjId($obj_id);
65 return new ilNewsContext($obj_id, $obj_type, $subid, $subtype);
66 }

◆ data()

ilNewsService::data ( )

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

34 {
35 return new ilNewsData($this, $this->_deps);
36 }
News data.

◆ item()

ilNewsService::item ( ilNewsContext  $context)

Get a new news item for a context.

Parameters
ilNewsContext$context
Returns
ilNewsItem

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

45 {
46 $news = new ilNewsItem();
47 $news->setContext($context->getObjId(), $context->getObjType(), $context->getSubId(), $context->getSubType());
48 $news->setPriority(NEWS_NOTICE);
49 $news->setUserId($this->_deps->user()->getId());
50 return $news;
51 }
const NEWS_NOTICE
$context
Definition: webdav.php:25

References $context, and NEWS_NOTICE.

Field Documentation

◆ $_deps

ilNewsService::$_deps
protected

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


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