Ignore:
Timestamp:
Apr 14, 2015, 10:20:16 PM (9 years ago)
Author:
chronos
Message:
  • Removed: Spaces on end of line.
  • Modified: Tabs converted to spaces.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/IS/IS.php

    r736 r738  
    3232    if(array_key_exists('t', $_GET)) $Table = $_GET['t'];
    3333      else $Table = '';
    34     // i - index of item 
     34    // i - index of item
    3535    if(array_key_exists('i', $_GET)) $ItemId = $_GET['i'];
    3636      else $ItemId = 0;
    37     // fc - preset colum 
     37    // fc - preset colum
    3838    if(array_key_exists('fn', $_GET)) $FilterName = $_GET['fn'];
    3939      else $FilterName = '';
     
    4646
    4747    if($Action == 'list') {
    48         if($FilterName == '') $Content = $this->ShowList($Table);
    49           else $Content = $this->ShowList($Table, '', '', $FilterName, $FilterValue);
     48      if($FilterName == '') $Content = $this->ShowList($Table);
     49        else $Content = $this->ShowList($Table, '', '', $FilterName, $FilterValue);
    5050    }
    5151    else if($Action == 'select') $Content = $this->ShowSelect($Table);
     
    8484    $DbRow = $DbResult->fetch_row();
    8585    $Output .= 'Nedokončených úkolů: '.$DbRow['0'].'<br/>';
    86    
     86
    8787    $DbResult = $this->Database->select('Member', 'COUNT(*)', '1');
    8888    $DbRow = $DbResult->fetch_row();
    8989    $Output .= 'Zákazníků: '.$DbRow['0'].'<br/>';
    90    
     90
    9191    $DbResult = $this->Database->select('Subject', 'COUNT(*)', '1');
    9292    $DbRow = $DbResult->fetch_row();
    9393    $Output .= 'Subjektů: '.$DbRow['0'].'<br/>';
    94    
     94
    9595    $DbResult = $this->Database->select('User', 'COUNT(*)', '1');
    9696    $DbRow = $DbResult->fetch_row();
    9797    $Output .= 'Uživatelů: '.$DbRow['0'].'<br/>';
    98    
     98
    9999    $DbResult = $this->Database->select('NetworkDevice', 'COUNT(*)', '1');
    100100    $DbRow = $DbResult->fetch_row();
    101101    $Output .= 'Registrovaných zařízení: '.$DbRow['0'].'<br/>';
    102    
     102
    103103    $DbResult = $this->Database->select('FinanceOperation', 'SUM(`Value` * `Direction`)', '1');
    104104    $DbRow = $DbResult->fetch_row();
    105105    $Output .= 'Stav placení: '.$DbRow['0'].'<br/>';
    106    
     106
    107107    $DbResult = $this->Database->select('FinanceBankImport', 'COUNT(*)', '`FinanceOperation` IS NULL');
    108108    $DbRow = $DbResult->fetch_row();
     
    142142  function LogChange($Form, $Action, $NewId, $OldId)
    143143  {
    144         $Values = $Form->Definition['Table'].' (Id: '.$OldId.' => '.$NewId.'):'."\n";
    145         // Compare old values loaded from database with new values in Form variable
    146         $NewValues = $Form->Values;
    147         if($OldId != 0)
    148         {
    149           $FormOld = new Form($this->System->FormManager);
    150           $FormOld->SetClass($Form->Definition['Table']);
    151           $FormOld->LoadValuesFromDatabase($OldId);
    152                 $OldValues = $FormOld->Values;
    153                 // Keep only changes values
    154           foreach($NewValues as $Index => $Value)
    155           {
    156                 if($OldValues[$Index] != $NewValues[$Index])
    157                 {
    158                 $Values .= $Index.': '.$FormOld->GetValue($Index);
    159                 if($NewId != 0) $Values .= ' => '.$Form->GetValue($Index);
    160                 $Values .= "\n";
    161                 }
    162         }
    163         } else {
    164                 foreach($NewValues as $Index => $Value)
    165                 {
    166                         $Values .= $Index.': '.$Form->GetValue($Index)."\n";
    167                 }
    168         }
    169         $this->System->ModuleManager->Modules['Log']->NewRecord('IS', $Action, $Values);
     144    $Values = $Form->Definition['Table'].' (Id: '.$OldId.' => '.$NewId.'):'."\n";
     145    // Compare old values loaded from database with new values in Form variable
     146    $NewValues = $Form->Values;
     147    if($OldId != 0)
     148    {
     149      $FormOld = new Form($this->System->FormManager);
     150      $FormOld->SetClass($Form->Definition['Table']);
     151      $FormOld->LoadValuesFromDatabase($OldId);
     152      $OldValues = $FormOld->Values;
     153      // Keep only changes values
     154      foreach($NewValues as $Index => $Value)
     155      {
     156        if($OldValues[$Index] != $NewValues[$Index])
     157        {
     158          $Values .= $Index.': '.$FormOld->GetValue($Index);
     159          if($NewId != 0) $Values .= ' => '.$Form->GetValue($Index);
     160          $Values .= "\n";
     161        }
     162      }
     163    } else {
     164      foreach($NewValues as $Index => $Value)
     165      {
     166        $Values .= $Index.': '.$Form->GetValue($Index)."\n";
     167      }
     168    }
     169    $this->System->ModuleManager->Modules['Log']->NewRecord('IS', $Action, $Values);
    170170  }
    171171
     
    179179      if($_GET['o'] == 'save')
    180180      {
    181         if(!array_key_exists('submit', $_POST))
    182                 return($this->SystemMessage('Formulář', 'Formulář nebyl řádně odeslán. Vraťte se zpět a odešlete formulář znovu.'));
     181        if(!array_key_exists('submit', $_POST))
     182          return($this->SystemMessage('Formulář', 'Formulář nebyl řádně odeslán. Vraťte se zpět a odešlete formulář znovu.'));
    183183        $Form = new Form($this->System->FormManager);
    184184        $Form->SetClass($Table);
     
    193193        } catch (Exception $E)
    194194        {
    195                 $Output .= $this->SystemMessage('Úprava položky', 'Položku se nepodařilo uložit. Opravte problém a opakujte akci.<br/>'.$E->getMessage());
     195          $Output .= $this->SystemMessage('Úprava položky', 'Položku se nepodařilo uložit. Opravte problém a opakujte akci.<br/>'.$E->getMessage());
    196196          $Form->OnSubmit = '?a=edit&amp;t='.$Table.'&amp;i='.$_GET['i'].'&amp;o=save';
    197197          $Output .= $Form->ShowEditForm();
     
    230230    $Output = '';
    231231    if(defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Write'))
    232       return('Nemáte oprávnění');   
     232      return('Nemáte oprávnění');
    233233    $DbResult = $this->Database->select($Table, '*', '`Id`='.$Id);
    234234    if($DbResult->num_rows > 0)
    235235    {
    236         $DbRow = $DbResult->fetch_assoc();
    237         try {
     236      $DbRow = $DbResult->fetch_assoc();
     237      try {
    238238        $Form = new Form($this->System->FormManager);
    239239        $this->ShortTitle .= ' - '.$Form->Definition['Title'].' odstranění';
     
    244244      } catch (Exception $E)
    245245      {
    246         $Output .= $this->SystemMessage('Smazání položky', 'Položku se nepodařilo smazat. Pravděpodobně na ni závisejí další položky.');
     246        $Output .= $this->SystemMessage('Smazání položky', 'Položku se nepodařilo smazat. Pravděpodobně na ni závisejí další položky.');
    247247      }
    248248    } else $Output .= $this->SystemMessage('Smazání položky', 'Položka nenalezena');
     
    301301        } catch (Exception $E)
    302302        {
    303                 $Output .= $this->SystemMessage('Přidání položky', 'Položku se nepodařilo přidat. Opravte problém a opakujte akci.<br/>'.$E->getMessage());
    304                 $Form->OnSubmit = '?a=add&amp;t='.$Table.'&amp;o=save';
     303          $Output .= $this->SystemMessage('Přidání položky', 'Položku se nepodařilo přidat. Opravte problém a opakujte akci.<br/>'.$E->getMessage());
     304          $Form->OnSubmit = '?a=add&amp;t='.$Table.'&amp;o=save';
    305305          $Output .= $Form->ShowEditForm();
    306306          $Actions[] = '<a href="?a=list&amp;t='.$Table.'"><img alt="Seznam" title="Seznam" src="'.
     
    353353    if(defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Read'))
    354354      return('Nemáte oprávnění');
    355    
     355
    356356    $FormClass = $this->System->FormManager->Classes[$Table];
    357357    if(array_key_exists('BaseTable', $FormClass)) $TableModify = $FormClass['BaseTable'];
    358358      else $TableModify = $Table;
    359    
     359
    360360    $Form = new Form($this->System->FormManager);
    361361    $Form->SetClass($Table);
     
    407407  function ShowTable($Table, $Filter = '', $Title = '', $RowActions = array(), $ExcludeColumn = '')
    408408  {
    409         if($Table != '') $FormClass = $this->System->FormManager->Classes[$Table];
     409    if($Table != '') $FormClass = $this->System->FormManager->Classes[$Table];
    410410      else return($this->SystemMessage('Chyba', 'Tabulka nenalezena'));
    411411
     
    416416    // Build form type filter
    417417    $TypeFilter = '';
    418     foreach($FormClass['Items'] as $ItemIndex => $FormItem)   
     418    foreach($FormClass['Items'] as $ItemIndex => $FormItem)
    419419    if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or
    420420    (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and
     
    422422    if(array_key_exists('Filter', $FormItem) and ($FormItem['Filter'] == true))
    423423    {
    424         if($TypeFilter != '') $TypeFilter .= ' AND ';           
    425         $TypeFilter .= '('.$ItemIndex.' = "'.$FormItem['Default'].'")';
    426     }     
     424      if($TypeFilter != '') $TypeFilter .= ' AND ';
     425      $TypeFilter .= '('.$ItemIndex.' = "'.$FormItem['Default'].'")';
     426    }
    427427    if($TypeFilter != '')
    428428    {
    429         if($Filter != '') $Filter = ' AND';
    430         $Filter .= ' '.$TypeFilter;
    431     }
    432    
     429      if($Filter != '') $Filter = ' AND';
     430      $Filter .= ' '.$TypeFilter;
     431    }
     432
    433433    // Build user filter
    434434    $UserFilter = '';
     
    470470    if($Filter != '') $Filter = ' HAVING '.$Filter;
    471471
    472     foreach($FormClass['Items'] as $ItemIndex => $FormItem)     
     472    foreach($FormClass['Items'] as $ItemIndex => $FormItem)
    473473      if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or
    474474      (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and
    475475      ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne')))
    476476      {
    477         if($ExcludeColumn != $ItemIndex)
    478         if(!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false))
     477        if($ExcludeColumn != $ItemIndex)
     478        if(!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false))
    479479          $TableColumns[] = array('Name' => $ItemIndex, 'Title' => $FormItem['Caption']);
    480480        $UseType = $UseType = $FormItem['Type'];
     
    563563      ($ExcludeColumn != $ItemIndex))
    564564      {
    565         //$Output .= '<td>'.$Row[$ItemIndex].'</td>';
     565        //$Output .= '<td>'.$Row[$ItemIndex].'</td>';
    566566        $UseType = $UseType = $FormItem['Type'];
    567567        if(array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes))
     
    632632    if(array_key_exists('BaseTable', $FormClass)) $TableModify = $FormClass['BaseTable'];
    633633      else $TableModify = $Table;
    634    
     634
    635635    $RowActions = '<a href="?a=view&amp;t='.$Table.'&amp;i=#RowId"><img alt="Ukázat" title="Ukázat" src="'.
    636636      $this->System->Link('/images/view.png').'"/></a>'.
     
    755755      $Confirm = ' onclick="return confirmAction(\''.$Confirm.'\');"';
    756756    $Output = '<a href="'.$Target.'"'.$Confirm.'>'.$Output.'</a>';
    757         return($Output);
     757    return($Output);
    758758  }
    759759}
Note: See TracChangeset for help on using the changeset viewer.