Changeset 71 for trunk/www/Base


Ignore:
Timestamp:
Aug 23, 2009, 6:14:01 PM (15 years ago)
Author:
george
Message:
  • Upraveno: Znovu zprovozněny třídy HomePage, Server a User.
Location:
trunk/www/Base
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/Base/Form.php

    r69 r71  
    11<?php
    22
    3 class Form
     3class Form extends Module
    44{
    55  var $Definition = array();
     
    77  var $OnSubmit = '';
    88 
    9   function __construct($FormClass)
     9  function __construct($System, $FormClass)
    1010  { 
    1111    $this->Definition = $FormClass;
     
    1414      $this->Values[$Index] = '';
    1515    }   
     16    $this->System = $System;
     17    $this->Database = $System->Database;
     18    $this->Config = $System->Config;
    1619  }
    1720
     
    2427  function ShowTableBlock($Context = '')
    2528  {
    26     global $Database, $FormTypes;
     29    global $FormTypes;
    2730
    2831    $Table = array(
     
    4144      }
    4245    }
    43     $Output = '<div style="text-align: center">'.$this->Definition['Title'].'</div>'.Table($Table, 'WideTable');
     46    $Html = new Html();
     47    $Output = '<div style="text-align: center">'.$this->Definition['Title'].'</div>'.$Html->Table($Table, 'WideTable');
    4448    return($Output);
    4549  }
     
    5458  function ShowEditBlock($Context = '')
    5559  {
    56     global $Database, $FormTypes;
     60    global $FormTypes;
    5761
    5862    $Table = array(
     
    7074      }
    7175    }
    72     $Output = '<fieldset><legend>'.$this->Definition['Title'].'</legend>'.Table($Table, 'BasicTable').
     76    $Html = new Html();
     77    $Output = '<fieldset><legend>'.$this->Definition['Title'].'</legend>'.$Html->Table($Table, 'BasicTable').
    7378    '</fieldset>';
    7479    foreach($this->Definition['Items'] as $Index => $Item)
     
    7984  function LoadValuesFromDatabase($Id)
    8085  {
    81     global $Database;
    82 
    83     $DbResult = $Database->query('SELECT T.* FROM '.$this->Definition['Table'].' AS T WHERE T.Id='.$Id);
     86    $DbResult = $this->Database->query('SELECT T.* FROM '.$this->Definition['Table'].' AS T WHERE T.Id='.$Id);
    8487    if($DbResult->num_rows > 0) $DbRow = $DbResult->fetch_assoc();
    8588    foreach($this->Definition['Items'] as $Index => $Item)
     
    9497  function SaveValuesToDatabase($Id)
    9598  {
    96     global $Database;
    97 
    9899    if($Id == 0)
    99100    {
    100101      $this->Values['Id'] = $Id;
    101       $DbResult = $Database->replace($this->Definition['Table'], $this->Values);
     102      $DbResult = $this->Database->replace($this->Definition['Table'], $this->Values);
    102103    } else
    103     $DbResult = $Database->update($this->Definition['Table'], 'Id='.$Id, $this->Values);
     104    $DbResult = $this->Database->update($this->Definition['Table'], 'Id='.$Id, $this->Values);
    104105  }
    105106
  • trunk/www/Base/Html.php

    r69 r71  
    11<?php
    22
    3 class HTML extends Module
     3class HTML
    44{
    55  function ShowArray($Value)
  • trunk/www/Base/Table.php

    r69 r71  
    5757      'Rows' => $this->Values,
    5858    );
    59     $Output = Table($Table, 'WideTable');
    60     $Output .= '<div class="Pager">'.PageList('Page', $this->Page, $this->TotalRowCount, $Config['Web']['TableRowPerPage']).'</div>';
     59    $Html = new Html();
     60    $Output = $Html->Table($Table, 'WideTable');
     61    $Output .= '<div class="Pager">'.$Html->PageList('Page', $this->Page, $this->TotalRowCount, $Config['Web']['TableRowPerPage']).'</div>';
    6162    return($Output);
    6263  } 
  • trunk/www/Base/Types/Base.php

    r69 r71  
    11<?php
    22
    3 class TypeBase
     3class TypeBase extends Module
    44{
    55  var $DatabaseCompareOperators = array();
  • trunk/www/Base/Types/Include.php

    r69 r71  
    4242function ExecuteTypeEvent($TypeName, $Event, $Parameters = array())
    4343{
    44   global $TypeDefinitionList;
     44  global $TypeDefinitionList, $System;
    4545 
    4646  if(array_key_exists($TypeName, $TypeDefinitionList))
     
    4848    $Type = $TypeDefinitionList[$TypeName];
    4949    $TypeClass = 'Type'.$Type['Class'];
    50     $TypeObject = new $TypeClass;
     50    $TypeObject = new $TypeClass($System);
    5151    if(is_callable(array($TypeObject, $Event))) return($TypeObject->$Event($Parameters));
    5252      else return($TypeName.'->'.$Event.'('.serialize($Parameters).')');
  • trunk/www/Base/Types/PointerOneToOne.php

    r69 r71  
    55  function OnView($Item)
    66  {
    7     global $Database, $TypeDefinitionList;
     7    global $TypeDefinitionList;
    88
    99    $Type = $TypeDefinitionList[$Item['Type']];
    10     $DbResult = $Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name FROM `'.$Type['Parameters']['Table'].'` WHERE `'.$Type['Parameters']['Id'].'`='.$Item['Value']);
     10    $DbResult = $this->Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name FROM `'.$Type['Parameters']['Table'].'` WHERE `'.$Type['Parameters']['Id'].'`='.$Item['Value']);
    1111    $DbRow = $DbResult->fetch_assoc();
    1212    $Output = $DbRow['Name'];
     
    2424  function OnEdit($Item)
    2525  {
    26     global $Database, $TypeDefinitionList;
     26    global $TypeDefinitionList;
    2727
    2828    $Output = '<select name="'.$Item['Name'].'">';
     
    3030    if(array_key_exists('Condition', $Type['Parameters'])) $Where = ' WHERE '.$Type['Parameters']['Condition'];
    3131      else $Where = '';
    32     $DbResult = $Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name,'.$Type['Parameters']['Id'].' AS Id FROM `'.$Type['Parameters']['Table'].'`'.$Where.' ORDER BY Name DESC');
     32    $DbResult = $this->Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name,'.$Type['Parameters']['Id'].' AS Id FROM `'.$Type['Parameters']['Table'].'`'.$Where.' ORDER BY Name DESC');
    3333    while($DbRow = $DbResult->fetch_assoc())
    3434    {
Note: See TracChangeset for help on using the changeset viewer.