Changeset 500 for trunk/Common


Ignore:
Timestamp:
Mar 10, 2013, 10:08:23 AM (12 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.
Location:
trunk/Common
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Forms.php

    r485 r500  
    5454  {
    5555    if(!array_key_exists('SubmitText', $this->Definition)) $this->Definition['SubmitText'] = 'Uložit';
    56     $Output = '<form class="Form" action="'.$this->OnSubmit.'" method="post">'.$this->ShowEditBlock().
     56    $Output = '<form enctype="multipart/form-data" class="Form" action="'.$this->OnSubmit.'" method="post">'.$this->ShowEditBlock().
    5757      '<div><input type="submit" value="'.$this->Definition['SubmitText'].'" /> '.
    5858      '<input type="button" value="Zrušit" onclick="location.href=\'?\'"/></div></form>';
  • 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)
  • trunk/Common/Types/File/File.php

    r428 r500  
    11<?php
    22
    3 class TypeFile
     3class TypeFile extends TypeBase
    44{
     5  var $UploadFileFolder;
     6  var $FileDownloadURL;
     7  var $DirectoryId;
     8 
     9  function __construct()
     10  {
     11    $this->FileDownloadURL = 'File.php';
     12    $this->DirectoryId = null;
     13  }
     14 
    515  function OnView($Item)
    616  {
     
    1121    {
    1222      $DbRow = $DbResult->fetch_assoc();
    13       return('<a href="types/File/FileDownload.php?Id='.$Item['Value'].'">'.$DbRow['Name'].'</a> ('.HumanSize($DbRow['Size']).')');
     23      return('<a href="'.$this->FileDownloadURL.'?Id='.$Item['Value'].'">'.$DbRow['Name'].'</a> ('.HumanSize($DbRow['Size']).')');
    1424    } else return('');
    1525  }
     
    2939
    3040    $Result = 0;
    31     //print_r($_FILES);
     41    print_r($_FILES);
     42    print_r($_POST);
    3243    if(array_key_exists($Item['Name'], $_FILES) and ($_FILES[$Item['Name']]['name'] != ''))
    3344    {
     
    3546      {
    3647        $FileName = substr($_FILES[$Item['Name']]['name'], strrpos($_FILES[$Item['Name']]['name'], '/'));
    37         $Database->query('INSERT INTO SystemFile (`Name`, `Size`) VALUES ("'.$FileName.'", '.filesize($_FILES[$Item['Name']]['tmp_name']).')');
     48        $Database->insert('File', array('Name' => $FileName, 'Size' => filesize($_FILES[$Item['Name']]['tmp_name']),
     49           'Directory' => $this->DirectoryId));
    3850        $Result = $Database->insert_id;
    39         if(!move_uploaded_file($_FILES[$Item['Name']]['tmp_name'], $Config['UploadFileFolder'].'/'.$Result)) SystemMessage('Nahrání souboru', 'Cílová složka není dostupná!');
     51        if(!move_uploaded_file($_FILES[$Item['Name']]['tmp_name'], $this->UploadFileFolder.'/'.$Result))
     52          SystemMessage('Nahrání souboru', 'Cílová složka není dostupná!');
    4053      }
    4154    }
  • trunk/Common/Types/Type.php

    r484 r500  
    9898}
    9999
    100 
    101100?>
  • trunk/Common/Version.php

    r499 r500  
    11<?php
    22
    3 $Revision = 499; // Subversion revision
    4 $DatabaseRevision = 499;
     3$Revision = 500; // Subversion revision
     4$DatabaseRevision = 500;
    55$ReleaseTime = '2013-03-03';
    66
Note: See TracChangeset for help on using the changeset viewer.