コード例 #1
0
ファイル: start.php プロジェクト: eokyere/elgg
/**
 * Initialise the dgroups plugin.
 * Register actions, set up menus
 */
function dgroups_init()
{
    global $CONFIG;
    // Set up the menu for logged in users
    if (isloggedin()) {
        add_menu(elgg_echo('dgroups'), $CONFIG->wwwroot . "pg/dgroups/world/");
        //add_menu(elgg_echo('dgroups:alldiscussion'),$CONFIG->wwwroot."mod/dgroups/discussions.php");
    } else {
        add_menu(elgg_echo('dgroups'), $CONFIG->wwwroot . "pg/dgroups/world/");
    }
    // Register a page handler, so we can have nice URLs
    register_page_handler('dgroups', 'dgroups_page_handler');
    // Register a URL handler for dgroups and forum topics
    register_entity_url_handler('dgroups_url', 'group', 'dgroup');
    register_entity_url_handler('dgroups_dgroupforumtopic_url', 'object', 'dgroupforumtopic');
    // Register an icon handler for dgroups
    register_page_handler('dgroupicon', 'dgroups_icon_handler');
    // Register some actions
    register_action("dgroups/edit", false, $CONFIG->pluginspath . "dgroups/actions/edit.php");
    register_action("dgroups/delete", false, $CONFIG->pluginspath . "dgroups/actions/delete.php");
    register_action("dgroups/join", false, $CONFIG->pluginspath . "dgroups/actions/join.php");
    register_action("dgroups/leave", false, $CONFIG->pluginspath . "dgroups/actions/leave.php");
    register_action("dgroups/joinrequest", false, $CONFIG->pluginspath . "dgroups/actions/joinrequest.php");
    register_action("dgroups/killrequest", false, $CONFIG->pluginspath . "dgroups/actions/dgroupskillrequest.php");
    register_action("dgroups/addtodgroup", false, $CONFIG->pluginspath . "dgroups/actions/addtodgroup.php");
    register_action("dgroups/invite", false, $CONFIG->pluginspath . "dgroups/actions/invite.php");
    extend_view('dgroups/menu/links', 'pages/menu');
    // Add to groups context
    extend_view('dgroups/right_column', 'pages/groupprofile_pages');
    // Add to groups context
    // Use dgroup widgets
    use_widgets('dgroups');
    // Add a page owner handler
    add_page_owner_handler('dgroups_page_owner_handler');
    // Add some widgets
    add_widget_type('a_users_dgroups', elgg_echo('dgroups:widget:membership'), elgg_echo('dgroups:widgets:description'));
    //extend some views
    extend_view('profile/icon', 'dgroups/icon');
    extend_view('css', 'dgroups/css');
    // Write access permissions
    register_plugin_hook('access:collections:write', 'all', 'dgroups_write_acl_plugin_hook');
    // Notification hooks
    if (is_callable('register_notification_object')) {
        register_notification_object('object', 'dgroupforumtopic', elgg_echo('dgroupforumtopic:new'));
    }
    register_plugin_hook('object:notifications', 'object', 'dgroup_object_notifications_intercept');
    // Listen to notification events and supply a more useful message
    register_plugin_hook('notify:entity:message', 'object', 'dgroupforumtopic_notify_message');
    // add the forum tool option
    // Now override icons
    register_plugin_hook('entity:icon:url', 'group', 'dgroups_dgroupicon_hook');
}
コード例 #2
0
ファイル: start.php プロジェクト: adamboardman/Elgg
/**
 * Initialise the groups plugin.
 * Register actions, set up menus
 */
function groups_init()
{
    global $CONFIG;
    // Set up the menu
    add_menu(elgg_echo('groups'), $CONFIG->wwwroot . "pg/groups/member/");
    // Register a page handler, so we can have nice URLs
    register_page_handler('groups', 'groups_page_handler');
    // Register a URL handler for groups and forum topics
    register_entity_url_handler('groups_url', 'group', 'all');
    register_entity_url_handler('groups_groupforumtopic_url', 'object', 'groupforumtopic');
    // Register an icon handler for groups
    register_page_handler('groupicon', 'groups_icon_handler');
    // Register some actions
    register_action("groups/edit", false, $CONFIG->pluginspath . "groups/actions/edit.php");
    register_action("groups/delete", false, $CONFIG->pluginspath . "groups/actions/delete.php");
    register_action("groups/join", false, $CONFIG->pluginspath . "groups/actions/join.php");
    register_action("groups/leave", false, $CONFIG->pluginspath . "groups/actions/leave.php");
    register_action("groups/joinrequest", false, $CONFIG->pluginspath . "groups/actions/joinrequest.php");
    register_action("groups/killrequest", false, $CONFIG->pluginspath . "groups/actions/groupskillrequest.php");
    register_action("groups/killinvitation", false, $CONFIG->pluginspath . "groups/actions/groupskillinvitation.php");
    register_action("groups/addtogroup", false, $CONFIG->pluginspath . "groups/actions/addtogroup.php");
    register_action("groups/invite", false, $CONFIG->pluginspath . "groups/actions/invite.php");
    // Use group widgets
    use_widgets('groups');
    // Add a page owner handler
    add_page_owner_handler('groups_page_owner_handler');
    // Add some widgets
    add_widget_type('a_users_groups', elgg_echo('groups:widget:membership'), elgg_echo('groups:widgets:description'));
    //extend some views
    elgg_extend_view('profile/icon', 'groups/icon');
    elgg_extend_view('css', 'groups/css');
    // Access permissions
    register_plugin_hook('access:collections:write', 'all', 'groups_write_acl_plugin_hook');
    //register_plugin_hook('access:collections:read', 'all', 'groups_read_acl_plugin_hook');
    // Notification hooks
    if (is_callable('register_notification_object')) {
        register_notification_object('object', 'groupforumtopic', elgg_echo('groupforumtopic:new'));
    }
    register_plugin_hook('object:notifications', 'object', 'group_object_notifications_intercept');
    // Listen to notification events and supply a more useful message
    register_plugin_hook('notify:entity:message', 'object', 'groupforumtopic_notify_message');
    // add the forum tool option
    add_group_tool_option('forum', elgg_echo('groups:enableforum'), true);
    // Now override icons
    register_plugin_hook('entity:icon:url', 'group', 'groups_groupicon_hook');
}