/**
  * Compiles from a meta data array human readable content.
  *
  * @param	array		$row Meta data record array
  * @param	string		$displayItems Item names as comma list which are array keys or special names like "_dimensions". Format and option can be added (separated with ":") to call tx_dam::tools_formatValue().
  * @param	string		$formatData If set the array wll be formatted as "paragraph" or "table".
  * @return	array		Info data array
  */
 function meta_compileInfoData($row, $displayItems = '', $formatData = '')
 {
     $infoData = array();
     $displayItems = $displayItems ? $displayItems : 'title, file_name, file_size:filesize, _dimensions, description:truncate:50';
     $displayItems = t3lib_div::trimExplode(',', $displayItems, true);
     foreach ($displayItems as $item) {
         list($item, $format, $config) = t3lib_div::trimExplode(':', $item, true);
         $label = '';
         switch ($item) {
             case '_media_type':
                 $infoData[$item]['value'] = tx_dam_guiFunc::convert_mediaType($row['media_type']);
                 t3lib_div::loadTCA('tx_dam');
                 $label = $GLOBALS['TCA']['tx_dam']['columns']['media_type']['label'];
                 break;
             case '_dimensions':
                 if ($row['media_type'] == TXDAM_mtype_image and $row['hpixels']) {
                     $infoData[$item]['value'] = $row['hpixels'] . 'x' . $row['vpixels'] . ' px';
                     $label = 'LLL:EXT:dam/locallang_db.xml:tx_dam_item.metrics';
                 } elseif ($row['height_unit']) {
                     $infoData[$item]['value'] = $row['width'] . 'x' . $row['height'] . ' ' . $row['height_unit'];
                     $label = 'LLL:EXT:dam/locallang_db.xml:tx_dam_item.metrics';
                 }
                 break;
                 // todo _techinfo
                 //				case '_techinfo':
                 //					if ($row['media_type'] == TXDAM_mtype_image AND $row['color_space']) {
                 //						$value = tx_dam_guifunc::getLabelFromItemlist('tx_dam', 'color_space', $row['color_space']);
                 //						if (is_object($GLOBALS['LANG'])) {
                 //							$value = $LANG->sL($value);
                 //						}
                 //						$infoData[$item]['value'] = $value;
                 //					}
                 //				break;
             // todo _techinfo
             //				case '_techinfo':
             //					if ($row['media_type'] == TXDAM_mtype_image AND $row['color_space']) {
             //						$value = tx_dam_guifunc::getLabelFromItemlist('tx_dam', 'color_space', $row['color_space']);
             //						if (is_object($GLOBALS['LANG'])) {
             //							$value = $LANG->sL($value);
             //						}
             //						$infoData[$item]['value'] = $value;
             //					}
             //				break;
             case '_caption':
                 $infoData[$item]['value'] = $row['caption'] ? $row['caption'] : $row['description'];
                 break;
             default:
                 if (isset($row[$item])) {
                     $infoData[$item]['value'] = $row[$item];
                 }
                 break;
         }
         if ($format and isset($infoData[$item])) {
             $infoData[$item]['value'] = tx_dam_guiFunc::tools_formatValue($infoData[$item]['value'], $format, $config);
         }
         if ($label and is_object($GLOBALS['LANG'])) {
             $infoData[$item]['label'] = $GLOBALS['LANG']->sL($label);
         }
         if (isset($infoData[$item]) and !isset($infoData[$item]['label']) and is_object($GLOBALS['LANG'])) {
             t3lib_div::loadTCA('tx_dam');
             $infoData[$item]['label'] = $GLOBALS['LANG']->sL($GLOBALS['TCA']['tx_dam']['columns'][$item]['label']);
         }
     }
     switch ($formatData) {
         case 'p':
         case 'paragraph':
             $infoText = '';
             foreach ($infoData as $val) {
                 $infoText .= '<p><strong>' . htmlspecialchars($val['label']) . '</strong> ' . htmlspecialchars($val['value']) . '</p>';
             }
             $infoData = $infoText;
             break;
         case 'table':
             $infoText = '';
             foreach ($infoData as $val) {
                 $infoText .= '<tr><td><strong>' . htmlspecialchars($val['label']) . '</strong>&nbsp;</td><td>' . htmlspecialchars($val['value']) . '</td></tr>';
             }
             $infoData = '<table>' . $infoText . '</table>';
             break;
         case 'value-array':
             $infoArr = array();
             foreach ($infoData as $item => $val) {
                 $infoArr[$item] = $val['value'];
             }
             $infoData = $infoArr;
             break;
         case 'value-string':
             $infoArr = array();
             foreach ($infoData as $item => $val) {
                 $infoArr[$item] = $val['value'];
             }
             $infoData = implode("\n", $infoArr);
             break;
         default:
             break;
     }
     return $infoData;
 }