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 foreach($value as $index => $record)
foreach($this->widgets as $id => $widget)
23 $value[$index][$id] = $widget->convert($record[$id]);
29 if(is_array($value))
foreach($value as $index => $record)
if(is_numeric($index)){
32 foreach($this->widgets as $id => $widget)
33 if(($array[$id] = $widget->purge(\
Rsi\Record::get($record,$id))) != $widget->defaultValue) $empty =
false;
34 if(!$empty) $result[] = $array;
40 if(array_key_exists($id = array_pop($id),$this->widgets)) $this->widgets[$this->request->widgetId = $id]->execute();
41 else parent::executeChild($id);
44 protected function checkMin($value,$index = null){
45 return parent::checkMin(count($value),$index);
48 protected function checkMax($value,$index = null){
49 return parent::checkMax(count($value),$index);
53 foreach($value as $index => $record)
foreach($this->widgets as $id => $widget)
if($error = $widget->check($record[$id] ?? null,$index)){
54 $this->log->debug(
"Validation error '$error' for record $index, column '$id'",__FILE__,__LINE__,[
'records' => $value]);
61 foreach($this->unique as $id){
62 $values = array_filter(array_column($value,$id));
63 if(count($values) != count(array_unique($values)))
return false;