ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilNewsData.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
12 {
16  protected $_deps;
17 
21  protected $service;
22 
27  {
28  $this->service = $service;
29  $this->_deps = $_deps;
30  }
31 
38  public function save(ilNewsItem $news_item) : int
39  {
40  if ($news_item->getId() > 0) {
41  $news_item->update(true);
42  } else {
43  $news_item->create();
44  }
45  return $news_item->getId();
46  }
47 
54  public function getNewsOfContext(ilNewsContext $context) : array
55  {
57  $context->getObjId(),
58  $context->getObjType(),
59  $context->getSubId(),
60  $context->getSubType()
61  );
62  }
63 
68  public function delete(ilNewsItem $news_item)
69  {
70  $news_item->delete();
71  }
72 }
$context
Definition: webdav.php:25
getObjId()
Get Obj Id.
News data.
save(ilNewsItem $news_item)
Save news item.
getNewsOfContext(ilNewsContext $context)
Get news of context.
News service.
getSubId()
Get Sub Obj Id.
getId()
Get Id.
__construct(ilNewsService $service, $_deps)
Constructor.
static getNewsOfContext( $a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id=0, $a_context_sub_obj_type="")
Get all news of a context.
update($a_as_new=false)
Update item in database.
getObjType()
Get Obj Type.
create()
Create.
getSubType()
Get Sub Obj Type.