parentField = $parentField; $this->updateMethod = $updateMethod; parent::__construct($name); } function ParentField() { return $this->form->FormName() . '_' . $this->parentField; } function FieldHolder() { Requirements::javascript(THIRDPARTY_DIR . '/prototype/prototype.js'); Requirements::javascript(THIRDPARTY_DIR . '/behaviour/behaviour.js'); Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js'); Requirements::javascript(CMS_DIR . '/javascript/ThumbnailStripField.js'); return $this->renderWith('ThumbnailStripField'); } function UpdateMethod() { return $this->updateMethod; } /** * Populate the Thumbnail strip field, by looking for a folder, * and the descendants of this folder. */ function getimages() { $result = ''; $images = null; $whereSQL = ''; $folderID = isset($_GET['folderID']) ? (int) $_GET['folderID'] : 0; $searchText = (isset($_GET['searchText']) && $_GET['searchText'] != 'undefined' && $_GET['searchText'] != 'null') ? Convert::raw2sql($_GET['searchText']) : ''; $folder = DataObject::get_by_id('Folder', (int) $_GET['folderID']); if($folder) { $folderList = $folder->getDescendantIDList(); array_unshift($folderList, $folder->ID); $whereSQL = '"ParentID" IN (' . implode(', ', $folderList) . ')'; if($searchText) $whereSQL .= " AND \"Filename\" LIKE '%$searchText%'"; $images = DataObject::get('Image', $whereSQL, 'Title'); } else { $whereSQL = "\"ParentID\" = 0"; if($searchText) { $whereSQL .= " AND \"Filename\" LIKE '%$searchText%'"; } $images = DataObject::get('Image', $whereSQL, 'Title'); } if($images) { $result .= ''; } else { if($folder) { $result = '

' . _t('ThumbnailStripField.NOFOLDERIMAGESFOUND', 'No images found in') . ' ' . $folder->Title . '

'; } else { $result = '

' . _t('ThumbnailStripField.NOIMAGESFOUND', 'No images found') . '

'; } } return $result; } function getflash() { $flashObjects = null; $result = ''; $whereSQL = ''; $folderID = isset($_GET['folderID']) ? (int) $_GET['folderID'] : 0; $searchText = (isset($_GET['searchText']) && $_GET['searchText'] != 'undefined' && $_GET['searchText'] != 'null') ? Convert::raw2sql($_GET['searchText']) : ''; $width = Image::$strip_thumbnail_width - 10; $height = Image::$strip_thumbnail_height - 10; $folder = DataObject::get_by_id("Folder", (int) $_GET['folderID']); if($folder) { $folderList = $folder->getDescendantIDList(); array_unshift($folderList, $folder->ID); $whereSQL = "\"ParentID\" IN (" . implode(', ', $folderList) . ") AND \"Filename\" LIKE '%.swf'"; if($searchText) $whereSQL .= " AND \"Filename\" LIKE '%$searchText%'"; $flashObjects = DataObject::get('File', $whereSQL); } else { if($searchText) { $flashObjects = DataObject::get('File', "\"Filename\" LIKE '%$searchText%' AND \"Filename\" LIKE '%.swf'"); } } if($flashObjects) { $result .= ''; } else { if($folder) { $result = '

' . _t('ThumbnailStripField.NOFOLDERFLASHFOUND', 'No flash files found in') . ' ' . $folder->Title . '

'; } else { $result = '

' . _t('ThumbnailStripField.NOFLASHFOUND', 'No flash files found') . '

'; } } return $result; } } ?>