From 059badecbc0be895c6165430e5096a9ab653027e Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 15 Mar 2014 14:56:18 -0300 Subject: Squashed 'mod/livestream/' content from commit 89d1f38 git-subtree-dir: mod/livestream git-subtree-split: 89d1f3877f241f34e3ed3baad3c9ee9a4fee79e7 --- start.php | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100755 start.php (limited to 'start.php') diff --git a/start.php b/start.php new file mode 100755 index 000000000..826c360d7 --- /dev/null +++ b/start.php @@ -0,0 +1,95 @@ +pluginspath}livestream/libraries.php"; + + + function livestream_init() + { + global $CONFIG; + + // require libraries + require_once "{$CONFIG->pluginspath}livestream/libraries.php"; + + register_page_handler('livestream','livestream_page_handler'); + + //enable for groups + add_group_tool_option('groups',elgg_echo('livestream:enable'),true); + + //put in group hp + elgg_extend_view('groups/right_column', 'livestream/groupprofile_livestream'); + + + if (isloggedin()) + { + add_menu(elgg_echo('livestream:livestream'), $CONFIG->wwwroot . "livestream/" . $page_owner->username); + } + + register_elgg_event_handler('pagesetup','system','livestream_pagesetup'); + //actions + register_action("livestream/new", false, $CONFIG->pluginspath . "livestream/actions/new.php"); + register_action("livestream/delete", false, $CONFIG->pluginspath . "livestream/actions/delete.php"); + + + } + + function livestream_pagesetup(){ + global $CONFIG; + + //Link to group items if comes form group environment + $page_owner = page_owner_entity(); + + if ($page_owner instanceof ElggGroup && (get_context() == 'groups' || get_context() == 'group_profile')) { + add_submenu_item(elgg_echo("livestream:livestream"), $CONFIG->url ."livestream/". $page_owner->username ); + } + + //tools menu item + $logged_user = get_loggedin_user(); + if($logged_user){ + add_menu(elgg_echo('livestream:livestream'), $CONFIG->wwwroot . "livestream/" . $logged_user->username); + } + } + + function livestream_page_handler($page) + { + global $_CONFIG; + + if (isset($page[0]) && $page[0]) { + set_input('username',$page[0]); + } + + if (isset($page[1]) && $page[1]) { + switch($page[1]){ + case 'new': + include(dirname(__FILE__) . "/pages/livestream/new.php"); + break; + case 'view': + set_input('username', $page[0]); + set_input('streamid', $page[2]); + + include(dirname(__FILE__) . "/pages/livestream/view.php"); + break; + case 'delete': + set_input('username', $page[0]); + set_input('streamid', $page[2]); + + include(dirname(__FILE__) . "/pages/livestream/delete.php"); + break; + + default: + include(dirname(__FILE__) . "/pages/livestream/list.php"); + break; + } + }else{ + include(dirname(__FILE__) . "/pages/livestream/list.php"); + } + + return true; + } + + register_elgg_event_handler('init','system','livestream_init'); + +?> -- cgit v1.2.3