ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.NewsItemManager.php
Go to the documentation of this file.
1<?php
2
20
24
30{
34
35 public function __construct(
39 ) {
40 $this->repo = $repo;
41 $this->data = $data;
42 $this->domain = $domain;
43 }
44
48 public function save(\ilNewsItem $news_item): int
49 {
50 if ($news_item->getId() > 0) {
51 $news_item->update(true);
52 } else {
53 $news_item->create();
54 }
55 return $news_item->getId();
56 }
57
64 public function getNewsOfContext(\ilNewsContext $context): array
65 {
66 return \ilNewsItem::getNewsOfContext(
67 $context->getObjId(),
68 $context->getObjType(),
69 $context->getSubId(),
70 $context->getSubType()
71 );
72 }
73
78 public function delete(\ilNewsItem $news_item): void
79 {
80 $news_item->delete();
81 }
82}
Repository internal data service.
save(\ilNewsItem $news_item)
Save news item.
getNewsOfContext(\ilNewsContext $context)
Get news of context.
__construct(InternalDataService $data, InternalRepoService $repo, InternalDomainService $domain)
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.
update(bool $a_as_new=false)
Update item in database.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$context
Definition: webdav.php:31