aboutsummaryrefslogtreecommitdiff
path: root/mod/guidbrowser/start.php
blob: a75711c1d75412b4b8af74950d108f1aa470091d (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
<?php
	/**
	 * Elgg GUID browser
	 * 
	 * @package ElggDevTools
	 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
	 * @author Marcus Povey <marcus@marcus-povey.co.uk>
	 * @copyright Curverider Ltd 2008
	 * @link http://elgg.com/
	 */

	function guidbrowser_init($event, $object_type, $object = null) {
		
		global $CONFIG;
			// register_translations($CONFIG->pluginspath . "guidbrowser/languages/");
		add_menu("GUID Browser",$CONFIG->wwwroot . "mod/tasklist/",array(
				menu_item("The GUID browser",$CONFIG->wwwroot."mod/guidbrowser/"),
		));
	}
	
	function guidbrowser_displayentity($entity)
	{
		return elgg_view("guidbrowser/entity",
			array(
				'entity_guid' => $entity->guid,
				'type' => $entity->type,
				'subtype' => $entity->getSubtype(),
				'full' => elgg_view(
					"guidbrowser/entity_full",
					array(
						'entity' => $entity,
						'metadata' => get_metadata_for_entity($entity->guid),
						'annotations' => get_annotations($entity->guid),
						'relationships' => get_entity_relationships($entity->guid)
					)
				)
			) 
		);
	}
	
	function guidbrowser_display($offset = 0, $limit = 10, $type = "", $subtype = "")
	{
		$entities = get_entities($type, $subtype, page_owner(), "time_created desc", $limit, $offset);
		$display = "";

		foreach ($entities as $e)
			$display .= guidbrowser_displayentity($e);
		
		return elgg_view("guidbrowser/browser",
			array(
				'entities' => $display,
				'prevnext' => elgg_view("guidbrowser/prevnext", array("limit" => $limit, "offset" => $offset))
			)
		);
	}
	
	
	// Make sure test_init is called on initialisation
	register_elgg_event_handler('init','system','guidbrowser_init');
?>