Files
Phraseanet/lib/Alchemy/Phrasea/Command/Feedback/Report/StatusBitAction.php
jygaulier 69f3b30ee5 PHRAS-3768_feedback-report-per-record (#4421)
* 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
2023-11-30 17:26:14 +01:00

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))
];
}
}