- Created `Articles` class for rendering article views including full articles, miniature lists, and news sections. - Added `Banners` class for handling banner displays. - Introduced `Languages` class for rendering language options. - Implemented `Menu` class for rendering page and menu structures. - Developed `Newsletter` class for newsletter rendering. - Created `Scontainers` class for rendering specific containers. - Added `ShopCategory` class for managing shop category views and pagination. - Implemented `ShopClient` class for client-related views including address management and login forms. - Created `ShopPaymentMethod` class for displaying payment methods in the basket. - Added `ShopProduct` class for generating product URLs. - Introduced `ShopSearch` class for rendering a simple search form. - Added `.htaccess` file in the plugins directory to enhance security by restricting access to sensitive files and directories.
74 lines
1.8 KiB
PHP
74 lines
1.8 KiB
PHP
<?php
|
|
namespace admin\ViewModels\Forms;
|
|
|
|
/**
|
|
* Definicja akcji formularza (przycisku)
|
|
*/
|
|
class FormAction
|
|
{
|
|
public string $name;
|
|
public string $label;
|
|
public string $type;
|
|
public string $url;
|
|
public ?string $backUrl;
|
|
public string $cssClass;
|
|
public array $attributes;
|
|
|
|
/**
|
|
* @param string $name Nazwa akcji (save, cancel, delete)
|
|
* @param string $label Etykieta przycisku
|
|
* @param string $url URL akcji (dla save)
|
|
* @param string|null $backUrl URL powrotu po zapisie
|
|
* @param string $cssClass Klasy CSS przycisku
|
|
* @param string $type Typ przycisku (submit, button, link)
|
|
* @param array $attributes Dodatkowe atrybuty HTML
|
|
*/
|
|
public function __construct(
|
|
string $name,
|
|
string $label,
|
|
string $url = '',
|
|
?string $backUrl = null,
|
|
string $cssClass = 'btn btn-primary',
|
|
string $type = 'submit',
|
|
array $attributes = []
|
|
) {
|
|
$this->name = $name;
|
|
$this->label = $label;
|
|
$this->url = $url;
|
|
$this->backUrl = $backUrl;
|
|
$this->cssClass = $cssClass;
|
|
$this->type = $type;
|
|
$this->attributes = $attributes;
|
|
}
|
|
|
|
/**
|
|
* Predefiniowana akcja Zapisz
|
|
*/
|
|
public static function save(string $url, string $backUrl = '', string $label = 'Zapisz'): self
|
|
{
|
|
return new self(
|
|
'save',
|
|
$label,
|
|
$url,
|
|
$backUrl,
|
|
'btn btn-primary',
|
|
'submit'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Predefiniowana akcja Anuluj
|
|
*/
|
|
public static function cancel(string $backUrl, string $label = 'Anuluj'): self
|
|
{
|
|
return new self(
|
|
'cancel',
|
|
$label,
|
|
$backUrl,
|
|
null,
|
|
'btn btn-default',
|
|
'link'
|
|
);
|
|
}
|
|
}
|