| // +---------------------------------------------------------------------------+ /** * View helper methods. * * @package seagull * @subpackage media * @author Demian Turner */ class MediaOutput { /** * Maps icon HTML to corresponding position in a grid. * * The idea is to allow for filtering views by doc type. * * @access public * @param int $documentID doc type * @return string $tdString * @see id2AssetIcon() */ function outputIcon($fileTypeId) { $iconString = $this->id2MediaIcon($fileTypeId); if ($fileTypeId == 7) { $pos = 1; } else { $pos = $fileTypeId; } $tdString = ''; for ($i = 1; $i <= 6; $i++) { $icon = ($i == $pos) ? $iconString : ' '; $tdString .= "". $icon ."\n"; } return $tdString; } /** * Takes doc type ID from DB and converts to corresponding icon. * * @access public * @param int $fileTypeId file type * @return string $iconString */ function id2MediaIcon($fileTypeId) { $c = &SGL_Config::singleton(); $theme = $_SESSION['aPrefs']['theme']; switch ($fileTypeId) { case 1: case 8: $iconString = ''; break; case 2: $iconString = ''; break; case 3: $iconString = ''; break; case 4: $iconString = ''; break; case 5: $iconString = ''; break; case 6: $iconString = ''; break; case 7: $iconString = ''; break; default: $iconString = ' '; } return $iconString; } function isImage($fileTypeId) { return ($fileTypeId == 5) ? true: false; } function rowStart($elementId, $type) { return ($elementId % 5 == 0) ? true : false; } function rowEnd($elementId, $type) { return ($elementId % 4 == 0 && $elementId != 0) ? true : false; } function isLastElement($elementId, $total) { return (count($total) == ($elementId + 1)) ? true : false; } function getKey($arrayToSearch, $key) { return $arrayToSearch[$key]; } } ?>