Autor Tópico: Simples Top 10 Estatísticas  (Lida 8249 vezes)

0 Membros e 1 Visitante estão a ver este tópico.

Offline candidosa2

  • Suporte Tecnico
  • Fundador
  • *
  • Mensagens: 5073
  • Rank: 1658
  • Sexo: Masculino
  • Suporte
    • Hosting Moçambique
Simples Top 10 Estatísticas
« em: 25 de Julho de 2009, 12:43 »



Board.Index.Template.php

Pesquisar Por
/* Each category in categories is made up of:

Adicionar antes da Linha pesquisada

Código: [Seleccione]
// TopXStats by_yağız Update candidosa2 suporte smfpt.net
   echo '
   <table border="0" width="100%" cellspacing="1" cellpadding="2" class="bordercolor">
      <tr>
         <td width="100%" colspan="4" class="catbg" height="24"><center>Estatísticas</center></td>
      </tr>
      <tr class="titlebg">
         <td><span class="smalltext">Mensagem Enviadas</span></td>
         <td><span class="smalltext">Novos membros</span></td>
         <td><span class="smalltext">Postes Recentes</span></td>
      </tr>
      <tr class="windowbg2">
         <td width="21%" valign="top">
            <table width="100%">
               <tr>
                  <td class="windowbg2"><b><span class="smalltext">Membro:</span></b></td>
                  <td class="windowbg2" align="right"><b><span class="smalltext">Mensagem:</span></b></td>
               </tr>';
      foreach ($context['top_posters'] as $poster)
      {
         echo '
               <tr>
                  <td class="windowbg2"><img src="', $settings['images_url'], '/topx1.gif" /><span class="smalltext">', $poster['link'], '</span></td>
                  <td class="windowbg2" align="right"><img src="', $settings['images_url'], '/topx2.gif" /><span class="smalltext">', $poster['num_posts'], '</span></td>
               </tr>';
      }
         echo '
            </table>
         </td>
         <td width="20%" valign="top">
            <table width="100%">
               <tr>
                  <td class="windowbg2"><b><span class="smalltext">Membro:</span></b></td>
               </tr>';
      foreach ($context['new_members'] as $poster)
      {
         echo '
               <tr>
                  <td class="windowbg2" valign="top"><img src="', $settings['images_url'], '/topx3.gif" /><span class="smalltext">',$poster['link'], '</span></td>
               </tr>';
      }
         echo '
            </table>
         </td>
         <td width="59%" valign="top">';
      // Show lots of posts.
      if (!empty($context['latest_posts']))
      {
         echo '
            <table width="100%">
               <tr class="windowbg2">
                  <td width="42%"><b><span class="smalltext">Assunto:</span></b></td>
                  <td width="22%"><b><span class="smalltext">De:</span></b></td>
                  <td width="36%"><b><span class="smalltext">Data:</span></b></td>
               </tr>';
         foreach ($context['latest_posts'] as $post)
            echo '
               <tr>
                  <td class="windowbg2" valign="top" ><img src="', $settings['images_url'], '/topx4.gif" /><span class="smalltext"><a href="',$post['href'],'">', $post['short_subject'], '</a></span></td>
                  <td class="windowbg2" valign="top"><img src="', $settings['images_url'], '/topx5.gif" /><span class="smalltext">', $post['poster']['link'], '</span></td>
                  <td class="windowbg2" valign="top"><span class="smalltext"><img src="', $settings['images_url'], '/topx6.gif" />', $post['time'], '</span></td>
               </tr>';
            echo '
            </table>';
      }
      echo '
         </td>
      </tr>

   </table><br/>';


Sources/BoardIndex.php
Pesquisar

Código: [Seleccione]
$context['show_calendar'] = false;
Adicionar

Código: [Seleccione]
TopXStats();

Pesquisar

Código: [Seleccione]
// And go back to the board index.
   BoardIndex();
}

?>


Trocar por

Código: [Seleccione]
// And go back to the board index.
   BoardIndex();
}

// TopXStats
function TopXStats()
{
   global $context, $smcFunc, $txt, $db_prefix, $scripturl, $modSettings;
   
   // Poster top 10.
   $members_result = $smcFunc['db_query']('', '
      SELECT id_member, real_name, posts
      FROM {db_prefix}members
      WHERE posts > {int:no_posts}
      ORDER BY posts DESC
      LIMIT 10',
      array(
         'no_posts' => 0,
      )
   );
   $context['top_posters'] = array();
   $context['MemberColor_ID_MEMBER'] = array();
   while ($row_members = $smcFunc['db_fetch_assoc']($members_result))
   {
      $context['top_posters'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'num_posts' => $row_members['posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );
        if (!empty($modSettings['MemberColorStats']) && !empty($row_members['id_member']))
         $context['MemberColor_ID_MEMBER'][$row_members['id_member']] = $row_members['id_member'];
   }
   $smcFunc['db_free_result']($members_result);
   
   if (!empty($modSettings['latestMember']) && !empty($modSettings['MemberColorLatestMember']))
      $context['MemberColor_ID_MEMBER'][$modSettings['latestMember']] = $modSettings['latestMember'];
   
   //Yeah baby give me some colors =).
   if (!empty($context['MemberColor_ID_MEMBER'])) {
      //Now Load the Missing global
      global $user_profile;
      loadMemberData($context['MemberColor_ID_MEMBER']);
      $cmemcolid = NULL;
      if (!empty($modSettings['MemberColorStats'])) {
         // First the Top Posters =)
         foreach($context['top_posters'] as $key => $value) {
            $cmemcolid = $context['top_posters'][$key]['id'];
            $profile = &$user_profile[$cmemcolid];
            if(!empty($profile['member_group_color']) || !empty($profile['post_group_color']))
               $context['top_posters'][$key]['link'] = '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $profile['real_name'] . '"><span style="color:'.(!empty($profile['member_group_color']) ? $profile['member_group_color'] : $profile['post_group_color']).';">' . $profile['real_name'] . '</span></a>';
         }
         // First the Top Starter =)     
         foreach($context['top_starters'] as $key => $value) {
            $cmemcolid = $context['top_starters'][$key]['id'];
            $profile = &$user_profile[$cmemcolid];
            if(!empty($profile['member_group_color']) || !empty($profile['post_group_color']))
               $context['top_starters'][$key]['link'] = '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $profile['real_name'] . '"><span style="color:'.(!empty($profile['member_group_color']) ? $profile['member_group_color'] : $profile['post_group_color']).';">' . $profile['real_name'] . '</span></a>';
         }
         // First the Top Onliner =)           
         foreach($context['top_time_online'] as $key => $value) {
            $cmemcolid = $context['top_time_online'][$key]['id'];
            $profile = &$user_profile[$cmemcolid];
            if(!empty($profile['member_group_color']) || !empty($profile['post_group_color']))
               $context['top_time_online'][$key]['link'] = '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $profile['real_name'] . '"><span style="color:'.(!empty($profile['member_group_color']) ? $profile['member_group_color'] : $profile['post_group_color']).';">' . $profile['real_name'] . '</span></a>';
         }
      }
      if (!empty($modSettings['latestMember']) && !empty($modSettings['MemberColorLatestMember'])) {
         $profile = &$user_profile[$modSettings['latestMember']];
         if(!empty($profile['member_group_color']) || !empty($profile['post_group_color']))
            $context['latest_member']['link'] = '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $profile['real_name'] . '"><span style="color:'.(!empty($profile['member_group_color']) ? $profile['member_group_color'] : $profile['post_group_color']).';">' . $profile['real_name'] . '</span></a>';
      }
   }
   
   // Newest members top 10
   $members_result =  $smcFunc['db_query']('', '
      SELECT id_member, real_name, posts
      FROM {db_prefix}members
      ORDER BY id_member DESC
      LIMIT 10',
      array(
      )
   );
   $context['new_members'] = array();
   while ($row_members = $smcFunc['db_fetch_assoc']($members_result))
   {
      $context['new_members'][] = array(
         'name' => $row_members['real_name'],
         'id' => $row_members['id_member'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
      );
   }
   $smcFunc['db_free_result']($members_result);

}

?>

As imagens estao no anexo
« Última modificação: 21 de Agosto de 2013, 17:37 por candidosa2 »