Changeset 873 for trunk/Common/Form


Ignore:
Timestamp:
Apr 6, 2020, 11:17:40 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved code format.
Location:
trunk/Common/Form
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Form/Form.php

    r872 r873  
    6767  {
    6868    $Item = $this->Definition['Items'][$Index];
    69     if(array_key_exists($Item['Type'], $this->FormManager->FormTypes))
    70     {
    71       if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
     69    if (array_key_exists($Item['Type'], $this->FormManager->FormTypes))
     70    {
     71      if (!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
    7272        $this->FormManager->Type->RegisterType($Item['Type'], '', $this->FormManager->FormTypes[$Item['Type']]);
    73       if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
     73      if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
    7474        $UseType = 'OneToMany';
    75       else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
     75      else if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
    7676        $UseType = 'Enumeration';
    7777    } else $UseType = $Item['Type'];
     
    8888      'Rows' => array(),
    8989    );
    90     foreach($this->Definition['Items'] as $Index => $Item)
    91     if(!array_key_exists('Hidden', $Item) or ($Item['Hidden'] == false))
    92     if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
     90    foreach ($this->Definition['Items'] as $Index => $Item)
     91    if (!array_key_exists('Hidden', $Item) or ($Item['Hidden'] == false))
     92    if (!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
    9393    (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and
    9494    ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne')))
    9595    {
    96       if(array_key_exists($Item['Type'], $this->FormManager->FormTypes))
    97       {
    98         if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
     96      if (array_key_exists($Item['Type'], $this->FormManager->FormTypes))
     97      {
     98        if (!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
    9999          $this->FormManager->Type->RegisterType($Item['Type'], '', $this->FormManager->FormTypes[$Item['Type']]);
    100         if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
     100        if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
    101101          $UseType = 'OneToMany';
    102         else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
     102        else if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
    103103          $UseType = 'Enumeration';
    104104      } else $UseType = $Item['Type'];
     
    107107        'Type' => $Item['Type'], 'Values' => $this->Values,
    108108        'Filter' => $this->ValuesFilter[$Index]));
    109       if(array_key_exists('Suffix', $Item)) $Edit .= ' '.$Item['Suffix'];
    110       if(!$this->FormManager->Type->IsHidden($UseType))
     109      if (array_key_exists('Suffix', $Item)) $Edit .= ' '.$Item['Suffix'];
     110      if (!$this->FormManager->Type->IsHidden($UseType))
    111111        array_push($Table['Rows'], array($Item['Caption'].':', $Edit));
    112112    }
    113113    $Output = '<fieldset><legend>'.$this->Definition['Title'].'</legend>'.Table($Table).
    114114    '</fieldset>';
    115     return($Output);
     115    return ($Output);
    116116  }
    117117
    118118  function ShowEditForm()
    119119  {
    120     if(!array_key_exists('SubmitText', $this->Definition)) $this->Definition['SubmitText'] = 'Uložit';
     120    if (!array_key_exists('SubmitText', $this->Definition)) $this->Definition['SubmitText'] = 'Uložit';
    121121    $Output = '<form enctype="multipart/form-data" class="Form" action="'.$this->OnSubmit.'" method="post">'.$this->ShowEditBlock().
    122122      '<div><input name="submit" type="submit" value="'.$this->Definition['SubmitText'].'" /> '.
    123123      '<input type="button" value="Zrušit" onclick="location.href=\'?\'"/></div></form>';
    124     return($Output);
     124    return ($Output);
    125125  }
    126126
     
    184184  function LoadValuesFromDatabase($Id)
    185185  {
    186     foreach($this->Definition['Items'] as $Index => $Item)
    187     if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
     186    foreach ($this->Definition['Items'] as $Index => $Item)
     187    if (!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
    188188    (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and
    189189    ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne')))
    190190    {
    191         if(array_key_exists($Item['Type'], $this->FormManager->FormTypes))
    192         {
    193           if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
     191        if (array_key_exists($Item['Type'], $this->FormManager->FormTypes))
     192        {
     193          if (!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
    194194            $this->FormManager->Type->RegisterType($Item['Type'], '',
    195195              $this->FormManager->FormTypes[$Item['Type']]);
    196           if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
     196          if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
    197197            $UseType = 'OneToMany';
    198           else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
     198          else if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
    199199            $UseType = 'Enumeration';
    200200        } else $UseType = $Item['Type'];
    201       if(!array_key_exists('SQL', $Item)) $Item['SQL'] = '';
     201      if (!array_key_exists('SQL', $Item)) $Item['SQL'] = '';
    202202        else $Item['SQL'] = str_replace('#Id', $Id, $Item['SQL']);
    203203      $Columns[] = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnFilterNameQuery',
     
    205205    }
    206206    $Columns = implode(',', $Columns);
    207     if(array_key_exists('SQL', $this->Definition))
     207    if (array_key_exists('SQL', $this->Definition))
    208208      $SourceTable = '('.$this->Definition['SQL'].') AS `TX`';
    209209      else $SourceTable = '`'.$this->Definition['Table'].'` AS `TX`';
    210210    $DbResult = $this->Database->query('SELECT '.$Columns.' FROM '.$SourceTable.' WHERE `TX`.`Id`='.$Id);
    211211    $DbRow = $DbResult->fetch_array();
    212     foreach($this->Definition['Items'] as $Index => $Item)
    213     if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
     212    foreach ($this->Definition['Items'] as $Index => $Item)
     213    if (!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
    214214    (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and
    215215    ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne')))
    216216    {
    217         if(array_key_exists($Item['Type'], $this->FormManager->FormTypes))
    218         {
    219           if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
     217        if (array_key_exists($Item['Type'], $this->FormManager->FormTypes))
     218        {
     219          if (!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
    220220            $this->FormManager->Type->RegisterType($Item['Type'], '',
    221221              $this->FormManager->FormTypes[$Item['Type']]);
    222           if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
     222          if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
    223223            $UseType = 'OneToMany';
    224           else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
     224          else if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
    225225            $UseType = 'Enumeration';
    226226        } else $UseType = $Item['Type'];
     
    235235  {
    236236    $Values = array();
    237     foreach($this->Definition['Items'] as $Index => $Item)
    238     {
    239       if(array_key_exists($Index, $this->Values))
    240       if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
     237    foreach ($this->Definition['Items'] as $Index => $Item)
     238    {
     239      if (array_key_exists($Index, $this->Values))
     240      if (!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
    241241      (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and
    242242      ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne')))
     
    245245          'Type' => $Item['Type'], 'Values' => $this->Values);
    246246
    247         if(array_key_exists($Item['Type'], $this->FormManager->FormTypes))
    248         {
    249           if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
     247        if (array_key_exists($Item['Type'], $this->FormManager->FormTypes))
     248        {
     249          if (!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
    250250            $this->FormManager->Type->RegisterType($Item['Type'], '',
    251251              $this->FormManager->FormTypes[$Item['Type']]);
    252           if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
     252          if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
    253253          {
    254254            $UseType = 'OneToMany';
    255255          }
    256           else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
     256          else if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
    257257            $UseType = 'Enumeration';
    258258        } else $UseType = $Item['Type'];
    259259        $Values[$Index] = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnSaveDb', $Parameters);
    260         if(($Item['Type'] == 'Password') and ($Values[$Index] == '')) unset($Values[$Index]);
    261       }
    262     }
    263     if($Id == 0)
     260        if (($Item['Type'] == 'Password') and ($Values[$Index] == '')) unset($Values[$Index]);
     261      }
     262    }
     263    if ($Id == 0)
    264264    {
    265265      $Values['Id'] = $Id;
     
    316316      }
    317317    }
    318     return($Values);
     318    return ($Values);
    319319  }
    320320
     
    322322  {
    323323    $Valid = true;
    324     foreach($this->Definition['Items'] as $Index => $Item)
    325     if((!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
     324    foreach ($this->Definition['Items'] as $Index => $Item)
     325    if ((!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
    326326    (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and
    327327    ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) and
     
    330330    ($Item['ReadOnly'] != true))))
    331331    {
    332         //if(array_key_exists($Context.$Index, $_POST))
    333         if(array_key_exists($Item['Type'], $this->FormManager->FormTypes))
    334         {
    335           if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
     332        //if (array_key_exists($Context.$Index, $_POST))
     333        if (array_key_exists($Item['Type'], $this->FormManager->FormTypes))
     334        {
     335          if (!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
    336336            $this->FormManager->Type->RegisterType($Item['Type'], '',
    337337              $this->FormManager->FormTypes[$Item['Type']]);
    338338          $CustomType = $this->FormManager->FormTypes[$Item['Type']]['Type'];
    339           if($CustomType == 'Reference')
     339          if ($CustomType == 'Reference')
    340340            $UseType = 'OneToMany';
    341           else if($CustomType == 'Enumeration')
     341          else if ($CustomType == 'Enumeration')
    342342            $UseType = 'Enumeration';
    343343        } else $UseType = $Item['Type'];
    344344
    345345        $Parameters = array('Value' => $this->Values[$Index]);
    346         if(array_key_exists('Null', $Item)) $Parameters['Null'] = $Item['Null'];
     346        if (array_key_exists('Null', $Item)) $Parameters['Null'] = $Item['Null'];
    347347          else $Parameters['Null'] = false;
    348         if(!$this->FormManager->Type->ExecuteTypeEvent($UseType, 'Validate',
     348        if (!$this->FormManager->Type->ExecuteTypeEvent($UseType, 'Validate',
    349349          $Parameters)) {
    350350            $this->ValuesValidate[$Index] = true;
     
    352352          }
    353353    }
    354     if($Valid == false) throw new Exception('not validated');
    355     return($Valid);
     354    if ($Valid == false) throw new Exception('not validated');
     355    return ($Valid);
    356356  }
    357357}
     
    360360function MakeLink($Target, $Title)
    361361{
    362   return('<a href="'.$Target.'">'.$Title.'</a>');
     362  return ('<a href="'.$Target.'">'.$Title.'</a>');
    363363}
    364364
     
    366366{
    367367  $Result = '<table class="BasicTable">';
    368   if(array_key_exists('Header', $Table))
     368  if (array_key_exists('Header', $Table))
    369369  {
    370370    $Result .= '<tr>';
    371     foreach($Table['Header'] as $Item)
     371    foreach ($Table['Header'] as $Item)
    372372      $Result .= '<th>'.$Item.'</th>';
    373373    $Result .= '</tr>';
    374374  }
    375   foreach($Table['Rows'] as $Row)
     375  foreach ($Table['Rows'] as $Row)
    376376  {
    377377    $Result .= '<tr>';
    378     foreach($Row as $Index => $Item)
    379     {
    380       if($Index == 0) $Class = ' class="Header"'; else $Class = '';
     378    foreach ($Row as $Index => $Item)
     379    {
     380      if ($Index == 0) $Class = ' class="Header"'; else $Class = '';
    381381      $Result .= '<td'.$Class.' style="width: '.(floor(100 / count($Row))).'%">'.$Item.'</td>';
    382382    }
     
    384384  }
    385385  $Result .= '</table>';
    386   return($Result);
     386  return ($Result);
    387387}
    388388
     
    432432    $this->Database->query('DELETE FROM DataType');
    433433
    434     foreach($this->Type->TypeDefinitionList as $Name => $Type)
     434    foreach ($this->Type->TypeDefinitionList as $Name => $Type)
    435435    {
    436436      $DbResult = $this->Database->select('DataType', 'Id', 'Name="'.$Name.'"');
    437       if($DbResult->num_rows == 0)
     437      if ($DbResult->num_rows == 0)
    438438      {
    439439        $this->Database->insert('DataType', array('Name' => $Name,
     
    447447    }
    448448
    449     foreach($this->Classes as $Class)
    450     if(!array_key_exists('SQL', $Class) and ($Class['Table'] != ''))
     449    foreach ($this->Classes as $Class)
     450    if (!array_key_exists('SQL', $Class) and ($Class['Table'] != ''))
    451451    {
    452452      $DbResult = $this->Database->query('SELECT * FROM information_schema.tables  WHERE table_schema = "centrala_big"
    453453          AND table_name = "'.$Class['Table'].'" LIMIT 1');
    454       if($DbResult->num_rows == 0) continue;
     454      if ($DbResult->num_rows == 0) continue;
    455455
    456456      echo($Class['Table'].'<br>');
    457457      $Module = 1;
    458458      $DbResult = $this->Database->select('Model', 'Id', 'Name="'.$Class['Table'].'"');
    459       if($DbResult->num_rows == 0)
     459      if ($DbResult->num_rows == 0)
    460460      {
    461461        $this->Database->insert('Model', array('Name' => $Class['Table'], 'Title' => $Class['Title'], 'Module' => $Module));
     
    469469      }
    470470
    471       foreach($Class['Items'] as $Name => $Field)
     471      foreach ($Class['Items'] as $Name => $Field)
    472472      {
    473473        echo($Name.', ');
    474474        $DbResult = $this->Database->select('DataType', 'Id', 'Name="'.$Field['Type'].'"');
    475         if($DbResult->num_rows > 0)
     475        if ($DbResult->num_rows > 0)
    476476        {
    477477          $DbRow = $DbResult->fetch_assoc();
     
    482482          // Search parent type
    483483          $DbResult = $this->Database->select('DataType', 'Id', 'Name="'.$Type['Type'].'"');
    484           if($DbResult->num_rows > 0)
     484          if ($DbResult->num_rows > 0)
    485485          {
    486486            $DbRow = $DbResult->fetch_assoc();
     
    494494
    495495        $DbResult = $this->Database->select('ModelField', 'Id', '(Name="'.$Name.'") AND (Model='.$Model.')');
    496         if($DbResult->num_rows == 0)
     496        if ($DbResult->num_rows == 0)
    497497        {
    498498          $this->Database->insert('ModelField', array('Name' => $Name,
  • trunk/Common/Form/Types/Base.php

    r738 r873  
    1717  function OnView($Item)
    1818  {
    19     return('');
     19    return ('');
    2020  }
    2121
    2222  function OnEdit($Item)
    2323  {
    24     return('');
     24    return ('');
    2525  }
    2626
    2727  function OnLoad($Item)
    2828  {
    29     return('');
     29    return ('');
    3030  }
    3131
    3232  function OnLoadDb($Item)
    3333  {
    34     return($Item['Value']);
     34    return ($Item['Value']);
    3535  }
    3636
    3737  function OnSaveDb($Item)
    3838  {
    39     return($Item['Value']);
     39    return ($Item['Value']);
    4040  }
    4141
    4242  function DatabaseEscape($Value)
    4343  {
    44     return(addslashes($Value));
     44    return (addslashes($Value));
    4545  }
    4646
    4747  function OnFilterName($Item)
    4848  {
    49     if(array_key_exists('SQL', $Item) and ($Item['SQL'] != ''))
     49    if (array_key_exists('SQL', $Item) and ($Item['SQL'] != ''))
    5050      $SQL = '('.$Item['SQL'].') AS ';
    5151      else $SQL = '';
    52     return($SQL.'`'.$Item['Name'].'`');
     52    return ($SQL.'`'.$Item['Name'].'`');
    5353  }
    5454
    5555  function OnFilterNameQuery($Item)
    5656  {
    57     if(array_key_exists('SQL', $Item) and ($Item['SQL'] != ''))
     57    if (array_key_exists('SQL', $Item) and ($Item['SQL'] != ''))
    5858      $Output = '('.$Item['SQL'].') AS `'.$Item['Name'].'`, ('.$Item['SQL'].') AS `'.$Item['Name'].'_Filter`';
    5959      else $Output = '`'.$Item['Name'].'`, `'.$Item['Name'].'` AS `'.$Item['Name'].'_Filter`';
    60     return($Output);
     60    return ($Output);
    6161  }
    6262
    6363  function Validate($Item)
    6464  {
    65     return(true);
     65    return (true);
    6666  }
    6767
    6868  function GetValidationFormat()
    6969  {
    70     return('');
     70    return ('');
    7171  }
    7272}
  • trunk/Common/Form/Types/Boolean.php

    r738 r873  
    99  function OnView($Item)
    1010  {
    11     if($Item['Value'] == 1) $Checked = ' checked="1"'; else $Checked = '';
    12     return('<input type="checkbox" name="'.$Item['Name'].'" disabled="1"'.$Checked.'/>');
     11    if ($Item['Value'] == 1) $Checked = ' checked="1"'; else $Checked = '';
     12    return ('<input type="checkbox" name="'.$Item['Name'].'" disabled="1"'.$Checked.'/>');
    1313  }
    1414
    1515  function OnEdit($Item)
    1616  {
    17     if($Item['Value'] == 1) $Checked = ' checked="1"'; else $Checked = '';
    18     return('<input type="checkbox" name="'.$Item['Name'].'"'.$Checked.'/>');
     17    if ($Item['Value'] == 1) $Checked = ' checked="1"'; else $Checked = '';
     18    return ('<input type="checkbox" name="'.$Item['Name'].'"'.$Checked.'/>');
    1919  }
    2020
    2121  function OnLoad($Item)
    2222  {
    23     if(array_key_exists($Item['Name'], $_POST)) return(1);
    24       else return(0);
     23    if (array_key_exists($Item['Name'], $_POST)) return (1);
     24      else return (0);
    2525  }
    2626}
  • trunk/Common/Form/Types/Color.php

    r548 r873  
    1010  {
    1111    $Output = '<span style="background-color: #'.$Item['Value'].'">&nbsp;&nbsp;&nbsp;&nbsp;</span>';
    12     return($Output);
     12    return ($Output);
    1313  }
    1414
     
    1616  {
    1717    $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'"/>';
    18     return($Output);
     18    return ($Output);
    1919  }
    2020
    2121  function OnLoad($Item)
    2222  {
    23     return($_POST[$Item['Name']]);
     23    return ($_POST[$Item['Name']]);
    2424  }
    2525}
  • trunk/Common/Form/Types/Date.php

    r872 r873  
    1111    global $MonthNames;
    1212
    13     if($Item['Value'] == null) return('');
    14     if((strtolower($Item['Value']) == 'now') or (strtolower($Item['Value']) == '')) $Item['Value'] = time();
     13    if ($Item['Value'] == null) return ('');
     14    if ((strtolower($Item['Value']) == 'now') or (strtolower($Item['Value']) == '')) $Item['Value'] = time();
    1515    $Parts = getdate($Item['Value']);
    1616
    1717    $Output = $Parts['mday'].'.'.$Parts['mon'].'.'.$Parts['year'];
    18     return($Output);
     18    return ($Output);
    1919  }
    2020
     
    3232    $Output = '';
    3333    $Style = '';
    34     if(array_key_exists('Null', $Item) and $Item['Null'])
     34    if (array_key_exists('Null', $Item) and $Item['Null'])
    3535    {
    36       if(!$IsNull)
     36      if (!$IsNull)
    3737      {
    3838        $Checked = ' checked="1"';
     
    4949    // Day
    5050    $Output .= '<select name="'.$Item['Name'].'-day" id="'.$Item['Name'].'-day" '.$Style.'>';
    51     for($I = 1; $I <= 31; $I++)
     51    for ($I = 1; $I <= 31; $I++)
    5252    {
    53       if($Parts['mday'] == $I) $Selected = ' selected="1"'; else $Selected = '';
     53      if ($Parts['mday'] == $I) $Selected = ' selected="1"'; else $Selected = '';
    5454      $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>';
    5555    }
     
    5757    // Month
    5858   $Output .= '<select name="'.$Item['Name'].'-month" id="'.$Item['Name'].'-month" '.$Style.'>';
    59    for($I = 1; $I <= 12; $I++)
     59   for ($I = 1; $I <= 12; $I++)
    6060    {
    61       if($Parts['mon'] == $I) $Selected = ' selected="1"'; else $Selected = '';
     61      if ($Parts['mon'] == $I) $Selected = ' selected="1"'; else $Selected = '';
    6262      $Output .= '<option value="'.$I.'"'.$Selected.'>'.$MonthNames[$I].'</option>';
    6363    }
     
    6565    // Year
    6666    $Output .= '<select name="'.$Item['Name'].'-year" id="'.$Item['Name'].'-year" '.$Style.'>';
    67     for($I = 1900; $I < 2100; $I++)
     67    for ($I = 1900; $I < 2100; $I++)
    6868    {
    69       if($Parts['year'] == $I) $Selected = ' selected="1"'; else $Selected = '';
     69      if ($Parts['year'] == $I) $Selected = ' selected="1"'; else $Selected = '';
    7070      $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>';
    7171    }
    7272    $Output .= '</select>';
    73     return($Output);
     73    return ($Output);
    7474  }
    7575
    7676  function OnLoad($Item)
    7777  {
    78     if(!array_key_exists($Item['Name'].'-null', $_POST) and array_key_exists('Null', $Item) and ($Item['Null'] == true)) return(null);
    79       else return(mktime(0, 0, 0, $_POST[$Item['Name'].'-month'], $_POST[$Item['Name'].'-day'], $_POST[$Item['Name'].'-year']));
     78    if (!array_key_exists($Item['Name'].'-null', $_POST) and array_key_exists('Null', $Item) and ($Item['Null'] == true)) return (null);
     79      else return (mktime(0, 0, 0, $_POST[$Item['Name'].'-month'], $_POST[$Item['Name'].'-day'], $_POST[$Item['Name'].'-year']));
    8080  }
    8181
    8282  function OnLoadDb($Item)
    8383  {
    84     return(MysqlDateToTime($Item['Value']));
     84    return (MysqlDateToTime($Item['Value']));
    8585  }
    8686
    8787  function OnSaveDb($Item)
    8888  {
    89     if($Item['Value'] == null) return(null);
    90       else return(date('Y-m-d', $Item['Value']));
     89    if ($Item['Value'] == null) return (null);
     90      else return (date('Y-m-d', $Item['Value']));
    9191  }
    9292
    9393  function DatabaseEscape($Value)
    9494  {
    95     return('"'.addslashes($Value).'"');
     95    return ('"'.addslashes($Value).'"');
    9696  }
    9797}
  • trunk/Common/Form/Types/Enumeration.php

    r738 r873  
    88  {
    99    $Type = $this->FormManager->Type->GetTypeDefinition($Item['Type']);
    10     if(array_key_exists($Item['Value'], $Type['Parameters']['States']))
     10    if (array_key_exists($Item['Value'], $Type['Parameters']['States']))
    1111      $Output = $Type['Parameters']['States'][$Item['Value']];
    1212      else $Output = $Item['Value'];
    13     return($Output);
     13    return ($Output);
    1414  }
    1515
     
    1818    $Type = $this->FormManager->Type->GetTypeDefinition($Item['Type']);
    1919    $Output = '<select name="'.$Item['Name'].'">';
    20       if(array_key_exists('Null', $Item) and $Item['Null'])
     20      if (array_key_exists('Null', $Item) and $Item['Null'])
    2121    {
    22       if($Item['Value'] == NULL) $Selected = ' selected="1"'; else $Selected = '';
     22      if ($Item['Value'] == NULL) $Selected = ' selected="1"'; else $Selected = '';
    2323      $Output .= '<option value=""'.$Selected.'></option>';
    2424    }
    25     foreach($Type['Parameters']['States'] as $Index => $StateName)
     25    foreach ($Type['Parameters']['States'] as $Index => $StateName)
    2626    {
    27       if($Item['Value'] == $Index) $Selected = ' selected="1"'; else $Selected = '';
     27      if ($Item['Value'] == $Index) $Selected = ' selected="1"'; else $Selected = '';
    2828      $Output .= '<option value="'.$Index.'"'.$Selected.'>'.$StateName.'</option>';
    2929    }
    3030    $Output .= '</select>';
    31     return($Output);
     31    return ($Output);
    3232  }
    3333
    3434  function OnLoad($Item)
    3535  {
    36     if($_POST[$Item['Name']] == '') return(NULL);
    37     return($_POST[$Item['Name']]);
     36    if ($_POST[$Item['Name']] == '') return (NULL);
     37    return ($_POST[$Item['Name']]);
    3838  }
    3939
    4040  function OnLoadDb($Item)
    4141  {
    42     if($Item['Value'] == '') return(NULL);
    43     else return($Item['Value']);
     42    if ($Item['Value'] == '') return (NULL);
     43    else return ($Item['Value']);
    4444  }
    4545}
  • trunk/Common/Form/Types/File.php

    r738 r873  
    1616    $Result = $FileInfo->file($this->FileName);
    1717    //$FileInfo->close();
    18     return($Result);
     18    return ($Result);
    1919  }
    2020
     
    2222  {
    2323    $FileName = $this->GetFullName($Item);
    24     if(file_exists($FileName)) $Result = filesize($FileName);
     24    if (file_exists($FileName)) $Result = filesize($FileName);
    2525      else $Result = 0;
    26     return($Result);
     26    return ($Result);
    2727  }
    2828
     
    3030  {
    3131    $ParentId = $this->Directory;
    32     while($ParentId != null)
     32    while ($ParentId != null)
    3333    {
    3434      $DbResult = $this->Database->select('FileDirectory', '*', 'Id='.$ParentId);
     
    3838    }
    3939    $Result = $this->UploadFileFolder.'/'.$Path.$File->Name;
    40     return($Result);
     40    return ($Result);
    4141  }
    4242
    4343  function GetExt()
    4444  {
    45     return(substr($this->Name, 0, strpos($this->Name, '.') - 1));
     45    return (substr($this->Name, 0, strpos($this->Name, '.') - 1));
    4646  }
    4747
    4848  function Delete()
    4949  {
    50     if(file_exists($this->GetFullName())) unlink($this->GetFullName());
     50    if (file_exists($this->GetFullName())) unlink($this->GetFullName());
    5151  }
    5252
    5353  function GetContent()
    5454  {
    55     if($this->TempName != '') $Content = file_get_contents($this->TempName);
     55    if ($this->TempName != '') $Content = file_get_contents($this->TempName);
    5656      else $Content = file_get_contents($this->GetFullName());
    57     return($Content);
     57    return ($Content);
    5858  }
    5959}
     
    7575  {
    7676    $File = &$Item['Value'];
    77     return('<a href="'.$this->FileDownloadURL.'?id='.$File->Id.'">'.
     77    return ('<a href="'.$this->FileDownloadURL.'?id='.$File->Id.'">'.
    7878      $File.'</a> ('.HumanSize($File->Size).')');
    7979  }
     
    8686    $File = &$Item['Value'];
    8787    $Output = '<input type="file" name="'.$Item['Name'].'" value="'.$File->Name.'">';
    88     return($Output);
     88    return ($Output);
    8989  }
    9090
    9191  function OnLoad($Item)
    9292  {
    93     if(!is_object($Item['Value'])) $Item['Value'] = new DbFile();
     93    if (!is_object($Item['Value'])) $Item['Value'] = new DbFile();
    9494    $File = &$Item['Value'];
    95     if(array_key_exists($Item['Name'], $_FILES) and ($_FILES[$Item['Name']]['name'] != ''))
     95    if (array_key_exists($Item['Name'], $_FILES) and ($_FILES[$Item['Name']]['name'] != ''))
    9696    {
    9797      $UploadFile = $_FILES[$Item['Name']];
    98       if(file_exists($UploadFile['tmp_name']))
     98      if (file_exists($UploadFile['tmp_name']))
    9999      {
    100100        $File->Name = $UploadFile['name'];
     
    103103      }
    104104    }
    105     return($File);
     105    return ($File);
    106106  }
    107107
    108108  function OnLoadDb($Item)
    109109  {
    110     if(!is_object($Item['Value'])) $Item['Value'] = new DbFile();
     110    if (!is_object($Item['Value'])) $Item['Value'] = new DbFile();
    111111    $File = &$Item['Value'];
    112112    $DbResult = $this->Database->select('File', '*', 'Id='.$File->Id);
    113     if($DbResult->num_rows() > 0)
     113    if ($DbResult->num_rows() > 0)
    114114    {
    115115      $DbRow = $DbResult->fetch_assoc();
     
    118118      $File->Directory = $DbRow['Directory'];
    119119    }
    120     return($File);
     120    return ($File);
    121121  }
    122122
    123123  function OnSaveDb($Item)
    124124  {
    125     if(!is_object($Item['Value'])) $Item['Value'] = new DbFile();
     125    if (!is_object($Item['Value'])) $Item['Value'] = new DbFile();
    126126    $File = &$Item['Value'];
    127127    $Properties = array('Name' => $File->Name,
    128128      'Size' => $File->GetSize(), 'Directory' => $File->Directory);
    129129    $DbResult = $this->Database->select('File', '*', 'Id='.$File->Id);
    130     if($DbResult->num_rows() > 0)
     130    if ($DbResult->num_rows() > 0)
    131131    {
    132132      $DbRow = $DbResult->fetch_assoc();
    133       if($File->TempName != '')
     133      if ($File->TempName != '')
    134134      {
    135135        $FileName = $File->GetFullName();
     
    142142      $File->Id = $this->Database->insert_id;
    143143    }
    144     if(!move_uploaded_file($File->TempName, $FileName))
     144    if (!move_uploaded_file($File->TempName, $FileName))
    145145      SystemMessage('Nahrání souboru', 'Cílová složka není dostupná!');
    146146  }
  • trunk/Common/Form/Types/Float.php

    r548 r873  
    1010  {
    1111    $Output = $Item['Value'];
    12     return($Output);
     12    return ($Output);
    1313  }
    1414
     
    1616  {
    1717    $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'"/>';
    18     return($Output);
     18    return ($Output);
    1919  }
    2020
    2121  function OnLoad($Item)
    2222  {
    23     return($_POST[$Item['Name']]);
     23    return ($_POST[$Item['Name']]);
    2424  }
    2525}
  • trunk/Common/Form/Types/GPS.php

    r548 r873  
    1010
    1111    $DbResult = $Database->query('SELECT * FROM `SystemGPS` WHERE `Id`='.$Item['Value']);
    12     if($DbResult->num_rows > 0)
     12    if ($DbResult->num_rows > 0)
    1313    {
    1414      $DbRow = $DbResult->fetch_assoc();
     
    1717      $Output = '<a href="http://www.mapy.cz/?st=search&fr=loc:'.$DbRow['Latitude'].' '.$DbRow['Longitude'].'">'.$Latitude[0].'°'.$Latitude[1]."'".$Latitude[2].'" '.$Longitude[0].'°'.$Longitude[1]."'".$Longitude[2].'"</a>';
    1818    }
    19     return($Output);
     19    return ($Output);
    2020  }
    2121
     
    2424    global $Database;
    2525
    26     if($Item['Value'] != '')
     26    if ($Item['Value'] != '')
    2727    {
    2828      $DbResult = $Database->query('SELECT * FROM `SystemGPS` WHERE `Id`='.$Item['Value']);
    29       if($DbResult->num_rows > 0)
     29      if ($DbResult->num_rows > 0)
    3030      {
    3131        $DbRow = $DbResult->fetch_assoc();
     
    4040    $Output .= '<input type="text" size="3" name="'.$Item['Name'].'-lon-min" value="'.$Value[1].'"/>\'';
    4141    $Output .= '<input type="text" size="3" name="'.$Item['Name'].'-lon-sec" value="'.$Value[2].'"/>"';
    42     return($Output);
     42    return ($Output);
    4343  }
    4444
     
    5050    $Longitude = $this->Implode($_POST[$Item['Name'].'-lon-deg'], $_POST[$Item['Name'].'-lon-min'], $_POST[$Item['Name'].'-lon-sec']);
    5151    $Database->query('INSERT INTO SystemGPS (`Latitude`, `Longitude`) VALUES ("'.$Latitude.'", "'.$Longitude.'")');
    52     return($Database->insert_id);
     52    return ($Database->insert_id);
    5353  }
    5454
     
    6161    $Float = ($Float - intval($Float)) * 60;
    6262    $Seconds = round($Float, 3);
    63     return(array($Degrees, $Minutes, $Seconds));
     63    return (array($Degrees, $Minutes, $Seconds));
    6464  }
    6565
    6666  function Implode($Degrees, $Minutes, $Seconds)
    6767  {
    68     if($Degrees < 0) return(-(abs($Degrees) + ($Minutes + $Seconds / 60) / 60));
    69     else return($Degrees + ($Minutes + $Seconds / 60) / 60);
     68    if ($Degrees < 0) return (-(abs($Degrees) + ($Minutes + $Seconds / 60) / 60));
     69    else return ($Degrees + ($Minutes + $Seconds / 60) / 60);
    7070  }
    7171}
  • trunk/Common/Form/Types/Hidden.php

    r738 r873  
    1414  {
    1515    $Output = $Item['Value'];
    16     return($Output);
     16    return ($Output);
    1717  }
    1818
     
    2020  {
    2121    $Output = '<input type="hidden" name="'.$Item['Name'].'" value="'.$Item['Value'].'" />';
    22     return($Output);
     22    return ($Output);
    2323  }
    2424
    2525  function OnLoad($Item)
    2626  {
    27     return($_POST[$Item['Name']]);
     27    return ($_POST[$Item['Name']]);
    2828  }
    2929}
  • trunk/Common/Form/Types/Hyperlink.php

    r548 r873  
    88  {
    99    $Output = '<a href="'.$Item['Value'].'">'.$Item['Value'].'</a>';
    10     return($Output);
     10    return ($Output);
    1111  }
    1212
     
    1414  {
    1515    $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'"/>';
    16     return($Output);
     16    return ($Output);
    1717  }
    1818
    1919  function OnLoad($Item)
    2020  {
    21     return($_POST[$Item['Name']]);
     21    return ($_POST[$Item['Name']]);
    2222  }
    2323}
  • trunk/Common/Form/Types/IPv4Address.php

    r738 r873  
    88  {
    99    $Output = $Item['Value'];
    10     return($Output);
     10    return ($Output);
    1111  }
    1212
     
    1414  {
    1515    $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'"/>';
    16     return($Output);
     16    return ($Output);
    1717  }
    1818
    1919  function OnLoad($Item)
    2020  {
    21     return($_POST[$Item['Name']]);
     21    return ($_POST[$Item['Name']]);
    2222  }
    2323
    2424  function Validate($Item)
    2525  {
    26     if($Item['Null'] and ($Item['Value'] == '')) return(true);
    27     return(filter_var($Item['Value'], FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV4)));
     26    if ($Item['Null'] and ($Item['Value'] == '')) return (true);
     27    return (filter_var($Item['Value'], FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV4)));
    2828  }
    2929
    3030  function GetValidationFormat()
    3131  {
    32     return('x.x.x.x kde x je hodnota 0..255');
     32    return ('x.x.x.x kde x je hodnota 0..255');
    3333  }
    3434}
  • trunk/Common/Form/Types/IPv6Address.php

    r738 r873  
    88  {
    99    $Output = $Item['Value'];
    10     return($Output);
     10    return ($Output);
    1111  }
    1212
     
    1414  {
    1515    $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'"/>';
    16     return($Output);
     16    return ($Output);
    1717  }
    1818
    1919  function OnLoad($Item)
    2020  {
    21     return($_POST[$Item['Name']]);
     21    return ($_POST[$Item['Name']]);
    2222  }
    2323
    2424  function Validate($Item)
    2525  {
    26     if($Item['Null'] and ($Item['Value'] == '')) return(true);
    27     return(filter_var($Item['Value'], FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV6)));
     26    if ($Item['Null'] and ($Item['Value'] == '')) return (true);
     27    return (filter_var($Item['Value'], FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV6)));
    2828  }
    2929
    3030  function GetValidationFormat()
    3131  {
    32     return('xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx kde x je hexa hodnota 0..f');
     32    return ('xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx kde x je hexa hodnota 0..f');
    3333  }
    3434}
  • trunk/Common/Form/Types/Image.php

    r738 r873  
    77    global $System;
    88
    9     return('<img src="'.$System->Link('/images/favicons/'.$Item['Value']).'"/> '.$Item['Value']);
     9    return ('<img src="'.$System->Link('/images/favicons/'.$Item['Value']).'"/> '.$Item['Value']);
    1010  }
    1111}
  • trunk/Common/Form/Types/Integer.php

    r738 r873  
    1010  {
    1111    $Output = $Item['Value'];
    12     return($Output);
     12    return ($Output);
    1313  }
    1414
     
    1616  {
    1717    $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'"/>';
    18     return($Output);
     18    return ($Output);
    1919  }
    2020
    2121  function OnLoad($Item)
    2222  {
    23     return($_POST[$Item['Name']]);
     23    return ($_POST[$Item['Name']]);
    2424  }
    2525
    2626  function Validate($Item)
    2727  {
    28     if($Item['Null'] and ($Item['Value'] == '')) return(true);
    29     return(preg_match('/^\-*[0-9\.]+$/', $Item['Value']));
     28    if ($Item['Null'] and ($Item['Value'] == '')) return (true);
     29    return (preg_match('/^\-*[0-9\.]+$/', $Item['Value']));
    3030  }
    3131
    3232  function GetValidationFormat()
    3333  {
    34     return('číselná hodnota');
     34    return ('číselná hodnota');
    3535  }
    3636}
  • trunk/Common/Form/Types/MacAddress.php

    r738 r873  
    1010  {
    1111    $Output = $Item['Value'];
    12     return($Output);
     12    return ($Output);
    1313  }
    1414
     
    1616  {
    1717    $Output = '<input type="text" name="'.$Item['Name'].'" id="'.$Item['Name'].'" value="'.$Item['Value'].'"/>';
    18     return($Output);
     18    return ($Output);
    1919  }
    2020
     
    2222  {
    2323    //echo($Item['Name'].'='.$_POST[$Item['Name']].','.is_null(NULL).'<br>');
    24     return(strtoupper($_POST[$Item['Name']]));
     24    return (strtoupper($_POST[$Item['Name']]));
    2525  }
    2626
    2727  function DatabaseEscape($Value)
    2828  {
    29     return('"'.addslashes($Value).'"');
     29    return ('"'.addslashes($Value).'"');
    3030  }
    3131
    3232  function Validate($Item)
    3333  {
    34     if($Item['Null'] and ($Item['Value'] == '')) return(true);
    35     return(preg_match('/^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$/', $Item['Value']));
     34    if ($Item['Null'] and ($Item['Value'] == '')) return (true);
     35    return (preg_match('/^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$/', $Item['Value']));
    3636  }
    3737
    3838  function GetValidationFormat()
    3939  {
    40     return('XX:XX:XX:XX:XX:XX kde X je hexa hodnota 0..F');
     40    return ('XX:XX:XX:XX:XX:XX kde X je hexa hodnota 0..F');
    4141  }
    4242}
  • trunk/Common/Form/Types/OneToMany.php

    r738 r873  
    1010  {
    1111    $Type = $this->FormManager->Type->TypeDefinitionList[$Item['Type']];
    12     if($Item['Value'] != '')
     12    if ($Item['Value'] != '')
    1313    {
    1414      $Output = '<a href="?t='.$Type['Parameters']['Table'].'&amp;a='.
    1515        'view'.'&amp;i='.$Item['Value'].'">'.$Item['Filter'].'</a>';
    1616    } else $Output = '';
    17     return($Output);
     17    return ($Output);
    1818  }
    1919
     
    2222    $Output = '<select name="'.$Item['Name'].'" id="'.$Item['Name'].'">';
    2323    $Type = $this->FormManager->Type->TypeDefinitionList[$Item['Type']];
    24     if(array_key_exists('Condition', $Type['Parameters'])) $Where = ' WHERE '.$Type['Parameters']['Condition'];
     24    if (array_key_exists('Condition', $Type['Parameters'])) $Where = ' WHERE '.$Type['Parameters']['Condition'];
    2525      else $Where = '';
    26     if(array_key_exists('Null', $Item) and $Item['Null'])
     26    if (array_key_exists('Null', $Item) and $Item['Null'])
    2727    {
    28       if($Item['Value'] == NULL) $Selected = ' selected="1"'; else $Selected = '';
     28      if ($Item['Value'] == NULL) $Selected = ' selected="1"'; else $Selected = '';
    2929      $Output .= '<option value=""'.$Selected.'></option>';
    3030    }
    31     if(array_key_exists('View', $Type['Parameters'])) $Table = $Type['Parameters']['View'];
     31    if (array_key_exists('View', $Type['Parameters'])) $Table = $Type['Parameters']['View'];
    3232      else $Table = $Type['Parameters']['Table'];
    3333    $DbResult = $this->Database->query('SELECT '.$Type['Parameters']['Name'].' AS `Name`,'.$Type['Parameters']['Id'].' AS `Id` FROM '.$Table.''.$Where.' ORDER BY `Name`');
    34     while($DbRow = $DbResult->fetch_assoc())
     34    while ($DbRow = $DbResult->fetch_assoc())
    3535    {
    36       if($Item['Value'] == $DbRow['Id']) $Selected = ' selected="1"'; else $Selected = '';
     36      if ($Item['Value'] == $DbRow['Id']) $Selected = ' selected="1"'; else $Selected = '';
    3737      $Output .= '<option value="'.$DbRow['Id'].'"'.$Selected.'>'.$DbRow['Name'].'</option>';
    3838    }
    3939    $Output .= '</select>';
    40     if($this->FormManager->ShowRelation)
     40    if ($this->FormManager->ShowRelation)
    4141    {
    4242      $URL = '';
    43       if(array_key_exists('OnPreset', $Item))
     43      if (array_key_exists('OnPreset', $Item))
    4444      {
    4545        $Preset = call_user_func($Item['OnPreset'], $Item['Values']);
     
    5151        'onclick="return popupwindow(&quot;'.$this->FormManager->Root.'/is/?a=select&amp;t='.$Table.'&amp;r='.$Item['Name'].'&quot;,&quot;test&quot;);" style="cursor:hand;cursor:pointer"/>';
    5252    }
    53     return($Output);
     53    return ($Output);
    5454  }
    5555
    5656  function OnLoad($Item)
    5757  {
    58     if($_POST[$Item['Name']] == '') return(NULL);
    59       else return($_POST[$Item['Name']]);
     58    if ($_POST[$Item['Name']] == '') return (NULL);
     59      else return ($_POST[$Item['Name']]);
    6060  }
    6161
    6262  function OnLoadDb($Item)
    6363  {
    64     if($Item['Value'] == '') return(NULL);
    65       else return($Item['Value']);
     64    if ($Item['Value'] == '') return (NULL);
     65      else return ($Item['Value']);
    6666  }
    6767
    6868  function OnFilterName($Item)
    6969  {
    70     return('`'.$Item['Name'].'_Filter`');
     70    return ('`'.$Item['Name'].'_Filter`');
    7171  }
    7272
     
    7474  {
    7575    $Type = $this->FormManager->Type->TypeDefinitionList[$Item['Type']];
    76     //if($Item['Value'] != '')
     76    //if ($Item['Value'] != '')
    7777    //{
    78       if(array_key_exists('View', $Type['Parameters'])) $Table = $Type['Parameters']['View'];
     78      if (array_key_exists('View', $Type['Parameters'])) $Table = $Type['Parameters']['View'];
    7979        else $Table = $Type['Parameters']['Table'];
    8080      $Output = '`'.$Item['Name'].'`, (SELECT '.$Type['Parameters']['Name'].''.
     
    8282        $Type['Parameters']['Id'].'`=`TX`.`'.$Item['Name'].'`) AS `'.$Item['Name'].'_Filter`';
    8383    //} else $Output = '`'.$Item['Name'].'`, `'.$Item['Name'].'` AS `'.$Item['Name'].'_Filter`';
    84     return($Output);
     84    return ($Output);
    8585  }
    8686}
  • trunk/Common/Form/Types/OneToMany2.php

    r548 r873  
    88  {
    99    $Output = '<a href="?Action=ShowList&amp;TableId='.$Item['TypeDefinition'].'&amp;ParentTable='.$Item['SourceTable'].'&amp;ParentColumn='.$Item['SourceItemId'].'">Seznam</a>';
    10     return($Output);
     10    return ($Output);
    1111  }
    1212
     
    1414  {
    1515    $Output = '<a href="?Action=ShowList&amp;TableId='.$Item['TypeDefinition'].'&amp;ParentTable='.$Item['SourceTable'].'&amp;ParentColumn='.$Item['SourceItemId'].'">Seznam</a>';
    16     return($Output);
     16    return ($Output);
    1717  }
    1818
    1919  function OnLoad($Item)
    2020  {
    21     return($_POST[$Item['Name']]);
     21    return ($_POST[$Item['Name']]);
    2222  }
    2323}
  • trunk/Common/Form/Types/Password.php

    r738 r873  
    1010  {
    1111    $Output = '';
    12     for($I = 0; $I < 6; $I++)
     12    for ($I = 0; $I < 6; $I++)
    1313      $Output .= '*';
    14     return($Output);
     14    return ($Output);
    1515  }
    1616
     
    1818  {
    1919    $Output = '<input type="password" name="'.$Item['Name'].'" value=""/>';
    20     return($Output);
     20    return ($Output);
    2121  }
    2222
     
    2727    $Result = $_POST[$Item['Name']];
    2828    /*
    29     if(!array_key_exists('SourceItemId', $Item)) $Result = sha1($_POST[$Item['Name']]);
     29    if (!array_key_exists('SourceItemId', $Item)) $Result = sha1($_POST[$Item['Name']]);
    3030    else
    3131    {
    3232      $DbRestult = $Database->query('SELECT '.$Item['Name'].' FROM '.$Item['SourceTable'].' WHERE Id='.$Item['SourceItemId']);
    33       if($DbResult->num_rows > 0)
     33      if ($DbResult->num_rows > 0)
    3434      {
    3535        $DbRow = $DbResult->fetch_assoc();
    36         if($_POST[$Item['Name']] == '') $Result = $DbRow[$Item['Name']];
     36        if ($_POST[$Item['Name']] == '') $Result = $DbRow[$Item['Name']];
    3737        else $Result = sha1($_POST[$Item['Name']]);
    3838      } else $Result = sha1($_POST[$Item['Name']]);
    3939    }
    4040    */
    41     return($Result);
     41    return ($Result);
    4242  }
    4343
    4444  function OnSaveDb($Item)
    4545  {
    46     if($Item['Value'] == '') return('');
     46    if ($Item['Value'] == '') return ('');
    4747    else {
    4848      $PasswordHash = new PasswordHash();
    49       return($PasswordHash->Hash($Item['Value'], $Item['Values']['Salt']));
     49      return ($PasswordHash->Hash($Item['Value'], $Item['Values']['Salt']));
    5050    }
    5151  }
     
    5353  function OnLoadDb($Item)
    5454  {
    55     return('');
     55    return ('');
    5656  }
    5757}
  • trunk/Common/Form/Types/RandomHash.php

    r738 r873  
    1414  {
    1515    $Output = $Item['Value'];
    16     return($Output);
     16    return ($Output);
    1717  }
    1818
    1919  function OnEdit($Item)
    2020  {
    21     if($Item['Value'] == '')
     21    if ($Item['Value'] == '')
    2222    {
    2323      // Create only once
     
    2626    }
    2727    $Output = '<input type="hidden" name="'.$Item['Name'].'" value="'.$Item['Value'].'" />';
    28     return($Output);
     28    return ($Output);
    2929  }
    3030
    3131  function OnLoad($Item)
    3232  {
    33     return($_POST[$Item['Name']]);
     33    return ($_POST[$Item['Name']]);
    3434  }
    3535}
  • trunk/Common/Form/Types/String.php

    r574 r873  
    1010  {
    1111    $Output = $Item['Value'];
    12     return($Output);
     12    return ($Output);
    1313  }
    1414
     
    1616  {
    1717    $Output = '<input type="text" name="'.$Item['Name'].'" id="'.$Item['Name'].'" value="'.$Item['Value'].'"/>';
    18     return($Output);
     18    return ($Output);
    1919  }
    2020
     
    2222  {
    2323    //echo($Item['Name'].'='.$_POST[$Item['Name']].','.is_null(NULL).'<br>');
    24     return($_POST[$Item['Name']]);
     24    return ($_POST[$Item['Name']]);
    2525  }
    2626
    2727  function DatabaseEscape($Value)
    2828  {
    29     return('"'.addslashes($Value).'"');
     29    return ('"'.addslashes($Value).'"');
    3030  }
    3131}
  • trunk/Common/Form/Types/Text.php

    r799 r873  
    1010  {
    1111    $Output = str_replace("\n", '<br/>', strip_tags($Item['Value']));
    12     return($Output);
     12    return ($Output);
    1313  }
    1414
     
    1616  {
    1717    $Output = '<textarea name="'.$Item['Name'].'">'.$Item['Value'].'</textarea>';
    18     return($Output);
     18    return ($Output);
    1919  }
    2020
    2121  function OnLoad($Item)
    2222  {
    23     return($_POST[$Item['Name']]);
     23    return ($_POST[$Item['Name']]);
    2424  }
    2525
    2626  function DatabaseEscape($Value)
    2727  {
    28     return('"'.addslashes($Value).'"');
     28    return ('"'.addslashes($Value).'"');
    2929  }
    3030}
  • trunk/Common/Form/Types/Time.php

    r872 r873  
    99  function OnView($Item)
    1010  {
    11     if($Item['Value'] == 0) return('');
    12     if((strtolower($Item['Value']) == 'now') or (strtolower($Item['Value']) == '')) $Item['Value'] = time();
     11    if ($Item['Value'] == 0) return ('');
     12    if ((strtolower($Item['Value']) == 'now') or (strtolower($Item['Value']) == '')) $Item['Value'] = time();
    1313    $TimeParts = getdate($Item['Value']);
    1414
    1515    $Output = sprintf('%02d', $TimeParts['hours']).':'.sprintf('%02d', $TimeParts['minutes']).':'.sprintf('%02d', $TimeParts['seconds']);
    16     return($Output);
     16    return ($Output);
    1717  }
    1818
     
    2828    $Output = '';
    2929    $Style = '';
    30     if(array_key_exists('Null', $Item) and $Item['Null'])
     30    if (array_key_exists('Null', $Item) and $Item['Null'])
    3131    {
    32       if($IsNull)
     32      if ($IsNull)
    3333      {
    3434        $Checked = ' checked="1"';
     
    4545    // Hour
    4646    $Output .= '<select name="'.$Item['Name'].'-hour" id="'.$Item['Name'].'-hour" '.$Style.'>';
    47     for($I = 1; $I <= 24; $I++)
     47    for ($I = 1; $I <= 24; $I++)
    4848    {
    49       if($TimeParts['hours'] == $I) $Selected = ' selected="1"'; else $Selected = '';
     49      if ($TimeParts['hours'] == $I) $Selected = ' selected="1"'; else $Selected = '';
    5050      $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>';
    5151    }
     
    5353    // Minute
    5454    $Output .= '<select name="'.$Item['Name'].'-minute" id="'.$Item['Name'].'-minute" '.$Style.'>';
    55     for($I = 1; $I <= 60; $I++)
     55    for ($I = 1; $I <= 60; $I++)
    5656    {
    57       if($TimeParts['month'] == $I) $Selected = ' selected="1"'; else $Selected = '';
     57      if ($TimeParts['month'] == $I) $Selected = ' selected="1"'; else $Selected = '';
    5858      $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>';
    5959    }
     
    6161    // Second
    6262    $Output .= '<select name="'.$Item['Name'].'-second" id="'.$Item['Name'].'-second" '.$Style.'>';
    63     for($I = 1; $I <= 60; $I++)
     63    for ($I = 1; $I <= 60; $I++)
    6464    {
    65       if($TimeParts['seconds'] == $I) $Selected = ' selected="1"'; else $Selected = '';
     65      if ($TimeParts['seconds'] == $I) $Selected = ' selected="1"'; else $Selected = '';
    6666      $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>';
    6767    }
    6868    $Output .= '</select>';
    69     return($Output);
     69    return ($Output);
    7070  }
    7171
    7272  function OnLoad($Item)
    7373  {
    74     if(!array_key_exists($Item['Name'].'-null', $_POST) and array_key_exists('Null', $Item) and ($Item['Null'] == true)) return(null);
    75       return(mktime($_POST[$Item['Name'].'-hour'], $_POST[$Item['Name'].'-minute'], $_POST[$Item['Name'].'-second']));
     74    if (!array_key_exists($Item['Name'].'-null', $_POST) and array_key_exists('Null', $Item) and ($Item['Null'] == true)) return (null);
     75      return (mktime($_POST[$Item['Name'].'-hour'], $_POST[$Item['Name'].'-minute'], $_POST[$Item['Name'].'-second']));
    7676  }
    7777
    7878  function OnLoadDb($Item)
    7979  {
    80     return(MysqlTimeToTime($Item['Value']));
     80    return (MysqlTimeToTime($Item['Value']));
    8181  }
    8282
    8383  function OnSaveDb($Item)
    8484  {
    85     if($Item['Value'] == null) return(null);
    86       else return(date('H:i:s', $Item['Value']));
     85    if ($Item['Value'] == null) return (null);
     86      else return (date('H:i:s', $Item['Value']));
    8787  }
    8888
    8989  function DatabaseEscape($Value)
    9090  {
    91     return('"'.addslashes($Value).'"');
     91    return ('"'.addslashes($Value).'"');
    9292  }
    9393}
  • trunk/Common/Form/Types/TimeDiff.php

    r660 r873  
    77  function OnView($Item)
    88  {
    9     if($Item['Value'] == null) $Output = '';
     9    if ($Item['Value'] == null) $Output = '';
    1010    else {
    1111      $Output = sprintf('%02d', floor($Item['Value'] / 3600 % 24)).':'.
     
    1313        sprintf('%02d', floor($Item['Value'] % 60));
    1414      $Days = floor($Item['Value'] / (60 * 60 * 24));
    15       if($Days > 0) $Output = $Days.' dnů '.$Output;
     15      if ($Days > 0) $Output = $Days.' dnů '.$Output;
    1616    }
    17     return($Output);
     17    return ($Output);
    1818  }
    1919}
  • trunk/Common/Form/Types/Type.php

    r738 r873  
    6767  function ExecuteTypeEvent($TypeName, $Event, $Parameters = array())
    6868  {
    69     if(array_key_exists($TypeName, $this->TypeDefinitionList))
     69    if (array_key_exists($TypeName, $this->TypeDefinitionList))
    7070    {
    7171      $Type = $this->TypeDefinitionList[$TypeName];
    7272      $TypeClass = 'Type'.$Type['Class'];
    7373      $TypeObject = new $TypeClass($this->FormManager);
    74       if(is_callable(array($TypeObject, $Event))) return($TypeObject->$Event($Parameters));
    75         else return($TypeName.'->'.$Event.'('.serialize($Parameters).')');
    76     } else return($TypeName);
     74      if (is_callable(array($TypeObject, $Event))) return ($TypeObject->$Event($Parameters));
     75        else return ($TypeName.'->'.$Event.'('.serialize($Parameters).')');
     76    } else return ($TypeName);
    7777  }
    7878
    7979  function IsHidden($TypeName)
    8080  {
    81     if(array_key_exists($TypeName, $this->TypeDefinitionList))
     81    if (array_key_exists($TypeName, $this->TypeDefinitionList))
    8282    {
    8383      $Type = $this->TypeDefinitionList[$TypeName];
    8484      $TypeClass = 'Type'.$Type['Class'];
    8585      $TypeObject = new $TypeClass($this->FormManager);
    86       return($TypeObject->Hidden);
    87     } else return(false);
     86      return ($TypeObject->Hidden);
     87    } else return (false);
    8888  }
    8989
    9090  function RegisterType($Name, $ParentType, $Parameters)
    9191  {
    92     if($ParentType != '')
     92    if ($ParentType != '')
    9393    {
    9494      $Type = $this->TypeDefinitionList[$ParentType];
     
    9797    $Type['Name'] = $Name;
    9898    $Type['Class'] = $Name;
    99     if(array_key_exists('Parameters', $Type))
     99    if (array_key_exists('Parameters', $Type))
    100100      $Type['Parameters'] = array_merge($Type['Parameters'], $Parameters);
    101101      else $Type['Parameters'] = $Parameters;
     
    111111  function GetTypeDefinition($TypeName)
    112112  {
    113     return($this->TypeDefinitionList[$TypeName]);
     113    return ($this->TypeDefinitionList[$TypeName]);
    114114  }
    115115}
Note: See TracChangeset for help on using the changeset viewer.