Ignore:
Timestamp:
Apr 14, 2020, 11:13:32 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved code formatting.
File:
1 edited

Legend:

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

    r1 r7  
    4444  { 
    4545    $Result = '<table class="BasicTable">';
    46     if(array_key_exists('Header', $Table))
     46    if (array_key_exists('Header', $Table))
    4747    {
    4848      $Result .= '<tr>';
    49       foreach($Table['Header'] as $Item)
     49      foreach ($Table['Header'] as $Item)
    5050        $Result .= '<th>'.$Item.'</th>';
    5151      $Result .= '</tr>';
    5252    }
    53     foreach($Table['Rows'] as $Row)
     53    foreach ($Table['Rows'] as $Row)
    5454    {
    5555      $Result .= '<tr>';
    56       foreach($Row as $Index => $Item)
    57       {
    58         if($Index == 0) $Class = ' class="Header"'; else $Class = '';
     56      foreach ($Row as $Index => $Item)
     57      {
     58        if ($Index == 0) $Class = ' class="Header"'; else $Class = '';
    5959        $Result .= '<td'.$Class.' style="width: '.(floor(100 / count($Row))).'%">'.$Item.'</td>';
    6060      }
     
    6262    }
    6363    $Result .= '</table>';
    64     return($Result);
     64    return $Result;
    6565  }
    6666
    6767  function LoadDefaults()
    6868  {
    69     foreach($this->Definition['Items'] as $Index => $Item)
    70     if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
     69    foreach ($this->Definition['Items'] as $Index => $Item)
     70    if (!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
    7171    (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and
    7272    ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne')))
    7373    {
    74       if(!array_key_exists($Index, $this->Values) and isset($Item['Default']))
     74      if (!array_key_exists($Index, $this->Values) and isset($Item['Default']))
    7575        $this->Values[$Index] = $Item['Default'];
    7676    }
     
    8686  {
    8787    $Item = $this->Definition['Items'][$Index];
    88     if(array_key_exists($Item['Type'], $this->FormManager->FormTypes))
    89     {
    90       if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
     88    if (array_key_exists($Item['Type'], $this->FormManager->FormTypes))
     89    {
     90      if (!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
    9191        $this->FormManager->Type->RegisterType($Item['Type'], '', $this->FormManager->FormTypes[$Item['Type']]);
    92       if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
     92      if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
    9393        $UseType = 'OneToMany';
    94       else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
     94      else if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
    9595        $UseType = 'Enumeration';
    9696    } else $UseType = $Item['Type'];
     
    107107      'Rows' => array(),
    108108    );
    109     foreach($this->Definition['Items'] as $Index => $Item)
    110     if(!array_key_exists('Hidden', $Item) or ($Item['Hidden'] == false))
    111     if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
     109    foreach ($this->Definition['Items'] as $Index => $Item)
     110    if (!array_key_exists('Hidden', $Item) or ($Item['Hidden'] == false))
     111    if (!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
    112112    (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and
    113113    ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne')))
    114114    {
    115       if(array_key_exists($Item['Type'], $this->FormManager->FormTypes))
    116       {
    117         if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
     115      if (array_key_exists($Item['Type'], $this->FormManager->FormTypes))
     116      {
     117        if (!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
    118118          $this->FormManager->Type->RegisterType($Item['Type'], '', $this->FormManager->FormTypes[$Item['Type']]);
    119         if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
     119        if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
    120120          $UseType = 'OneToMany';
    121         else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
     121        else if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
    122122          $UseType = 'Enumeration';
    123123      } else $UseType = $Item['Type'];
     
    126126        'Type' => $Item['Type'], 'Values' => $this->Values,
    127127        'Filter' => $this->ValuesFilter[$Index]));
    128       if(array_key_exists('Suffix', $Item)) $Edit .= ' '.$Item['Suffix'];
    129       if(!$this->FormManager->Type->IsHidden($UseType))
     128      if (array_key_exists('Suffix', $Item)) $Edit .= ' '.$Item['Suffix'];
     129      if (!$this->FormManager->Type->IsHidden($UseType))
    130130        array_push($Table['Rows'], array($Item['Caption'].':', $Edit));
    131131    }
    132132    $Output = '<fieldset><legend>'.$this->Definition['Title'].'</legend>'.$this->Table($Table).
    133133    '</fieldset>';
    134     return($Output);
     134    return $Output;
    135135  }
    136136
    137137  function ShowEditForm()
    138138  {
    139     if(!array_key_exists('SubmitText', $this->Definition)) $this->Definition['SubmitText'] = 'Uložit';
     139    if (!array_key_exists('SubmitText', $this->Definition)) $this->Definition['SubmitText'] = 'Uložit';
    140140    $Output = '<form enctype="multipart/form-data" class="Form" action="'.$this->OnSubmit.'" method="post">'.$this->ShowEditBlock().
    141141      '<div><input name="submit" type="submit" value="'.$this->Definition['SubmitText'].'" /> '.
    142142      '<input type="button" value="Zrušit" onclick="location.href=\'?\'"/></div></form>';
    143     return($Output);
     143    return $Output;
    144144  }
    145145
     
    152152      'Rows' => array(),
    153153    );
    154     if($Context != '') $Context = $Context.'-';
    155     foreach($this->Definition['Items'] as $Index => $Item)
    156     {
    157       if(!array_key_exists('ReadOnly', $Item)) $Item['ReadOnly'] = false;
    158     if($Item['ReadOnly'] == false)
    159     if(!array_key_exists('Hidden', $Item) or ($Item['Hidden'] == false))
    160     if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
     154    if ($Context != '') $Context = $Context.'-';
     155    foreach ($this->Definition['Items'] as $Index => $Item)
     156    {
     157      if (!array_key_exists('ReadOnly', $Item)) $Item['ReadOnly'] = false;
     158    if ($Item['ReadOnly'] == false)
     159    if (!array_key_exists('Hidden', $Item) or ($Item['Hidden'] == false))
     160    if (!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
    161161    (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and
    162162    ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne')))
     
    164164        $Parameters = array('Value' => $this->Values[$Index], 'Name' => $Index,
    165165            'Type' => $Item['Type'], 'Values' => $this->Values);
    166         if(array_key_exists('Null', $Item)) $Parameters['Null'] = $Item['Null'];
     166        if (array_key_exists('Null', $Item)) $Parameters['Null'] = $Item['Null'];
    167167          else unset($Parameters['Null']);
    168         if(array_key_exists('OnPreset', $Item)) $Parameters['OnPreset'] = $Item['OnPreset'];
     168        if (array_key_exists('OnPreset', $Item)) $Parameters['OnPreset'] = $Item['OnPreset'];
    169169          else unset($Parameters['OnPreset']);
    170170
    171         if(array_key_exists($Item['Type'], $this->FormManager->FormTypes))
    172         {
    173           if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
    174             $this->FormManager->Type->RegisterType($Item['Type'], '',
    175               $this->FormManager->FormTypes[$Item['Type']]);
    176           if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
     171        if (array_key_exists($Item['Type'], $this->FormManager->FormTypes))
     172        {
     173          if (!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
     174            $this->FormManager->Type->RegisterType($Item['Type'], '',
     175              $this->FormManager->FormTypes[$Item['Type']]);
     176          if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
    177177          {
    178178            $UseType = 'OneToMany';
    179           } else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
     179          } else if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
    180180            $UseType = 'Enumeration';
    181181        } else $UseType = $Item['Type'];
    182182        $Edit = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnEdit', $Parameters);
    183         if(array_key_exists('Suffix', $Item)) $Edit .= $Item['Suffix'];
     183        if (array_key_exists('Suffix', $Item)) $Edit .= $Item['Suffix'];
    184184
    185185      $Caption = $Item['Caption'].':';
    186       if(array_key_exists($Index, $this->ValuesValidate) and
     186      if (array_key_exists($Index, $this->ValuesValidate) and
    187187        $this->ValuesValidate[$Index]) {
    188188          $Format = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'GetValidationFormat', array());
    189           if($Format != '') $Caption .= '<br/><small>'.$Format.'</small>';
     189          if ($Format != '') $Caption .= '<br/><small>'.$Format.'</small>';
    190190          $Caption = '<span style="color:red;">'.$Caption.'</span>';
    191191        }
    192       if(!$this->FormManager->Type->IsHidden($UseType))
     192      if (!$this->FormManager->Type->IsHidden($UseType))
    193193          array_push($Table['Rows'], array($Caption, $Edit));
    194194      else $Hidden .= $Edit;
     
    197197    $Output = '<fieldset><legend>'.$this->Definition['Title'].'</legend>'.$this->Table($Table).
    198198    $Hidden.'</fieldset>';
    199     return($Output);
     199    return $Output;
    200200  }
    201201
    202202  function LoadValuesFromDatabase($Id)
    203203  {
    204     foreach($this->Definition['Items'] as $Index => $Item)
    205     if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
     204    foreach ($this->Definition['Items'] as $Index => $Item)
     205    if (!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
    206206    (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and
    207207    ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne')))
    208208    {
    209         if(array_key_exists($Item['Type'], $this->FormManager->FormTypes))
    210         {
    211           if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
    212             $this->FormManager->Type->RegisterType($Item['Type'], '',
    213               $this->FormManager->FormTypes[$Item['Type']]);
    214           if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
    215             $UseType = 'OneToMany';
    216           else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
    217             $UseType = 'Enumeration';
    218         } else $UseType = $Item['Type'];
    219       if(!array_key_exists('SQL', $Item)) $Item['SQL'] = '';
     209        if (array_key_exists($Item['Type'], $this->FormManager->FormTypes))
     210        {
     211          if (!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
     212            $this->FormManager->Type->RegisterType($Item['Type'], '',
     213              $this->FormManager->FormTypes[$Item['Type']]);
     214          if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
     215            $UseType = 'OneToMany';
     216          else if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
     217            $UseType = 'Enumeration';
     218        } else $UseType = $Item['Type'];
     219      if (!array_key_exists('SQL', $Item)) $Item['SQL'] = '';
    220220        else $Item['SQL'] = str_replace('#Id', $Id, $Item['SQL']);
    221221      $Columns[] = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnFilterNameQuery',
     
    223223    }
    224224    $Columns = implode(',', $Columns);
    225     if(array_key_exists('SQL', $this->Definition))
     225    if (array_key_exists('SQL', $this->Definition))
    226226      $SourceTable = '('.$this->Definition['SQL'].') AS `TX`';
    227227      else $SourceTable = '`'.$this->Definition['Table'].'` AS `TX`';
    228228    $DbResult = $this->Database->query('SELECT '.$Columns.' FROM '.$SourceTable.' WHERE `TX`.`Id`='.$Id);
    229229    $DbRow = $DbResult->fetch_array();
    230     foreach($this->Definition['Items'] as $Index => $Item)
    231     if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
     230    foreach ($this->Definition['Items'] as $Index => $Item)
     231    if (!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
    232232    (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and
    233233    ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne')))
    234234    {
    235         if(array_key_exists($Item['Type'], $this->FormManager->FormTypes))
    236         {
    237           if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
    238             $this->FormManager->Type->RegisterType($Item['Type'], '',
    239               $this->FormManager->FormTypes[$Item['Type']]);
    240           if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
    241             $UseType = 'OneToMany';
    242           else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
     235        if (array_key_exists($Item['Type'], $this->FormManager->FormTypes))
     236        {
     237          if (!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
     238            $this->FormManager->Type->RegisterType($Item['Type'], '',
     239              $this->FormManager->FormTypes[$Item['Type']]);
     240          if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
     241            $UseType = 'OneToMany';
     242          else if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
    243243            $UseType = 'Enumeration';
    244244        } else $UseType = $Item['Type'];
     
    253253  {
    254254    $Values = array();
    255     foreach($this->Definition['Items'] as $Index => $Item)
    256     {
    257       if(array_key_exists($Index, $this->Values))
    258       if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
     255    foreach ($this->Definition['Items'] as $Index => $Item)
     256    {
     257      if (array_key_exists($Index, $this->Values))
     258      if (!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
    259259      (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and
    260260      ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne')))
     
    263263          'Type' => $Item['Type'], 'Values' => $this->Values);
    264264
    265         if(array_key_exists($Item['Type'], $this->FormManager->FormTypes))
    266         {
    267           if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
    268             $this->FormManager->Type->RegisterType($Item['Type'], '',
    269               $this->FormManager->FormTypes[$Item['Type']]);
    270           if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
     265        if (array_key_exists($Item['Type'], $this->FormManager->FormTypes))
     266        {
     267          if (!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
     268            $this->FormManager->Type->RegisterType($Item['Type'], '',
     269              $this->FormManager->FormTypes[$Item['Type']]);
     270          if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference')
    271271          {
    272272            $UseType = 'OneToMany';
    273273          }
    274           else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
     274          else if ($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration')
    275275            $UseType = 'Enumeration';
    276276        } else $UseType = $Item['Type'];
    277277        $Values[$Index] = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnSaveDb', $Parameters);
    278         if(($Item['Type'] == 'Password') and ($Values[$Index] == '')) unset($Values[$Index]);
    279       }
    280     }
    281     if($Id == 0)
     278        if (($Item['Type'] == 'Password') and ($Values[$Index] == '')) unset($Values[$Index]);
     279      }
     280    }
     281    if ($Id == 0)
    282282    {
    283283      $Values['Id'] = $Id;
     
    294294  function LoadValuesFromFormBlock($Context = '')
    295295  {
    296     if($Context != '') $Context = $Context.'-';
     296    if ($Context != '') $Context = $Context.'-';
    297297    $Values = array();
    298     foreach($this->Definition['Items'] as $Index => $Item)
    299     if(!array_key_exists('Hidden', $Item) or ($Item['Hidden'] == false))
    300     {
    301     if((!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
     298    foreach ($this->Definition['Items'] as $Index => $Item)
     299    if (!array_key_exists('Hidden', $Item) or ($Item['Hidden'] == false))
     300    {
     301    if ((!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
    302302    (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and
    303303    ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) and
     
    306306    ($Item['ReadOnly'] != true))))
    307307    {
    308         //if(array_key_exists($Context.$Index, $_POST))
    309         if(array_key_exists($Item['Type'], $this->FormManager->FormTypes))
    310         {
    311           if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
     308        //if (array_key_exists($Context.$Index, $_POST))
     309        if (array_key_exists($Item['Type'], $this->FormManager->FormTypes))
     310        {
     311          if (!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
    312312            $this->FormManager->Type->RegisterType($Item['Type'], '',
    313313              $this->FormManager->FormTypes[$Item['Type']]);
    314314          $CustomType = $this->FormManager->FormTypes[$Item['Type']]['Type'];
    315           if($CustomType == 'Reference')
    316             $UseType = 'OneToMany';
    317           else if($CustomType == 'Enumeration')
     315          if ($CustomType == 'Reference')
     316            $UseType = 'OneToMany';
     317          else if ($CustomType == 'Enumeration')
    318318            $UseType = 'Enumeration';
    319319        } else $UseType = $Item['Type'];
    320320        $Parameters = array('Name' => $Index, 'Type' => $Item['Type'], 'Values' => $this->Values);
    321         if(array_key_exists('Null', $Item)) $Parameters['Null'] = $Item['Null'];
     321        if (array_key_exists('Null', $Item)) $Parameters['Null'] = $Item['Null'];
    322322          else unset($Parameters['Null']);
    323323        $Values[$Index] = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnLoad',
     
    326326    } else
    327327    {
    328       if(isset($Item['Default'])) {
    329         if(isset($Item['Null']) and ($Item['Null'] == true))
     328      if (isset($Item['Default'])) {
     329        if (isset($Item['Null']) and ($Item['Null'] == true))
    330330          $Values[$Index] = null;
    331331        else $Values[$Index] = $Item['Default'];
    332332      }
    333333    }
    334     return($Values);
     334    return $Values;
    335335  }
    336336
     
    338338  {
    339339    $Valid = true;
    340     foreach($this->Definition['Items'] as $Index => $Item)
    341     if((!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
     340    foreach ($this->Definition['Items'] as $Index => $Item)
     341    if ((!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or
    342342    (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and
    343343    ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) and
     
    346346    ($Item['ReadOnly'] != true))))
    347347    {
    348         //if(array_key_exists($Context.$Index, $_POST))
    349         if(array_key_exists($Item['Type'], $this->FormManager->FormTypes))
    350         {
    351           if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
     348        //if (array_key_exists($Context.$Index, $_POST))
     349        if (array_key_exists($Item['Type'], $this->FormManager->FormTypes))
     350        {
     351          if (!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList))
    352352            $this->FormManager->Type->RegisterType($Item['Type'], '',
    353353              $this->FormManager->FormTypes[$Item['Type']]);
    354354          $CustomType = $this->FormManager->FormTypes[$Item['Type']]['Type'];
    355           if($CustomType == 'Reference')
    356             $UseType = 'OneToMany';
    357           else if($CustomType == 'Enumeration')
     355          if ($CustomType == 'Reference')
     356            $UseType = 'OneToMany';
     357          else if ($CustomType == 'Enumeration')
    358358            $UseType = 'Enumeration';
    359359        } else $UseType = $Item['Type'];
    360360
    361361        $Parameters = array('Value' => $this->Values[$Index]);
    362         if(array_key_exists('Null', $Item)) $Parameters['Null'] = $Item['Null'];
     362        if (array_key_exists('Null', $Item)) $Parameters['Null'] = $Item['Null'];
    363363          else $Parameters['Null'] = false;
    364         if(!$this->FormManager->Type->ExecuteTypeEvent($UseType, 'Validate',
     364        if (!$this->FormManager->Type->ExecuteTypeEvent($UseType, 'Validate',
    365365          $Parameters)) {
    366366            $this->ValuesValidate[$Index] = true;
     
    368368          }
    369369    }
    370     if($Valid == false) throw new Exception('not validated');
    371     return($Valid);
     370    if ($Valid == false) throw new Exception('not validated');
     371    return $Valid;
    372372  }
    373373}
     
    418418    $this->Database->query('DELETE FROM DataType');
    419419
    420     foreach($this->Type->TypeDefinitionList as $Name => $Type)
     420    foreach ($this->Type->TypeDefinitionList as $Name => $Type)
    421421    {
    422422      $DbResult = $this->Database->select('DataType', 'Id', 'Name="'.$Name.'"');
    423       if($DbResult->num_rows == 0)
     423      if ($DbResult->num_rows == 0)
    424424      {
    425425        $this->Database->insert('DataType', array('Name' => $Name,
     
    433433    }
    434434
    435     foreach($this->Classes as $Class)
    436     if(!array_key_exists('SQL', $Class) and ($Class['Table'] != ''))
     435    foreach ($this->Classes as $Class)
     436    if (!array_key_exists('SQL', $Class) and ($Class['Table'] != ''))
    437437    {
    438438      $DbResult = $this->Database->query('SELECT * FROM information_schema.tables  WHERE table_schema = "centrala_big"
    439439          AND table_name = "'.$Class['Table'].'" LIMIT 1');
    440       if($DbResult->num_rows == 0) continue;
     440      if ($DbResult->num_rows == 0) continue;
    441441
    442442      echo($Class['Table'].'<br>');
    443443      $Module = 1;
    444444      $DbResult = $this->Database->select('Model', 'Id', 'Name="'.$Class['Table'].'"');
    445       if($DbResult->num_rows == 0)
     445      if ($DbResult->num_rows == 0)
    446446      {
    447447        $this->Database->insert('Model', array('Name' => $Class['Table'], 'Title' => $Class['Title'], 'Module' => $Module));
     
    455455      }
    456456
    457       foreach($Class['Items'] as $Name => $Field)
     457      foreach ($Class['Items'] as $Name => $Field)
    458458      {
    459459        echo($Name.', ');
    460460        $DbResult = $this->Database->select('DataType', 'Id', 'Name="'.$Field['Type'].'"');
    461         if($DbResult->num_rows > 0)
     461        if ($DbResult->num_rows > 0)
    462462        {
    463463          $DbRow = $DbResult->fetch_assoc();
     
    468468          // Search parent type
    469469          $DbResult = $this->Database->select('DataType', 'Id', 'Name="'.$Type['Type'].'"');
    470           if($DbResult->num_rows > 0)
     470          if ($DbResult->num_rows > 0)
    471471          {
    472472            $DbRow = $DbResult->fetch_assoc();
     
    480480
    481481        $DbResult = $this->Database->select('ModelField', 'Id', '(Name="'.$Name.'") AND (Model='.$Model.')');
    482         if($DbResult->num_rows == 0)
     482        if ($DbResult->num_rows == 0)
    483483        {
    484484          $this->Database->insert('ModelField', array('Name' => $Name,
Note: See TracChangeset for help on using the changeset viewer.