<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Marcus Povey &#187; export</title>
	<atom:link href="http://www.marcus-povey.co.uk/tag/export/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.marcus-povey.co.uk</link>
	<description>Making the world a better place, one byte at a time...</description>
	<lastBuildDate>Mon, 06 Feb 2012 19:13:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
	<atom:link rel='hub' href='http://www.marcus-povey.co.uk/?pushpress=hub'/>
		<item>
		<title>The Export Interface</title>
		<link>http://www.marcus-povey.co.uk/2009/08/24/the-export-interface/</link>
		<comments>http://www.marcus-povey.co.uk/2009/08/24/the-export-interface/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 16:42:21 +0000</pubDate>
		<dc:creator>Marcus Povey</dc:creator>
				<category><![CDATA[elgg]]></category>
		<category><![CDATA[#ue]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[interface]]></category>

		<guid isPermaLink="false">http://www.marcus-povey.co.uk/?p=263</guid>
		<description><![CDATA[One of the more hidden features of Elgg is the Export interface. In a nutshell this interface provides an export view for Entities, Metadata, Annotations and relationships which can provide a convenient way of accessing data objects in a machine readable form. Endpoints The export url is constructed in different ways for entities, relationships and [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.marcus-povey.co.uk/wp-content/elgg-com-logo.gif" alt="" width="180" align="right" />One of the more hidden features of Elgg is the Export interface.</p>
<p>In a nutshell this interface provides an export view for Entities, Metadata, Annotations and relationships which can provide a convenient way of accessing data objects in a machine readable form.</p>
<h2>Endpoints</h2>
<p>The export url is constructed in different ways for entities, relationships and metadata.</p>
<p>All endpoints begin with:</p>
<blockquote><p><code>http://yoursite.com/export/<strong>[VIEW]</strong>/</code></p></blockquote>
<p>Where [VIEW] is the format you want the data exported in &#8211; e.g. json, opendd, php or default.</p>
<p><strong>Entities</strong><br />
To export a GUID simply add it to the end:</p>
<blockquote><p><code>http://yoursite.com/export/<strong>[VIEW]</strong>/<strong>[GUID]</strong>/</code></p></blockquote>
<p><strong>Annotations &amp; Metadata</strong></p>
<p>Metadata and annotation can be exported by providing the type (&#8216;annotation&#8217; or &#8216;metadata&#8217;) and the appropriate ID.</p>
<blockquote><p><code>http://yoursite.com/export/<strong>[VIEW]</strong>/<strong>[GUID]</strong>/<strong>[annotation|metadata]</strong>/<strong>[annotation_id|metadata_id]</strong>/</code></p></blockquote>
<p><strong>Relationships</strong><br />
Follows the same format as above, but with <strong>[GUID]</strong> being the first guid in the relationship &#8211; in essence the entity to which the relationship &#8220;belongs&#8221;.</p>
<blockquote><p><code>http://yoursite.com/export/<strong>[VIEW]</strong>/<strong>[GUID]</strong>/relationship/<strong>[relationship_id]</strong>/</code></p></blockquote>
<h2>Security</h2>
<p>Some items of data (for example user passwords) are restricted from this export view. Exactly what is output by an output view is governed by <code>$object-&gt;getExportableValues();</code> which returns a list of exportable fields in the entity.</p>
<p>In addition, access permissions on the object are respected &#8211; meaning that if you can&#8217;t see an item in Elgg, you will not be able to see it in the export view either.</p>
<div class="wsbuttons">
	<div class="shareblob facebook">
		<div class="fb-like" data-href="http://www.marcus-povey.co.uk/2009/08/24/the-export-interface/" data-send="false" data-layout="box_count" data-width="60" data-show-faces="false" data-colorscheme="light"></div>
	</div>

	<div class="shareblob google">
		<div class="g-plusone" data-size="tall" data-href="http://www.marcus-povey.co.uk/2009/08/24/the-export-interface/"></div>
	</div>

	<div class="shareblob twitter">
		<div class="twitter">
			<a href="https://twitter.com/share?url=http%3A%2F%2Fwww.marcus-povey.co.uk%2F2009%2F08%2F24%2Fthe-export-interface%2F&count=vertical" class="twitter-share-button" data-lang="en">Tweet</a>
			<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
		</div>
	</div>

</div>
	]]></content:encoded>
			<wfw:commentRss>http://www.marcus-povey.co.uk/2009/08/24/the-export-interface/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Import and Export in Elgg 1.0</title>
		<link>http://www.marcus-povey.co.uk/2008/07/31/import-and-export-in-elgg-10-2/</link>
		<comments>http://www.marcus-povey.co.uk/2008/07/31/import-and-export-in-elgg-10-2/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 17:13:44 +0000</pubDate>
		<dc:creator>Marcus Povey</dc:creator>
				<category><![CDATA[elgg]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://www.marcus-povey.co.uk/?p=56</guid>
		<description><![CDATA[Perhaps one of the most useful and unique features about Elgg 1.0 is its ability to import and export data. Initially this is accomplished via OpenDD, but we have added hooks which make it very easy to add other formats. I&#8217;m going to talk a little bit about how this works. Firstly, Export. Export works [...]]]></description>
			<content:encoded><![CDATA[<p>Perhaps one of the most useful and unique features about Elgg 1.0 is its ability to import and export data. Initially this is accomplished via OpenDD, but we have added hooks which make it very easy to add other formats.</p>
<p>I&#8217;m going to talk a little bit about how this works. Firstly, Export.</p>
<p>Export works via the <a href="http://docs.elgg.org/wiki/Views">views system</a>, and involves creating a brand new view hierarchy for your new format.</p>
<p>We first need to <a href="http://docs.elgg.org/wiki/Tutorials">create a plugin</a>, and in this plugin we create a &#8220;views&#8221; directory. We need to then create a new directory for your format, and then create a couple of views underneath.</p>
<p><img class="alignleft" style="float: left;"src="http://www.marcus-povey.co.uk/wp-content/viewsactions.png" alt="" width="216" height="330" />The image to the left shows the necessary file hierarchy that you need to create &#8211; in this instance to export &#8220;myformat&#8221;.</p>
<p>Create a directory called &#8220;export&#8221;. In this directory place the three php files &#8211; <code>entity.php</code>, <code>metadata.php</code> and <code>relationship.php</code> &#8211; which handle entities, metadata (and annotations) and relationships respectively.</p>
<p>Each of these files are passed objects via <code>$vars</code>. Depending on which file you are in, this might be <code>$vars['entity']</code>, <code>$vars['metadata']</code> or <code>$vars['relationship']</code>.</p>
<p>It is then up to you to encode and output the object according to your format.</p>
<p>All that remains is to provide the <code>pageshell</code> which handles how the overall page is displayed. This file may set the content-type header or provide wrapping tags (e.g. for XML output).</p>
<p><code>pageshell.php</code> is passed <code>$vars['body']</code> containing the output of your other files.</p>
<p>Providing a handler to deal with importing data is also fairly simple, and works through the <a href="http://docs.elgg.org/wiki/Actions">action interface</a>.</p>
<p>In your plugin&#8217;s init function register the action &#8220;import/YOURFORMAT&#8221;, and point it to your <code>actions/import/myformat.php</code>, e.g.</p>
<blockquote>
<pre>&lt;?php

	function myformatplugin_init()
	{
		global $CONFIG;

		// Register import action
		register_action('import/myformat', false,
		  $CONFIG-&gt;pluginspath . "myformatplugin_init/actions/import/myformat.php");
	}

	// Initialise
	register_elgg_event_handler('init','system','myformatplugin_init');
?&gt;</pre>
</blockquote>
<p>This will then register an import action which will be picked up by the administrator import export utility. Your action can access the information it needs to import with the call:</p>
<blockquote><p><code>$data = get_input('data');</code></p></blockquote>
<p>Elgg 1.0 will ship with native support for <a href="http://www.opendd.net">OpenDD</a> (both import and export) which will allow administrators to migrate between <a href="http://classic.elgg.org">Elgg classic</a> and the new codebase with a minimum amount of effort.</p>
<p>Elgg 1.0 also offers export views in JSON and PHP native, making it easier to reference the data directly and create mashups.</p>
<p>Over time we will be adding more import and export functionality, and I hope you will be too!</p>
<div class="wsbuttons">
	<div class="shareblob facebook">
		<div class="fb-like" data-href="http://www.marcus-povey.co.uk/2008/07/31/import-and-export-in-elgg-10-2/" data-send="false" data-layout="box_count" data-width="60" data-show-faces="false" data-colorscheme="light"></div>
	</div>

	<div class="shareblob google">
		<div class="g-plusone" data-size="tall" data-href="http://www.marcus-povey.co.uk/2008/07/31/import-and-export-in-elgg-10-2/"></div>
	</div>

	<div class="shareblob twitter">
		<div class="twitter">
			<a href="https://twitter.com/share?url=http%3A%2F%2Fwww.marcus-povey.co.uk%2F2008%2F07%2F31%2Fimport-and-export-in-elgg-10-2%2F&count=vertical" class="twitter-share-button" data-lang="en">Tweet</a>
			<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
		</div>
	</div>

</div>
	]]></content:encoded>
			<wfw:commentRss>http://www.marcus-povey.co.uk/2008/07/31/import-and-export-in-elgg-10-2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

