44 function __construct(&$form, $field, $label, $super, $options, $format =
null)
47 $this->super = $super;
48 $this->format = $format;
55 $id =
"{$this->parent->id}_{$field}_container";
56 $superId =
"{$this->parent->id}_{$this->super}";
58 Fakoli::includeScript(
"/fakoli/js/subselect_checklist_manager.js");
61 window.addEvent(
'domready',
function()
63 new SubSelectChecklistManager(
'<?php echo $superId?>',
'<?php echo $id?>');
73 $rawValue = $this->parent->data->get($field);
74 if (!isset($rawValue)) $rawValue = $this->parent->data->getDecoration($field);
76 if (is_array($rawValue))
79 $rawValue = $this->parent->data->get($field);
82 $values = explode(
",", $rawValue);
84 $divider = $this->horizontal ?
" " :
"";
85 $layout = $this->horizontal ?
" style='display: inline'" :
"";
87 if ($this->showSelectAll)
89 echo
"<a class='select_toggle' href='#' onclick='return {$this->parent->id}_{$field}_toggleSelectAll(this);'>Select All</a><br/>";
92 if ($this->width && $this->height && $this->
getOptionCount() > $this->scrollAfter)
94 $width = is_numeric($this->width) ?
"{$this->width}px" : $this->width;
95 $height = is_numeric($this->height) ?
"{$this->height}px" : $this->height;
96 $padding = ($width ==
"auto") ?
"padding-right: 20px; " :
"";
98 $resizable = ($this->resizable && !$this->dropdown) ?
" resizable":
"";
99 $dropdown = $this->dropdown ?
" multi_select_dropdown_list" :
"";
100 echo
"<div id='{$this->parent->id}_{$field}_container' class='selectbox scrollbox{$resizable}{$dropdown}' style='width: {$width}; height: {$height}; $padding overflow: auto'>\n";
104 echo
"<div id='{$this->parent->id}_{$field}_container' class='selectbox'>";
109 foreach($this->options as $group => $options)
111 foreach($options as $value => $item)
117 $text = $item->format($this->format);
118 $value = $item->getPrimaryKeyValue();
125 if ($this->fixedOptions[$value])
127 $disabled =
" disabled";
128 $checked =
" checked";
132 $checked = (array_search($value, $values) !== FALSE) ?
" checked" :
"";
134 if ($this->nobr) { $text = str_replace(
" ",
" ", $text); }
136 echo
"<label data-select='{$group}' for='{$this->parent->id}_{$field}[$idx]'$layout><input type='checkbox' class='checkbox' id='{$this->parent->id}_{$field}[$idx]' name='{$field}[$idx]' value='$value'$checked$disabled/>$text</label>$divider";
142 echo
"<input type=\"hidden\" name=\"count_{$field}\" value=\"".$idx.
"\">";
CheckListFieldRenderer: Renders the specified list of options as a list of checkboxes from which mult...
renderScript($field)
FieldRenderers can override this method to provide any Javascript that their control requires for an ...
CheckListFieldRenderer(&$form, $field, $label, $options, $grouped=false)
renderField($field)
FieldRenderers must override this method to provide the HTML implementation of the control used to ed...
preProcess($field="")
FieldRenderers can override this method to provide behavior that occurs prior to the saving of the pa...
_startField($field, $styles="")
Internal method to generate the starting HTML for the field (including the label)
_endField($field)
Internal method to generate the closing HTML for the field.