ILIAS  release_8 Revision v8.24
class.ilNewsData.php
Go to the documentation of this file.
1<?php
2
24{
27
28 public function __construct(
31 ) {
32 $this->service = $service;
33 $this->_deps = $_deps;
34 }
35
39 public function save(ilNewsItem $news_item): int
40 {
41 if ($news_item->getId() > 0) {
42 $news_item->update(true);
43 } else {
44 $news_item->create();
45 }
46 return $news_item->getId();
47 }
48
55 public function getNewsOfContext(ilNewsContext $context): array
56 {
58 $context->getObjId(),
59 $context->getObjType(),
60 $context->getSubId(),
61 $context->getSubType()
62 );
63 }
64
69 public function delete(ilNewsItem $news_item): void
70 {
71 $news_item->delete();
72 }
73}
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...
ilNewsService $service
getNewsOfContext(ilNewsContext $context)
Get news of context.
__construct(ilNewsService $service, ilNewsServiceDependencies $_deps)
ilNewsServiceDependencies $_deps
save(ilNewsItem $news_item)
Save news item.
A news item can be created by different sources.
update(bool $a_as_new=false)
Update item in database.
static getNewsOfContext(int $a_context_obj_id, string $a_context_obj_type, int $a_context_sub_obj_id=0, string $a_context_sub_obj_type="")
Get all news of a context.
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...
$context
Definition: webdav.php:29