From fe04f54b34210e6771fa06d8e4ca2849749c8477 Mon Sep 17 00:00:00 2001 From: marcus Date: Wed, 9 Jul 2008 18:04:00 +0000 Subject: Closes #81: OpenDD aggregator http://trac.elgg.org/elgg/ticket/81 git-svn-id: https://code.elgg.org/elgg/trunk@1377 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/opendd/start.php | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 mod/opendd/start.php (limited to 'mod/opendd/start.php') diff --git a/mod/opendd/start.php b/mod/opendd/start.php new file mode 100644 index 000000000..88891ba11 --- /dev/null +++ b/mod/opendd/start.php @@ -0,0 +1,116 @@ +wwwroot . "pg/opendd/{$_SESSION['user']->username}",array( + menu_item(elgg_echo('opendd:your'), $CONFIG->wwwroot."pg/opendd/{$_SESSION['user']->username}"), + menu_item(elgg_echo('opendd:feeds'), $CONFIG->wwwroot."pg/opendd/{$_SESSION['user']->username}/feeds/"), + menu_item(elgg_echo('opendd:manage'), $CONFIG->wwwroot . "pg/opendd/{$_SESSION['user']->username}/manage/"), + ),'opendd'); + } + + // Register a page handler, so we can have nice URLs + register_page_handler('opendd','opendd_page_handler'); + + // Register opendd url + register_entity_url_handler('opendd_url','object','oddfeed'); + + // Actions + register_action("opendd/feed/subscribe",false, $CONFIG->pluginspath . "opendd/actions/opendd/feed/subscribe.php"); + register_action("opendd/feed/delete",false, $CONFIG->pluginspath . "opendd/actions/opendd/feed/delete.php"); + + // Extend some views + extend_view('css','opendd/css'); + + + // Subscribe fields + $CONFIG->opendd = array( + 'feedurl' => 'text', + ); + + } + + /** + * Group page handler + * + * @param array $page Array of page elements, forwarded by the page handling mechanism + */ + function opendd_page_handler($page) + { + global $CONFIG; + + if (isset($page[0])) + set_input('username',$page[0]); + + if (isset($page[1])) + { + // See what context we're using + switch($page[1]) + { + case "view" : + if (isset($page[2])) + { + set_input('feed_guid', $page[2]); + include($CONFIG->pluginspath . "opendd/viewfeed.php"); + } + break; + case "manage": + include($CONFIG->pluginspath . "opendd/manage.php"); + break; + case "feeds" : + include($CONFIG->pluginspath . "opendd/feeds.php"); + break; + case "activity" : + if (isset($page[2])) + { + switch ($page[2]) + { + case 'opendd' : + default : + set_input('view', 'odd'); + include($CONFIG->pluginspath . "opendd/index.php"); + } + } + break; + default: + include($CONFIG->pluginspath . "opendd/index.php"); + } + } + else + include($CONFIG->pluginspath . "opendd/index.php"); + } + + /** + * Register a url to handle opendd feeds. + * + * @param ElggEntity $feed The feed object. + * @return string + */ + function opendd_url($feed) + { + global $CONFIG; + return $CONFIG->wwwroot . "pg/opendd/" . $feed->getOwnerEntity()->username . "/view/{$feed->guid}"; + } + + + // Make sure the groups initialisation function is called on initialisation + register_elgg_event_handler('init','system','opendd_init'); +?> \ No newline at end of file -- cgit v1.2.3