first table
This commit is contained in:
20
ActionColumn/ActionColumn.php
Normal file
20
ActionColumn/ActionColumn.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace itguild\forms\table\ActionColumn;
|
||||
|
||||
abstract class ActionColumn
|
||||
{
|
||||
protected string $baseUrl;
|
||||
protected string $prefix;
|
||||
|
||||
protected int $id;
|
||||
public function __construct(string $baseUrl, int $id)
|
||||
{
|
||||
$this->baseUrl = $baseUrl;
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
abstract public function fetch();
|
||||
|
||||
|
||||
}
|
14
ActionColumn/DeleteActionColumn.php
Normal file
14
ActionColumn/DeleteActionColumn.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace itguild\forms\table\ActionColumn;
|
||||
|
||||
class DeleteActionColumn extends ActionColumn
|
||||
{
|
||||
protected string $prefix = "/form-delete/";
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
$link = $this->baseUrl . $this->prefix . $this->id;
|
||||
return " <a href='$link' class='btn btn-danger'>Удалить</a> ";
|
||||
}
|
||||
}
|
16
ActionColumn/EditActionColumn.php
Normal file
16
ActionColumn/EditActionColumn.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace itguild\forms\table\ActionColumn;
|
||||
|
||||
class EditActionColumn extends ActionColumn
|
||||
{
|
||||
|
||||
protected string $prefix = "/form-edit/";
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
$link = $this->baseUrl . $this->prefix . $this->id;
|
||||
return " <a href='$link' class='btn btn-primary'>Редактировать</a> ";
|
||||
}
|
||||
|
||||
}
|
14
ActionColumn/ViewActionColumn.php
Normal file
14
ActionColumn/ViewActionColumn.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace itguild\forms\table\ActionColumn;
|
||||
|
||||
class ViewActionColumn extends ActionColumn
|
||||
{
|
||||
protected string $prefix = "/form-item/";
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
$link = $this->baseUrl . $this->prefix . $this->id;
|
||||
return " <a href='$link' class='btn btn-primary'>Просмотр</a> ";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user