[ADD ON] F1 Statistik in Beitragsansicht ( Viewtopic )

Benutzeravatar
Foren Mitglied
Site Admin
Site Admin
Beiträge: 1984
Registriert: 05.02.2005 15:41
Wohnort: Xanten
Kontaktdaten:

Formel 1 WebTipp
Formel 1 Punkte : 0
Keine Platzierung
(0 von bisher 22 Rennen getippt)

[ADD ON] F1 Statistik in Beitragsansicht ( Viewtopic )

Beitrag von Foren Mitglied »

Dieses ADD ON für das Formel 1 WebTipp MOD fügt in der Beitragsansicht unterhalb des Avatars die Spieler Statistik ein.

ACHTUNG: OUTDATED - VERALTET Dieses ADD ON funktioniert erst ab Version F1 WebTipp Version 0.1.27

Beispiel:
Formel 1 WebTipp
Formel 1 Punkte : 29
6. Platz
(3 von 3 Rennen getippt)

ÖFFNE: viewtopic.php

SUCHE:

Code: Alles auswählen

    // Dump vars into template
    $template->assign_block_vars('postrow', $postrow);     
DAVOR EINFÜGEN:

Code: Alles auswählen

    //
    // F1 WebTipp
    //
    include_once($phpbb_root_path . 'includes/functions_formel.'.$phpEx);
    $formel_config  = get_formel_config();
    $user->setup('mods/formel');

    if ( $formel_config['show_in_profile'] ) 
    {
        // Check if this user has one of the formular 1 admin permission. If this user has one or more of these permissions, he gets also moderator permissions.
        $is_admin = $auth->acl_gets('a_formel_settings', 'a_formel_drivers', 'a_formel_teams', 'a_formel_races');
        
        if ( $formel_config['restrict_to'] == 0 || get_formel_auth() || $is_admin == 1 || $user->data['user_id'] == $formel_config['mod_id'] ) 
        {
            $tippers_rank   = $user->lang['FORMEL_PROFILE_NORANK'];
            $tippers_points = 0;
            $race_done      = 0;
            
            // Get tipp data for this user
            $sql = 'SELECT *, sum(tipp_points) as total_points, count(tipp_points) as tipps_made 
                FROM ' . FORMEL_TIPPS_TABLE . '
                GROUP BY tipp_user
                ORDER BY total_points DESC';
            $result = $db->sql_query($sql);

            $rank_count = $real_rank  = 1;
            $previous_points = false;
            while ($row_f1 = $db->sql_fetchrow($result)) 
            { 
                
                if($row_f1['total_points'] != $previous_points) 
                { 
                    $rank_count = $real_rank; 
                    $previous_points = $row_f1['total_points']; 
                }

                if ( $row_f1['tipp_user'] == $poster_id ) 
                {
                    $tippers_points = $row_f1['total_points'];
                    $race_done      = $row_f1['tipps_made'];
                    $tippers_rank   = sprintf($user->lang['FORMEL_PROFILE_RANK'], $rank_count);
                    break;
                }
                $real_rank++; 
            }
            $db->sql_freeresult($result);

            // Count total races with existing results
            $sql = 'SELECT * 
                FROM ' . FORMEL_RACES_TABLE . '
                WHERE race_result <> 0';
            $result = $db->sql_query($sql);

            $race_total = $db->sql_affectedrows($result);
            $db->sql_freeresult($result);

            $formel1 = array(
                'TIPPER_POINTS'     => $tippers_points,
                'TIPPER_RANK'       => $tippers_rank,
                'RACE_DONE'         => sprintf($user->lang['FORMEL_PROFILE_TIPSS'], $race_done, $race_total),
                'U_FORMEL_STATS'    => append_sid("formel.$phpEx?mode=stats"),
                'U_FORMEL_WEB_TIPP'    => append_sid("formel.$phpEx"),
            );
            
            $postrow = array_merge($postrow, $formel1);
        }
    }        
    //
    // END of F1 WebTipp
    //      
ÖFFNE: styles/prosilver/template/viewtopic_body.html

SUCHE:

Code: Alles auswählen

        <!-- IF postrow.POSTER_FROM --><dd><strong>{L_LOCATION}:</strong> {postrow.POSTER_FROM}</dd><!-- ENDIF -->     
DANACH EINFÜGEN:

Code: Alles auswählen

        <!-- IF postrow.TIPPER_POINTS --><dd><br/><strong><a href="{postrow.U_FORMEL_WEB_TIPP}" class="genmed">{L_FORMEL_TITLE}</a><br/>{L_FORMEL_PROFILE_WEBTIPP} : {postrow.TIPPER_POINTS}<br /><a href="{postrow.U_FORMEL_STATS}" class="genmed">{postrow.TIPPER_RANK}</a></strong><br />({postrow.RACE_DONE})</dd><!-- ENDIF -->     
ÖFFNE: styles/subsilver2/template/viewtopic_body.html

SUCHE:

Code: Alles auswählen

                    <!-- IF postrow.POSTER_FROM --><br /><b>{L_LOCATION}:</b> {postrow.POSTER_FROM}<!-- ENDIF -->     
DANACH EINFÜGEN:

Code: Alles auswählen

                    <!-- IF postrow.TIPPER_POINTS --><br /><br /><b><a href="{postrow.U_FORMEL_WEB_TIPP}" class="genmed">{L_FORMEL_TITLE}</a><br />{L_FORMEL_PROFILE_WEBTIPP} : {postrow.TIPPER_POINTS}<br /><a href="{postrow.U_FORMEL_STATS}" class="genmed">{postrow.TIPPER_RANK}</a></b><br />({postrow.RACE_DONE})<!-- ENDIF -->     
Doc. :schein:

 

 

 

Benutzeravatar
Foren Mitglied
Site Admin
Site Admin
Beiträge: 1984
Registriert: 05.02.2005 15:41
Wohnort: Xanten
Kontaktdaten:

Formel 1 WebTipp
Formel 1 Punkte : 0
Keine Platzierung
(0 von bisher 22 Rennen getippt)

Re: [ADD ON] F1 Statistik in Beitragsansicht ( Viewtopic )

Beitrag von Foren Mitglied »

Dieses ADD ON für das Formel 1 WebTipp MOD fügt in der Beitragsansicht unterhalb des Avatars die Spieler Statistik ein.

ACHTUNG: Dieses ADD ON funktioniert erst ab Version F1 WebTipp Version 0.1.28

Beispiel:
Formel 1 WebTipp
Formel 1 Punkte : 29
6. Platz
(3 von 3 Rennen getippt)

ÖFFNE: viewtopic.php

SUCHE:

Code: Alles auswählen

    // Dump vars into template
    $template->assign_block_vars('postrow', $postrow);      
DAVOR EINFÜGEN:

Code: Alles auswählen

    //
    // F1 WebTipp
    //
    include_once($phpbb_root_path . 'includes/functions_formel.'.$phpEx);
    $formel_config      = get_formel_config();

    if ( $formel_config['show_in_profile'] ) 
    {
        // Check if this user has one of the formular 1 admin permission. If this user has one or more of these permissions, he gets also moderator permissions.
        $is_admin = $auth->acl_gets('a_formel_settings', 'a_formel_drivers', 'a_formel_teams', 'a_formel_races');
        
        //Is the user member of the restricted group?
        include_once($phpbb_root_path . 'includes/functions_user.'.$phpEx);
        $is_in_group = group_memberships($formel_config['restrict_to'], $user->data['user_id'], true);        
        
        if ( $formel_config['restrict_to'] == 0 || $is_in_group || $is_admin == 1 || $user->data['user_id'] == $formel_config['mod_id'] ) 
        {
            $user->add_lang('mods/formel');
            $tippers_rank   = $user->lang['FORMEL_PROFILE_NORANK'];
            $tippers_points = 0;
            $race_done      = 0;
            
            // Get tipp data for this user
            $sql = 'SELECT *, sum(tipp_points) as total_points, count(tipp_points) as tipps_made 
                FROM ' . FORMEL_TIPPS_TABLE . '
                GROUP BY tipp_user
                ORDER BY total_points DESC';
            $result = $db->sql_query($sql);

            $rank_count = $real_rank  = 1;
            $previous_points = false;
            while ($row_f1 = $db->sql_fetchrow($result)) 
            { 
                
                if($row_f1['total_points'] != $previous_points) 
                { 
                    $rank_count = $real_rank; 
                    $previous_points = $row_f1['total_points']; 
                }

                if ( $row_f1['tipp_user'] == $poster_id ) 
                {
                    $tippers_points = $row_f1['total_points'];
                    $race_done      = $row_f1['tipps_made'];
                    $tippers_rank   = sprintf($user->lang['FORMEL_PROFILE_RANK'], $rank_count);
                    break;
                }
                $real_rank++; 
            }
            $db->sql_freeresult($result);

            // Count total races with existing results
            $sql = 'SELECT * 
                FROM ' . FORMEL_RACES_TABLE . '
                WHERE race_result <> 0';
            $result = $db->sql_query($sql);

            $race_total = $db->sql_affectedrows($result);
            $db->sql_freeresult($result);

            $formel1 = array(
                'TIPPER_POINTS'     => $tippers_points,
                'TIPPER_RANK'       => $tippers_rank,
                'RACE_DONE'         => sprintf($user->lang['FORMEL_PROFILE_TIPSS'], $race_done, $race_total),
                'U_FORMEL_STATS'    => append_sid("{$phpbb_root_path}formel.$phpEx?mode=stats"),
                'U_FORMEL_WEB_TIPP'    => append_sid("{$phpbb_root_path}formel.$phpEx"),
            );
            
            $postrow = array_merge($postrow, $formel1);
        }
    }        
    //
    // END of F1 WebTipp
    //      
ÖFFNE: styles/prosilver/template/viewtopic_body.html

SUCHE:

Code: Alles auswählen

        <!-- IF postrow.POSTER_FROM --><dd><strong>{L_LOCATION}:</strong> {postrow.POSTER_FROM}</dd><!-- ENDIF -->      
DANACH EINFÜGEN:

Code: Alles auswählen

        <!-- IF postrow.TIPPER_POINTS --><dd><br/><strong><a href="{postrow.U_FORMEL_WEB_TIPP}" class="genmed">{L_FORMEL_TITLE}</a><br/>{L_FORMEL_PROFILE_WEBTIPP} : {postrow.TIPPER_POINTS}<br /><a href="{postrow.U_FORMEL_STATS}" class="genmed">{postrow.TIPPER_RANK}</a></strong><br />({postrow.RACE_DONE})</dd><!-- ENDIF -->      
ÖFFNE: styles/subsilver2/template/viewtopic_body.html

SUCHE:

Code: Alles auswählen

                    <!-- IF postrow.POSTER_FROM --><br /><b>{L_LOCATION}:</b> {postrow.POSTER_FROM}<!-- ENDIF -->      
DANACH EINFÜGEN:

Code: Alles auswählen

                    <!-- IF postrow.TIPPER_POINTS --><br /><br /><b><a href="{postrow.U_FORMEL_WEB_TIPP}" class="genmed">{L_FORMEL_TITLE}</a><br />{L_FORMEL_PROFILE_WEBTIPP} : {postrow.TIPPER_POINTS}<br /><a href="{postrow.U_FORMEL_STATS}" class="genmed">{postrow.TIPPER_RANK}</a></b><br />({postrow.RACE_DONE})<!-- ENDIF -->      
Doc. :schein:

 

 

 

Benutzeravatar
Foren Mitglied
Site Admin
Site Admin
Beiträge: 1984
Registriert: 05.02.2005 15:41
Wohnort: Xanten
Kontaktdaten:

Formel 1 WebTipp
Formel 1 Punkte : 0
Keine Platzierung
(0 von bisher 22 Rennen getippt)

Re: [ADD ON] F1 Statistik in Beitragsansicht ( Viewtopic )

Beitrag von Foren Mitglied »

Dieses AddOn ist ab Version 0.3.6 bereits enthalten.
Doc. :schein:

 

 

 

Gesperrt