ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\News\Service Class Reference
+ Collaboration diagram for ILIAS\News\Service:

Public Member Functions

 __construct (Container $DIC)
 
 data ()
 Internal service, do not use in other components. More...
 
 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...
 
 isGloballyActivated ()
 

Protected Attributes

ilObjUser $user
 
ilNewsObjectAdapter $obj_adapter
 
Container $DIC
 

Detailed Description

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

Definition at line 29 of file class.Service.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\News\Service::__construct ( Container  $DIC)

Definition at line 35 of file class.Service.php.

36 {
37 $this->DIC = $DIC;
38 $this->obj_adapter = new \ilNewsObjectAdapter();
39 $this->user = $DIC->user();
40 }
user()
Get the current user.
Definition: Container.php:71

References ILIAS\News\Service\$DIC, ILIAS\DI\Container\user(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ contextForRefId()

ILIAS\News\Service::contextForRefId ( int  $ref_id,
int  $subid = 0,
string  $subtype = "" 
)

Get context object for news.

Definition at line 75 of file class.Service.php.

80 $obj_id = $this->obj_adapter->getObjIdForRefId($ref_id);
81 $obj_type = $this->obj_adapter->getTypeForObjId($obj_id);
82 return new \ilNewsContext($obj_id, $obj_type, $subid, $subtype);
83 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:66

◆ data()

ILIAS\News\Service::data ( )

Internal service, do not use in other components.

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

50 : NewsItemManager
51 {
52 $i = $this->internal();
53 return new NewsItemManager(
54 $i->data(),
55 $i->repo(),
56 $i->domain()
57 );
58 }

◆ isGloballyActivated()

ILIAS\News\Service::isGloballyActivated ( )

Definition at line 85 of file class.Service.php.

85 : bool
86 {
87 return (bool) $this->DIC->settings()->get("block_activated_news");
88 }

◆ item()

ILIAS\News\Service::item ( \ilNewsContext  $context)

Get a new news item for a context.

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

64 {
65 $news = new \ilNewsItem();
66 $news->setContext($context->getObjId(), $context->getObjType(), $context->getSubId(), $context->getSubType());
67 $news->setPriority(NEWS_NOTICE);
68 $news->setUserId($this->user->getId());
69 return $news;
70 }
const NEWS_NOTICE
A news item can be created by different sources.
$context
Definition: webdav.php:31

References $context, NEWS_NOTICE, and ILIAS\Repository\user().

+ Here is the call graph for this function:

Field Documentation

◆ $DIC

Container ILIAS\News\Service::$DIC
protected

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

Referenced by ILIAS\News\Service\__construct().

◆ $obj_adapter

ilNewsObjectAdapter ILIAS\News\Service::$obj_adapter
protected

Definition at line 32 of file class.Service.php.

◆ $user

ilObjUser ILIAS\News\Service::$user
protected

Definition at line 31 of file class.Service.php.


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