FRED™  3.0
FRED™: Framework for Rapid and Easy Development
Sorter.php
Go to the documentation of this file.
1 <?php
2 
4 
5 class Sorter extends Options{
6 
7  protected function renderOptions($value,$attribs = null){
8  $options = $this->_widget->options;
9  $available = $selected = [];
10  foreach($options as $key => $descr) if(!in_array($key,$value ?: [])) $available[$key] = $descr;
11  if($value) foreach($value as $key) if(array_key_exists($key,$options)) $selected[$key] = $options[$key];
12  return $this->html->div(
13  $this->html->fieldset(
14  ($available ? $this->html->input(null,$attribs,'checkbox',$this->_name,$available) : null),
15  ['class' => 'fred-available']
16  ) .
17  $this->html->div(null,null,'fred-actions') .
18  $this->html->fieldset(
19  ($selected ? $this->html->input($value,$attribs,'checkbox',$this->_name,$selected) : null),
20  ['class' => 'fred-selected']
21  ),
22  null,
23  'fred-options'
24  );
25  }
26 
27  protected function renderMinimal($value,$raw){
28  $content = $this->renderHidden(json_encode($value),$raw);
29  $options = $this->_widget->options;
30  if($value) foreach($value as $key) if(array_key_exists($key,$options)) $content .= $this->html->_div($options[$key],null,'value');
31  return $this->container($content,'minimal');
32  }
33 
34 }
renderOptions($value, $attribs=null)
Definition: Sorter.php:7
container($content, $display)
Definition: Widget.php:42