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 public function __construct($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;
79 $res = $ilDB->queryf(
'SELECT * FROM object_data WHERE title = %s',
80 array(
'text'), array($mod_title));
101 global
$ilDB,$ilUser;
116 global
$ilLog,$rbacadmin,$rbacreview;
120 $source_rolf = $rbacreview->getRoleFolderIdOfObject($this->
getRefId());
121 $target_rolf = $rbacreview->getRoleFolderIdOfObject($new_obj->getRefId());
123 if(!$moderator || !$new_moderator || !$source_rolf || !$target_rolf)
125 $ilLog->write(__METHOD__.
' : Error cloning auto generated role: il_chat_moderator');
127 $rbacadmin->copyRolePermissions($moderator,$source_rolf,$target_rolf,$new_moderator,
true);
128 $ilLog->write(__METHOD__.
' : Finished copying of role il_chat_moderator.');
156 $role_obj = $rolf_obj->createRole(
"il_chat_moderator_".$this->
getRefId(),
"Moderator of chat obj_no.".$this->
getId());
160 $rbacadmin->grantPermission($role_obj->getId(),
166 return array($role_obj->getId());
169 public function delete()
173 if(!parent::delete())
177 $rooms = $this->chat_room->getAllRoomsOfObject();
178 foreach($rooms as $room)
180 $this->chat_room->delete($room[
"room_id"]);
184 $res = $ilDB->manipulateF(
'
185 DELETE FROM chat_room_messages WHERE chat_id = %s',
186 array(
'integer'),array($this->
getRefId()));
190 $res = $ilDB->manipulateF(
'
191 DELETE FROM chat_user WHERE chat_id = %s',
192 array(
'integer'), array($this->
getRefId()));
196 $res = $ilDB->queryf(
'
197 SELECT record_id FROM chat_records
199 array(
'integer'), array($this->
getId()));
203 if (($num =
$res->numRows()) > 0)
205 for ($i = 0; $i < $num; $i++)
208 $res = $ilDB->manipulateF(
'
209 DELETE FROM chat_record_data WHERE record_id = %s',
210 array(
'integer'), array($rec_data[
'record_id']));
215 $res = $ilDB->manipulateF(
'
216 DELETE FROM chat_records WHERE chat_id = %s',
217 array(
'integer'), array($this->
getId()));
224 include_once
"Services/Mail/classes/class.ilMail.php";
232 $tmp_lang =&
new ilLanguage($tmp_user->getLanguage());
236 $this->
formatBody($tmp_user,$tmp_lang),array(),array(
"normal"));
238 unset($tmp_mail_obj);
247 include_once
"Services/Mail/classes/class.ilMail.php";
255 $tmp_lang =&
new ilLanguage($tmp_user->getLanguage());
258 $message = $tmp_mail_obj->sendMail(self::formatRecipient($tmp_user),
"",
"",self::formatSubject($tmp_lang),
261 unset($tmp_mail_obj);
270 $tmp_tpl =&
new ilTemplate(
"tpl.chat_export.html",
true,
true);
272 $this->chat_room->setRoomId(0);
274 $tmp_tpl->setVariable(
"CHAT_NAME",$this->
getTitle());
275 $tmp_tpl->setVariable(
"CHAT_DATE",strftime(
"%c",time()));
276 $tmp_tpl->setVariable(
"CONTENT",$this->chat_room->getAllMessages());
281 return $file_obj->addFile(
'index.html',$tmp_tpl->get());
288 return $user->getLogin();
295 return $lang->txt(
"chat_invitation_subject");
300 global $ilClientIniFile;
302 $room_id = $this->chat_room->getRoomId();
303 $room_title = $this->chat_room->getTitle();
305 $body = sprintf($this->lng->txt(
"chat_notification_intro"), $ilClientIniFile->readVariable(
"client",
"name"), ILIAS_HTTP_PATH).
"\n\n";
306 $body .=
$lang->txt(
"chat_invitation_body").
" ";
307 $body .= $this->ilias->account->getFullname();
309 $body .=
$lang->txt(
"chat_chatroom_body").
' '.$this->
getTitle();
310 if ($room_title !=
'')
312 $body .=
', '.$room_title;
315 $body .=
$lang->txt(
'chat_to_chat_body');
316 $body .=
': '.ILIAS_HTTP_PATH.
"/ilias.php?baseClass=ilChatPresentationGUI&room_id=".$room_id.
"&ref_id=".$this->
getRefId();
325 $room_id = $room->getRoomId();
326 $room_title = $room->getTitle();
328 $body = sprintf($lng->txt(
"chat_notification_intro"), $ilClientIniFile->readVariable(
"client",
"name"), ILIAS_HTTP_PATH).
"\n\n";
329 $body .=
$lang->txt(
"chat_invitation_body").
" ";
330 $body .= $ilias->account->getFullname();
332 $body .=
$lang->txt(
"chat_chatroom_body").
' '.$this->
getTitle();
333 if ($room_title !=
'')
335 $body .=
', '.$room_title;
338 $body .=
$lang->txt(
'chat_to_chat_body');
339 $body .=
': '.ILIAS_HTTP_PATH.
"/ilias.php?baseClass=ilChatPresentationGUI&room_id=".$room_id.
"&ref_id=".$room->getObjId();
348 if(!is_object($this->chat_recording))
350 include_once
'Modules/Chat/classes/class.ilChatRecording.php';
361 static $public_chat_ref_id = 0;
365 if($public_chat_ref_id)
367 return $public_chat_ref_id;
371 foreach($tree->getSubTree($tree->getNodeData(SYSTEM_FOLDER_ID)) as $node)
373 if($node[
'type'] ==
'chat')
375 return $public_chat_ref_id = $node[
'child'];