Ignore:
Timestamp:
Mar 10, 2013, 8:15:46 PM (11 years ago)
Author:
chronos
Message:
  • Přidáno: FormManager pro objektové řešení zrušení vazeb na třídu System. FormManager nyní obsluhuje existující formulářové typy a třídy formulářů.
  • Přidáno: Formulářový typ FileContent zajistí načtení obsahu souboru. Typ File pak zajistí i uložení do databáze a přiřazení Id do tabulky File.
  • Odstraněno: Adresář docs obsahoval staré dokumenty. Ty musí být přesunuty do adresáře files a registrovány do databáze.
  • Upraveno: Třídy Database nyní bude hlásit chyby přes výjimky PHP.
File:
1 edited

Legend:

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

    r498 r501  
    11<?php
    22
    3 include_once('Common/Global.php');
     3include_once(dirname(__FILE__).'/../../Common/Global.php');
    44
    55class PageIS extends Page
     
    1111  function Show()
    1212  {
    13     global $FormClasses;
    14      
    1513    if(!$this->System->Modules['User']->CheckPermission('IS', 'Manage'))
    1614      return('Nemáte oprávnění');
     
    5553      if($_GET['o'] == 'save')
    5654      {
    57         $Form = new Form($Table);
     55        $Form = new Form($this->System->FormManager);
     56        $Form->SetClass($Table);
    5857        $Form->LoadValuesFromForm();
    5958        $Form->SaveValuesToDatabase($Id);
     
    6463    } else
    6564    {
    66       $Form = new Form($Table);
     65      $Form = new Form($this->System->FormManager);
     66      $Form->SetClass($Table);
    6767      $Form->LoadValuesFromDatabase($Id);
    6868      $Form->OnSubmit = '?a=edit&amp;o=save';
     
    9797      if($_GET['o'] == 'save')
    9898      {
    99         $Form = new Form($Table);
     99        $Form = new Form($this->System->FormManager);
     100        $Form->SetClass($Table);
    100101        $Form->LoadValuesFromForm();
    101102        $Form->SaveValuesToDatabase(0);
     
    111112    } else
    112113    {
    113       $Form = new Form($Table);
     114      $Form = new Form($this->System->FormManager);
     115      $Form->SetClass($Table);
    114116      $Form->OnSubmit = '?a=add&amp;o=save';
    115117      $Output .= $Form->ShowEditForm();
     
    124126  function ShowView($Table, $Id)
    125127  {
    126     global $FormTypes;
    127    
    128     $Form = new Form($Table);
     128    $Form = new Form($this->System->FormManager);
     129    $Form->SetClass($Table);
    129130    $Form->LoadValuesFromDatabase($Id);
    130131    $Form->OnSubmit = '?a=view';
     
    143144    // Show ManyToOne relations
    144145    foreach($Form->Definition['Items'] as $Index => $Item)
    145     if((array_key_exists($Item['Type'], $FormTypes) and ($FormTypes[$Item['Type']]['Type'] == 'ManyToOne')))
    146     {
    147       $Output .= $this->ShowList($FormTypes[$Item['Type']]['Table'], '`'.$FormTypes[$Item['Type']]['Ref'].'`='.$Id, $Item['Caption']).'<br/>';
     146    if((array_key_exists($Item['Type'], $this->System->FormManager->FormTypes) and
     147    ($this->System->FormManager->FormTypes[$Item['Type']]['Type'] == 'ManyToOne')))
     148    {
     149      $Output .= $this->ShowList($this->System->FormManager->FormTypes[$Item['Type']]['Table'], '`'.
     150        $this->System->FormManager->FormTypes[$Item['Type']]['Ref'].'`='.$Id, $Item['Caption']).'<br/>';
    148151    }   
    149152    return($Output);
     
    152155  function ShowList($Table, $Filter = '', $Title = '')
    153156  {   
    154     global $Type, $FormTypes, $FormClasses;
    155    
    156     if($Table != '') $FormClass = $FormClasses[$Table];
     157    if($Table != '') $FormClass = $this->System->FormManager->Classes[$Table];
    157158      else return($this->SystemMessage('Chyba', 'Tabulka nenalezena'));
    158159    if($Filter != '') $Filter = ' WHERE '.$Filter;
     
    166167   
    167168    foreach($FormClass['Items'] as $ItemIndex => $FormItem)
    168     if(!array_key_exists($FormItem['Type'], $FormTypes) or
    169       (array_key_exists($FormItem['Type'], $FormTypes) and ($FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne')))
     169    if(!array_key_exists($FormItem['Type'], $this->System->FormManager->Type) or
     170      (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and
     171      ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne')))
    170172      $TableColumns[] = array('Name' => $ItemIndex, 'Title' => $FormItem['Caption']);
    171173    $TableColumns[] = array('Name' => '', 'Title' => 'Akce');
     
    182184      $Output .= '<tr>';
    183185      foreach($FormClass['Items'] as $ItemIndex => $FormItem)
    184       if(!array_key_exists($FormItem['Type'], $FormTypes) or
    185       (array_key_exists($FormItem['Type'], $FormTypes) and ($FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne')))
     186      if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or
     187      (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and
     188      ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne')))
    186189      {
    187190        //$Output .= '<td>'.$Row[$ItemIndex].'</td>';
    188191        $UseType = $UseType = $FormItem['Type'];
    189         if(array_key_exists($FormItem['Type'], $FormTypes))
     192        if(array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes))
    190193        {
    191           if(!array_key_exists($FormItem['Type'], $this->System->Type->TypeDefinitionList))
    192             $this->System->Type->RegisterType($FormItem['Type'], '',
    193               $FormTypes[$FormItem['Type']]);
    194           if($FormTypes[$FormItem['Type']]['Type'] == 'Reference')
     194          if(!array_key_exists($FormItem['Type'], $this->System->FormManager->Type->TypeDefinitionList))
     195            $this->System->FormManager->Type->RegisterType($FormItem['Type'], '',
     196              $this->System->FormManager->FormTypes[$FormItem['Type']]);
     197          if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Reference')
    195198          $UseType = 'OneToMany';
    196199          else
    197           if($FormTypes[$FormItem['Type']]['Type'] == 'Enumeration')
     200          if($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] == 'Enumeration')
    198201          $UseType = 'Enumeration';
    199202        }
    200         $Row[$ItemIndex] = $this->System->Type->ExecuteTypeEvent($UseType, 'OnLoadDb',
     203        $Row[$ItemIndex] = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnLoadDb',
    201204          array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex,
    202205          'Type' => $FormItem['Type']));
    203         $Value = $this->System->Type->ExecuteTypeEvent($UseType, 'OnView',
     206        $Value = $this->System->FormManager->Type->ExecuteTypeEvent($UseType, 'OnView',
    204207          array('Value' => $Row[$ItemIndex], 'Name' => $ItemIndex,
    205208          'Type' => $FormItem['Type']));
Note: See TracChangeset for help on using the changeset viewer.