| Current Path : /var/www/iplanru/data/old/www/i-plan.ru/media/zoo/elements/radio/ | 
| Current File : /var/www/iplanru/data/old/www/i-plan.ru/media/zoo/elements/radio/radio.php | 
<?php
/**
* @package   ZOO
* @author    YOOtheme http://www.yootheme.com
* @copyright Copyright (C) YOOtheme GmbH
* @license   http://www.gnu.org/licenses/gpl.html GNU/GPL
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
// register ElementOption class
App::getInstance('zoo')->loader->register('ElementOption', 'elements:option/option.php');
/*
	Class: ElementRadio
		The radio element class
*/
class ElementRadio extends ElementOption {
	/*
	   Function: edit
	       Renders the edit form field.
	   Returns:
	       String - html
	*/
	public function edit(){
		// init vars
		$options_from_config = $this->config->get('option', array());
		$default 			 = $this->config->get('default');
		if (count($options_from_config)) {
			// set default, if item is new
			if ($default != '' && $this->_item != null && $this->_item->id == 0) {
				$this->set('option', array($default));
			}
			$options = array();
			foreach ($options_from_config as $option) {
				$options[] = $this->app->html->_('select.option', $option['value'], $option['name']);
			}
			$option = $this->get('option', array());
			return $this->app->html->_('select.radiolist', $options, $this->getControlName('option', true), null, 'value', 'text', (isset($option[0]) ? $option[0] : null));
		}
		return JText::_("There are no options to choose from.");
	}
}