From: <gem...@li...> - 2012-07-13 10:01:46
|
Revision: 839 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=839&view=rev Author: mennodekker Date: 2012-07-13 10:01:36 +0000 (Fri, 13 Jul 2012) Log Message: ----------- Fixing concatenated row in exhibitor and formatted data Modified Paths: -------------- trunk/library/classes/Gems/FormattedData.php trunk/library/classes/MUtil/View/Helper/Exhibitor.php Modified: trunk/library/classes/Gems/FormattedData.php =================================================================== --- trunk/library/classes/Gems/FormattedData.php 2012-07-13 09:51:02 UTC (rev 838) +++ trunk/library/classes/Gems/FormattedData.php 2012-07-13 10:01:36 UTC (rev 839) @@ -103,8 +103,20 @@ if ($multiOptions = $model->get($name, 'multiOptions')) { if (is_array($multiOptions)) { - if (array_key_exists($result, $multiOptions)) { - $result = $multiOptions[$result]; + /* + * Sometimes a field is an array and will be formatted later on using the + * formatFunction -> handle each element in the array. + */ + if (is_array($result)) { + foreach($result as $key => $value) { + if (array_key_exists($value, $multiOptions)) { + $result[$key] = $multiOptions[$value]; + } + } + } else { + if (array_key_exists($result, $multiOptions)) { + $result = $multiOptions[$result]; + } } } } Modified: trunk/library/classes/MUtil/View/Helper/Exhibitor.php =================================================================== --- trunk/library/classes/MUtil/View/Helper/Exhibitor.php 2012-07-13 09:51:02 UTC (rev 838) +++ trunk/library/classes/MUtil/View/Helper/Exhibitor.php 2012-07-13 10:01:36 UTC (rev 839) @@ -74,8 +74,20 @@ $multiOptions = $attribs['multiOptions']; if (is_array($multiOptions)) { - if (array_key_exists($value, $multiOptions)) { - $result = $multiOptions[$value]; + /* + * Sometimes a field is an array and will be formatted later on using the + * formatFunction -> handle each element in the array. + */ + if (is_array($result)) { + foreach($result as $key => $arrayValue) { + if (array_key_exists($arrayValue, $multiOptions)) { + $result[$key] = $multiOptions[$arrayValue]; + } + } + } else { + if (array_key_exists($result, $multiOptions)) { + $result = $multiOptions[$result]; + } } } } @@ -123,7 +135,7 @@ $result = $callback($result); } */ - if (isset($attribs['nohidden']) && $attribs['nohidden']) { + if (isset($attribs['nohidden']) && $attribs['nohidden'] || is_array($value)) { return $result; } else { return $this->_hidden($name, $value) . $result; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |