Ignore:
Timestamp:
Apr 23, 2013, 10:49:05 PM (12 years ago)
Author:
chronos
Message:
  • Opraveno: Ve správce dat se nyní hodnoty položek z URL nepamatují, ale musí být nastaveny v každém URL.
File:
1 edited

Legend:

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

    r529 r530  
    1515    if(!$this->System->User->CheckPermission('IS', 'Manage'))
    1616      return('Nemáte oprávnění');
    17 
    18     $DbResult = $this->Database->query('SELECT `MenuItem`.`Id`, `MenuItem`.`Name`, `MenuItem`.`Parent`, `Action`.`URL` AS `URL`, `ActionIcon`.`Name` AS `IconName`  FROM `MenuItem` '.
    19       'LEFT JOIN `Action` ON `Action`.`Id` = `MenuItem`.`Action` '.
    20       'LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '.
    21       'ORDER BY `MenuItem`.`Parent`,`MenuItem`.`Name`');
    22     while($DbRow = $DbResult->fetch_assoc())
    23     {
    24       $this->MenuItems[$DbRow['Id']] = $DbRow;
    25     }   
    26    
    27     if(array_key_exists('t', $_GET)) $_SESSION['Table'] = $_GET['t'];
    28     if(array_key_exists('a', $_GET)) $_SESSION['Action'] = $_GET['a'];
    29     if(array_key_exists('id', $_GET)) $_SESSION['Id'] = $_GET['id'];
    30     if(array_key_exists('r', $_GET)) $_SESSION['Ref'] = $_GET['r'];
    31    
    32     if(!array_key_exists('Action', $_SESSION)) $_SESSION['Action'] = 'list';
    33     if(!array_key_exists('Id', $_SESSION) or !array_key_exists('Table', $_SESSION) or
    34     ($_SESSION['Table'] == '')) {
    35       $_SESSION['Id'] = 0;
    36       $_SESSION['Action'] = '';
    37       $_SESSION['Table'] = '';
    38       $_SESSION['Ref'] = '';
    39     }
    40    
    41     if($_SESSION['Action'] == 'list') $Content = $this->ShowList($_SESSION['Table']);
    42     else if($_SESSION['Action'] == 'select') $Content = $this->ShowSelect($_SESSION['Table']);
    43     else if($_SESSION['Action'] == 'edit') $Content = $this->ShowEdit($_SESSION['Table'], $_SESSION['Id']);
    44     else if($_SESSION['Action'] == 'add') $Content = $this->ShowAdd($_SESSION['Table']);
    45     else if($_SESSION['Action'] == 'view') $Content = $this->ShowView($_SESSION['Table'], $_SESSION['Id']);
    46     else if($_SESSION['Action'] == 'delete') $Content = $this->ShowDelete($_SESSION['Table'], $_SESSION['Id']);
     17   
     18    if(array_key_exists('a', $_GET)) $Action = $_GET['a'];
     19      else $Action = '';
     20    if(array_key_exists('t', $_GET)) $Table = $_GET['t'];
     21      else $Table = '';
     22    if(array_key_exists('i', $_GET)) $ItemId = $_GET['i'];
     23      else $ItemId = 0;
     24   
     25    if($Action == 'list') $Content = $this->ShowList($Table);
     26    else if($Action == 'select') $Content = $this->ShowSelect($Table);
     27    else if($Action == 'edit') $Content = $this->ShowEdit($Table, $ItemId);
     28    else if($Action == 'add') $Content = $this->ShowAdd($Table);
     29    else if($Action == 'view') $Content = $this->ShowView($Table, $ItemId);
     30    else if($Action == 'delete') $Content = $this->ShowDelete($Table, $ItemId);
    4731    else $Content = '';
    4832    if($this->HideMenu == false)
    4933    {
    5034      $Output = '<table style="width: 100%"><tr><td style="width: 20%; vertical-align: top;">';
    51       $Output .= '<strong>Nabídka:</strong><br/>'.$this->ShowMenuItem('');
     35      $Output .= '<strong>Nabídka:</strong>'.$this->ShowMenuItem('');
    5236      $Output .= '</td><td style="width: 80%; vertical-align: top;">';
    5337      $Output .= $Content;
     
    7054        $Form->SaveValuesToDatabase($Id);
    7155        $Output .= $this->SystemMessage('Úprava položky', 'Položka upravena');
    72         $_SESSION['Action'] = 'view';
    7356        $Output .= $this->ShowView($Table, $Id);   
    7457      }
     
    8568      $Output .= '<li><a href="?a=list&amp;t='.$Table.'"><img alt="Seznam" title="Seznam" src="'.
    8669        $this->System->Link('/images/list.png').'"/>Seznam</a></li>';
    87       $Output .= '<li><a href="?a=delete&amp;t='.$Table.'" onclick="return confirmAction(\'Opravdu smazat položku?\');"><img alt="Odstranit" title="Odstranit" src="'.
     70      $Output .= '<li><a href="?a=delete&amp;t='.$Table.'&amp;i='.$Id.'" onclick="return confirmAction(\'Opravdu smazat položku?\');"><img alt="Odstranit" title="Odstranit" src="'.
    8871        $this->System->Link('/images/delete.png').'"/>Odstranit</a></li>';
    8972      $Output .= '</ul>';
     
    9780    $this->Database->delete($Table, 'Id='.$Id);
    9881    $Output .= $this->SystemMessage('Odstranění položky', 'Položka odstraněna');
    99     $_SESSION['Action'] = 'list';
    10082    $Output .= $this->ShowList($Table);   
    10183    return($Output);
     
    11496        $Form->SaveValuesToDatabase(0);
    11597        $Output .= $this->SystemMessage('Přidání položky', 'Nová položka vytvořena');
    116         $_SESSION['Action'] = 'view';
    11798        $Id = $this->Database->insert_id;
    118         $_SESSION['Id'] = $Id;
    11999        //$this->Database->update($Table, 'Id='.$Id,
    120100        //  array('UserCreate' => $this->System->User->User['Id'],
     
    147127    $Output = $Form->ShowViewForm();
    148128    $Output .= '<ul class="ActionMenu">';
    149     $Output .= '<li><a href="?a=edit"><img alt="Upravit" title="Upravit" src="'.
     129    $Output .= '<li><a href="?a=edit&amp;t='.$Table.'&amp;i='.$Id.'"><img alt="Upravit" title="Upravit" src="'.
    150130      $this->System->Link('/images/edit.png').'"/>Upravit</a></li>';
    151     $Output .= '<li><a href="?a=list"><img alt="Seznam" title="Seznam" src="'.
     131    $Output .= '<li><a href="?a=list&amp;t='.$Table.'"><img alt="Seznam" title="Seznam" src="'.
    152132      $this->System->Link('/images/list.png').'"/>Seznam</a></li>';
    153     $Output .= '<li><a href="?a=delete" onclick="return confirmAction(\'Opravdu smazat položku?\');"><img alt="Odstranit" title="Odstranit" src="'.
     133    $Output .= '<li><a href="?a=delete&amp;t='.$Table.'&amp;i='.$Id.'" onclick="return confirmAction(\'Opravdu smazat položku?\');"><img alt="Odstranit" title="Odstranit" src="'.
    154134      $this->System->Link('/images/delete.png').'" />Odstranit</a></li>';
    155     $Output .= '<li><a href="?a=add"><img alt="Přidat" title="Přidat" src="'.
     135    $Output .= '<li><a href="?a=add&amp;t='.$Table.'"><img alt="Přidat" title="Přidat" src="'.
    156136      $this->System->Link('/images/add.png').'"/>Přidat</a></li>';
    157137    if(array_key_exists('ItemActions', $FormClass))
    158138    {
    159139      foreach($FormClass['ItemActions'] as $Action)
    160         $Output .= '<li><a href="'.$this->System->Link($Action['URL']).'&amp;id='.$Id.'"><img alt="'.$Action['Caption'].'" title="'.$Action['Caption'].'" src="'.
     140        $Output .= '<li><a href="'.$this->System->Link($Action['URL']).'&amp;i='.$Id.'"><img alt="'.$Action['Caption'].'" title="'.$Action['Caption'].'" src="'.
    161141            $this->System->Link('/images/action.png').'"/>'.$Action['Caption'].'</a></li>';
    162142    } 
     
    268248        $Output .= '<td>'.$Value.'</td>';
    269249      }
    270       $Output .= '<td><a href="javascript:window.close();" onclick="set_return('.$Row['Id'].',&quot;'.$_SESSION['Ref'].'&quot;);"><img alt="Vybrat" title="Vybrat" src="'.
     250      $Output .= '<td><a href="javascript:window.close();" onclick="set_return('.$Row['Id'].',&quot;'.$_GET['r'].'&quot;);"><img alt="Vybrat" title="Vybrat" src="'.
    271251        $this->System->Link('/images/select.png').'"/></a>';
    272252      $Output .= '</td></tr>';
     
    320300   
    321301    // Show search fields
    322     $Output .= '<tr><form action="?a=list&amp;filter=1" method="post">';
     302    $Output .= '<tr><form action="?a=list&amp;t='.$Table.'&amp;filter=1" method="post">';
    323303    foreach($FormClass['Items'] as $ItemIndex => $FormItem)
    324304      if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or
     
    366346        $Output .= '<td>'.$Value.'</td>';
    367347      }
    368       $Output .= '<td><a href="?a=view&amp;t='.$Table.'&amp;id='.$Row['Id'].'"><img alt="Ukázat" title="Ukázat" src="'.
     348      $Output .= '<td><a href="?a=view&amp;t='.$Table.'&amp;i='.$Row['Id'].'"><img alt="Ukázat" title="Ukázat" src="'.
    369349        $this->System->Link('/images/view.png').'"/></a>'.
    370         '<a href="?a=edit&amp;t='.$Table.'&amp;id='.$Row['Id'].'"><img alt="Upravit" title="Upravit" src="'.
     350        '<a href="?a=edit&amp;t='.$Table.'&amp;i='.$Row['Id'].'"><img alt="Upravit" title="Upravit" src="'.
    371351        $this->System->Link('/images/edit.png').'"/></a>'.
    372         '<a href="?a=delete&amp;t='.$Table.'&amp;id='.$Row['Id'].'"><img alt="Smazat" title="Smazat" src="'.
     352        '<a href="?a=delete&amp;t='.$Table.'&amp;i='.$Row['Id'].'"><img alt="Smazat" title="Smazat" src="'.
    373353        $this->System->Link('/images/delete.png').'" onclick="return confirmAction(\'Opravdu smazat položku?\');"/></a>';
    374354      if(array_key_exists('ItemActions', $FormClass))
    375355      {
    376356        foreach($FormClass['ItemActions'] as $Action)
    377           $Output .= '<a href="'.$this->System->Link($Action['URL']).'&amp;id='.$Row['Id'].'"><img alt="'.$Action['Caption'].'" title="'.$Action['Caption'].'" src="'.
     357          $Output .= '<a href="'.$this->System->Link($Action['URL']).'&amp;i='.$Row['Id'].'"><img alt="'.$Action['Caption'].'" title="'.$Action['Caption'].'" src="'.
    378358            $this->System->Link('/images/action.png').'"/></a>';
    379359      }
     
    399379  function ShowMenuItem($Parent)
    400380  {
     381    $DbResult = $this->Database->query('SELECT `MenuItem`.`Id`, `MenuItem`.`Name`, `MenuItem`.`Parent`, `Action`.`URL` AS `URL`, `ActionIcon`.`Name` AS `IconName`  FROM `MenuItem` '.
     382      'LEFT JOIN `Action` ON `Action`.`Id` = `MenuItem`.`Action` '.
     383      'LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '.
     384      'ORDER BY `MenuItem`.`Parent`,`MenuItem`.`Name`');
     385    while($DbRow = $DbResult->fetch_assoc())
     386    {
     387      $this->MenuItems[$DbRow['Id']] = $DbRow;
     388    }   
     389   
    401390    $Output = '<ul style="list-style: none; margin-left:1em; padding-left:0em;">';
    402391    foreach($this->MenuItems as $MenuItem)
Note: See TracChangeset for help on using the changeset viewer.