Ignore:
Timestamp:
Apr 6, 2020, 11:17:40 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved code format.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/VCL/General.php

    r693 r873  
    88  //echo($Name.',');
    99  $Result = '';
    10   if($Persistent)
    11     if(array_key_exists($Name, $_SESSION)) $Result = $_SESSION[$Name];
    12   if(array_key_exists($Name, $_GET))
     10  if ($Persistent)
     11    if (array_key_exists($Name, $_SESSION)) $Result = $_SESSION[$Name];
     12  if (array_key_exists($Name, $_GET))
    1313  {
    1414    $Result = $_GET[$Name];
    15     if($Persistent) $_SESSION[$Name] = $Result;
    16   }
    17   return($Result);
     15    if ($Persistent) $_SESSION[$Name] = $Result;
     16  }
     17  return ($Result);
    1818}
    1919
     
    3434    $Output = '';
    3535    //$Output .= '#'.$this->Id;
    36     return($Output);
     36    return ($Output);
    3737  }
    3838
     
    4848  function Show()
    4949  {
    50     if($this->Visible)
     50    if ($this->Visible)
    5151    {
    5252      $Output = parent::Show();
    53       foreach($this->Items as $Item)
     53      foreach ($this->Items as $Item)
    5454        $Output .= $Item->Show();
    55       return($Output);
    56     }
    57   }
    58 
    59   function Prepare()
    60   {
    61     foreach($this->Items as $Item)
     55      return ($Output);
     56    }
     57  }
     58
     59  function Prepare()
     60  {
     61    foreach ($this->Items as $Item)
    6262      $Item->Prepare();
    6363  }
     
    7070  function Show()
    7171  {
    72     if($this->Visible)
    73     {
    74       return(parent::Show().'<button>'.$this->Caption.'</button>');
     72    if ($this->Visible)
     73    {
     74      return (parent::Show().'<button>'.$this->Caption.'</button>');
    7575    }
    7676  }
     
    8383  function Show()
    8484  {
    85     return(parent::Show().'<input type="text" name="'.$this->Id.'" value="'.$this->Text.'"/>');
     85    return (parent::Show().'<input type="text" name="'.$this->Id.'" value="'.$this->Text.'"/>');
    8686  }
    8787
     
    108108  function Show()
    109109  {
    110     if(array_key_exists($this->Id.'_Page', $_GET))
     110    if (array_key_exists($this->Id.'_Page', $_GET))
    111111      $this->Position = $_GET[$this->Id.'_Page'];
    112     if($this->Position >= $this->Count) $this->Position = $this->Count / $this->PageSize - 1;
     112    if ($this->Position >= $this->Count) $this->Position = $this->Count / $this->PageSize - 1;
    113113    $Output = '';
    114     for($I = 0; $I < $this->Count / $this->PageSize; $I++)
     114    for ($I = 0; $I < $this->Count / $this->PageSize; $I++)
    115115    {
    116116      $Text = '<a href="?'.$this->Id.'_Page='.$I.'">'.$I.'</a> ';
    117       if($I == $this->Position) $Text = '<strong>'.$Text.'</strong>';
     117      if ($I == $this->Position) $Text = '<strong>'.$Text.'</strong>';
    118118      $Output .= $Text;
    119119    }
    120120    $Output .= '<br/>';
    121     return($Output);
     121    return ($Output);
    122122  }
    123123
     
    134134  function Show()
    135135  {
    136     return($this->Name);
     136    return ($this->Name);
    137137  }
    138138}
     
    155155  {
    156156    $Output = '<table class="WideTable" style="font-size: small;><tr>';
    157     foreach($this->Columns as $Column)
    158     {
    159       if($this->OnColumnDraw != '') $Text = call_user_func($this->OnColumnDraw, $Column);
     157    foreach ($this->Columns as $Column)
     158    {
     159      if ($this->OnColumnDraw != '') $Text = call_user_func($this->OnColumnDraw, $Column);
    160160        else $Text = $Column->Show();
    161161      $Output .= '<th>'.$Text.'</th>';
    162162    }
    163163    $Output .= '</tr>';
    164     foreach($this->Rows as $Row)
     164    foreach ($this->Rows as $Row)
    165165    {
    166166      $Output .= '<tr>';
    167       foreach($Row as $Value)
     167      foreach ($Row as $Value)
    168168        $Output .= '<td>'.$Value.'</td>';
    169169      $Output .= '</tr>';
    170170    }
    171171    $Output .= '</table>';
    172     return($Output);
     172    return ($Output);
    173173  }
    174174}
     
    192192  function ColumnClick($Column)
    193193  {
    194     return('?'.$this->Id.'_SortColumn='.$Column->Id.'&amp;'.$this->Id.'_SortOrder='.(1 - $this->SortOrder));
     194    return ('?'.$this->Id.'_SortColumn='.$Column->Id.'&amp;'.$this->Id.'_SortOrder='.(1 - $this->SortOrder));
    195195  }
    196196
     
    201201    $Output = $Column->Show();
    202202
    203     if($Column->Name == $this->SortColumn)
     203    if ($Column->Name == $this->SortColumn)
    204204    {
    205205      $Output .= '<img style="vertical-align: middle; border: 0px;" src="'.
    206206        $System->Link('/images/'.$this->OrderArrowImage[$this->SortOrder]).'" alt="order arrow">';
    207207    }
    208     if($this->OnColumnClick != '')
     208    if ($this->OnColumnClick != '')
    209209      $Output = '<a href="'.call_user_func($this->OnColumnClick, $Column).'">'.$Output.'</a>';
    210     return($Output);
     210    return ($Output);
    211211  }
    212212
     
    219219    $Output .= parent::Show();
    220220    $Output .= $this->PageSelect->Show();
    221     return($Output);
     221    return ($Output);
    222222  }
    223223
     
    239239  {
    240240    $Output .= '<table>';
    241     foreach($this->Rows as $RowNum => $Row)
     241    foreach ($this->Rows as $RowNum => $Row)
    242242    {
    243243      $Output .= '<tr>';
    244       foreach($Row as $ColNum => $Value)
     244      foreach ($Row as $ColNum => $Value)
    245245      {
    246         if($this->Span[$RowNum][$ColNum] != 1) $Span = ' colspan="'.$this->Span[$RowNum][$ColNum].'"';
     246        if ($this->Span[$RowNum][$ColNum] != 1) $Span = ' colspan="'.$this->Span[$RowNum][$ColNum].'"';
    247247          else $Span = '';
    248248        $Output .= '<td'.$Span.'>'.$Value->Show().'</td>';
     
    251251    }
    252252    $Output .= '</table>';
    253     return($Output);
    254   }
    255 
    256   function Prepare()
    257   {
    258     foreach($this->Rows as $RowNum => $Row)
    259     {
    260       foreach($Row as $ColNum => $Value)
     253    return ($Output);
     254  }
     255
     256  function Prepare()
     257  {
     258    foreach ($this->Rows as $RowNum => $Row)
     259    {
     260      foreach ($Row as $ColNum => $Value)
    261261      {
    262262        $Value->Prepare();
     
    274274  {
    275275    $Output = $this->Caption;
    276     if(method_exists($this->OnExecute[0], $this->OnExecute[1]))
     276    if (method_exists($this->OnExecute[0], $this->OnExecute[1]))
    277277    {
    278278      $Link = 'O='.$this->Id.'&amp;M=Execute';
    279279      $Output = '<a href="?'.$Link.'">'.$Output.'</a>';
    280280    };
    281     return($Output);
     281    return ($Output);
    282282  }
    283283
     
    286286    $Object = ReadSessionVar('O', false);
    287287    $Method = ReadSessionVar('M', false);
    288     if(($Object == $this->Id) and ($Method == 'Execute'))
     288    if (($Object == $this->Id) and ($Method == 'Execute'))
    289289      call_user_func($this->OnExecute, $this);
    290290  }
     
    298298  {
    299299    $Output = '<!DOCTYPE html><html><head></head><body>';
    300     foreach($this->Items as $Item)
     300    foreach ($this->Items as $Item)
    301301      $Output .= $Item->Show();
    302302    $Output .= '</body></html>';
    303     return($Output);
    304   }
    305 
    306   function Prepare()
    307   {
    308     foreach($this->Items as $Item)
     303    return ($Output);
     304  }
     305
     306  function Prepare()
     307  {
     308    foreach ($this->Items as $Item)
    309309      $Item->Prepare();
    310310  }
Note: See TracChangeset for help on using the changeset viewer.