ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilForumUtil.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
9 {
15  public static function getPublicUserAlias($user_alias, $is_anonymized = false)
16  {
17  global $DIC;
18  $ilUser = $DIC->user();
19  $lng = $DIC->language();
20 
21  if ($is_anonymized) {
22  if (!strlen($user_alias)) {
23  $user_alias = $lng->txt('forums_anonymous');
24  }
25 
26  return $user_alias;
27  }
28  return $ilUser->getLogin();
29  }
30 
31  public static function collectPostInformationByPostId($post_id)
32  {
33  global $DIC;
34  $ilDB = $DIC->database();
35 
36  $res = $ilDB->queryF(
37  '
38  SELECT frm.top_name, thr.thr_subject, pos.pos_subject FROM frm_data frm
39  INNER JOIN frm_threads thr ON frm.top_pk = thr.thr_top_fk
40  INNER JOIN frm_posts pos ON thr.thr_pk = pos.pos_thr_fk
41  WHERE pos_pk = %s',
42  array('integer'),
43  array($post_id)
44  );
45 
46  $info = array();
47  while ($row = $ilDB->fetchAssoc($res)) {
48  $info['forum_title'] = $row['top_name'];
49  $info['thread_title'] = $row['thr_subject'];
50  $info['post_title'] = $row['pos_subject'];
51  }
52  return $info;
53  }
54 
62  public static function moveMediaObjects($post_message, $source_type, $source_id, $target_type, $target_id, $direction = 0)
63  {
64  $mediaObjects = ilRTE::_getMediaObjects($post_message, $direction);
65  $myMediaObjects = ilObjMediaObject::_getMobsOfObject($source_type, $source_id);
66  foreach ($mediaObjects as $mob) {
67  foreach ($myMediaObjects as $myMob) {
68  if ($mob == $myMob) {
69  // change usage
70  ilObjMediaObject::_removeUsage($mob, $source_type, $source_id);
71  break;
72  }
73  }
75  }
76  }
77 
83  public static function saveMediaObjects($post_message, $target_type, $target_id, $direction = 0)
84  {
85  $mediaObjects = ilRTE::_getMediaObjects($post_message, $direction);
86 
87  foreach ($mediaObjects as $mob) {
89  }
90  }
91 }
static _getMediaObjects($a_text, $a_direction=0)
Returns all media objects found in the passed string.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
$target_type
Definition: goto.php:48
static getPublicUserAlias($user_alias, $is_anonymized=false)
global $DIC
Definition: saml.php:7
static saveMediaObjects($post_message, $target_type, $target_id, $direction=0)
$target_id
Definition: goto.php:49
static moveMediaObjects($post_message, $source_type, $source_id, $target_type, $target_id, $direction=0)
static _removeUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Remove usage of mob in another container.
static collectPostInformationByPostId($post_id)
foreach($_POST as $key=> $value) $res
$lng
$ilUser
Definition: imgupload.php:18
$row
global $ilDB
$info
Definition: index.php:5
static _saveUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Save usage of mob within another container (e.g.
Class ilForumUtil.