Ignore:
Timestamp:
Mar 10, 2013, 10:08:23 AM (11 years ago)
Author:
chronos
Message:
  • Upraveno: Bankovní účty se nyní odkazují do seznamu existujících bank. Z nich se pak přiřazuje kód banky.
  • Upraveno: Pro import plateb z banky bude nově použit samostatný modul FinanceBankAPI.
  • Upraveno: Zkušební podpora formulářového typu soubor (File).
  • Upraveno: Kód PrefixMultiplier přesunut do samostatného souboru.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Global.php

    r498 r500  
    3939include_once(dirname(__FILE__).'/../Modules/WebCam/WebCam.php');
    4040include_once(dirname(__FILE__).'/../Modules/User/User.php');
    41 
    42 $PrefixMultipliers = array
    43 (
    44   'Binary' => array
    45   (
    46     'BaseIndex' => 0,
    47     'Definition' => array
    48     (
    49       array('', '', pow(2, 0)),
    50       array('Ki', 'kibi', pow(2, 10)),
    51       array('Mi', 'mebi', pow(2, 20)),
    52       array('Gi', 'gibi', pow(2, 30)),
    53       array('Ti', 'tebi', pow(2, 40)),
    54       array('Pi', 'pebi', pow(2, 50)),
    55       array('Ei', 'exbi', pow(2, 60)),
    56       array('Zi', 'zebi', pow(2, 70)),
    57       array('Yi', 'yobi', pow(2, 80)),
    58     ),
    59   ),
    60   'Decimal' => array
    61   (
    62     'BaseIndex' => 8,
    63     'Definition' => array
    64     (
    65       array('y', 'yocto', pow(10, -24)),
    66       array('z', 'zepto', pow(10, -21)),
    67       array('a', 'atto', pow(10, -18)),
    68       array('f', 'femto', pow(10, -15)),
    69       array('p', 'piko', pow(10, -12)),
    70       array('n', 'nano', pow(10, -9)),
    71       array('u', 'mikro', pow(10, -6)),
    72       array('m', 'mili', pow(10, -3)),
    73       array('', '', pow(10, 0)),
    74       array('k', 'kilo', pow(10, 3)),
    75       array('M', 'mega', pow(10, 6)),
    76       array('G', 'giga', pow(10, 9)),
    77       array('T', 'tera', pow(10, 12)),
    78       array('P', 'peta', pow(10, 15)),
    79       array('E', 'exa', pow(10, 18)),
    80       array('Z', 'zetta', pow(10, 21)),
    81       array('Y', 'yotta', pow(10, 24)),
    82     ),
    83   ),
    84   'Time' => array
    85   (
    86     'BaseIndex' => 8,
    87     'Definition' => array
    88     (
    89       array('ys', 'yoctosekunda', pow(10, -24)),
    90       array('zs', 'zeptosekunda', pow(10, -21)),
    91       array('as', 'attosekunda', pow(10, -18)),
    92       array('fs', 'femtosekunda', pow(10, -15)),
    93       array('ps', 'pikosekunda', pow(10, -12)),
    94       array('ns', 'nanosekunda', pow(10, -9)),
    95       array('us', 'mikrosekunda', pow(10, -6)),
    96       array('ms', 'milisekunda', pow(10, -3)),
    97       array('s', 'sekunda', 1),
    98       array('minut', 'minuta', 60),
    99       array('hodin', 'hodina', 60 * 60) ,
    100       array('dnů', 'den', 24 * 60 * 60),
    101       array('týdnů', 'týden', 7 * 24 * 60 * 60),
    102       array('měsíců', 'měsíc', 30 * 24 * 60 * 60),
    103       array('roků', 'rok', 364 * 24 * 60 * 60),
    104       array('desetiletí', 'desetiletí', 10 * 364 * 24 * 60 * 60),
    105       array('stalatí', 'staletí', 100 * 364 * 24 * 60 * 60),
    106       array('tisíciletí', 'tisiciletí', 10000 * 364 * 24 * 60 * 60),
    107     ),
    108   ),
    109 );
     41include_once(dirname(__FILE__).'/../Modules/Finance/Finance.php');
     42include_once(dirname(__FILE__).'/../Modules/FinanceBankAPI/FinanceBankAPI.php');
    11043
    11144class System extends Module
     
    14376      {
    14477        array_shift($PathItems);
    145         return(SearchPage($PathItems, $Path[$PathItem]));
    146       } else return($this->Pages[$PathItem]);
     78        return($this->SearchPage($PathItems, $Pages[$PathItem]));
     79      } else return($Pages[$PathItem]);
    14780    } else return('');
    14881  }
     
    215148    return(date('j.n.Y', $Time));
    216149  }
    217 
    218   function TruncateDigits($Value, $Digits = 4)
    219   {
    220     for($II = 2; $II > -6; $II--)
    221     {
    222       if($Value >= pow(10, $II))
    223       {
    224         if($Digits < ($II + 1)) $RealDigits = $II + 1; else $RealDigits = $Digits;
    225         $Value = round($Value / pow(10, $II - $RealDigits + 1)) * pow(10, $II - $RealDigits + 1);
    226         break;
    227       }
    228     }
    229     return($Value);
    230   }
    231 
    232   function AddPrefixMultipliers($Value, $Unit, $Digits = 4, $PrefixType = 'Decimal')
    233   {
    234     global $PrefixMultipliers;
    235 
    236     $Negative = ($Value < 0);
    237     $Value = abs($Value);
    238     if(($Unit == '') and ($PrefixType != 'Time'))
    239       return($this->TruncateDigits($Value, $Digits));
    240 
    241     $I = $PrefixMultipliers[$PrefixType]['BaseIndex'];
    242     if($Value == 0) return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit);
    243      
    244     if($Value > 1)
    245     {
    246       while((($I + 1) <= count($PrefixMultipliers[$PrefixType]['Definition'])) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I + 1][2]) > 1))
    247         $I = $I + 1;
    248     } else
    249     if($Value < 1)
    250     {
    251       while((($I - 1) >= 0) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2]) < 1))
    252         $I = $I - 1;
    253     }
    254     $Value = $Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2];
    255    
    256     // Truncate digits count
    257     $Value = $this->TruncateDigits($Value, $Digits);
    258     if($Negative) $Value = -$Value;
    259     return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit);
    260   }
    261150 
    262151  function Link($Target)
     
    323212  $System->ModuleManager->RegisterModule(new ModuleWebCam($System));
    324213  $System->ModuleManager->RegisterModule(new ModuleUser($System));
     214  $System->ModuleManager->RegisterModule(new ModuleFinance($System));
     215  $System->ModuleManager->RegisterModule(new ModuleFinanceBankAPI($System));
    325216  $System->ModuleManager->StartAll();
    326217}
     
    633524    else $PathString = '';
    634525  if(substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1);
    635   //echo('"'.$QueryString.'"');
    636526  $PathItems = explode('/', $PathString);
    637527  if(strpos($_SERVER['REQUEST_URI'], '?') !== false)
Note: See TracChangeset for help on using the changeset viewer.