5 class Grid extends \Rsi\Fred\Controller\Widget{
17 foreach($this->widgets as $id => $widget) $captions[$id] = strip_tags($widget->caption($id));
18 return array_merge(parent::clientConfig(),$this->
get([self::EDIT_ALL,self::UNIQUE,self::TOTAL]),[
'captions' => $captions]);
22 if(!is_array($value))
return [];
23 foreach($value as $index => $record)
foreach($this->widgets as $id => $widget)
24 $value[$index][$id] = $widget->convert($record[$id] ??
null);
31 if(is_array($value))
foreach($value as $key => $record)
if(is_numeric($key) && ($this->_executing || $key >= 0)){
34 foreach($this->widgets as $id => $widget)
35 if(($array[$id] = $widget->purge(\
Rsi\Record::get($record,$id))) != $widget->defaultValue) $empty =
false;
36 if(!$empty) $result[$this->_executing ? $key : $index++] = $array;
42 if(($id = array_slice($id,1)) && array_key_exists($widget_id = array_shift($id),$this->widgets)) $this->widgets[$widget_id]->execute($id);
43 else parent::executeChild($id);
47 return parent::checkMin(count($value));
51 return parent::checkMax(count($value));
55 foreach($value as $index => $record)
foreach($this->widgets as $id => $widget){
56 $widget->indexes = array_merge($this->indexes,[$index]);
57 if($error = $widget->check($record[$id] ??
null)){
58 $this->log->debug(
"Validation error '$error' for record $index, column '$id'",__FILE__,__LINE__,[
'records' => $value,
'indexes' => $widget->indexes]);
66 foreach($this->unique as $id){
67 $values = array_filter(array_column($value,$id));
68 if(count($values) != count(array_unique($values)))
return false;