Changeset 286 for quests/statistic.php


Ignore:
Timestamp:
Jan 30, 2008, 6:43:37 PM (17 years ago)
Author:
maron
Message:

Oprava statistiky, přidání uživatelského infa s napsáním emailu

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quests/statistic.php

    r280 r286  
    3636
    3737  echo '<tr><th><a href="statistic.php?order=user&amp;desc='.$desc.'">Jméno</a></th>
    38   <th><a href="statistic.php?order=NumberTranslate&amp;desc='.$desc.'" Title="Poèet pøeloœených questù">Pøel. Q.</a></th>
    39   <th><a href="statistic.php?order=NumberTranslateNPC&amp;desc='.$desc.'" Title="Poèet pøeloœených NPC_textù">Pøel. N.</a></th>
    40   <th><a href="statistic.php?order=vote&amp;desc='.$desc.'" Title="Prùmìrná známka questù">Z. Q</a></th>
    41   <th><a href="statistic.php?order=voteNPC&amp;desc='.$desc.'" Title="Prùmìrná známka NPC_text">Z. N.</a></th>
     38  <th><a href="statistic.php?order=NumberTranslate&amp;desc='.$desc.'" Title="Poèet pøelo¾ených questù">Pøelo¾ených</a></th>
     39  <th><a href="statistic.php?order=vote&amp;desc='.$desc.'" Title="Prùmìrná známka questù">Prùmìrná známka</a></th>
    4240  <th><a href="statistic.php?order=GM&amp;desc='.$desc.'">Oprávnìní</a></th>
    4341  <th><a href="statistic.php?order=LastLogin&amp;desc='.$desc.'">Poslední pøipojení</a></th></tr>';
    4442
    45   $ID = $Database->SQLCommand("SELECT user,Email,LastLogin,GM,
    46   (SELECT count(*) FROM `quests` WHERE User = user.id AND User <> 0) as NumberTranslate,
    47   (SELECT count(*) FROM `npc_text` WHERE User = user.id AND User <> 0) as NumberTranslateNPC,
    48   (SELECT avg(vote) FROM `quests` WHERE User = user.id AND Complete = 1) as vote,
    49   (SELECT avg(Vote) FROM `npc_text` WHERE User = user.id AND Complete = 1) as voteNPC
     43/*
     44SELECT user, LastLogin, GM, (
     45     (SELECT count(*) FROM `quests` WHERE User = user.ID AND User <> 0 AND Complete = 1) +
     46     (SELECT count(*) FROM `npc_text` WHERE User = user.ID AND User <> 0 AND Complete = 1) +
     47     (SELECT count(*) FROM `page_text` WHERE User = user.ID AND User <> 0 AND Complete = 1)
     48   ) as NumberTranslate, (
     49     SELECT IFNULL((SELECT AVG(Vote) AS Vote FROM `quests` WHERE User = user.ID AND Complete =1),0)
     50     + IFNULL((SELECT AVG(Vote) AS Vote FROM `page_text` WHERE User = user.ID AND Complete =1),0)
     51     + IFNULL((SELECT AVG(Vote) AS Vote FROM `npc_text` WHERE User = user.ID AND Complete =1),0)
     52     ) /3 AS Vote
     53   FROM `user`
     54   
     55   */
     56
     57  $ID = $Database->SQLCommand("
     58  SELECT ID,user, LastLogin, GM, (
     59     (SELECT count(*) FROM `quests` WHERE User = user.ID AND User <> 0 AND Complete = 1) +
     60     (SELECT count(*) FROM `npc_text` WHERE User = user.ID AND User <> 0 AND Complete = 1) +
     61     (SELECT count(*) FROM `page_text` WHERE User = user.ID AND User <> 0 AND Complete = 1)
     62   ) as NumberTranslate, (
     63       IFNULL((SELECT sum(Vote) AS Vote FROM `quests` WHERE User = user.ID AND Complete =1),0)
     64     + IFNULL((SELECT sum(Vote) AS Vote FROM `page_text` WHERE User = user.ID AND Complete =1),0)
     65     + IFNULL((SELECT sum(Vote) AS Vote FROM `npc_text` WHERE User = user.ID AND Complete =1),0)
     66     ) AS SumVote, (
     67       (SELECT count(Vote) AS Vote FROM `quests` WHERE User = user.ID AND Complete =1)
     68     + (SELECT count(Vote) AS Vote FROM `page_text` WHERE User = user.ID AND Complete =1)
     69     + (SELECT count(Vote) AS Vote FROM `npc_text` WHERE User = user.ID AND Complete =1)
     70     ) AS CountText
    5071   FROM `user` ORDER BY $order $desc");
    51       while ($Line = mysql_fetch_array($ID))
    52         echo '<tr><td>'.$Line['user'].'</td>
     72   
     73      while ($Line = mysql_fetch_array($ID)) {
     74     
     75        if ($Line['CountText'] <> 0)
     76          $Vote = $Line['SumVote']/$Line['CountText'];
     77        else $Vote = 0;
     78       
     79        if (Licence(1))
     80          $Name = '<a href="user.php?user='.$Line['ID'].'">'.$Line['user'].'</a>';
     81        else
     82          $Name = $Line['user'];
     83       
     84        echo '<tr><td>'.$Name.'</td>
    5385        <td>'.$Line['NumberTranslate'].'</td>
    54         <td>'.$Line['NumberTranslateNPC'].'</td>
    55         <td>'.substr($Line['vote'], 0, 4).'</td>
    56         <td>'.substr($Line['voteNPC'], 0, 4).'</td>
     86        <td>'.substr($Vote, 0, 4).'</td>
    5787        <td>'.$Moderators[$Line['GM']].'</td>
    5888        <td>'.$Line['LastLogin'].'</td></tr>';
    5989         
     90      }
    6091         
    6192  echo '</table>';
Note: See TracChangeset for help on using the changeset viewer.