aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/export.php
blob: 4a39d295f3bdc08c15f1e1759d21570de8fc6957 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
	/**
	 * Elgg Data import export functionality.
	 * 
	 * @package Elgg
	 * @subpackage Core
	 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
	 * @author Marcus Povey
	 * @copyright Curverider Ltd 2008
	 * @link http://elgg.org/
	 */

	/**
	 * Export a GUID.
	 * 
	 * This function exports a GUID and all information related to it in an XML format.
	 * 
	 * @param int $guid The GUID.
	 * @return xml 
	 */
	function export($guid)
	{
		// trigger serialise event

		// serialise resultant object

		/*
		  	XML will look something like this:


			<elgg>
				<elgguser uuid="skdfjslklkjsldkfsdfjs:556">
					<guid>556</guid>
					<name>Marcus Povey</name>

					...
				
				</elgguser>
				<annotation>
					<name>Foo</name>
					<value>baaaa</value>
				</annotation>
				<annotation>
					<name>Monkey</name>
					<value>bibble</value>
				</annotation>

				...

				<metadata>
					<name>Foo</name>
					<value>baaaa</value>
				</metadata>

				...

				<my_plugin>

					...

				</my_plugin>

			</elgg> 
		 
		 */
		
	}
	
	/**
	 * Import an XML serialisation of an object.
	 * This will make a best attempt at importing a given xml doc.
	 *
	 * @param string $xml
	 * @return int The new GUID of the object.
	 */
	function import($xml)
	{
		// import via object ? 

		// import via tag : so you pass a tag "<foo>" and all its contents out and something answers by handling it.
		// THis is recursive but bredth first.

		
	}

	/**
	 * Generate a UUID from a given GUID.
	 * 
	 * @param int $guid The GUID of an object.
	 */
	function guid_to_uuid($guid)
	{
		global $CONFIG;
		
		return md5($CONFIG->wwwroot . ":$guid");
	}
?>