library/Garp/Content/Export/Abstract.php
protected function _humanizeData($data, Garp_Model_Db $model) {
        $humanizedData = array();
        foreach ($data as $i => $datum) {
            if (!is_array($datum)) {
                $humanizedData[$i] = $datum;
                continue;
            }
            foreach ($datum as $column => $value) {
                $field = $model->getFieldConfiguration($column);
                if ($field['type'] === 'checkbox') {
                    $value = $value ? __('yes') : __('no');
                }
                $alias = $column;
                if ($field) {
                    $alias = $field['label'];
                }

                $alias = ucfirst(__($alias));
                if (is_array($value) && $this->_isMultilingualArray($value)) {
                    // special case: we convert the language keys to new columns in the output
                    foreach ($value as $key => $data) {
                        $i18n_alias = "$alias ($key)";
                        $humanizedData[$i][$i18n_alias] = $data;
                    }
                    // Continue so we don't add duplicate data
                    continue;
                } elseif (is_array($value)) {
                    // OMG recursion!
                    $value = $this->_humanizeData($value, $model);
                }
                $humanizedData[$i][$alias] = $value;
            }
        }
        return $humanizedData;
    }
protected function _humanizeData($data, Garp_Model_Db $model) {
        $humanizedData = array();
        foreach ($data as $i => $datum) {
            if (!is_array($datum)) {
                $humanizedData[$i] = $datum;
                continue;
            }
            foreach ($datum as $column => $value) {
                $field = $model->getFieldConfiguration($column);
                if ($field['type'] === 'checkbox') {
                    $value = $value ? __('yes') : __('no');
                }
                $alias = $column;
                if ($field) {
                    $alias = $field['label'];
                }

                $alias = ucfirst(__($alias));
                if (is_array($value) && $this->_isMultilingualArray($value)) {
                    // special case: we convert the language keys to new columns in the output
                    foreach ($value as $key => $data) {
                        $i18n_alias = "$alias ($key)";
                        $humanizedData[$i][$i18n_alias] = $data;
                    }
                    // Continue so we don't add duplicate data
                    continue;
                } elseif (is_array($value)) {
                    // OMG recursion!
                    $value = $this->_humanizeData($value, $model);
                }
                $humanizedData[$i][$alias] = $value;
            }
        }
        return $humanizedData;
    }
protected function _humanizeData ( $ data , Garp_Model_Db $ model ) { $ humanizedData = array ( ) ; foreach ( $ data as $ i => $ datum ) { if ( ! is_array ( $ datum ) ) { $ humanizedData [ $ i ] = $ datum ; continue ; } foreach ( $ datum as $ column => $ value ) { $ field = $ model -> getFieldConfiguration ( $ column ) ; if ( $ field [ 'type' ] === 'checkbox' ) { $ value = $ value ? __ ( 'yes' ) : __ ( 'no' ) ; } $ alias = $ column ; if ( $ field ) { $ alias = $ field [ 'label' ] ; } $ alias = ucfirst ( __ ( $ alias ) ) ; if ( is_array ( $ value ) && $ this -> _isMultilingualArray ( $ value ) ) { // special case: we convert the language keys to new columns in the output foreach ( $ value as $ key => $ data ) { $ i18n_alias = "$alias ($key)" ; $ humanizedData [ $ i ] [ $ i18n_alias ] = $ data ; } // Continue so we don't add duplicate data continue ; } elseif ( is_array ( $ value ) ) { // OMG recursion! $ value = $ this -> _humanizeData ( $ value , $ model ) ; } $ humanizedData [ $ i ] [ $ alias ] = $ value ; } } return $ humanizedData ; }
Translate the columns of a record into the human-friendly versions used
in the CMS

@param array $data
@param Garp_Model_Db $model
@return array
Translate the columns of a record into the human - friendly versions used in the CMS