示例#1
0
/**
 * Initialize component
 *
 * @return void
 */
function about_user()
{
    ossn_profile_subpage('about');
    ossn_register_callback('page', 'load:profile', 'profile_about_user');
    ossn_add_hook('profile', 'subpage', 'profile_about_user_page');
    ossn_extend_view('css/ossn.default', 'css/aboutuser');
}
/**
 * Initialize Photos Component
 *
 * @return void;
 * @access private;
 */
function ossn_photos_initialize()
{
    //css
    ossn_extend_view('css/ossn.default', 'components/OssnPhotos/css/photos');
    //js
    ossn_extend_view('js/opensource.socialnetwork', 'components/OssnPhotos/js/OssnPhotos');
    //hooks
    ossn_add_hook('profile', 'subpage', 'ossn_profile_photos_page');
    ossn_add_hook('profile', 'modules', 'profile_modules_albums');
    ossn_add_hook('notification:view', 'like:entity:file:ossn:aphoto', 'ossn_notification_like_photo');
    ossn_add_hook('notification:view', 'comments:entity:file:ossn:aphoto', 'ossn_notification_like_photo');
    ossn_add_hook('photo:view', 'profile:controls', 'ossn_profile_photo_menu');
    ossn_add_hook('photo:view', 'album:controls', 'ossn_album_photo_menu');
    //actions
    if (ossn_isLoggedin()) {
        ossn_register_action('ossn/album/add', __OSSN_PHOTOS__ . 'actions/album/add.php');
        ossn_register_action('ossn/photos/add', __OSSN_PHOTOS__ . 'actions/photos/add.php');
        ossn_register_action('profile/photo/delete', __OSSN_PHOTOS__ . 'actions/photo/profile/delete.php');
        ossn_register_action('photo/delete', __OSSN_PHOTOS__ . 'actions/photo/delete.php');
    }
    //callbacks
    ossn_register_callback('page', 'load:profile', 'ossn_profile_menu_photos');
    ossn_register_callback('delete', 'profile:photo', 'ossn_photos_likes_comments_delete');
    ossn_register_callback('delete', 'album:photo', 'ossn_photos_likes_comments_delete');
    ossn_profile_subpage('photos');
    ossn_register_page('album', 'ossn_album_page_handler');
    ossn_register_page('photos', 'ossn_photos_page_handler');
    $url = ossn_site_url();
    if (ossn_isLoggedin()) {
        $user_loggedin = ossn_loggedin_user();
        $icon = ossn_site_url('components/OssnPhotos/images/photos-ossn.png');
        ossn_register_sections_menu('newsfeed', array('text' => ossn_print('photos:ossn'), 'url' => $user_loggedin->profileURL('/photos'), 'section' => 'links', 'icon' => $icon));
    }
}
示例#3
0
function option_trips_init()
{
    //Hooks
    ossn_add_hook('profile', 'modules', 'profile_modules_trips');
    //Funció pq aparegui el modul inferior "profile_modules_trips($hook, $type, $module, $params)"
    ossn_add_hook('profile', 'subpage', 'profile_trips_page');
    //Actions
    ossn_register_action('optiontrips/getmaptrips', __OSSN_TRIPS__ . 'actions/map/get.php');
    //Registre petició lat. long. mapa perfil
    ossn_register_action('trip/addPhoto', __OSSN_TRIPS__ . 'actions/addPhoto.php');
    //Acció per afegir les fotos en el formulari de viatges
    //Callbacks
    ossn_register_callback('page', 'load:profile', 'profile_menu_trips');
    //Afageix en el menú de navegació superior la opció viatges
    ossn_register_page('trip', 'trip_page_handler');
    //CSS i JS
    //Afegir capçalera styles i scripts
    ossn_extend_view('css/ossn.default', 'css/trips-style');
    //Registre JS
    ossn_new_js('trips', 'js/OptionTrips');
    //Carrega JS extern
    ossn_load_external_js('maps.google');
    //Carrega API Google
    //ossn_load_js('mapa.viatgers');
    if (ossn_isLoggedin()) {
        //Si ha iniciat sessió apreix les diferents accions
        //ossn_extend_view('js/opensource.socialnetwork', 'js/OptionTrips');
        ossn_load_js('trips');
        ossn_register_action('trips/add', __OSSN_TRIPS__ . 'actions/add.php');
        //Afageix un nou viatge a la base de dades
    }
    ossn_profile_subpage('trips');
    ossn_register_page('trip', 'trip_page_handler');
    $url = ossn_site_url();
    if (ossn_isLoggedin()) {
        //Si ha iniciat sessió
        $user_loggedin = ossn_loggedin_user();
        //URL actual de l'usuari
        $icon = ossn_site_url('components/OptionTrips/images/live_logo.png');
        //Afegir enllaç menú sidebar(left)
        ossn_register_sections_menu('newsfeed', array('text' => ossn_print('trips:ossn'), 'url' => $user_loggedin->profileURL('/trips'), 'section' => 'links', 'icon' => $icon));
    }
}
示例#4
0
/**
 * Initialize Profile Component
 *
 * @return void;
 * @access private;
 */
function ossn_profile()
{
    //pages
    ossn_register_page('u', 'profile_page_handler');
    ossn_register_page('avatar', 'avatar_page_handler');
    ossn_register_page('cover', 'cover_page_handler');
    //css and js
    ossn_extend_view('css/ossn.default', 'css/profile');
    ossn_extend_view('js/opensource.socialnetwork', 'js/OssnProfile');
    //actions
    if (ossn_isLoggedin()) {
        ossn_register_action('profile/photo/upload', __OSSN_PROFILE__ . 'actions/photo/upload.php');
        ossn_register_action('profile/cover/upload', __OSSN_PROFILE__ . 'actions/cover/upload.php');
        ossn_register_action('profile/cover/reposition', __OSSN_PROFILE__ . 'actions/cover/reposition.php');
        ossn_register_action('profile/edit', __OSSN_PROFILE__ . 'actions/edit.php');
        ossn_register_menu_item('topbar_dropdown', array('name' => 'account_settings', 'text' => ossn_print('account:settings'), 'href' => ossn_loggedin_user()->profileURL('/edit')));
    }
    //callback
    ossn_register_callback('page', 'load:search', 'ossn_search_users_link');
    ossn_register_callback('page', 'load:profile', 'ossn_profile_load_event');
    ossn_register_callback('delete', 'profile:photo', 'ossn_profile_delete_photo_wallpost');
    ossn_register_callback('delete', 'profile:cover:photo', 'ossn_profile_delete_photo_wallpost');
    //hooks
    ossn_add_hook('newsfeed', "sidebar:left", 'profile_photo_newsefeed', 1);
    ossn_add_hook('profile', 'subpage', 'profile_user_friends');
    ossn_add_hook('search', 'type:users', 'profile_search_handler');
    ossn_add_hook('profile', 'subpage', 'profile_edit_page');
    ossn_add_hook('profile', 'modules', 'profile_modules');
    ossn_add_hook('wall:template', 'profile:photo', 'ossn_wall_profile_photo');
    ossn_add_hook('wall:template', 'cover:photo', 'ossn_wall_profile_cover_photo');
    //notifications
    ossn_add_hook('notification:view', 'like:entity:file:profile:photo', 'ossn_notification_like_profile_photo');
    ossn_add_hook('notification:view', 'comments:entity:file:profile:photo', 'ossn_notification_like_profile_photo');
    //subpages of profile
    ossn_profile_subpage('friends');
    ossn_profile_subpage('edit');
}
    if (in_array($page, $VIEW->pagePush)) {
        return true;
    }
    return false;
}
ossn_profile_subpage('friends');
function profile_user_friends($hook, $type, $return, $params)
{
    $page = $params['subpage'];
    if ($page == 'friends') {
        $user['user'] = $params['user'];
        $friends = ossn_view('components/OssnProfile/pages/friends', $user);
        echo ossn_set_page_layout('module', array('title' => ossn_print('friends'), 'content' => $friends));
    }
}
ossn_profile_subpage('edit');
function profile_edit_page($hook, $type, $return, $params)
{
    $page = $params['subpage'];
    if ($page == 'edit') {
        $user['user'] = $params['user'];
        if ($user['user']->guid !== ossn_loggedin_user()->guid) {
            redirect(REF);
        }
        $params = array('action' => ossn_site_url() . 'action/profile/edit', 'component' => 'OssnProfile', 'class' => 'ossn-edit-form', 'params' => $user);
        $form = ossn_view_form('edit', $params, false);
        echo ossn_set_page_layout('module', array('title' => ossn_print('edit'), 'content' => $form));
    }
}
function profile_search_handler($hook, $type, $return, $params)
{