ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
trait.ilObjFileNews.php File Reference

Go to the source code of this file.

Functions

 notifyCreation (int $obj_id, ?string $additional_message=null)
 
 enableNotification ()
 
 notifyUpdate (int $obj_id, ?string $additional_message=null)
 
 addNewsNotification (int $obj_id, string $a_lang_var, ?string $description=null)
 

Variables

trait ilObjFileNews
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...
 
bool $notify = false
 

Function Documentation

◆ addNewsNotification()

addNewsNotification ( int  $obj_id,
string  $a_lang_var,
?string  $description = null 
)
protected

Definition at line 52 of file trait.ilObjFileNews.php.

52 : void
53 {
54 global $DIC;
55
56 // ilHistory::_createEntry($this->getId(), "create", $this->getFileName() . ",1" . ",1");
57
58 // Add Notification to news
59 $news_item = new ilNewsItem();
60 $news_item->setContext($obj_id, 'file');
61 $news_item->setPriority(NEWS_NOTICE);
62 $news_item->setTitle($a_lang_var);
63 $news_item->setContentIsLangVar(true);
64 if ($description && $description !== '') {
65 $news_item->setContent("<p>" . $description . "</p>");
66 }
67 $news_item->setUserId($DIC->user()->getId());
68 $news_item->setVisibility(NEWS_USERS);
69 $news_item->create();
70 }
const NEWS_USERS
const NEWS_NOTICE
A news item can be created by different sources.
global $DIC
Definition: shib_login.php:26

References $DIC, NEWS_NOTICE, and NEWS_USERS.

Referenced by notifyCreation().

+ Here is the caller graph for this function:

◆ enableNotification()

enableNotification ( )

Definition at line 34 of file trait.ilObjFileNews.php.

34 : void
35 {
36 $this->notify = true;
37 }

Referenced by ilObjFile\appendStream(), ilObjFile\appendUpload(), ilObjFile\replaceWithStream(), and ilObjFile\replaceWithUpload().

+ Here is the caller graph for this function:

◆ notifyCreation()

notifyCreation ( int  $obj_id,
?string  $additional_message = null 
)

Definition at line 28 of file trait.ilObjFileNews.php.

28 : void
29 {
30 $this->addNewsNotification($obj_id, 'file_created', $additional_message);
31 $this->just_notified = true;
32 }
addNewsNotification(int $obj_id, string $a_lang_var, ?string $description=null)

References addNewsNotification().

Referenced by ilObjFile\doCreate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ notifyUpdate()

notifyUpdate ( int  $obj_id,
?string  $additional_message = null 
)

Definition at line 39 of file trait.ilObjFileNews.php.

42 : void {
43 if (!$this->notify) {
44 return;
45 }
46 if (!$this->just_notified) {
47 $this->addNewsNotification($obj_id, 'file_updated', $additional_message);
48 $this->just_notified = true;
49 }
50 }

Referenced by ilObjFile\doUpdate().

+ Here is the caller graph for this function:

Variable Documentation

◆ $notify

◆ ilObjFileNews

trait ilObjFileNews
Initial value:
{
protected bool $just_notified = false

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 Trait ilObjFileNews

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 23 of file trait.ilObjFileNews.php.