Changeset 42 for trunk/Base/Types


Ignore:
Timestamp:
Nov 24, 2009, 9:13:38 AM (15 years ago)
Author:
george
Message:
  • Upraveno: Přepracován základový webový systém
Location:
trunk/Base/Types
Files:
1 added
1 deleted
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/Base/Types/Base.php

    r40 r42  
    11<?php
    22
    3 class TypeBase extends Module
     3class TypeBase
    44{
     5  var $System;
    56  var $DatabaseCompareOperators = array();
     7
     8  function __construct($System)
     9  {
     10    $this->System = $System;
     11  }
    612
    713  function OnView($Item)
  • trunk/Base/Types/Boolean.php

    r40 r42  
    11<?php
     2
     3include_once(dirname(__FILE__).'/Base.php');
    24
    35class TypeBoolean extends TypeBase
     
    810  {
    911    if($Item['Value'] == 1) $Checked = ' checked="1"'; else $Checked = '';
    10     return('<input type="checkbox" name="'.$Item['Name'].'" disabled="1"'.$Checked.'>');
     12    return('<input type="checkbox" name="'.$Item['Name'].'" disabled="1"'.$Checked.'/>');
    1113  }
    1214
     
    1416  {
    1517    if($Item['Value'] == 1) $Checked = ' checked="1"'; else $Checked = '';
    16     return('<input type="checkbox" name="'.$Item['Name'].'"'.$Checked.'>');
     18    return('<input type="checkbox" name="'.$Item['Name'].'"'.$Checked.'/>');
    1719  }
    1820
  • trunk/Base/Types/Date.php

    r40 r42  
    11<?php
     2
     3include_once(dirname(__FILE__).'/Base.php');
    24
    35class TypeDate extends TypeBase
  • trunk/Base/Types/DateTime.php

    r40 r42  
    11<?php
     2
     3include_once(dirname(__FILE__).'/Base.php');
    24
    35class TypeDateTime extends TypeBase
  • trunk/Base/Types/Enumeration.php

    r40 r42  
    11<?php
     2
     3include_once(dirname(__FILE__).'/Base.php');
    24
    35class TypeEnumeration extends TypeBase
     
    57  function OnView($Item)
    68  {
    7     $Type = GetTypeDefinition($Item['Type']);
    8     $Output = $Type['Parameters'][$Item['Value']];
     9    $Type = $this->System->Type->GetTypeDefinition($Item['Type']);
     10    if(array_key_exists($Item['Value'], $Type['Parameters']))
     11      $Output = $Type['Parameters'][$Item['Value']];
     12      else $Output = $Item['Value'];
    913    return($Output);
    1014  }
     
    1216  function OnEdit($Item)
    1317  {
    14     $Type = GetTypeDefinition($Item['Type']);
     18    $Type = $this->System->Type->GetTypeDefinition($Item['Type']);
    1519    $Output = '<select name="'.$Item['Name'].'">';
    1620    foreach($Type['Parameters'] as $Index => $StateName)
  • trunk/Base/Types/Float.php

    r40 r42  
    11<?php
     2
     3include_once(dirname(__FILE__).'/Base.php');
    24
    35class TypeFloat extends TypeBase
     
    1315  function OnEdit($Item)
    1416  {
    15     $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'">';
     17    $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'"/>';
    1618    return($Output);
    1719  }
  • trunk/Base/Types/GPS.php

    r40 r42  
    11<?php
     2
     3include_once(dirname(__FILE__).'/Base.php');
    24
    35class TypeGPS extends TypeBase
     
    3133    } else $DbRow = array('Longitude' => 0, 'Latitude' => 0);
    3234    $Value = $this->Explode($DbRow['Latitude']);
    33     $Output = '<input type="text" size="3" name="'.$Item['Name'].'-lat-deg" value="'.$Value[0].'">°';
    34     $Output .= '<input type="text" size="3" name="'.$Item['Name'].'-lat-min" value="'.$Value[1].'">\'';
    35     $Output .= '<input type="text" size="3" name="'.$Item['Name'].'-lat-sec" value="'.$Value[2].'">"<br />';
     35    $Output = '<input type="text" size="3" name="'.$Item['Name'].'-lat-deg" value="'.$Value[0].'"/>°';
     36    $Output .= '<input type="text" size="3" name="'.$Item['Name'].'-lat-min" value="'.$Value[1].'"/>\'';
     37    $Output .= '<input type="text" size="3" name="'.$Item['Name'].'-lat-sec" value="'.$Value[2].'"/>"<br />';
    3638    $Value = $this->Explode($DbRow['Longitude']);
    37     $Output .= '<input type="text" size="3" name="'.$Item['Name'].'-lon-deg" value="'.$Value[0].'">°';
    38     $Output .= '<input type="text" size="3" name="'.$Item['Name'].'-lon-min" value="'.$Value[1].'">\'';
    39     $Output .= '<input type="text" size="3" name="'.$Item['Name'].'-lon-sec" value="'.$Value[2].'">"';
     39    $Output .= '<input type="text" size="3" name="'.$Item['Name'].'-lon-deg" value="'.$Value[0].'"/>°';
     40    $Output .= '<input type="text" size="3" name="'.$Item['Name'].'-lon-min" value="'.$Value[1].'"/>\'';
     41    $Output .= '<input type="text" size="3" name="'.$Item['Name'].'-lon-sec" value="'.$Value[2].'"/>"';
    4042    return($Output);
    4143  }
  • trunk/Base/Types/Hidden.php

    r40 r42  
    11<?php
     2
     3include_once(dirname(__FILE__).'/Base.php');
    24
    35class TypeHidden extends TypeBase
     
    1113  function OnEdit($Item)
    1214  {
    13     $Output = '<input type="hidden" name="'.$Item['Name'].'" value="'.$Item['Value'].'">';
     15    $Output = '<input type="hidden" name="'.$Item['Name'].'" value="'.$Item['Value'].'" />';
    1416    return($Output);
    1517  }
  • trunk/Base/Types/Hyperlink.php

    r40 r42  
    11<?php
     2
     3include_once(dirname(__FILE__).'/Base.php');
    24
    35class TypeHyperlink extends TypeBase
     
    1113  function OnEdit($Item)
    1214  {
    13     $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'">';
     15    $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'"/>';
    1416    return($Output);
    1517  }
  • trunk/Base/Types/IPv4Address.php

    r40 r42  
    11<?php
     2
     3include_once(dirname(__FILE__).'/Base.php');
    24
    35class TypeIPv4Address extends TypeBase
     
    1113  function OnEdit($Item)
    1214  {
    13     $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'">';
     15    $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'"/>';
    1416    return($Output);
    1517  }
  • trunk/Base/Types/Integer.php

    r40 r42  
    11<?php
     2
     3include_once(dirname(__FILE__).'/Base.php');
    24
    35class TypeInteger extends TypeBase
     
    1315  function OnEdit($Item)
    1416  {
    15     $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'">';
     17    $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'"/>';
    1618    return($Output);
    1719  }
  • trunk/Base/Types/Password.php

    r40 r42  
    22
    33// SHA1 hash used
     4
     5include_once(dirname(__FILE__).'/Base.php');
    46
    57class TypePassword extends TypeBase
     
    1517  function OnEdit($Item)
    1618  {
    17     $Output = '<input type="password" name="'.$Item['Name'].'" value="">';
     19    $Output = '<input type="password" name="'.$Item['Name'].'" value=""/>';
    1820    return($Output);
    1921  }
  • trunk/Base/Types/PointerOneToMany.php

    r40 r42  
    11<?php
     2
     3include_once(dirname(__FILE__).'/Base.php');
    24
    35class TypePointerOneToMany extends TypeBase
  • trunk/Base/Types/PointerOneToOne.php

    r40 r42  
    11<?php
     2
     3include_once(dirname(__FILE__).'/Base.php');
    24
    35class TypePointerOneToOne extends TypeBase
     
    57  function OnView($Item)
    68  {
    7     global $TypeDefinitionList;
    8 
    9     $Type = $TypeDefinitionList[$Item['Type']];
    10     $DbResult = $this->Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name FROM `'.$Type['Parameters']['Table'].'` WHERE `'.$Type['Parameters']['Id'].'`='.$Item['Value']);
     9    $Type = $this->System->Type->TypeDefinitionList[$Item['Type']];
     10    $DbResult = $this->System->Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name FROM `'.$Type['Parameters']['Table'].'` WHERE `'.$Type['Parameters']['Id'].'`='.$Item['Value']);
    1111    $DbRow = $DbResult->fetch_assoc();
    12     $Output = $DbRow['Name'];
    13    
    14 /*    $Type = GetTypeDefinition($Item['Type']);
    15     $List = GetListDefinition($Type['Parameters'][0]);
    16     $TargetTable = $Type['Parameters'][0];
    17     $TargetName = $this->GetTablePointerName($Type, $Item);
    18     if($TargetName != '') $Output = '<a href="?Action=ViewItem&amp;Table='.$TargetTable.'&amp;Item='.$TargetName[$List['IdName']].'">'.$TargetName['Name'].'</a>';
    19     else $Output = '';
    20     */
     12    if($this->System->Modules['Permission']->Check('Corporation', 'Show'))
     13      $Output = $this->System->HTML->MakeLink($DbRow['Name'], $this->System->MakeLink($Type['Parameters']['Table'], 'Show', array('Id' => $Item['Value'])));
     14      else $Output = $DbRow['Name'];
    2115    return($Output);
    2216  }
     
    2418  function OnEdit($Item)
    2519  {
    26     global $TypeDefinitionList;
    27 
    2820    $Output = '<select name="'.$Item['Name'].'">';
    29     $Type = $TypeDefinitionList[$Item['Type']];
     21    $Type = $this->System->Type->TypeDefinitionList[$Item['Type']];
    3022    if(array_key_exists('Condition', $Type['Parameters'])) $Where = ' WHERE '.$Type['Parameters']['Condition'];
    3123      else $Where = '';
    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');
     24    $DbResult = $this->System->Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name,'.$Type['Parameters']['Id'].' AS Id FROM `'.$Type['Parameters']['Table'].'`'.$Where.' ORDER BY Name DESC');
    3325    while($DbRow = $DbResult->fetch_assoc())
    3426    {
  • trunk/Base/Types/String.php

    r40 r42  
    11<?php
     2
     3include_once(dirname(__FILE__).'/Base.php');
    24
    35class TypeString extends TypeBase
     
    1315  function OnEdit($Item)
    1416  {
    15     $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'">';
     17    $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'"/>';
    1618    return($Output);
    1719  }
  • trunk/Base/Types/Text.php

    r40 r42  
    11<?php
     2
     3include_once(dirname(__FILE__).'/Base.php');
    24
    35class TypeText extends TypeBase
  • trunk/Base/Types/Time.php

    r40 r42  
    11<?php
     2
     3include_once(dirname(__FILE__).'/Base.php');
    24
    35class TypeTime extends TypeBase
Note: See TracChangeset for help on using the changeset viewer.