ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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
5require_once "./Services/Object/classes/class.ilObject.php";
6
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
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 }
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?>
Class ilChatroomUser.
getUserId()
Returns Ilias User ID.
getUsername()
Returns username from Object or SESSION.
Class ilChatroom.
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
Class ilObjChatroom.
getPersonalInformation(ilChatroomUser $user)
Prepares and returns $userInfo using given $user object.
__construct($a_id=0, $a_call_by_reference=true)
Constructor.
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Clone object permissions, put in tree ...
initDefaultRoles()
@global type $rbacadmin @global type $rbacreview @global ilDB $ilDB
static createDefaultRole($a_title, $a_description, $a_tpl_name, $a_ref_id)
Class ilObject Basic functions for all objects.
ilObject($a_id=0, $a_reference=true)
Constructor @access public.
getRefId()
get reference id @access public
getId()
get object id @access public
static add($a_action, $a_ref_id, array $a_diff, $a_source_ref_id=false)
static gatherFaPa($a_ref_id, array $a_role_ids, $a_add_action=false)
const CREATE_OBJECT
ILIAS Setting Class.
global $ilDB