예제 #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');
}
            }
        }
    }
    return $return;
}
/**
 * Run some things once.
 *
 */
function widget_run_once()
{
    // Register a class
    add_subtype("object", "widget", "ElggWidget");
}
/**
 * Function to initialise widgets functionality on Elgg init
 *
 */
function widgets_init()
{
    register_action('widgets/reorder');
    register_action('widgets/save');
    register_action('widgets/add');
    // Now run this stuff, but only once
    run_function_once("widget_run_once");
}
// Register event
register_elgg_event_handler('init', 'system', 'widgets_init');
// Use widgets on the dashboard
use_widgets('dashboard');
            $icontime = "default";
        }
        if ($entity->isBanned()) {
            return elgg_view('icon/user/default/' . $size);
        }
        $filehandler = new ElggFile();
        $filehandler->owner_guid = $entity->getGUID();
        $filehandler->setFilename("profile/" . $username . $size . ".jpg");
        if ($filehandler->exists()) {
            //$url = $CONFIG->url . "pg/icon/$username/$size/$icontime.jpg";
            return $CONFIG->wwwroot . 'mod/profile/icondirect.php?lastcache=' . $icontime . '&username='******'&size=' . $size;
        }
    }
}
// Make sure the profile initialisation function is called on initialisation
register_elgg_event_handler('init', 'system', 'profile_init', 1);
register_elgg_event_handler('init', 'system', 'profile_fields_setup', 10000);
// Ensure this runs after other plugins
register_elgg_event_handler('pagesetup', 'system', 'profile_pagesetup');
register_elgg_event_handler('profileupdate', 'all', 'object_notifications');
// Register actions
global $CONFIG;
register_action("profile/edit", false, $CONFIG->pluginspath . "profile/actions/edit.php");
register_action("profile/iconupload", false, $CONFIG->pluginspath . "profile/actions/iconupload.php");
register_action("profile/cropicon", false, $CONFIG->pluginspath . "profile/actions/cropicon.php");
register_action("profile/editdefault", false, $CONFIG->pluginspath . "profile/actions/editdefault.php", true);
register_action("profile/editdefault/delete", false, $CONFIG->pluginspath . "profile/actions/deletedefaultprofileitem.php", true);
register_action("profile/editdefault/reset", false, $CONFIG->pluginspath . "profile/actions/resetdefaultprofile.php", true);
// Define widgets for use in this context
use_widgets('profile');