ILIAS  release_8 Revision v8.24
ilObjChatroom Class Reference

Class ilObjChatroom. More...

+ Inheritance diagram for ilObjChatroom:
+ Collaboration diagram for ilObjChatroom:

Public Member Functions

 __construct (int $a_id=0, bool $a_call_by_reference=true)
 
 setAccessVisibility (int $a_value)
 
 getAccessVisibility ()
 
 getAccessType ()
 
 setAccessType (int $access_type)
 
 getAccessBegin ()
 
 setAccessBegin (?int $access_begin)
 
 getAccessEnd ()
 
 setAccessEnd (?int $access_end)
 
 update ()
 
 read ()
 
 getPersonalInformation (ilChatroomUser $user)
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type. More...
 
 cloneObject (int $target_id, int $copy_id=0, bool $omit_tree=false)
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
- Public Member Functions inherited from ilObject
 __construct (int $id=0, bool $reference=true)
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $desc)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _getPublicRefId ()
 
static _getPublicObjId ()
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, \ilDBInterface $ilDB=null)
 

Protected Member Functions

 createDefaultRole ()
 
- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 

Protected Attributes

int $access_type = null
 
int $access_begin = null
 
int $access_end = null
 
int $access_visibility = null
 
- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
int $id
 
bool $referenced
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
bool $offline = false
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Additional Inherited Members

- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 

Detailed Description

Class ilObjChatroom.

Author
Jan Posselt <jposselt at databay.de>
Version
$Id$

Definition at line 30 of file class.ilObjChatroom.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjChatroom::__construct ( int  $id = 0,
bool  $reference = true 
)
Parameters
int$idreference_id or object_id
bool$referencebool treat the id as reference_id (true) or object_id (false)

Reimplemented from ilObject.

Definition at line 37 of file class.ilObjChatroom.php.

38 {
40
41 $this->type = 'chtr';
42 parent::__construct($a_id, $a_call_by_reference);
43 }
setAccessType(int $access_type)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct(), setAccessType(), and ilObjectActivation\TIMINGS_DEACTIVATED.

+ Here is the call graph for this function:

Member Function Documentation

◆ _getPublicObjId()

static ilObjChatroom::_getPublicObjId ( )
static

Definition at line 122 of file class.ilObjChatroom.php.

122 : int
123 {
124 global $DIC;
125
126 $rset = $DIC->database()->query(
127 'SELECT object_id FROM chatroom_settings WHERE room_type = ' . $DIC->database()->quote('default', 'text')
128 );
129 if ($row = $DIC->database()->fetchAssoc($rset)) {
130 return (int) $row['object_id'];
131 }
132
133 return 0;
134 }
global $DIC
Definition: feed.php:28

References $DIC.

Referenced by ilObjChatroomListGUI\__construct().

+ Here is the caller graph for this function:

◆ _getPublicRefId()

static ilObjChatroom::_getPublicRefId ( )
static

Definition at line 115 of file class.ilObjChatroom.php.

115 : int
116 {
117 $settings = new ilSetting('chatroom');
118
119 return (int) $settings->get('public_room_ref', '0');
120 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200

References ILIAS\LTI\ToolProvider\$settings.

Referenced by ilChatUserActionProvider\__construct(), ilChatroom\checkPermissions(), ilChatroomAdminViewGUI\forcePublicRoom(), and ILIAS\Chatroom\Provider\ChatMainBarProvider\getStaticSubItems().

+ Here is the caller graph for this function:

◆ cloneObject()

ilObjChatroom::cloneObject ( int  $target_id,
int  $copy_id = 0,
bool  $omit_tree = false 
)

Definition at line 160 of file class.ilObjChatroom.php.

160 : ?ilObject
161 {
162 $original_room = ilChatroom::byObjectId($this->getId());
163
164 $newObj = parent::cloneObject($target_id, $copy_id, $omit_tree);
165
166 $objId = $newObj->getId();
167
168 $original_settings = $original_room->getSettings();
169 $room = new ilChatroom();
170
171 $original_settings['object_id'] = $objId;
172
173 $room->saveSettings($original_settings);
174
175 $rbac_log_roles = $this->rbac_review->getParentRoleIds($newObj->getRefId(), false);
176 $rbac_log = ilRbacLog::gatherFaPa($newObj->getRefId(), array_keys($rbac_log_roles), true);
177 ilRbacLog::add(ilRbacLog::CREATE_OBJECT, $newObj->getRefId(), $rbac_log);
178
180 $connector = new ilChatroomServerConnector($settings);
181
182 $connector->sendCreatePrivateRoom($room->getRoomId(), 0, $newObj->getOwner(), $newObj->getTitle());
183
184 return $newObj;
185 }
static getDefaultConfiguration()
Instantiates and returns ilChatroomAdmin object using instance_id and settings from settingsTable.
Class ilChatroomServerConnector.
Class ilChatroom.
static byObjectId(int $object_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static add(int $a_action, int $a_ref_id, array $a_diff, bool $a_source_ref_id=false)
static gatherFaPa(int $a_ref_id, array $a_role_ids, bool $a_add_action=false)
const CREATE_OBJECT
$target_id
Definition: goto.php:52
$objId
Definition: xapitoken.php:57

References $objId, ILIAS\LTI\ToolProvider\$settings, $target_id, ilRbacLog\add(), ilChatroom\byObjectId(), ilRbacLog\CREATE_OBJECT, ilRbacLog\gatherFaPa(), ilChatroomAdmin\getDefaultConfiguration(), and ilObject\getId().

+ Here is the call graph for this function:

◆ createDefaultRole()

ilObjChatroom::createDefaultRole ( )
protected

Definition at line 150 of file class.ilObjChatroom.php.

150 : ilObjRole
151 {
153 'il_chat_moderator_' . $this->getRefId(),
154 'Moderator of chat obj_no.' . $this->getId(),
155 'il_chat_moderator',
156 $this->getRefId()
157 );
158 }
Class ilObjRole.
static createDefaultRole(string $a_title, string $a_description, string $a_tpl_name, int $a_ref_id)

References ilObjRole\createDefaultRole(), ilObject\getId(), and ilObject\getRefId().

Referenced by initDefaultRoles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilObjChatroom::delete ( )

delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!!

Returns
bool true if object was removed completely; false if only a references was removed

Reimplemented from ilObject.

Definition at line 187 of file class.ilObjChatroom.php.

187 : bool
188 {
189 $this->db->manipulateF(
190 'DELETE FROM chatroom_users WHERE chatroom_users.room_id IN (SELECT chatroom_settings.room_id FROM chatroom_settings WHERE chatroom_settings.object_id = %s)',
191 ['integer'],
192 [$this->getId()]
193 );
194
195 $this->db->manipulateF(
196 'DELETE FROM chatroom_history WHERE chatroom_history.room_id IN (SELECT chatroom_settings.room_id FROM chatroom_settings WHERE chatroom_settings.object_id = %s)',
197 ['integer'],
198 [$this->getId()]
199 );
200
201 $this->db->manipulateF(
202 'DELETE FROM chatroom_bans WHERE chatroom_bans.room_id IN (SELECT chatroom_settings.room_id FROM chatroom_settings WHERE chatroom_settings.object_id = %s)',
203 ['integer'],
204 [$this->getId()]
205 );
206
207 $this->db->manipulateF(
208 'DELETE FROM chatroom_sessions WHERE chatroom_sessions.room_id IN (SELECT chatroom_settings.room_id FROM chatroom_settings WHERE chatroom_settings.object_id = %s)',
209 ['integer'],
210 [$this->getId()]
211 );
212
213 $this->db->manipulateF(
214 '
215 DELETE FROM chatroom_proomaccess
216 WHERE chatroom_proomaccess.proom_id IN (
217 SELECT chatroom_prooms.proom_id
218 FROM chatroom_prooms WHERE chatroom_prooms.parent_id IN (
219 SELECT chatroom_settings.room_id
220 FROM chatroom_settings
221 WHERE chatroom_settings.object_id = %s
222 )
223 )',
224 ['integer'],
225 [$this->getId()]
226 );
227
228 $this->db->manipulateF(
229 '
230 DELETE FROM chatroom_psessions
231 WHERE chatroom_psessions.proom_id IN (
232 SELECT chatroom_prooms.proom_id
233 FROM chatroom_prooms WHERE chatroom_prooms.parent_id IN (
234 SELECT chatroom_settings.room_id
235 FROM chatroom_settings
236 WHERE chatroom_settings.object_id = %s
237 )
238 )',
239 ['integer'],
240 [$this->getId()]
241 );
242
243 $this->db->manipulateF(
244 'DELETE FROM chatroom_prooms WHERE chatroom_prooms.parent_id IN (SELECT chatroom_settings.room_id FROM chatroom_settings WHERE chatroom_settings.object_id = %s)',
245 ['integer'],
246 [$this->getId()]
247 );
248
249 // Finally delete rooms
250 $this->db->manipulateF(
251 'DELETE FROM chatroom_settings WHERE object_id = %s',
252 ['integer'],
253 [$this->getId()]
254 );
255
256 if ($this->ref_id && $this->getId()) {
258 }
259
260 return parent::delete();
261 }
static deleteAllEntries(int $ref_id)
Delete all db entries for ref id.

References ilObjectActivation\deleteAllEntries(), and ilObject\getId().

+ Here is the call graph for this function:

◆ getAccessBegin()

ilObjChatroom::getAccessBegin ( )

Definition at line 65 of file class.ilObjChatroom.php.

65 : ?int
66 {
68 }

References $access_begin.

Referenced by update().

+ Here is the caller graph for this function:

◆ getAccessEnd()

ilObjChatroom::getAccessEnd ( )

Definition at line 75 of file class.ilObjChatroom.php.

75 : ?int
76 {
77 return $this->access_end;
78 }

References $access_end.

Referenced by update().

+ Here is the caller graph for this function:

◆ getAccessType()

ilObjChatroom::getAccessType ( )

Definition at line 55 of file class.ilObjChatroom.php.

55 : ?int
56 {
57 return $this->access_type;
58 }

References $access_type.

Referenced by read(), and update().

+ Here is the caller graph for this function:

◆ getAccessVisibility()

ilObjChatroom::getAccessVisibility ( )

Definition at line 50 of file class.ilObjChatroom.php.

50 : ?int
51 {
53 }

References $access_visibility.

Referenced by update().

+ Here is the caller graph for this function:

◆ getPersonalInformation()

ilObjChatroom::getPersonalInformation ( ilChatroomUser  $user)

Definition at line 136 of file class.ilObjChatroom.php.

136 : stdClass
137 {
138 $userInfo = new stdClass();
139 $userInfo->username = $user->getUsername();
140 $userInfo->id = $user->getUserId();
141
142 return $userInfo;
143 }
ilObjUser $user

References ilObject\$user.

◆ initDefaultRoles()

ilObjChatroom::initDefaultRoles ( )

init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type.

If you want to set up default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example).

Reimplemented from ilObject.

Definition at line 145 of file class.ilObjChatroom.php.

145 : void
146 {
147 $this->createDefaultRole();
148 }

References createDefaultRole().

+ Here is the call graph for this function:

◆ read()

ilObjChatroom::read ( )

Reimplemented from ilObject.

Definition at line 100 of file class.ilObjChatroom.php.

100 : void
101 {
102 if ($this->referenced && $this->ref_id) {
103 $activation = ilObjectActivation::getItem($this->ref_id);
104 $this->setAccessType((int) $activation['timing_type']);
106 $this->setAccessBegin((int) $activation['timing_start']);
107 $this->setAccessEnd((int) $activation['timing_end']);
108 $this->setAccessVisibility((int) $activation['visible']);
109 }
110 }
111
112 parent::read();
113 }
setAccessBegin(?int $access_begin)
setAccessEnd(?int $access_end)
setAccessVisibility(int $a_value)
static getItem(int $ref_id)

References getAccessType(), ilObjectActivation\getItem(), setAccessBegin(), setAccessEnd(), setAccessType(), setAccessVisibility(), and ilObjectActivation\TIMINGS_ACTIVATION.

+ Here is the call graph for this function:

◆ setAccessBegin()

ilObjChatroom::setAccessBegin ( ?int  $access_begin)

Definition at line 70 of file class.ilObjChatroom.php.

70 : void
71 {
72 $this->access_begin = $access_begin;
73 }

References $access_begin.

Referenced by read().

+ Here is the caller graph for this function:

◆ setAccessEnd()

ilObjChatroom::setAccessEnd ( ?int  $access_end)

Definition at line 80 of file class.ilObjChatroom.php.

80 : void
81 {
82 $this->access_end = $access_end;
83 }

References $access_end.

Referenced by read().

+ Here is the caller graph for this function:

◆ setAccessType()

ilObjChatroom::setAccessType ( int  $access_type)

Definition at line 60 of file class.ilObjChatroom.php.

60 : void
61 {
62 $this->access_type = $access_type;
63 }

References $access_type.

Referenced by __construct(), and read().

+ Here is the caller graph for this function:

◆ setAccessVisibility()

ilObjChatroom::setAccessVisibility ( int  $a_value)

Definition at line 45 of file class.ilObjChatroom.php.

45 : void
46 {
47 $this->access_visibility = $a_value;
48 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilObjChatroom::update ( )

Reimplemented from ilObject.

Definition at line 85 of file class.ilObjChatroom.php.

85 : bool
86 {
87 if ($this->referenced && $this->ref_id) {
88 $activation = new ilObjectActivation();
89 $activation->setTimingType($this->getAccessType());
90 $activation->setTimingStart($this->getAccessBegin());
91 $activation->setTimingEnd($this->getAccessEnd());
92 $activation->toggleVisible((bool) $this->getAccessVisibility());
93 $activation->toggleChangeable(true);
94 $activation->update($this->ref_id);
95 }
96
97 return parent::update();
98 }
Class ilObjectActivation.

References getAccessBegin(), getAccessEnd(), getAccessType(), and getAccessVisibility().

+ Here is the call graph for this function:

Field Documentation

◆ $access_begin

int ilObjChatroom::$access_begin = null
protected

Definition at line 33 of file class.ilObjChatroom.php.

Referenced by getAccessBegin(), and setAccessBegin().

◆ $access_end

int ilObjChatroom::$access_end = null
protected

Definition at line 34 of file class.ilObjChatroom.php.

Referenced by getAccessEnd(), and setAccessEnd().

◆ $access_type

int ilObjChatroom::$access_type = null
protected

Definition at line 32 of file class.ilObjChatroom.php.

Referenced by getAccessType(), and setAccessType().

◆ $access_visibility

int ilObjChatroom::$access_visibility = null
protected

Definition at line 35 of file class.ilObjChatroom.php.

Referenced by getAccessVisibility().


The documentation for this class was generated from the following file: