Changeset 634


Ignore:
Timestamp:
Sep 14, 2009, 7:53:21 AM (15 years ago)
Author:
george
Message:
  • Upraveno: Stránka s výpisem dotací osamostatněna a doplněna o stránkování.
  • Přidáno: Zobrazení ročních příjmů a nákladů na stránce financí.
Location:
trunk
Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/inc/config.sample.php

    r630 r634  
    6969    'ServerFounded' => '1.1.2000',
    7070    'BankAccount' => '670100-2202937132/6210',
     71    'TableRowPerPage' => 20,
    7172    'ServerList' => array(
    7273      1 => array(
  • trunk/inc/html.php

    r630 r634  
    301301    }
    302302  } 
     303 
     304  function GetQueryStringArray()
     305  {
     306    $Result = array();
     307    $Parts = explode('&', $_SERVER['QUERY_STRING']);
     308    foreach($Parts as $Part)
     309    {
     310      if($Part != '')
     311      {
     312        $Item = explode('=', $Part);
     313        $Result[$Item[0]] = $Item[1];
     314      }
     315    }
     316    return($Result);
     317  }
     318
     319  function SetQueryStringArray($QueryStringArray)
     320  {
     321    $Parts = array();
     322    foreach($QueryStringArray as $Index => $Item)
     323    {
     324      $Parts[] = $Index.'='.$Item;
     325    }
     326    return(implode('&', $Parts));
     327  }
     328
     329  // Zobrazení číselný seznamu stránek
     330  function PageList($QueryStringVar, $Page, $TotalCount, $CountPerPage, $Around = 10)
     331  {
     332    $QueryStringArray = $this->GetQueryStringArray();
     333    $Count = ceil($TotalCount / $CountPerPage);
     334    $Result = '';
     335    if($Count > 1)
     336    {
     337      if($Page > 0)
     338      {
     339        $QueryStringArray[$QueryStringVar] = 0;
     340        $Result .= '<a href="?'.$this->SetQueryStringArray($QueryStringArray).'">&lt;&lt;</a> ';
     341        $QueryStringArray[$QueryStringVar] = $Page - 1;
     342        $Result .= '<a href="?'.$this->SetQueryStringArray($QueryStringArray).'">&lt;</a> ';
     343      }
     344      $PagesMax = $Count - 1;
     345      $PagesMin = 0;
     346      if($PagesMax > ($Page + $Around)) $PagesMax = $Page + $Around;
     347      if($PagesMin < ($Page - $Around))
     348      {
     349        $Result .= ' .. ';
     350        $PagesMin = $Page - $Around;
     351      }
     352      for($i = $PagesMin; $i <= $PagesMax; $i++)
     353      {
     354        if($i == $Page) $Result .= '<strong>';
     355        $QueryStringArray[$QueryStringVar] = $i;
     356        $Result .= '<a href="?'.$this->SetQueryStringArray($QueryStringArray).'">'.($i + 1).'</a> ';
     357        if($i == $Page) $Result .= '</strong>';
     358      }
     359      if($PagesMax < ($Count - 1)) $Result .= ' .. ';
     360      if($Page < ($Count - 1))
     361      {
     362        $QueryStringArray[$QueryStringVar] = $Page + 1;
     363        $Result .= '<a href="?'.$this->SetQueryStringArray($QueryStringArray).'">&gt;</a> ';
     364        $QueryStringArray[$QueryStringVar] = $Count - 1;
     365        $Result .= '<a href="?'.$this->SetQueryStringArray($QueryStringArray).'">&gt;&gt;</a>';
     366      }
     367    }
     368    return($Result);
     369  }
    303370}
    304371
  • trunk/inc/module.php

    r630 r634  
    1010  {
    1111    $this->Database = $System->Database;
    12     $this->Config = $System->Config;
     12    $this->Config = &$System->Config;
    1313    $this->System = $System;
    1414  }
  • trunk/inc/realm.php

    r633 r634  
    11<?php
     2
     3include_once(dirname(__FILE__).'/module.php');
    24
    35class Realm extends Module
  • trunk/inc/server.php

    r630 r634  
    11<?php
     2
     3include_once(dirname(__FILE__).'/module.php');
    24
    35function NullErrorHandler()
  • trunk/index.php

    r633 r634  
    3030include_once('inc/error.php');
    3131include_once('inc/database.php');
    32 include_once('inc/module.php');
    3332include_once('inc/html.php');
    3433include_once('inc/system.php');
  • trunk/pages/dotation.php

    r627 r634  
    2323</p>';
    2424
    25 $operace = array(
    26   'buy' => 'Nákup',
    27   'sell' => 'Prodej',
    28   'consumption' => 'Spotřeba',
    29   'internet' => 'Internet',
    30   'contribution' => 'Příspěvek od',
    31 );
    32 
    3325$load_money = $db->query('SELECT SUM(`Money`) FROM `Finance`;')->fetch_row();
    3426
    3527$Output .= '<p><strong>Aktuální stav financí: '.$load_money[0].' Kč</strong></p>';
     28
     29$Output .= '<h4 class="Center">Roční přehledy financování</h4>';
    3630$Output .= '<table class="BaseTable">'.
    37   '<tr>'.
    38   '<th>Datum</th>'.
    39   '<th>Suma</th>'.
    40   '<th>Popis</th>'.
    41   '<th>Odměna</th>'.
    42   '</tr>';
     31  '<tr><th>Rok</th><th>Příjmy</th><th>Výdaje</th><th>Rozdíl</th></tr>';
     32$DbResult = $db->query('SELECT MAX(Time), MIN(Time) FROM Finance');
     33$TimeRange = $DbResult->fetch_array();
    4334
    44 $load_dotation = $db->query('SELECT * FROM `Finance` ORDER BY `Id` DESC');
    45 while($row = $load_dotation->fetch_assoc())
     35$StartDateTimeParts = explode(' ',$TimeRange['MIN(Time)']);
     36$StartDateParts = explode('-',$StartDateTimeParts[0]);
     37$EndDateTimeParts = explode(' ',$TimeRange['MAX(Time)']);
     38$EndDateParts = explode('-',$EndDateTimeParts[0]);
     39
     40$TotalIncome = 0;
     41$TotalExpense = 0;
     42for($Year = $EndDateParts[0]; $Year >= $StartDateParts[0]; $Year--)
    4643{
    47   $odmena = $row['Reward'];
    48  
    49   if($row['Time'] != '')
    50   {
    51     $date = $server->HumanDate($row['Time'], 0);
    52     //$date = $row['time'];
    53   } else $date = '';
    54   if($row['Money'] > 0) $plus = '+';
    55     else $plus = '';
    56   $Output .= '<tr>'.
    57     '<td>'.$date.'</td>'.
    58     '<td>'.$plus.$row['Money'].'</td>'.
    59     '<td>'.$operace[$row['Operation']].' '.$row['Description'].'</td>'.
    60     '<td>'.$odmena.'</td>'.
    61     '</tr>';
     44  $DbResult = $db->query('SELECT SUM(Money) AS Income FROM Finance WHERE (Money > 0) AND (Time >= "'.$Year.'-01-01") AND (Time < DATE_ADD("'.$Year.'-01-01", INTERVAL 1 YEAR))');
     45  $Income = $DbResult->fetch_assoc();
     46  $Income = $Income['Income'];
     47  $TotalIncome += $Income;
     48  $DbResult = $db->query('SELECT -SUM(Money) AS Expense FROM Finance WHERE (Money < 0) AND (Time >= "'.$Year.'-01-01") AND (Time < DATE_ADD("'.$Year.'-01-01", INTERVAL 1 YEAR))');
     49  $Expense = $DbResult->fetch_assoc();
     50  $Expense = $Expense['Expense'];
     51  $TotalExpense += $Expense;
     52  $Output .= '<tr><td>'.$Year.'</td><td>'.$Income.'</td><td>'.$Expense.'</td><td>'.($Income - $Expense).'</td></tr>';
    6253}
     54$Output .= '<tr><th>Celkem</th><th>'.$TotalIncome.'</th><th>'.$TotalExpense.'</th><th>'.($TotalIncome - $TotalExpense).'</th></tr>';
    6355$Output .= '</table>';
     56
     57$Output .= '<br/><div class="Center"><a href="?page=dotation_dump">Výpis jednotlivých příspěvků</a></div>';
    6458
    6559echo($Output);
  • trunk/pages/guilda.php

    r632 r634  
    4343      <td>'.$total_members.' (Online : '.$online_mem['online_mem'].')</td>
    4444    </tr>');
    45   $DbResult = $db->query('SELECT Homepage FROM GuildInfo WHERE Guild='.$guild_id);
     45  $DbResult = $db->query('SELECT Homepage FROM GuildInfo WHERE Guild='.$guild_id.' AND Realm='.$Realm->Id);
    4646  $DbRow = $DbResult->fetch_assoc();
    4747  $Homepage = $DbRow['Homepage'];
  • trunk/pages/guildy.php

    r632 r634  
    5252  $DbResult = $db2->query('SELECT COUNT(*) AS online_mem  FROM `guild_member`, `characters`, `guild` WHERE guild.guildid = '.$row['guildid'].' AND guild_member.guildid = guild.guildid AND guild_member.guid = characters.guid AND characters.online = 1');
    5353  $online_mem = $DbResult->fetch_assoc();
    54   $DbResult = $db->query('SELECT Homepage FROM GuildInfo WHERE Guild='.$row['guildid']);
     54  $DbResult = $db->query('SELECT Homepage FROM GuildInfo WHERE Guild='.$row['guildid'].' AND Realm='.$Realm->Id);
    5555  $DbRow = $DbResult->fetch_assoc();
    5656  $Homepage = $DbRow['Homepage'];
  • trunk/styles/style.css

    r624 r634  
    305305}
    306306
     307.Center
     308{
     309  margin-left: auto;
     310  margin-right: auto;
     311  text-align: center;
     312}
     313
Note: See TracChangeset for help on using the changeset viewer.