ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjChatroom.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 require_once "./Services/Object/classes/class.ilObject.php";
6 
15 class ilObjChatroom extends ilObject
16 {
17 
24  public function __construct($a_id = 0, $a_call_by_reference = true)
25  {
26  $this->type = 'chtr';
27  $this->ilObject($a_id, $a_call_by_reference);
28  }
29 
36  public function getPersonalInformation(ilChatroomUser $user)
37  {
38  $userInfo = new stdClass();
39  $userInfo->username = $user->getUsername();
40  $userInfo->id = $user->getUserId();
41 
42  return $userInfo;
43  }
44 
45 
46  public static function _getPublicRefId() {
47  $settings = new ilSetting('chatroom');
48  return $settings->get('public_room_ref', 0);
49  }
50 
51  public static function _getPublicObjId() {
52  global $ilDB;
53 
54  $rset = $ilDB->query('SELECT object_id FROM chatroom_settings WHERE room_type=' . $ilDB->quote( 'default' ,'text'));
55  if ($row = $ilDB->fetchAssoc($rset)) {
56  return $row['object_id'];
57  }
58  return 0;
59  }
67  function initDefaultRoles()
68  {
69  include_once './Services/AccessControl/classes/class.ilObjRole.php';
71  'il_chat_moderator_'.$this->getRefId(),
72  "Moderator of chat obj_no.".$this->getId(),
73  'il_chat_moderator',
74  $this->getRefId()
75  );
76  return array();
77  }
78 
79  public function cloneObject($a_target_id,$a_copy_id = 0,$a_omit_tree = false) {
80  global $rbacreview;
81  require_once 'Modules/Chatroom/classes/class.ilChatroom.php';
82  $original_room = ilChatroom::byObjectId($this->getId());
83 
84  $newObj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
85 
86 
87 
88  $objId = $newObj->getId();
89 
90 
91 
92  $original_settings = $original_room->getSettings();
93  $room = new ilChatroom();
94 
95  $original_settings['object_id'] = $objId;
96 
97  $room->saveSettings($original_settings);
98 
99  // rbac log
100  include_once "Services/AccessControl/classes/class.ilRbacLog.php";
101  $rbac_log_roles = $rbacreview->getParentRoleIds( $newObj->getRefId(), false );
102  $rbac_log = ilRbacLog::gatherFaPa( $newObj->getRefId(), array_keys( $rbac_log_roles ), true );
103  ilRbacLog::add( ilRbacLog::CREATE_OBJECT, $newObj->getRefId(), $rbac_log );
104 
105  return $newObj;
106  }
107 }
108 
109 ?>