From ab832b65f7f288c24fd2dd8335533107e24fd649 Mon Sep 17 00:00:00 2001 From: Brayan Pereyra Date: Wed, 10 Jun 2015 16:48:12 -0400 Subject: [PATCH] BUG-17552 Dependatnt checkgroups into grids --- gulliver/system/class.xmlform.php | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index 5f2c36a66..954d6315d 100755 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -4028,6 +4028,42 @@ class XmlForm_Field_CheckGroup extends XmlForm_Field } } + + /** + * Renderring the checkgroup inner grid for Staff Eval Plugin + * @see class.form.php#validateArray(); + * @author Edauto + * @since 2012-07-20 + */ + public function renderGrid($values = NULL, $owner = NULL) { + $this->executeSQL ( $owner ); + $disable = ($owner->mode === 'view') ? 'disabled="disabled" ' : ' '; + $r = 1; + $result = array(); + foreach ( $values as $v ) { // foreach the grid row with selection + $i=1; + $html = ''; + if (! is_array ( $v )) { + $aV = explode ( '|', str_replace(" ","",$v)); + } else { + $aV = $v; + } + foreach ( $this->options as $optionName => $option ) { // foreach the options of checkbox group + $bChecked = in_array ( $i , $aV, true ) || in_array($optionName, $aV, true); + $html .= 'name . ']['. $r .']['. $this->name .'][]" '; + $html .= 'type="checkbox" value="' . $optionName . '" ' . ($bChecked ? 'checked ' : ' ') ; + $html .= $disable . '>' . $option . ''; + if(++$i==count($this->options)){ + $html .= ' ' . $this->renderHint(); + } + $html .= '
'; + } + $result[] = $html; + $r++; + } + return $result; + } } /* TODO: DEPRECATED */