19declare(strict_types=1);
35 DataFactory $data_factory,
46 return $this->
refinery->custom()->transformation(
47 static function ($v): ?FiveStarRatingScale {
48 if(is_null($v) || $v instanceof FiveStarRatingScale) {
70 if(!$value instanceof FiveStarRatingScale) {
78 return is_null($value) || is_numeric($value) || $value instanceof FiveStarRatingScale;
83 if ($this->requirement_constraint !==
null) {
84 return $this->requirement_constraint;
86 return $this->
refinery->custom()->constraint(
87 static fn($v) => $v instanceof FiveStarRatingScale && $v->value > 0,
94 return fn(
$id) =>
"$('#$id').on('input', function(event) {
95 il.UI.input.onFieldUpdate(event, '$id', $('#$id').val());
97 il.UI.input.onFieldUpdate(event, '$id', $('#$id').val());";
102 $max = count(FiveStarRatingScale::cases()) - 1;
103 if($current_average < 0 || $current_average > $max) {
104 throw new \InvalidArgumentException(
'current_average must be between 0 and ' . $max);
106 $clone = clone $this;
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
FiveStarRatingScale
This is the scale for the Rating Input.
A constraint encodes some resrtictions on values.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.