first table
This commit is contained in:
22
actionBtn/ActionBtn.php
Normal file
22
actionBtn/ActionBtn.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace itguild\forms\table\actionBtn;
|
||||
|
||||
abstract class ActionBtn
|
||||
{
|
||||
|
||||
protected string $baseUrl;
|
||||
protected string $prefix;
|
||||
|
||||
protected int $id;
|
||||
public function __construct(string $baseUrl, int $id)
|
||||
{
|
||||
$this->baseUrl = $baseUrl;
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
abstract public function fetch();
|
||||
|
||||
}
|
13
actionBtn/ToDeleteBtn.php
Normal file
13
actionBtn/ToDeleteBtn.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace itguild\forms\table\actionBtn;
|
||||
|
||||
class ToDeleteBtn extends ActionBtn
|
||||
{
|
||||
protected string $prefix = "/form-delete/";
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
return "<a class='btn btn-danger' href='$this->baseUrl$this->prefix$this->id' style='margin: 3px'>Удалить</a>";
|
||||
}
|
||||
}
|
13
actionBtn/ToEditBtn.php
Normal file
13
actionBtn/ToEditBtn.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace itguild\forms\table\actionBtn;
|
||||
|
||||
class ToEditBtn extends ActionBtn
|
||||
{
|
||||
protected string $prefix = "/form-edit/";
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
return "<a class='btn btn-warning' href='$this->baseUrl$this->prefix$this->id' style='margin: 3px'>Редактировать</a>";
|
||||
}
|
||||
}
|
13
actionBtn/ToListBtn.php
Normal file
13
actionBtn/ToListBtn.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace itguild\forms\table\actionBtn;
|
||||
|
||||
class ToListBtn extends ActionBtn
|
||||
{
|
||||
protected string $prefix = "/form-result/";
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
return "<a class='btn btn-primary' href='$this->baseUrl$this->prefix$this->id' style='margin: 3px'>Список</a>";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user