mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-09 11:03:17 +00:00

* add command feedback:report ; bump back to 4.1.8-rc9 WIP OK TO TEST * aadd dry, log, ... ; move conf ; bump back to 4.1.8-rc8 WIP OK TO TEST * add command feedback:report ; bump back to 4.1.8-rc9 WIP OK TO TEST * aadd dry, log, ... ; move conf ; bump back to 4.1.8-rc8 WIP OK TO TEST * add default (disabled) conf in conf.d * Update Version.php bump version made in #4426
33 lines
873 B
PHP
33 lines
873 B
PHP
<?php
|
|
|
|
namespace Alchemy\Phrasea\Command\Feedback\Report;
|
|
|
|
use Twig_Environment;
|
|
|
|
class StatusBitAction extends Action implements ActionInterface
|
|
{
|
|
private $bit;
|
|
|
|
public function __construct(Twig_Environment $twig, array $action_conf)
|
|
{
|
|
parent::__construct($twig, $action_conf);
|
|
$bit = (int)($sbit = trim($action_conf['status_bit']));
|
|
// already sanitized
|
|
// if($bit < 4 || $bit > 31) {
|
|
// throw new ConfigurationException(sprintf("bad status bit (%s)", $sbit));
|
|
// }
|
|
$this->bit = $bit;
|
|
}
|
|
|
|
public function addAction(array &$actions, array $context)
|
|
{
|
|
if(!array_key_exists('status', $actions)) {
|
|
$actions['status'] = [];
|
|
}
|
|
$actions['status'][] = [
|
|
"bit" => $this->bit,
|
|
"state" => !!trim($this->getValue($context))
|
|
];
|
|
}
|
|
}
|