Page 1 of 1

[REL] Add Online-Status to Team Block

Posted: Mon 5. Apr 2010, 10:36
by Marc
This will add the online status to the team block. Durch dies Anleitung wird der Online Status im Team-Block angezeigt.

Version: 1.0.0

Screenshot:
screenshot.png
screenshot.png (11.36 KiB) Viewed 23345 times
Tested with Board3 Portal 1.0.4 & 1.0.5. Getestet mit Board3 Portal 1.0.4 & 1.0.5

Normal Team block / Normaler Team Block

Instructions for normal team block:
[+] Install Instructions
Open portal/block/leaders.php
Find:

Code: Select all

    if ($row['group_type'] == GROUP_HIDDEN && !$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $row['ug_user_id'] != $user->data['user_id'])
    {
        $group_name = $user->lang['GROUP_UNDISCLOSED'];
        $u_group = '';
    }
    else
    {
        $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
        $u_group = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']);
    }   
After add:

Code: Select all

    // Generate online information for user
    $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
        FROM ' . SESSIONS_TABLE . '
        WHERE ' . $db->sql_in_set('session_user_id', $row['user_id']) . '
        GROUP BY session_user_id';
    $result2 = $db->sql_query($sql);

    $update_time = $config['load_online_time'] * 60;
    $user_online = false;
    while ($row2 = $db->sql_fetchrow($result2))
    {
        $user_online = (time() - $update_time < $row2['online_time'] && (($row2['viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false;
    }
    $db->sql_freeresult($result2);   
Find:

Code: Select all

        'USER_ID'            => $row['user_id'],   
After add:

Code: Select all

        'USER_ONLINE'        => $user_online,   

Open styles/prosilver/template/portal/block/leaders.html
Find:

Code: Select all

<span style="float:left; padding-left:5px; padding-top:2px;"><strong>{admin.USERNAME_FULL}</strong></span>
Inline: After add:

Code: Select all

<!-- IF admin.USER_ONLINE eq 'true' --><img src="{T_THEME_PATH}/images/portal/green-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ELSE --><img src="{T_THEME_PATH}/images/portal/red-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ENDIF -->
Find:

Code: Select all

<span style="float:left; padding-left:5px; padding-top:2px;"><strong>{mod.USERNAME_FULL}</strong></span>
Replace with:

Code: Select all

<span style="float:left; padding-left:5px; padding-top:2px;"><strong>{mod.USERNAME_FULL}</strong></span><!-- IF mod.USER_ONLINE eq 'true' --><img src="{T_THEME_PATH}/images/portal/green-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ELSE --><img src="{T_THEME_PATH}/images/portal/red-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ENDIF -->
Upload the following 2 files to styles/prosilver/theme/images/portal:
The attachment green-on-16.png is no longer available
The attachment red-on-16.png is no longer available
Anleitung für normalen Team Block:
[+] Installations Anleitung
Öffne portal/block/leaders.php
Finde:

Code: Select all

    if ($row['group_type'] == GROUP_HIDDEN && !$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $row['ug_user_id'] != $user->data['user_id'])
    {
        $group_name = $user->lang['GROUP_UNDISCLOSED'];
        $u_group = '';
    }
    else
    {
        $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
        $u_group = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']);
    }   
Danach einfügen:

Code: Select all

    // Generate online information for user
    $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
        FROM ' . SESSIONS_TABLE . '
        WHERE ' . $db->sql_in_set('session_user_id', $row['user_id']) . '
        GROUP BY session_user_id';
    $result2 = $db->sql_query($sql);

    $update_time = $config['load_online_time'] * 60;
    $user_online = false;
    while ($row2 = $db->sql_fetchrow($result2))
    {
        $user_online = (time() - $update_time < $row2['online_time'] && (($row2['viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false;
    }
    $db->sql_freeresult($result2);   
Finde:

Code: Select all

        'USER_ID'            => $row['user_id'],   
Danach einfügen:

Code: Select all

        'USER_ONLINE'        => $user_online,   

Öffne styles/prosilver/template/portal/block/leaders.html
Finde:

Code: Select all

<span style="float:left; padding-left:5px; padding-top:2px;"><strong>{admin.USERNAME_FULL}</strong></span>
In der Zeile direkt danach einfügen:

Code: Select all

<!-- IF admin.USER_ONLINE eq 'true' --><img src="{T_THEME_PATH}/images/portal/green-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ELSE --><img src="{T_THEME_PATH}/images/portal/red-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ENDIF -->
Finde:

Code: Select all

<span style="float:left; padding-left:5px; padding-top:2px;"><strong>{mod.USERNAME_FULL}</strong></span>
Ersetze mit:

Code: Select all

<span style="float:left; padding-left:5px; padding-top:2px;"><strong>{mod.USERNAME_FULL}</strong></span><!-- IF mod.USER_ONLINE eq 'true' --><img src="{T_THEME_PATH}/images/portal/green-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ELSE --><img src="{T_THEME_PATH}/images/portal/red-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ENDIF -->
Jetzt noch die folgenden 2 Dateien in styles/prosilver/theme/images/portal hochladen:
The attachment green-on-16.png is no longer available
The attachment red-on-16.png is no longer available
Extended Team block / Erweiterter Team Block

Instructions for extended team block:
[+] Install Instructions
Open portal/block/leaders_ext.php
Find:

Code: Select all

        $groups[$row['group_id']]['group_users'][] = array(
            'user_id'        => $row['user_id'],
            'username'        => $row['username'],
            'user_colour'    => $row['user_colour'],
        );   
Before add:

Code: Select all

        // Generate online information for user
        $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
            FROM ' . SESSIONS_TABLE . '
            WHERE ' . $db->sql_in_set('session_user_id', $row['user_id']) . '
            GROUP BY session_user_id';
        $result2 = $db->sql_query($sql);

        $update_time = $config['load_online_time'] * 60;
        $user_online = false;
        while ($row2 = $db->sql_fetchrow($result2))
        {
            $user_online = (time() - $update_time < $row2['online_time'] && (($row2['viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false;
        }
        $db->sql_freeresult($result2);   
Find:

Code: Select all

'user_id'        => $row['user_id'],   
After add:

Code: Select all

            'user_online'    => $user_online,   
Find:

Code: Select all

                    'USER_ID'            => $group_user['user_id'],   
After add:

Code: Select all

                    'USER_ONLINE'        => $group_user['user_online'],   

Open styles/prosilver/template/portal/block/leaders_ext.html
Find:

Code: Select all

		<span style="float:left;"><img src="{T_THEME_PATH}/images/portal/portal_user.png" width="16" height="16" alt="" /></span><span style="float:left; padding-left:5px; padding-top:2px;"><strong>{group.member.USERNAME_FULL}</strong></span><br style="clear:both" />
Replace with:

Code: Select all

		<span style="float:left;"><img src="{T_THEME_PATH}/images/portal/portal_user.png" width="16" height="16" alt="" /></span><span style="float:left; padding-left:5px; padding-top:2px;"><strong>{group.member.USERNAME_FULL}</strong></span><!-- IF group.member.USER_ONLINE eq 'true' --><img src="{T_THEME_PATH}/images/portal/green-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ELSE --><img src="{T_THEME_PATH}/images/portal/red-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ENDIF --><br style="clear:both" />
Upload the following 2 files to styles/prosilver/theme/images/portal hochladen (if the do not already exist):
The attachment green-on-16.png is no longer available
The attachment red-on-16.png is no longer available
Anleitung für Erweiterten Team-Block:
[+] Installations Anleitung
Öffne portal/block/leaders_ext.php
Finde:

Code: Select all

        $groups[$row['group_id']]['group_users'][] = array(
            'user_id'        => $row['user_id'],
            'username'        => $row['username'],
            'user_colour'    => $row['user_colour'],
        );  
Davor einfügen:

Code: Select all

        // Generate online information for user
        $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
            FROM ' . SESSIONS_TABLE . '
            WHERE ' . $db->sql_in_set('session_user_id', $row['user_id']) . '
            GROUP BY session_user_id';
        $result2 = $db->sql_query($sql);

        $update_time = $config['load_online_time'] * 60;
        $user_online = false;
        while ($row2 = $db->sql_fetchrow($result2))
        {
            $user_online = (time() - $update_time < $row2['online_time'] && (($row2['viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false;
        }
        $db->sql_freeresult($result2);  
Finde:

Code: Select all

'user_id'        => $row['user_id'],  
Danach einfügen:

Code: Select all

            'user_online'    => $user_online,  
Finde:

Code: Select all

                    'USER_ID'            => $group_user['user_id'],  
Danach einfügen:

Code: Select all

                    'USER_ONLINE'        => $group_user['user_online'],  

Öffne styles/prosilver/template/portal/block/leaders_ext.html
Finde:

Code: Select all

		<span style="float:left;"><img src="{T_THEME_PATH}/images/portal/portal_user.png" width="16" height="16" alt="" /></span><span style="float:left; padding-left:5px; padding-top:2px;"><strong>{group.member.USERNAME_FULL}</strong></span><br style="clear:both" />
Ersetze durch:

Code: Select all

		<span style="float:left;"><img src="{T_THEME_PATH}/images/portal/portal_user.png" width="16" height="16" alt="" /></span><span style="float:left; padding-left:5px; padding-top:2px;"><strong>{group.member.USERNAME_FULL}</strong></span><!-- IF group.member.USER_ONLINE eq 'true' --><img src="{T_THEME_PATH}/images/portal/green-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ELSE --><img src="{T_THEME_PATH}/images/portal/red-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ENDIF --><br style="clear:both" />
Jetzt noch die folgenden 2 Dateien in styles/prosilver/theme/images/portal hochladen (falls nicht schon vorhanden):
The attachment green-on-16.png is no longer available
The attachment red-on-16.png is no longer available
Note: The png-leds will not have a transparent background in IE6. If you want it to look correct in IE6, look for GIF led-icons.
Hinweis: Die PNG-LEDs haben im IE6 keinen transparenten Hintergrund. Falls du willst, dass es im IE6 auch gut aussieht, suche LED-Icons im GIF-Format.