Ignore:
Timestamp:
Nov 24, 2009, 9:13:38 AM (14 years ago)
Author:
george
Message:
  • Upraveno: Přepracován základový webový systém
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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    {
Note: See TracChangeset for help on using the changeset viewer.