Visible = true; $this->Enabled = true; } function Show(): string { $Output = ''; //$Output .= '#'.$this->Id; return $Output; } function Prepare(): void { } } class Layout extends Element { public array $Items; function Show(): string { if ($this->Visible) { $Output = parent::Show(); foreach ($this->Items as $Item) $Output .= $Item->Show(); return $Output; } } function Prepare(): void { foreach ($this->Items as $Item) $Item->Prepare(); } } class Button extends Element { public string $Caption; function Show(): string { if ($this->Visible) { return parent::Show().''; } } } class Edit extends Element { public string $Text; function Show(): string { return parent::Show().''; } function Prepare(): void { $this->Text = ReadSessionVar($this->Id.'_Text'); } } class PageSelect extends Element { public int $Count; public int $Position; public int $PageSize; function __construct() { parent::__construct(); $this->PageSize = 10; $this->Position = 0; $this->Count = 0; } function Show(): string { if (array_key_exists($this->Id.'_Page', $_GET)) $this->Position = $_GET[$this->Id.'_Page']; if ($this->Position >= $this->Count) $this->Position = $this->Count / $this->PageSize - 1; $Output = ''; for ($I = 0; $I < $this->Count / $this->PageSize; $I++) { $Text = ''.$I.' '; if ($I == $this->Position) $Text = ''.$Text.''; $Output .= $Text; } $Output .= '
'; return $Output; } function Prepare(): void { $this->Position = ReadSessionVar($this->Id.'_Page'); } } class ListViewColumn extends Element { public string $Name; function Show(): string { return $this->Name; } } class ListView extends Element { public array $Columns; public array $Rows; public $OnColumnClick; public $OnColumnDraw; function __construct() { parent::__construct(); $this->Rows = array(); $this->Columns = array(); } function Show(): string { $Output = ''; } if ($this->OnColumnClick != '') $Output = ''.$Output.''; return $Output; } function Show(): string { $this->PageSelect->Count = count($this->Rows); $this->OnColumnClick = array($this, 'ColumnClick'); $this->OnColumnDraw = array($this, 'ColumnDraw'); $Output = $this->PageSelect->Show(); $Output .= parent::Show(); $Output .= $this->PageSelect->Show(); return $Output; } function Prepare(): void { $this->PageSelect->Id = $this->Id.'PageSelect'; $this->PageSelect->Prepare(); $this->SortColumn = ReadSessionVar($this->Id.'_SortColumn'); $this->SortOrder = ReadSessionVar($this->Id.'_SortOrder'); } } class TableLayout extends Element { public array $Rows; public string $Span; function Show(): string { $Output = '
'; foreach ($this->Rows as $RowNum => $Row) { $Output .= ''; foreach ($Row as $ColNum => $Value) { if ($this->Span[$RowNum][$ColNum] != 1) $Span = ' colspan="'.$this->Span[$RowNum][$ColNum].'"'; else $Span = ''; $Output .= ''.$Value->Show().''; } $Output .= ''; } $Output .= '
'; return $Output; } function Prepare(): void { foreach ($this->Rows as $RowNum => $Row) { foreach ($Row as $ColNum => $Value) { $Value->Prepare(); } } } } class Label extends Element { public string $Caption; public $OnExecute; function Show(): string { $Output = $this->Caption; if (method_exists($this->OnExecute[0], $this->OnExecute[1])) { $Link = 'O='.$this->Id.'&M=Execute'; $Output = ''.$Output.''; }; return $Output; } function Prepare(): void { $Object = ReadSessionVar('O', false); $Method = ReadSessionVar('M', false); if (($Object == $this->Id) and ($Method == 'Execute')) call_user_func($this->OnExecute, $this); } } class Page2 { public array $Items; function Show(): string { $Output = ''; foreach ($this->Items as $Item) $Output .= $Item->Show(); $Output .= ''; return $Output; } function Prepare(): void { foreach ($this->Items as $Item) $Item->Prepare(); } }