Ignore:
Timestamp:
Mar 25, 2014, 7:09:47 PM (11 years ago)
Author:
chronos
Message:
  • Přidáno: Podpora pro virtuální tabulky.
  • Přidáno: Roční přehledy roků a subjektů.
  • Přidáno: Evidence zaměstnanců a mezd v nabídce v IS.
File:
1 edited

Legend:

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

    r646 r647  
    7474  function ShowEdit($Table, $Id)
    7575  {
     76        $this->ShortTitle .= ' - Úprava '.$Table;
    7677    $Output = '';
    7778    if(defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Write'))
     
    8485        $Form->SetClass($Table);
    8586        $Form->LoadValuesFromForm();
     87        $this->ShortTitle .= ' - úprava '.$Form->Definition['Title'];
    8688        try {
    8789          $Form->Validate();
     
    111113      $Form->SetClass($Table);
    112114      $Form->LoadValuesFromDatabase($Id);
     115      $this->ShortTitle .= ' - úprava '.$Form->Definition['Title'];
    113116      $Form->OnSubmit = '?a=edit&t='.$Table.'&i='.$_GET['i'].'&o=save';
    114117      $Output .= $Form->ShowEditForm();
     
    130133    if(defined('NEW_PERMISSION') and !$this->System->User->CheckPermission($this->TableToModule($Table), 'Write'))
    131134      return('Nemáte oprávnění');
     135    $this->ShortTitle .= ' - odstranění '.$Table;
    132136    $DbResult = $this->Database->select($Table, '*', '`Id`='.$Id);
    133137    if($DbResult->num_rows > 0)
     
    160164        $Form->SetClass($Table);
    161165        $Form->LoadValuesFromForm();
     166        $this->ShortTitle .= ' - přidání '.$Form->Definition['Title'];
    162167        try {
    163168          $Form->Validate();
     
    209214      $Form = new Form($this->System->FormManager);
    210215      $Form->SetClass($Table);
     216      $this->ShortTitle .= ' - přidání '.$Form->Definition['Title'];
    211217      // Load presets from URL
    212218      foreach($_GET as $Key => $Value)
     
    252258    $Form = new Form($this->System->FormManager);
    253259    $Form->SetClass($Table);
     260    $this->ShortTitle .= ' - položka '.$Form->Definition['Title'];
    254261    $Form->LoadValuesFromDatabase($Id);
    255262    $Form->OnSubmit = '?a=view';
     
    302309        if($Table != '') $FormClass = $this->System->FormManager->Classes[$Table];
    303310      else return($this->SystemMessage('Chyba', 'Tabulka nenalezena'));
     311     
     312    if(array_key_exists('SQL', $FormClass))
     313      $SourceTable = '('.$FormClass['SQL'].') AS `TX`';
     314      else $SourceTable = '`'.$FormClass['Table'].'` AS `TX`';
    304315
    305316    // Build user filter
     
    359370
    360371        if(!array_key_exists('SQL', $FormItem)) $FormItem['SQL'] = '';
    361           else $FormItem['SQL'] = str_replace('#Id', '`'.$FormClass['Table'].'`.`Id`', $FormItem['SQL']);
     372          else $FormItem['SQL'] = str_replace('#Id', '`TX`.`Id`', $FormItem['SQL']);
    362373        $Columns[] = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnFilterNameQuery',
    363374          array('Value' => $Value, 'Name' => $ItemIndex,
     
    366377
    367378    // Get total item count in database
    368     $Query = 'SELECT COUNT(*) FROM `'.$FormClass['Table'].'`';
     379    $Query = 'SELECT COUNT(*) FROM '.$SourceTable;
    369380    $DbResult = $this->Database->query($Query);
    370381    $DbRow = $DbResult->fetch_assoc();
     
    375386    if($Filter != '')
    376387    {
    377       $Query = 'SELECT COUNT(*) FROM (SELECT '.$Columns.' FROM `'.$FormClass['Table'].'`) AS `TS` '.$Filter;
     388      $Query = 'SELECT COUNT(*) FROM (SELECT '.$Columns.' FROM '.$SourceTable.') AS `TS` '.$Filter;
    378389      $DbResult = $this->Database->query($Query);
    379390      $DbRow = $DbResult->fetch_row();
     
    410421
    411422    // Load and show items
    412     $Query = 'SELECT * FROM (SELECT '.$Columns.' FROM `'.$FormClass['Table'].'`) AS `TS` '.
     423    $Query = 'SELECT * FROM (SELECT '.$Columns.' FROM '.$SourceTable.') AS `TS` '.
    413424      $Filter.' '.$Order['SQL'].$PageList['SQLLimit'];
    414425    $VisibleItemCount = 0;
Note: See TracChangeset for help on using the changeset viewer.