* @link http://www.nonumber.nl
* @copyright Copyright (C) 2010 NoNumber! All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
// Ensure this file is being included by a parent file
defined( '_JEXEC' ) or die( 'Restricted access' );
/**
* Radio Images Element
*/
class JElementRadioImages extends JElement
{
/**
* Element name
*
* @access protected
* @var string
*/
var $_name = 'RadioImages';
function fetchElement( $name, $value, &$node, $control_name )
{
jimport( 'joomla.filesystem.folder' );
jimport( 'joomla.filesystem.file' );
// path to images directory
$path = JPATH_ROOT.DS.str_replace( '/', DS, $node->attributes( 'directory' ) );
$filter = $node->attributes( 'filter' );
$exclude = $node->attributes( 'exclude' );
$stripExt = $node->attributes( 'stripext' );
$files = JFolder::files( $path, $filter);
$options = array ();
if ( !$node->attributes( 'hide_none' ) ) {
$options[] = JHTML::_( 'select.option', '-1', JText::_( 'Do not use' ).'
' );
}
if ( !$node->attributes( 'hide_default' ) ) {
$options[] = JHTML::_( 'select.option', '', JText::_( 'Use default' ).'
' );
}
if ( is_array( $files) ) {
foreach ( $files as $file) {
if ( $exclude) {
if (preg_match( chr( 1 ) . $exclude . chr( 1 ), $file ) ) {
continue;
}
}
if ( $stripExt) {
$file = JFile::stripExt( $file );
}
$image = '';
$options[] = JHTML::_( 'select.option', $file, $image);
}
}
$list = JHTML::_( 'select.radiolist', $options, ''.$control_name.'['.$name.']', '', 'value', 'text', $value, $control_name.$name );
$list = '