Ignore:
Timestamp:
Feb 23, 2022, 11:27:58 PM (2 years ago)
Author:
chronos
Message:
  • Modified: Do not show All tabs if only one tab is used in IS item relation tabs.
  • Modified: Do not show tabs at all if no relations are used for IS item.
File:
1 edited

Legend:

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

    r915 r920  
    514514    $Tabs = array();
    515515    foreach ($Form->Definition['Items'] as $Index => $Item)
    516     if ((array_key_exists($Item['Type'], $this->System->FormManager->FormTypes) and
    517     ($this->System->FormManager->FormTypes[$Item['Type']]['Type'] == 'ManyToOne')))
    518     {
    519       $Tabs[] = $Item['Caption'];
    520     }
    521     $Tabs[] = 'Vše';
    522     if (array_key_exists('tab', $_GET)) $TabIndex = $_GET['tab'];
    523       else $TabIndex = 0;
    524 
    525     $TabContent = '';
    526     $I = 0;
    527     foreach ($Form->Definition['Items'] as $Index => $Item)
    528     if ((array_key_exists($Item['Type'], $this->System->FormManager->FormTypes) and
    529     ($this->System->FormManager->FormTypes[$Item['Type']]['Type'] == 'ManyToOne')))
    530     {
    531       $TypeItem = $this->System->FormManager->FormTypes[$Item['Type']];
    532       if (($TabIndex == $I) or ($TabIndex == (count($Tabs) - 1)))
    533       {
    534         if ($TypeItem['Ref'] == null)
    535         {
    536           $Filter = $TypeItem['Filter'];
    537           $Filter = str_replace('#Id', $Id, $Filter);
    538           $TabContent .= $this->ShowList($TypeItem['Table'],
    539             $Filter, $Item['Caption']).'<br/>';
    540         } else $TabContent .= $this->ShowList($TypeItem['Table'], '`'.
    541           $TypeItem['Ref'].'`='.$Id, $Item['Caption'],
    542           $TypeItem['Ref'], $Id).'<br/>';
    543       }
    544       $I++;
    545     }
    546 
    547     $Output .= $this->ShowTabs($Tabs, 'tab', $TabContent);
     516    {
     517      if ((array_key_exists($Item['Type'], $this->System->FormManager->FormTypes) and
     518      ($this->System->FormManager->FormTypes[$Item['Type']]['Type'] == 'ManyToOne')))
     519      {
     520        $Tabs[] = $Item['Caption'];
     521      }
     522    }
     523    if (count($Tabs) > 0)
     524    {
     525      if (count($Tabs) > 1)
     526      {
     527        $Tabs[] = 'Vše';
     528      }
     529      if (array_key_exists('tab', $_GET))
     530      {
     531        $TabIndex = $_GET['tab'];
     532        if (($TabIndex < 0) or ($TabIndex >= count($Tabs)))
     533        {
     534          $TabIndex = 0;
     535        }
     536      } else $TabIndex = 0;
     537
     538      $TabContent = '';
     539      $I = 0;
     540      foreach ($Form->Definition['Items'] as $Index => $Item)
     541      if ((array_key_exists($Item['Type'], $this->System->FormManager->FormTypes) and
     542      ($this->System->FormManager->FormTypes[$Item['Type']]['Type'] == 'ManyToOne')))
     543      {
     544        $TypeItem = $this->System->FormManager->FormTypes[$Item['Type']];
     545        if (($TabIndex == $I) or ((count($Tabs) > 1) and ($TabIndex == (count($Tabs) - 1))))
     546        {
     547          if ($TypeItem['Ref'] == null)
     548          {
     549            $Filter = $TypeItem['Filter'];
     550            $Filter = str_replace('#Id', $Id, $Filter);
     551            $TabContent .= $this->ShowList($TypeItem['Table'],
     552              $Filter, $Item['Caption']).'<br/>';
     553          } else $TabContent .= $this->ShowList($TypeItem['Table'], '`'.
     554            $TypeItem['Ref'].'`='.$Id, $Item['Caption'],
     555            $TypeItem['Ref'], $Id).'<br/>';
     556        }
     557        $I++;
     558      }
     559
     560      $Output .= $this->ShowTabs($Tabs, 'tab', $TabContent);
     561    }
    548562    return $Output;
    549563  }
Note: See TracChangeset for help on using the changeset viewer.