ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilForumUtil.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
27 public static function getPublicUserAlias(string $user_alias, bool $is_anonymized): string
28 {
29 global $DIC;
30
31 $ilUser = $DIC->user();
32 $lng = $DIC->language();
33
34 if ($is_anonymized) {
35 if ($user_alias === '') {
36 $user_alias = $lng->txt('forums_anonymous');
37 }
38
39 return $user_alias;
40 }
41
42 return $ilUser->getLogin();
43 }
44
45 public static function moveMediaObjects(
46 string $post_message,
47 string $source_type,
48 int $source_id,
49 string $target_type,
50 int $target_id,
51 int $direction = 0
52 ): void {
53 $mediaObjects = ilRTE::_getMediaObjects($post_message, $direction);
54 $myMediaObjects = ilObjMediaObject::_getMobsOfObject($source_type, $source_id);
55 foreach ($mediaObjects as $mob) {
56 foreach ($myMediaObjects as $myMob) {
57 if ($mob === $myMob) {
58 ilObjMediaObject::_removeUsage($mob, $source_type, $source_id);
59 break;
60 }
61 }
62 ilObjMediaObject::_saveUsage($mob, $target_type, $target_id);
63 }
64 }
65
66 public static function saveMediaObjects(
67 string $post_message,
68 string $target_type,
69 int $target_id,
70 int $direction = 0
71 ): void {
72 $mediaObjects = ilRTE::_getMediaObjects($post_message, $direction);
73
74 foreach ($mediaObjects as $mob) {
75 ilObjMediaObject::_saveUsage($mob, $target_type, $target_id);
76 }
77 }
78}
Class ilForumUtil.
static getPublicUserAlias(string $user_alias, bool $is_anonymized)
static saveMediaObjects(string $post_message, string $target_type, int $target_id, int $direction=0)
static moveMediaObjects(string $post_message, string $source_type, int $source_id, string $target_type, int $target_id, int $direction=0)
static _getMobsOfObject(string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
static _removeUsage(int $a_mob_id, string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
Remove usage of mob in another container.
static _saveUsage(int $a_mob_id, string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
Save usage of mob within another container (e.g.
Rich Text Editor base class This class provides access methods to a Rich Text Editor (RTE) integrated...
Definition: class.ilRTE.php:31
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26