/**
 * Users initialisation function, which establishes the page handler
 *
 */
function users_init()
{
    // Load config
    global $CONFIG;
    // Set up menu for logged in users
    if (isloggedin()) {
        $user = get_loggedin_user();
        add_menu("Friends", $CONFIG->wwwroot . "pg/friends/" . $user->username);
    }
    register_page_handler('friends', 'friends_page_handler');
    register_page_handler('friendsof', 'friends_of_page_handler');
    register_page_handler('collections', 'collections_page_handler');
    register_page_handler('dashboard', 'dashboard_page_handler');
    register_action("register", true);
    register_action("useradd", true);
    register_action("useradd_content_item", true);
    register_action("friends/add");
    register_action("friends/remove");
    register_action('friends/addcollection');
    register_action('friends/deletecollection');
    register_action('friends/editcollection');
    register_action("user/spotlight");
    register_action("usersettings/save");
    register_action("user/passwordreset");
    register_action("user/requestnewpassword");
    // User name change
    extend_elgg_settings_page('user/settings/name', 'usersettings/user', 1);
    //register_action("user/name");
    // User password change
    extend_elgg_settings_page('user/settings/password', 'usersettings/user', 1);
    //register_action("user/password");
    // Add email settings
    extend_elgg_settings_page('user/settings/email', 'usersettings/user', 1);
    //register_action("email/save");
    // Add language settings
    extend_elgg_settings_page('user/settings/language', 'usersettings/user', 1);
    // Add default access settings
    extend_elgg_settings_page('user/settings/default_access', 'usersettings/user', 1);
    //register_action("user/language");
    // Register the user type
    register_entity_type('user', '');
    register_plugin_hook('usersettings:save', 'user', 'users_settings_save');
    register_plugin_hook('search', 'all', 'search_list_users_by_name');
    // Handle a special case for newly created users when the user is not logged in
    // TODO: handle this better!
    register_plugin_hook('permissions_check', 'all', 'new_user_enable_permissions_check');
}
/**
 * Correctly initialise notifications and register the email handler.
 *
 */
function notification_init()
{
    // Register a notification handler for the default email method
    register_notification_handler("email", "email_notify_handler");
    // Add settings view to user settings & register action
    extend_elgg_settings_page('notifications/settings/usersettings', 'usersettings/user');
    register_plugin_hook('usersettings:save', 'user', 'notification_user_settings_save');
    //register_action("notifications/settings/usersettings/save");
}
function form_pagesetup()
{
    global $CONFIG;
    // Set up menu and content setting for logged in users
    if (isloggedin()) {
        form_set_menu_items();
        if (form_get_user_content_status()) {
            add_menu(elgg_echo('item:object:form_data'), $CONFIG->wwwroot . "pg/form/" . $_SESSION['user']->username);
            // add a view content option to user settings
            extend_elgg_settings_page('form/settings/usersettings', 'usersettings/user');
        }
    }
    $context = get_context();
    $form_id = get_input('form_id', get_input('id', 0));
    if (!$form_id && ($sid = get_input('sid', 0))) {
        $form_id = get_entity($sid)->form_id;
    }
    if ($form_id) {
        $form = get_entity($form_id);
        set_page_owner($form->getOwner());
    }
    $username = page_owner_entity()->username;
    if (get_context() == 'admin') {
        $admin_url = $CONFIG->wwwroot . 'mod/form/manage_all_forms.php';
        if ($username) {
            $admin_url .= '?username='******'form:manage_forms_title'), $admin_url);
    }
    if ($context == 'form:admin' && isadminloggedin()) {
        // add_submenu_item(elgg_echo('form:add_new_profile_form_link'),$CONFIG->wwwroot.'mod/form/manage_form.php?username='******'&profile=1', '4formactions');
        // add_submenu_item(elgg_echo('form:add_new_group_profile_form_link'),$CONFIG->wwwroot.'mod/form/manage_form.php?username='******'&profile=2', '4formactions');
        add_submenu_item(elgg_echo('form:manage_group_profile_categories_title'), $CONFIG->wwwroot . 'mod/form/manage_group_profile_categories.php?username='******'4formactions');
    }
    if (in_array($context, array('form', 'form:content', 'form:admin')) && isadminloggedin()) {
        // currently only admins get to manage forms
        if ($form_id) {
            add_submenu_item(elgg_echo('form:edit_page_link'), $CONFIG->wwwroot . 'mod/form/manage_form.php?id=' . $form_id, '1formactions');
            if ($context == 'form:admin') {
                add_submenu_item(elgg_echo('form:preview_link_text'), $CONFIG->wwwroot . 'mod/form/form.php?id=' . $form_id . '&preview=true', '1formactions');
                add_submenu_item(elgg_echo('form:public_link_text'), $CONFIG->wwwroot . 'mod/form/form.php?id=' . $form_id, '1formactions');
                add_submenu_item(elgg_echo('form:list_search_definitions_link'), $CONFIG->wwwroot . 'mod/form/list_search_definitions.php?form_id=' . $form_id, '1formactions');
                add_submenu_item(elgg_echo('form:add_new_search_definition_link_text'), $CONFIG->wwwroot . 'mod/form/manage_search_definition.php?form_id=' . $form_id, '1formactions');
                add_submenu_item(elgg_echo('form:manage_translations_link'), $CONFIG->wwwroot . 'mod/form/manage_form_translation.php?id=' . $form_id, '1formactions');
            }
        }
        add_submenu_item(elgg_echo('form:manage_forms_title'), $CONFIG->wwwroot . 'mod/form/manage_all_forms.php?username='******'3formactions');
        if ($context == 'form:admin') {
            add_submenu_item(elgg_echo('form:add_new_link'), $CONFIG->wwwroot . 'mod/form/manage_form.php?username='******'4formactions');
            add_submenu_item(elgg_echo('form:list_all_fields_link'), $CONFIG->wwwroot . 'mod/form/list_fields.php?type=all&username='******'3formactions');
            add_submenu_item(elgg_echo('form:list_orphan_fields_link'), $CONFIG->wwwroot . 'mod/form/list_fields.php?type=orphan&username='******'3formactions');
        }
    }
    if (in_array($context, array('form', 'form:content', 'form:admin')) && form_get_user_content_status()) {
        add_submenu_item(elgg_echo('form:view_all_forms'), $CONFIG->wwwroot . 'pg/form/' . $username, '2formactions');
    }
    if ($context == 'form:content' && $form_id) {
        if (isloggedin()) {
            set_page_owner($_SESSION['user']->getGUID());
        }
        if (!$form->profile) {
            if ($sid = get_input('sid', 0)) {
                $sid_bit = '&sid=' . $sid;
            } else {
                $sid_bit = '';
            }
            if (isloggedin()) {
                add_submenu_item(elgg_echo('form:add_content'), $CONFIG->wwwroot . 'mod/form/form.php?id=' . $form_id, '0formactions');
                //add_submenu_item(elgg_echo('form:view_mine'),$CONFIG->wwwroot.'mod/form/my_forms.php?id='.$form_id.'&form_view=mine'.$sid_bit,'4formactions');
                //add_submenu_item(elgg_echo('form:view_friends'),$CONFIG->wwwroot.'mod/form/my_forms.php?id='.$form_id.'&form_view=friends'.$sid_bit,'4formactions');
            }
            add_submenu_item(elgg_echo('form:view_all'), $CONFIG->wwwroot . 'mod/form/my_forms.php?id=' . $form_id . '&form_view=all' . $sid_bit, '0formactions');
            $sd_list = get_entities_from_metadata('form_id', $form_id, 'object', 'form:search_definition');
            if ($sd_list) {
                foreach ($sd_list as $sd) {
                    $sd_id = $sd->getGUID();
                    add_submenu_item(form_search_definition_t($form, $sd, 'title'), $CONFIG->wwwroot . 'mod/form/search.php?sid=' . $sd_id, '0formactions');
                }
            }
        }
    }
}
示例#4
0
/**
 * Users initialisation function, which establishes the page handler
 *
 */
function users_init()
{
    // Load config
    global $CONFIG;
    // add Friends to tools menu - if profile mod is running
    if (isloggedin() && is_plugin_enabled('profile')) {
        $user = get_loggedin_user();
        add_menu(elgg_echo('friends'), $CONFIG->wwwroot . "pg/friends/" . $user->username, array(), 'core:friends');
    }
    register_page_handler('friends', 'friends_page_handler');
    register_page_handler('friendsof', 'friends_of_page_handler');
    //register_page_handler('collections', 'collections_page_handler');
    register_page_handler('dashboard', 'dashboard_page_handler');
    register_page_handler('register', 'registration_page_handler');
    register_page_handler('resetpassword', 'elgg_user_resetpassword_page_handler');
    register_action("register", true);
    register_action("useradd", true);
    register_action("friends/add");
    register_action("friends/remove");
    //register_action('friends/addcollection');
    //register_action('friends/deletecollection');
    //register_action('friends/editcollection');
    //register_action("user/spotlight");
    register_action("usersettings/save");
    register_action("user/passwordreset");
    register_action("user/requestnewpassword");
    // User name change
    extend_elgg_settings_page('user/settings/name', 'usersettings/user', 1);
    //register_action("user/name");
    // User password change
    extend_elgg_settings_page('user/settings/password', 'usersettings/user', 1);
    //register_action("user/password");
    // Add email settings
    extend_elgg_settings_page('user/settings/email', 'usersettings/user', 1);
    //register_action("email/save");
    // Add language settings
    extend_elgg_settings_page('user/settings/language', 'usersettings/user', 1);
    // Add default access settings
    extend_elgg_settings_page('user/settings/default_access', 'usersettings/user', 1);
    //register_action("user/language");
    // Register the user type
    register_entity_type('user', '');
    register_plugin_hook('usersettings:save', 'user', 'users_settings_save');
    register_elgg_event_handler('create', 'user', 'user_create_hook_add_site_relationship');
    // Handle a special case for newly created users when the user is not logged in
    // TODO: handle this better!
    register_plugin_hook('permissions_check', 'all', 'new_user_enable_permissions_check');
}
/**
 * Initialise the statistics admin page.
 */
function statistics_init()
{
    extend_elgg_admin_page('admin/statistics_opt/basic', 'admin/statistics');
    extend_elgg_admin_page('admin/statistics_opt/numentities', 'admin/statistics');
    extend_elgg_admin_page('admin/statistics_opt/online', 'admin/statistics');
    extend_elgg_settings_page('usersettings/statistics_opt/online', 'usersettings/statistics');
    extend_elgg_settings_page('usersettings/statistics_opt/numentities', 'usersettings/statistics');
}
示例#6
0
/**
 * Correctly initialise notifications and register the email handler.
 *
 */
function notification_init()
{
    // Register a notification handler for the default email method
    register_notification_handler("email", "email_notify_handler");
    // Add settings view to user settings & register action
    extend_elgg_settings_page('notifications/settings/usersettings', 'usersettings/user');
    register_plugin_hook('usersettings:save', 'user', 'notification_user_settings_save');
    //register_action("notifications/settings/usersettings/save");
    // Register some APIs
    expose_function('user.notification.get', 'get_user_notification_settings', array('user_guid' => array('type' => 'int')), elgg_echo('user.notification.get'));
    expose_function('user.notification.set', 'set_user_notification_settings', array('user_guid' => array('type' => 'int'), 'method' => array('type' => 'string'), 'value' => array('type' => 'bool')), elgg_echo('user.notification.set'));
}