MINOR Tidied up ThumbnailStripField->getimages() formatting

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@65444 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2008-11-07 02:57:48 +00:00
parent 54ac444b2c
commit 58c1695c39

View File

@ -40,16 +40,15 @@ class ThumbnailStripField extends FormField {
*/ */
function getimages() { function getimages() {
$result = ''; $result = '';
$folder = DataObject::get_by_id("Folder", $_GET['folderID']); $folder = DataObject::get_by_id('Folder', (int) $_GET['folderID']);
if( !$folder ) if(!$folder) return _t('ThumbnailStripField.NOTAFOLDER', 'This is not a folder');
return _t('ThumbnailStripField.NOTAFOLDER','This is not a folder');
$folderList = $folder->getDescendantIDList("Folder"); $folderList = $folder->getDescendantIDList("Folder");
array_unshift($folderList, $folder->ID); array_unshift($folderList, $folder->ID);
$images = DataObject::get("Image", "ParentID IN (" . implode(', ', $folderList) . ")","Title"); $images = DataObject::get('Image', 'ParentID IN (' . implode(', ', $folderList) . ')', 'Title');
if($images) { if($images) {
$result .= '<ul>'; $result .= '<ul>';
@ -70,19 +69,18 @@ class ThumbnailStripField extends FormField {
} }
$result .= $result .=
'<li>' . '<li>' .
'<a href=" ' . $image->Filename . '?r=' . rand(1,100000) . '">' . '<a href=" ' . $image->Filename . '?r=' . rand(1,100000) . '">' .
'<img class="destwidth=' . round($width) . ',destheight=' . round($height) . '" src="'. $thumbnail->URL . '?r=' . rand(1,100000) . '" alt="' . $image->Title . '" title="' . $image->Title . '" />' . '<img class="destwidth=' . round($width) . ',destheight=' . round($height) . '" src="'. $thumbnail->URL . '?r=' . rand(1,100000) . '" alt="' . $image->Title . '" title="' . $image->Title . '" />' .
'</a>' . '</a>' .
'</li>'; '</li>';
} }
$result .= '</ul>'; $result .= '</ul>';
}else{ } else {
$result = '<h2> '._t('ThumbnailStripField.NOIMAGESFOUND', 'No images found in').' '. $folder->Title. '</h2>'; $result = '<h2>' . _t('ThumbnailStripField.NOIMAGESFOUND', 'No images found in') . ' ' . $folder->Title . '</h2>';
} }
return $result; return $result;
} }
function getflash() { function getflash() {