33 require_once
"classes/class.ilObjectGUI.php";
34 require_once
"Modules/Chat/classes/class.ilChatServerConfig.php";
35 require_once
"Modules/Chat/classes/class.ilChatServerCommunicator.php";
36 require_once
"Modules/Chat/classes/class.ilChatUser.php";
37 require_once
"Modules/Chat/classes/class.ilChatRoom.php";
38 require_once
"Modules/Chat/classes/class.ilFileDataChat.php";
54 function ilObjChat($a_id = 0,$a_call_by_reference =
true)
57 $this->
ilObject($a_id,$a_call_by_reference);
77 $mod_title =
'il_chat_moderator_'.$a_ref_id;
78 $query =
"SELECT * FROM object_data WHERE title = ".$ilDB->quote($mod_title);
79 $res = $ilDB->query($query);
114 global
$ilLog,$rbacadmin,$rbacreview;
118 $source_rolf = $rbacreview->getRoleFolderIdOfObject($this->
getRefId());
119 $target_rolf = $rbacreview->getRoleFolderIdOfObject($new_obj->getRefId());
121 if(!$moderator || !$new_moderator || !$source_rolf || !$target_rolf)
123 $ilLog->write(__METHOD__.
' : Error cloning auto generated role: il_chat_moderator');
125 $rbacadmin->copyRolePermissions($moderator,$source_rolf,$target_rolf,$new_moderator,
true);
126 $ilLog->write(__METHOD__.
' : Finished copying of role il_chat_moderator.');
154 $role_obj = $rolf_obj->createRole(
"il_chat_moderator_".$this->
getRefId(),
"Moderator of chat obj_no.".$this->
getId());
158 $rbacadmin->grantPermission($role_obj->getId(),
164 return array($role_obj->getId());
171 if(!parent::delete())
175 $rooms = $this->chat_room->getAllRoomsOfObject();
176 foreach($rooms as $room)
178 $this->chat_room->delete($room[
"room_id"]);
182 $query =
"DELETE FROM chat_room_messages ".
183 "WHERE chat_id = ".$ilDB->quote($this->
getRefId()).
"";
185 $res = $this->ilias->db->query($query);
188 $query =
"DELETE FROM chat_user ".
189 "WHERE chat_id = ".$ilDB->quote($this->
getRefId()).
"";
191 $res = $this->ilias->db->query($query);
194 $query =
"SELECT record_id FROM chat_records WHERE
195 chat_id = ".$ilDB->quote($this->
getId()).
"";
196 $res = $this->ilias->db->query($query);
198 if (($num =
$res->numRows()) > 0)
200 for ($i = 0; $i < $num; $i++)
203 $this->ilias->db->query(
"DELETE FROM chat_record_data WHERE record_id = ".$ilDB->quote(
$data[
"record_id"]).
"");
207 $query =
"DELETE FROM chat_records WHERE
208 chat_id = ".$ilDB->quote($this->
getId()).
"";
209 $res = $this->ilias->db->query($query);
216 include_once
"Services/Mail/classes/class.ilMail.php";
224 $tmp_lang =&
new ilLanguage($tmp_user->getLanguage());
228 $this->
__formatBody($tmp_user,$tmp_lang),array(),array(
"normal"));
230 unset($tmp_mail_obj);
239 $tmp_tpl =&
new ilTemplate(
"tpl.chat_export.html",
true,
true);
241 $this->chat_room->setRoomId(0);
243 $tmp_tpl->setVariable(
"CHAT_NAME",$this->
getTitle());
244 $tmp_tpl->setVariable(
"CHAT_DATE",strftime(
"%c",time()));
245 $tmp_tpl->setVariable(
"CONTENT",$this->chat_room->getAllMessages());
250 return $file_obj->addFile(
'index.html',$tmp_tpl->get());
258 return $user->getLogin();
265 return $lang->txt(
"chat_invitation_subject");
270 global $ilClientIniFile;
272 $room_id = $this->chat_room->getRoomId();
273 $room_title = $this->chat_room->getTitle();
275 $body = sprintf($this->lng->txt(
"chat_notification_intro"), $ilClientIniFile->readVariable(
"client",
"name"), ILIAS_HTTP_PATH).
"\n\n";
276 $body .=
$lang->txt(
"chat_invitation_body").
" ";
277 $body .= $this->ilias->account->getFullname();
279 $body .=
$lang->txt(
"chat_chatroom_body").
' '.$this->
getTitle();
280 if ($room_title !=
'')
282 $body .=
', '.$room_title;
285 $body .=
$lang->txt(
'chat_to_chat_body');
286 $body .=
': '.ILIAS_HTTP_PATH.
"/ilias.php?baseClass=ilChatPresentationGUI&room_id=".$room_id.
"&ref_id=".$this->
getRefId();
294 if(!is_object($this->chat_recording))
296 include_once
'Modules/Chat/classes/class.ilChatRecording.php';
307 static $public_chat_ref_id = 0;
311 if($public_chat_ref_id)
313 return $public_chat_ref_id;
317 foreach($tree->getSubTree($tree->getNodeData(SYSTEM_FOLDER_ID)) as $node)
319 if($node[
'type'] ==
'chat')
321 return $public_chat_ref_id = $node[
'child'];