ILIAS
trunk Revision v11.0_alpha-2638-g80c1d007f79
◀ ilDoc Overview
class.Service.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\News
;
22
23
use
ILIAS\DI\Container
;
24
use
ILIAS\News\Items\NewsItemManager
;
25
29
class
Service
30
{
31
protected \ilObjUser
$user
;
32
protected \ilNewsObjectAdapter
$obj_adapter
;
33
protected
Container
$DIC
;
34
35
public
function
__construct
(
Container
$DIC)
36
{
37
$this->
DIC
=
$DIC
;
38
$this->obj_adapter = new \ilNewsObjectAdapter();
39
$this->
user
= $DIC->user();
40
}
41
45
public
function
internal
():
InternalService
46
{
47
return
new
InternalService
($this->
DIC
);
48
}
49
50
public
function
data
(): NewsItemManager
51
{
52
$i = $this->
internal
();
53
return
new
NewsItemManager(
54
$i->data(),
55
$i->repo(),
56
$i->domain()
57
);
58
}
59
63
public
function
item
(\
ilNewsContext
$context
): \
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
}
71
75
public
function
contextForRefId
(
76
int
$ref_id
,
77
int
$subid = 0,
78
string
$subtype =
""
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
}
84
85
public
function
isGloballyActivated
(): bool
86
{
87
return
(
bool
) $this->
DIC
->settings()->get(
"block_activated_news"
);
88
}
89
}
ILIAS\News\Service\isGloballyActivated
isGloballyActivated()
Definition:
class.Service.php:85
ilNewsContext
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition:
class.ilNewsContext.php:22
ILIAS\News\Service\contextForRefId
contextForRefId(int $ref_id, int $subid=0, string $subtype="")
Get context object for news.
Definition:
class.Service.php:75
$context
$context
Definition:
webdav.php:31
ILIAS\News\Service\$user
ilObjUser $user
Definition:
class.Service.php:31
ilNewsContext\getObjId
getObjId()
Definition:
class.ilNewsContext.php:37
ILIAS\News\InternalService
Notes internal service.
Definition:
class.InternalService.php:29
ILIAS\News\Service\item
item(\ilNewsContext $context)
Get a new news item for a context.
Definition:
class.Service.php:63
ILIAS\News\Service
Definition:
class.Service.php:29
ILIAS\News\Service\$obj_adapter
ilNewsObjectAdapter $obj_adapter
Definition:
class.Service.php:32
ILIAS\Repository\user
user()
Definition:
trait.GlobalDICDomainServices.php:66
ILIAS\News\Service\data
function data()
Internal service, do not use in other components.
Definition:
class.Service.php:50
Container
ilNewsContext\getSubId
getSubId()
Definition:
class.ilNewsContext.php:47
$ref_id
$ref_id
Definition:
ltiauth.php:65
NEWS_NOTICE
const NEWS_NOTICE
Definition:
class.ilNewsItem.php:21
ilNewsContext\getObjType
getObjType()
Definition:
class.ilNewsContext.php:42
ilNewsItem
A news item can be created by different sources.
Definition:
class.ilNewsItem.php:42
DIC
ILIAS\News\Service\$DIC
Container $DIC
Definition:
class.Service.php:33
ILIAS\News
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
NewsItemManager
ILIAS\Container
Definition:
Container.php:23
ILIAS\News\Service\__construct
__construct(Container $DIC)
Definition:
class.Service.php:35
ilNewsContext\getSubType
getSubType()
Definition:
class.ilNewsContext.php:52
components
ILIAS
News
Service
class.Service.php
Generated on Sun Aug 31 2025 23:02:16 for ILIAS by
1.8.13 (using
Doxyfile
)