ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
4
14{
15 public function backupHistoryToXML()
16 {
17 global $ilDB;
18
19 $res = $ilDB->query("
20 SELECT chat_id, room_id
21 FROM chat_room_messages
22 GROUP BY chat_id, room_id
23 ");
24
25 $chat_room_id_comb = array();
26
27 while( $row = $ilDB->fetchAssoc($res) )
28 {
29 $chat_room_id_comb[] = array( $row['chat_id'], $row['room_id'] );
30 }
31
32 foreach( $chat_room_id_comb as $combination )
33 {
34 $res = $ilDB->queryF("
35 SELECT *
36 FROM chat_room_messages
37 WHERE chat_id = %s
38 AND room_id = %s",
39
40 array( 'integer', 'integer' ),
41 array( $combination[0], $combination[1] )
42 );
43
44 $xml = new SimpleXMLElement('<entries />');
45 $xml->addAttribute('chat_id', $combination[0]);
46 $xml->addAttribute('room_id', $combination[1]);
47
48 while( $row = $ilDB->fetchAssoc($res) )
49 {
50 $child = $xml->addChild('entry', $row['message']);
51 $child->addAttribute('timestamp', $row['commit_timestamp']);
52 }
53
54 $xml->asXML();
55 }
56 }
57}
Class ilChatroomConverter.
global $ilDB