/** * Returns a dia like thumbnail * * @param array $row tx_dam record * @param integer $diaSize dia size * @param integer $diaMargin dia margin * @param array $showElements Extra elements to show: "title,info,icons" * @param string $onClick: ... * @param boolean $makeIcon: ... * @param string $actions action content to be displayed * @return string HTML output */ function getDia($row, $diaSize = 115, $diaMargin = 10, $showElements = '', $onClick = NULL, $makeIcon = TRUE, $actions = '') { if (!is_array($showElements)) { $showElements = t3lib_div::trimExplode(',', $showElements, 1); } // extra CSS code for HTML header if (is_object($GLOBALS['SOBE']) and !isset($GLOBALS['SOBE']->doc->inDocStylesArray['tx_dam_SCbase_dia'])) { $GLOBALS['SOBE']->doc->inDocStylesArray['tx_dam_SCbase_dia'] = tx_dam_guiFunc::getDiaStyles($diaSize, $diaMargin); } // use css/stylesheet $iconBgColor = t3lib_div::modifyHTMLcolor($GLOBALS['SOBE']->doc->bgColor, -10, -10, -10); $titleLen = ceil(30 * ($diaSize - $diaMargin) / (200 - $diaMargin)); $hpixels = $row['hpixels']; $vpixels = $row['vpixels']; if ($hpixels and $vpixels) { list($hpixels, $vpixels) = tx_dam_image::calcSize($hpixels, $vpixels, $diaSize, $diaSize); } else { if ($hpixels > $diaSize) { $hpixels = $diaSize; } if ($vpixels > $diaSize) { $vpixels = $diaSize; } } $uid = $row['uid']; $imgAttributes = array(); $imgAttributes['title'] = str_replace("\n", '', t3lib_div::fixed_lgd_cs($row['description'], 50)); if ($hpixels) { $imgAttributes['style'] = 'margin-top:' . (ceil(($diaSize - $vpixels) / 2) + $diaMargin) . 'px;'; } else { $imgAttributes['style'] = 'margin-top:' . $diaMargin . 'px;'; } $imgAttributes['onclick'] = $onClick; $thumb = tx_dam_image::previewImgTag($row, $diaSize, $imgAttributes); if (!$makeIcon and empty($thumb)) { return ''; } if (empty($thumb)) { $thumb = tx_dam_guiFunc::getMediaTypeIconBox($row); if ($onClick) { $thumb = '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $thumb . '</a>'; } } $descr = ''; if (in_array('title', $showElements)) { $descr .= htmlspecialchars(t3lib_div::fixed_lgd_cs($row['title'], $titleLen)) . '<br />'; } if (in_array('info', $showElements)) { $code = strtoupper($row['file_type']) . ', '; $code .= $row['hpixels'] ? $row['hpixels'] . 'x' . $row['vpixels'] . ', ' : ''; $code .= t3lib_div::formatSize($row['file_size']); $descr .= '<span class="txdam-descr">' . htmlspecialchars($code) . '</span>'; } if ($descr) { $descr = '<div class="txdam-title">' . $descr . '</div>'; } $icons = ''; $iconArr = array(); if (in_array('icons', $showElements)) { // deprecated $iconArr[] = tx_dam_SCbase::icon_editRec('tx_dam', $row['uid'], 'style="margin-left:3px;margin-right:3px;"'); $iconArr[] = tx_dam_SCbase::btn_editRec_inNewWindow('tx_dam', $row['uid'], 'style="margin-left:3px;margin-right:3px;"'); $iconArr[] = tx_dam_SCbase::icon_infoRec('tx_dam', $row['uid'], 'style="margin-left:3px;margin-right:3px;"'); $iconArr[] = tx_dam_SCbase::btn_removeRecFromSel('tx_dam', $row['uid'], 'style="margin-left:3px;margin-right:3px;"'); } if (in_array('actions', $showElements)) { $actions; } $icons = $icons ? '<div style="margin:3px;">' . implode('<span style="width:40px;"></span>', $iconArr) . '</div>' : ''; $actions = $actions ? '<div style="margin:3px;">' . $actions . '</div>' : ''; $diaCode = ' <table class="txdam-dia" cellspacing="0" cellpadding="0" border="0"> <tr><td><span class="txdam-dia">' . $thumb . '</span></td></tr> ' . ($descr . $icons . $actions ? '<tr><td align="center" bgcolor="' . $iconBgColor . '">' . $descr . $icons . $actions . '</td></tr>' : '') . ' </table> '; return $diaCode; }