Ignore:
Timestamp:
Apr 14, 2013, 9:04:17 PM (11 years ago)
Author:
chronos
Message:
  • Upraveno: Finance přepracovány na aplikační modul. Upraveny URL adresy stránek.
  • Přidáno: Slučování registrovaných stránek do stromu stránek. Registgrovat lze nyní také pomocí cesty jako pole adresářů URL.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Global.php

    r518 r521  
    2222include_once(dirname(__FILE__).'/Page.php');
    2323include_once(dirname(__FILE__).'/Form/Form.php');
    24 include_once(dirname(__FILE__).'/../finance/bills.php');
    25 include_once(dirname(__FILE__).'/../finance/finance.php');
    2624include_once(dirname(__FILE__).'/../form_classes.php');
    2725
     
    7068  function RegisterPage($Path, $Handler)
    7169  {
    72     $this->Pages[$Path] = $Handler;
     70    if(is_array($Path))
     71    {
     72      $Page = &$this->Pages;
     73      $LastKey = array_pop($Path);
     74      foreach($Path as $PathItem)
     75      {
     76        $Page = &$Page[$PathItem];       
     77      }
     78      if(!is_array($Page)) $Page = array('' => $Page);
     79      $Page[$LastKey] = $Handler;
     80    } else $this->Pages[$Path] = $Handler;
    7381  }
    7482 
    7583  function SearchPage($PathItems, $Pages)
    7684  {
    77     $PathItem = $PathItems[0];
     85    if(count($PathItems) > 0) $PathItem = $PathItems[0];
     86      else $PathItem = '';
    7887    if(array_key_exists($PathItem, $Pages))
    7988    {
     
    8695  }
    8796 
     97  function PageNotFound()
     98  {
     99    return('Page '.implode('/', $this->PathItems).' not found.');
     100  }
     101 
    88102  function ShowPage()
    89103  {
     
    96110      $Page->Database = &$this->Database;
    97111      $Page->GetOutput();
    98     } else echo('Page '.implode('/', $this->PathItems).' not found.');
     112    } else echo($this->PageNotFound());
    99113  }
    100114 
Note: See TracChangeset for help on using the changeset viewer.