ILIAS  release_8 Revision v8.24
ilNewsService Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilNewsService:

Public Member Functions

 __construct (ilLanguage $lng, ilSetting $settings, ilObjUser $user, ilNewsObjectAdapterInterface $obj_adapter=null)
 
 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...
 
 isGloballyActivated ()
 

Protected Attributes

ilNewsServiceDependencies $_deps
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning News service

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

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

Constructor & Destructor Documentation

◆ __construct()

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

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

32 {
33 if (is_null($obj_adapter)) {
34 $obj_adapter = new ilNewsObjectAdapter();
35 }
36 $this->_deps = new ilNewsServiceDependencies($lng, $settings, $user, $obj_adapter);
37 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
$lng

References $lng, and ILIAS\LTI\ToolProvider\$settings.

Member Function Documentation

◆ contextForRefId()

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

Get context object for news.

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

64 $obj_id = $this->_deps->obj()->getObjIdForRefId($ref_id);
65 $obj_type = $this->_deps->obj()->getTypeForObjId($obj_id);
66 return new ilNewsContext($obj_id, $obj_type, $subid, $subtype);
67 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:67

◆ data()

ilNewsService::data ( )

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

40 {
41 return new ilNewsData($this, $this->_deps);
42 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ isGloballyActivated()

ilNewsService::isGloballyActivated ( )

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

69 : bool
70 {
71 return (bool) $this->_deps->settings()->get("block_activated_news");
72 }

◆ item()

ilNewsService::item ( ilNewsContext  $context)

Get a new news item for a context.

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

48 {
49 $news = new ilNewsItem();
50 $news->setContext($context->getObjId(), $context->getObjType(), $context->getSubId(), $context->getSubType());
51 $news->setPriority(NEWS_NOTICE);
52 $news->setUserId($this->_deps->user()->getId());
53 return $news;
54 }
const NEWS_NOTICE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A news item can be created by different sources.
$context
Definition: webdav.php:29

References $context, and NEWS_NOTICE.

Field Documentation

◆ $_deps

ilNewsServiceDependencies ilNewsService::$_deps
protected

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


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