This repository has been archived by the owner on Oct 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d194a34
commit 2fb13dc
Showing
10 changed files
with
208 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<?php | ||
/** | ||
* Copyright (c) Allan Carvalho 2020. | ||
* Under Mit License | ||
* link: https://github.com/wsssoftware/cakephp-data-renderer | ||
* author: Allan Carvalho <allan.m.carvalho@outlook.com> | ||
* license: MIT License https://github.com/wsssoftware/cakephp-datatables/blob/master/LICENSE | ||
*/ | ||
declare(strict_types = 1); | ||
|
||
namespace DataTables\Table; | ||
|
||
use Cake\Core\Configure as CakePhpConfigure; | ||
|
||
/** | ||
* Class Configure | ||
* Created by allancarvalho in june 28, 2020 | ||
*/ | ||
class Configure { | ||
|
||
/** | ||
* @var \DataTables\Table\Configure | ||
*/ | ||
private static $_instance; | ||
|
||
/** | ||
* @var bool | ||
*/ | ||
private $columnAutoGeneratedWarning; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $storageEngine; | ||
|
||
/** | ||
* @var bool | ||
*/ | ||
private $forceCache; | ||
|
||
public function __construct() { | ||
$this->setColumnAutoGeneratedWarning(CakePhpConfigure::read('DataTables.columnAutoGeneratedWarning')); | ||
$this->setStorageEngine(CakePhpConfigure::read('DataTables.StorageEngine.class')); | ||
$this->setForceCache(CakePhpConfigure::read('DataTables.StorageEngine.forceCache')); | ||
} | ||
|
||
/** | ||
* Return a instance of builder object. | ||
* | ||
* @param bool $reset | ||
* @return \DataTables\Table\Configure | ||
*/ | ||
public static function getInstance(bool $reset = false) { | ||
if (static::$_instance === null || $reset === true) { | ||
static::$_instance = new self(); | ||
} | ||
|
||
return static::$_instance; | ||
} | ||
|
||
/** | ||
* Check if the table columns data is auto generated. | ||
* | ||
* @return bool | ||
*/ | ||
public function isColumnAutoGeneratedWarning(): bool { | ||
return $this->columnAutoGeneratedWarning; | ||
} | ||
|
||
/** | ||
* Set if the plugin must show a blink alert when the table columns data is auto generated. | ||
* | ||
* @param bool $columnAutoGeneratedWarning | ||
* @return $this | ||
*/ | ||
public function setColumnAutoGeneratedWarning(bool $columnAutoGeneratedWarning) { | ||
$this->columnAutoGeneratedWarning = $columnAutoGeneratedWarning; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Get the current StorageEngine class FQN | ||
* | ||
* @return string | ||
*/ | ||
public function getStorageEngine(): string { | ||
return $this->storageEngine; | ||
} | ||
|
||
/** | ||
* Set the StorageEngine class FQN | ||
* | ||
* @param string $storageEngine | ||
* @return $this | ||
*/ | ||
public function setStorageEngine(string $storageEngine) { | ||
$this->storageEngine = $storageEngine; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Check if the plugin must do the cache even debug is on. | ||
* | ||
* @return bool | ||
*/ | ||
public function isForceCache(): bool { | ||
return $this->forceCache; | ||
} | ||
|
||
/** | ||
* Set if the plugin must do the cache even debug is on. | ||
* | ||
* @param bool $forceCache | ||
* @return $this | ||
*/ | ||
public function setForceCache(bool $forceCache) { | ||
$this->forceCache = $forceCache; | ||
|
||
return $this; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
/** | ||
* Copyright (c) Allan Carvalho 2020. | ||
* Under Mit License | ||
* php version 7.2 | ||
* | ||
* link https://github.com/allanmcarvalho/cakephp-data-renderer | ||
* author Allan Carvalho <allan.m.carvalho@outlook.com> | ||
*/ | ||
declare(strict_types = 1); | ||
|
||
namespace TestApp\DataTables; | ||
|
||
use DataTables\Table\Assets; | ||
use DataTables\Table\Configure; | ||
use DataTables\Table\Option\MainOption; | ||
|
||
/** | ||
* Class AppDataTables | ||
*/ | ||
class AppDataTables { | ||
|
||
/** | ||
* This will be applied to all DataTables tables. | ||
* | ||
* @param \DataTables\Table\Option\MainOption $options Options of DataTable library. | ||
* @param \DataTables\Table\Assets $assets Options for asset load. | ||
* @return void | ||
*/ | ||
public function mainConfig(MainOption $options, Assets $assets): void { | ||
// TODO: Configure here the rules that will be applied to all tables. | ||
} | ||
|
||
/** | ||
* This is the plugin configuration that will be applied to all DataTables tables. | ||
* | ||
* @param \DataTables\Table\Configure $configure Plugin base configurations. | ||
* @return void | ||
*/ | ||
public function configure(Configure $configure): void { | ||
// TODO: Configure here the plugin configuration that will be applied to all tables. | ||
} | ||
|
||
} |