ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilNewsData.php
Go to the documentation of this file.
1 <?php
2 
24 {
27 
28  public function __construct(
29  ilNewsService $service,
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 }
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...
$context
Definition: webdav.php:29
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
save(ilNewsItem $news_item)
Save news item.
getNewsOfContext(ilNewsContext $context)
Get news of context.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilNewsServiceDependencies $_deps
ilNewsService $service
A news item can be created by different sources.
__construct(ilNewsService $service, ilNewsServiceDependencies $_deps)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
create()
Create.