ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilChatroomConverter.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
11{
12 public function backupHistoryToXML()
13 {
14 global $ilDB;
15
16 $res = $ilDB->query("
17 SELECT chat_id, room_id
18 FROM chat_room_messages
19 GROUP BY chat_id, room_id
20 ");
21
22 $chat_room_id_comb = array();
23
24 while($row = $ilDB->fetchAssoc($res))
25 {
26 $chat_room_id_comb[] = array($row['chat_id'], $row['room_id']);
27 }
28
29 foreach($chat_room_id_comb as $combination)
30 {
31 $res = $ilDB->queryF("
32 SELECT *
33 FROM chat_room_messages
34 WHERE chat_id = %s
35 AND room_id = %s",
36
37 array('integer', 'integer'),
38 array($combination[0], $combination[1])
39 );
40
41 $xml = new SimpleXMLElement('<entries />');
42 $xml->addAttribute('chat_id', $combination[0]);
43 $xml->addAttribute('room_id', $combination[1]);
44
45 while($row = $ilDB->fetchAssoc($res))
46 {
47 $child = $xml->addChild('entry', $row['message']);
48 $child->addAttribute('timestamp', $row['commit_timestamp']);
49 }
50
51 $xml->asXML();
52 }
53 }
54}
An exception for terminatinating execution or to throw for unit testing.
Class ilChatroomConverter.
global $ilDB