/** * Render statistics about indexed media types * * @return string HTML output */ function statisticsMediaType($addFileTypes = true) { global $LANG; $content = ''; // init table layout $tableLayout = array('table' => array('<table border="0" cellspacing="1" cellpadding="2" style="width:auto;">', '</table>'), '0' => array('tr' => array('<tr class="bgColor2">', '</tr>'), 'defCol' => array('<td align="center">', '</td>')), 'defRow' => array('tr' => array('<tr class="bgColor3-20">', '</tr>'), '1' => array('<td align="center">', '</td>'), '4' => array('<td align="right" style="padding-right:0.5em;">', '</td>'), '5' => array('<td align="right" style="padding-right:0.5em;">', '</td>'), 'defCol' => array('<td>', '</td>'))); $table = array(); $tr = 0; // add header row $table[$tr][] = ' '; $table[$tr][] = $LANG->getLL('mediaTypes', 1); $table[$tr][] = ' '; $table[$tr][] = ' '; $table[$tr][] = 'Count'; $table[$tr][] = 'Total'; $totalCount = 0; foreach ($GLOBALS['T3_VAR']['ext']['dam']['media2code'] as $media_type) { $whereClauses = array(); $whereClauses['media_type'] = 'media_type=' . $media_type; $rows = tx_dam_db::getDataWhere('COUNT(uid) as count', $whereClauses); reset($rows); $row = current($rows); $count = $row['count']; $totalCount += $count; $icon = tx_dam_guiFunc::icon_getMediaTypeImgTag(array('media_type' => $media_type), '', false); $mediaTypeName = tx_dam_guiFunc::convert_mediaType($media_type); // add row to table $tr++; $table[$tr][] = $icon; $table[$tr][] = '<strong>' . htmlspecialchars($mediaTypeName) . '</strong>'; $table[$tr][] = ' '; $table[$tr][] = ' '; $table[$tr][] = ' '; $table[$tr][] = '<strong>' . $count . '</strong>'; $tableLayout[$tr]['tr'] = array('<tr class="bgColor4">', '</tr>'); if ($addFileTypes) { if ($contentFileTypes = $this->statisticsFileType($media_type)) { foreach ($contentFileTypes as $fileTypeRow) { // add row to table $tr++; $table[$tr][] = ' '; $table[$tr][] = ' '; $table[$tr][] = $fileTypeRow[0]; $table[$tr][] = $fileTypeRow[1]; $table[$tr][] = $fileTypeRow[2]; $table[$tr][] = ' '; } } } // add row to table $tr++; $table[$tr][] = '<span></span>'; $table[$tr][] = '<span></span>'; $table[$tr][] = '<span></span>'; $table[$tr][] = '<span></span>'; $table[$tr][] = '<span></span>'; $table[$tr][] = '<span></span>'; $tableLayout[$tr]['tr'] = array('<tr class="bgColor" style="height:0.5em;">', '</tr>'); } // add row to table $tr++; $table[$tr][] = ' '; $table[$tr][] = ' '; $table[$tr][] = ' '; $table[$tr][] = ' '; $table[$tr][] = ' '; $table[$tr][] = '<strong>' . $totalCount . '</strong>'; $tableLayout[$tr]['tr'] = array('<tr class="bgColor4-20">', '</tr>'); $content .= $this->pObj->doc->table($table, $tableLayout); return $content; }
/** * Returns a media type icon from a record * * @param array $infoArr Record array * @param boolean $iconPlusType If set the name of the media type is printed below the icon * @return string Rendered icon */ function getMediaTypeIconBox($infoArr, $iconPlusType = TRUE) { global $LANG, $BACK_PATH; $label = tx_dam_guifunc::getLabelFromItemlist('tx_dam', 'media_type', $infoArr['media_type']); $label = strtoupper(trim($LANG->sL($label))); $icon = tx_dam_guiFunc::icon_getMediaTypeImgTag($infoArr, '', !$iconPlusType); if ($iconPlusType) { #$icon = '<div class="txdam-typeiconbox" style="display:compact;"><div class="txdam-typeiconbox-wrapper" style="text-align:center;">'.$icon.'<br /><span style="color:#555;">'.htmlspecialchars($label).'</span></div></div>'; $icon = '<div class="txdam-typeiconbox-wrapper" style="text-align:center;">' . $icon . '<br /><span style="color:#555;">' . htmlspecialchars($label) . '</span></div>'; } return $icon; }