ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\News\Service Class Reference
+ Collaboration diagram for ILIAS\News\Service:

Public Member Functions

 __construct (Container $DIC)
 
function 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.

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

36  {
37  $this->DIC = $DIC;
38  $this->obj_adapter = new \ilNewsObjectAdapter();
39  $this->user = $DIC->user();
40  }
+ 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.

79  : \ilNewsContext {
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:65

◆ data()

function 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.

References ilNewsContext\getObjId(), ilNewsContext\getObjType(), ilNewsContext\getSubId(), ilNewsContext\getSubType(), NEWS_NOTICE, and ILIAS\Repository\user().

63  : \ilNewsItem
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  }
$context
Definition: webdav.php:31
const NEWS_NOTICE
A news item can be created by different sources.
+ 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: