Ignore:
Timestamp:
Apr 14, 2020, 11:13:32 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved code formatting.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/Form/Types/OneToMany.php

    r1 r7  
    1010  {
    1111    $Type = $this->FormManager->Type->TypeDefinitionList[$Item['Type']];
    12     if($Item['Value'] != '')
     12    if ($Item['Value'] != '')
    1313    {
    1414      $Output = '<a href="?t='.$Type['Parameters']['Table'].'&amp;a='.
    1515        'view'.'&amp;i='.$Item['Value'].'">'.$Item['Filter'].'</a>';
    1616    } else $Output = '';
    17     return($Output);
     17    return $Output;
    1818  }
    1919
     
    2222    $Output = '<select name="'.$Item['Name'].'" id="'.$Item['Name'].'">';
    2323    $Type = $this->FormManager->Type->TypeDefinitionList[$Item['Type']];
    24     if(array_key_exists('Condition', $Type['Parameters'])) $Where = ' WHERE '.$Type['Parameters']['Condition'];
     24    if (array_key_exists('Condition', $Type['Parameters'])) $Where = ' WHERE '.$Type['Parameters']['Condition'];
    2525      else $Where = '';
    26     if(array_key_exists('Null', $Item) and $Item['Null'])
     26    if (array_key_exists('Null', $Item) and $Item['Null'])
    2727    {
    28       if($Item['Value'] == NULL) $Selected = ' selected="1"'; else $Selected = '';
     28      if ($Item['Value'] == NULL) $Selected = ' selected="1"'; else $Selected = '';
    2929      $Output .= '<option value=""'.$Selected.'></option>';
    3030    }
    31     if(array_key_exists('View', $Type['Parameters'])) $Table = $Type['Parameters']['View'];
     31    if (array_key_exists('View', $Type['Parameters'])) $Table = $Type['Parameters']['View'];
    3232      else $Table = $Type['Parameters']['Table'];
    3333    $DbResult = $this->Database->query('SELECT '.$Type['Parameters']['Name'].' AS `Name`,'.$Type['Parameters']['Id'].' AS `Id` FROM '.$Table.''.$Where.' ORDER BY `Name`');
    34     while($DbRow = $DbResult->fetch_assoc())
     34    while ($DbRow = $DbResult->fetch_assoc())
    3535    {
    36       if($Item['Value'] == $DbRow['Id']) $Selected = ' selected="1"'; else $Selected = '';
     36      if ($Item['Value'] == $DbRow['Id']) $Selected = ' selected="1"'; else $Selected = '';
    3737      $Output .= '<option value="'.$DbRow['Id'].'"'.$Selected.'>'.$DbRow['Name'].'</option>';
    3838    }
    3939    $Output .= '</select>';
    40     if($this->FormManager->ShowRelation)
     40    if ($this->FormManager->ShowRelation)
    4141    {
    4242      $URL = '';
    43       if(array_key_exists('OnPreset', $Item))
     43      if (array_key_exists('OnPreset', $Item))
    4444      {
    4545        $Preset = call_user_func($Item['OnPreset'], $Item['Values']);
     
    5151        'onclick="return popupwindow(&quot;'.$this->FormManager->Root.'/is/?a=select&amp;t='.$Table.'&amp;r='.$Item['Name'].'&quot;,&quot;test&quot;);" style="cursor:hand;cursor:pointer"/>';
    5252    }
    53     return($Output);
     53    return $Output;
    5454  }
    5555
    5656  function OnLoad($Item)
    5757  {
    58     if($_POST[$Item['Name']] == '') return(NULL);
    59       else return($_POST[$Item['Name']]);
     58    if ($_POST[$Item['Name']] == '') return NULL;
     59      else return $_POST[$Item['Name']];
    6060  }
    6161
    6262  function OnLoadDb($Item)
    6363  {
    64     if($Item['Value'] == '') return(NULL);
    65       else return($Item['Value']);
     64    if ($Item['Value'] == '') return NULL;
     65      else return $Item['Value'];
    6666  }
    6767
    6868  function OnFilterName($Item)
    6969  {
    70     return('`'.$Item['Name'].'_Filter`');
     70    return '`'.$Item['Name'].'_Filter`';
    7171  }
    7272
     
    7474  {
    7575    $Type = $this->FormManager->Type->TypeDefinitionList[$Item['Type']];
    76     //if($Item['Value'] != '')
     76    //if ($Item['Value'] != '')
    7777    //{
    78       if(array_key_exists('View', $Type['Parameters'])) $Table = $Type['Parameters']['View'];
     78      if (array_key_exists('View', $Type['Parameters'])) $Table = $Type['Parameters']['View'];
    7979        else $Table = $Type['Parameters']['Table'];
    8080      $Output = '`'.$Item['Name'].'`, (SELECT '.$Type['Parameters']['Name'].''.
     
    8282        $Type['Parameters']['Id'].'`=`TX`.`'.$Item['Name'].'`) AS `'.$Item['Name'].'_Filter`';
    8383    //} else $Output = '`'.$Item['Name'].'`, `'.$Item['Name'].'` AS `'.$Item['Name'].'_Filter`';
    84     return($Output);
     84    return $Output;
    8585  }
    8686}
Note: See TracChangeset for help on using the changeset viewer.