ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 $ilUser, $lng;
18 
19  if($is_anonymized)
20  {
21  if(!strlen($user_alias))
22  {
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 $ilDB;
34 
35  $res = $ilDB->queryF('
36  SELECT frm.top_name, thr.thr_subject, pos.pos_subject FROM frm_data frm
37  INNER JOIN frm_threads thr ON frm.top_pk = thr.thr_top_fk
38  INNER JOIN frm_posts pos ON thr.thr_pk = pos.pos_thr_fk
39  WHERE pos_pk = %s',
40  array('integer'), array($post_id));
41 
42  $info = array();
43  while($row = $ilDB->fetchAssoc($res))
44  {
45  $info['forum_title'] = $row['top_name'];
46  $info['thread_title'] = $row['thr_subject'];
47  $info['post_title'] = $row['pos_subject'];
48  }
49  return $info;
50  }
51 
59  public static function moveMediaObjects($post_message, $source_type, $source_id, $target_type, $target_id, $direction = 0)
60  {
61  include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
62  $mediaObjects = ilRTE::_getMediaObjects($post_message, $direction);
63  $myMediaObjects = ilObjMediaObject::_getMobsOfObject($source_type, $source_id);
64  foreach($mediaObjects as $mob)
65  {
66  foreach($myMediaObjects as $myMob)
67  {
68  if($mob == $myMob)
69  {
70  // change usage
71  ilObjMediaObject::_removeUsage($mob, $source_type, $source_id);
72  break;
73  }
74  }
76  }
77  }
78 
84  public static function saveMediaObjects($post_message, $target_type, $target_id, $direction = 0)
85  {
86  include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
87  $mediaObjects = ilRTE::_getMediaObjects($post_message, $direction);
88 
89  foreach($mediaObjects as $mob)
90  {
92  }
93  }
94 }
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:50
static getPublicUserAlias($user_alias, $is_anonymized=false)
static saveMediaObjects($post_message, $target_type, $target_id, $direction=0)
$target_id
Definition: goto.php:51
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.
$info
Definition: example_052.php:80
static collectPostInformationByPostId($post_id)
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
global $ilDB
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.