2016-07-21 15:35:23 +03:00
|
|
|
<?php namespace App\Ninja\Datatables;
|
2016-05-23 19:52:20 +03:00
|
|
|
|
|
|
|
|
class EntityDatatable
|
|
|
|
|
{
|
|
|
|
|
public $entityType;
|
|
|
|
|
public $isBulkEdit;
|
|
|
|
|
public $hideClient;
|
|
|
|
|
|
2016-11-24 11:22:37 +02:00
|
|
|
public function __construct($isBulkEdit = true, $hideClient = false, $entityType = false)
|
2016-05-23 19:52:20 +03:00
|
|
|
{
|
|
|
|
|
$this->isBulkEdit = $isBulkEdit;
|
|
|
|
|
$this->hideClient = $hideClient;
|
2016-11-24 11:22:37 +02:00
|
|
|
|
|
|
|
|
if ($entityType) {
|
|
|
|
|
$this->entityType = $entityType;
|
|
|
|
|
}
|
2016-05-23 19:52:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function columns()
|
|
|
|
|
{
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function actions()
|
|
|
|
|
{
|
|
|
|
|
return [];
|
|
|
|
|
}
|
2016-11-24 11:22:37 +02:00
|
|
|
|
|
|
|
|
public function columnFields()
|
|
|
|
|
{
|
|
|
|
|
$data = [];
|
|
|
|
|
$columns = $this->columns();
|
|
|
|
|
|
|
|
|
|
if ($this->isBulkEdit) {
|
|
|
|
|
$data[] = 'checkbox';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach ($columns as $column) {
|
|
|
|
|
if (count($column) == 3) {
|
|
|
|
|
// third column is optionally used to determine visibility
|
|
|
|
|
if (!$column[2]) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$data[] = $column[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$data[] = '';
|
|
|
|
|
|
|
|
|
|
return $data;
|
|
|
|
|
}
|
2016-05-23 19:52:20 +03:00
|
|
|
}
|